copilot-operator 0.1.41 → 0.1.42

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 (56) hide show
  1. package/dist/src/api/operator.controller.js +28 -6
  2. package/dist/src/api/operator.service.js +82 -7
  3. package/dist/src/config/schema.js +7 -0
  4. package/dist/src/orchestrator/planMode.js +102 -0
  5. package/dist/src/orchestrator/review.js +8 -4
  6. package/dist/src/orchestrator/taskRunner.js +137 -2
  7. package/dist/src/plan/brief.js +12 -0
  8. package/dist/src/plan/importPlan.js +2 -0
  9. package/dist/src/plan/schema.js +10 -0
  10. package/dist/src/plan/systemGuide.js +193 -2
  11. package/dist/src/protocol/parser.js +26 -2
  12. package/dist/src/protocol/replySchema.js +28 -4
  13. package/dist/src/session/compose.js +62 -7
  14. package/dist/src/session/exports.js +1 -0
  15. package/dist/src/session/model.js +38 -0
  16. package/dist/src/session/store.js +30 -3
  17. package/dist/src/vcs/startChoice.js +80 -8
  18. package/dist/src/vcs/taskVcs.js +16 -7
  19. package/dist/web/404.html +2 -2
  20. package/dist/web/_next/static/chunks/{584-578be94a0786334b.js → 204-db82ca47ff211e21.js} +1 -1
  21. package/dist/web/_next/static/chunks/499-39b2c00bda3656f0.js +1 -0
  22. package/dist/web/_next/static/chunks/549-348b0a1404407e5a.js +1 -0
  23. package/dist/web/_next/static/chunks/867-7d86a692260006f1.js +1 -0
  24. package/dist/web/_next/static/chunks/app/defaults/page-a25c40436fc312db.js +1 -0
  25. package/dist/web/_next/static/chunks/app/history/page-47973539ceff81d6.js +1 -0
  26. package/dist/web/_next/static/chunks/app/layout-6ee612d25e78b246.js +1 -0
  27. package/dist/web/_next/static/chunks/app/sessions/view/page-872d8b9fe8eedbbf.js +1 -0
  28. package/dist/web/_next/static/css/{cea7913ba416dbb7.css → 0e55721108c300f2.css} +1 -1
  29. package/dist/web/appearance.html +2 -2
  30. package/dist/web/appearance.txt +13 -13
  31. package/dist/web/defaults.html +2 -2
  32. package/dist/web/defaults.txt +13 -13
  33. package/dist/web/history.html +2 -2
  34. package/dist/web/history.txt +13 -13
  35. package/dist/web/import.html +2 -2
  36. package/dist/web/import.txt +13 -13
  37. package/dist/web/index.html +2 -2
  38. package/dist/web/index.txt +13 -13
  39. package/dist/web/level1.html +2 -2
  40. package/dist/web/level1.txt +13 -13
  41. package/dist/web/presets.html +2 -2
  42. package/dist/web/presets.txt +13 -13
  43. package/dist/web/sessions/view.html +2 -2
  44. package/dist/web/sessions/view.txt +13 -13
  45. package/dist/web/system.html +2 -2
  46. package/dist/web/system.txt +13 -13
  47. package/package.json +159 -158
  48. package/dist/web/_next/static/chunks/499-28e118e33ce07935.js +0 -1
  49. package/dist/web/_next/static/chunks/549-f295c8429e83b25b.js +0 -1
  50. package/dist/web/_next/static/chunks/867-8dc5bbb092ca2c5c.js +0 -1
  51. package/dist/web/_next/static/chunks/app/defaults/page-879158e9e550eea7.js +0 -1
  52. package/dist/web/_next/static/chunks/app/history/page-9f69ccde726c9be2.js +0 -1
  53. package/dist/web/_next/static/chunks/app/layout-73f28bc065a46ed3.js +0 -1
  54. package/dist/web/_next/static/chunks/app/sessions/view/page-0485ee7f781156ec.js +0 -1
  55. /package/dist/web/_next/static/{-htN5GTSrd3W3f5j_QC2y → lDmqS7pWU_B_Ac5idPvdS}/_buildManifest.js +0 -0
  56. /package/dist/web/_next/static/{-htN5GTSrd3W3f5j_QC2y → lDmqS7pWU_B_Ac5idPvdS}/_ssgManifest.js +0 -0
package/package.json CHANGED
@@ -1,158 +1,159 @@
1
- {
2
- "name": "copilot-operator",
3
- "version": "0.1.41",
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: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-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
- "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:review-evidence": "tsx test/review-evidence.check.ts",
43
- "check:settings-precedence": "tsx test/settings-precedence.check.ts",
44
- "check:suite": "tsx test/suite.check.ts",
45
- "check:model-help": "tsx test/model-help.check.ts",
46
- "check:shells": "tsx test/shells.check.ts",
47
- "check:save": "tsx test/save.check.ts",
48
- "check:guide": "tsx test/guide.check.ts",
49
- "typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json && npm run typecheck --workspace web",
50
- "check:bundle": "tsx test/bundle.check.ts",
51
- "check:runname": "tsx test/runname.check.ts",
52
- "update": "node scripts/update.mjs",
53
- "check:dangerous": "tsx test/dangerous.check.ts",
54
- "check:programs": "tsx test/programs.check.ts",
55
- "check:manifest": "tsx test/manifest.check.ts",
56
- "check:lock": "tsx test/lock.check.ts",
57
- "check:isolation": "tsx test/isolation.check.ts",
58
- "check:security": "tsx test/security.check.ts",
59
- "check:update": "tsx test/update.check.ts",
60
- "check:persona": "tsx test/persona.check.ts",
61
- "check:script": "tsx test/script.check.ts",
62
- "check:batch": "tsx test/batch.check.ts",
63
- "check:confinement": "tsx test/confinement.check.ts",
64
- "check:network": "tsx test/network.check.ts",
65
- "check:hardening": "tsx test/hardening.check.ts",
66
- "check:package": "tsx test/package.check.ts",
67
- "check:models": "tsx test/models.check.ts",
68
- "check:continue": "tsx test/continue.check.ts",
69
- "check:startfrom": "tsx test/startfrom.check.ts",
70
- "check:diff": "tsx test/diff.check.ts",
71
- "check:integrity": "tsx test/integrity.check.ts",
72
- "check:scope": "tsx test/scope.check.ts",
73
- "check:progress": "tsx test/progress.check.ts",
74
- "check:metrics": "tsx test/metrics.check.ts",
75
- "check:modelpicker": "tsx test/modelpicker.check.ts",
76
- "check:formatrepair": "tsx test/formatrepair.check.ts",
77
- "check:intent": "tsx test/intent.check.ts",
78
- "check:sync": "tsx test/sync.check.ts",
79
- "check:prepare": "tsx test/prepare.check.ts",
80
- "check:live-fixes": "tsx test/live-fixes.check.ts",
81
- "check:live-models": "tsx test/live-models.check.ts",
82
- "check:live-chat": "tsx test/live-chatname.check.ts",
83
- "check:e2e-run": "tsx test/e2e-run.check.ts",
84
- "check:e2e-continue": "tsx test/e2e-continue.check.ts",
85
- "check:e2e-interrupt": "tsx test/e2e-interrupt.check.ts",
86
- "check:ui": "node scripts/build-package.mjs && tsx test/ui.check.ts && tsx test/ui-flows.check.ts",
87
- "check:all": "npm run check && npm run check:ui && npm run check:release",
88
- "check:e2e-vcs": "tsx test/e2e-vcs.check.ts",
89
- "check:noattach": "tsx test/noattach.check.ts",
90
- "check:guard": "tsx test/guard.check.ts",
91
- "check:gate": "tsx test/gate.check.ts",
92
- "check:e2e-batch": "tsx test/e2e-batch.check.ts",
93
- "check:e2e-review": "tsx test/e2e-review.check.ts",
94
- "check:e2e-branches": "tsx test/e2e-branches.check.ts",
95
- "check:e2e-loop": "tsx test/e2e-loop.check.ts",
96
- "check:transport": "tsx test/transport.check.ts",
97
- "check:e2e-plan": "tsx test/e2e-plan.check.ts",
98
- "check:exec": "tsx test/exec.check.ts",
99
- "check:pins": "tsx test/pins.check.ts",
100
- "check:release": "tsx test/release.check.ts",
101
- "check:ui-flows": "tsx test/ui-flows.check.ts",
102
- "check:login": "tsx test/login.check.ts",
103
- "check:order": "tsx test/order.check.ts",
104
- "check:snapshot": "tsx test/snapshot.check.ts",
105
- "check:inputs": "tsx test/inputs.check.ts",
106
- "check:e2e-inputs": "tsx test/e2e-inputs.check.ts",
107
- "check:attempts": "tsx test/attempts.check.ts",
108
- "check:finding-ids": "tsx test/finding-ids.check.ts",
109
- "check:e2e-commit": "tsx test/e2e-commit.check.ts",
110
- "check:e2e-retry-inputs": "tsx test/e2e-retry-inputs.check.ts",
111
- "check:e2e-run-vcs": "tsx test/e2e-run-vcs.check.ts",
112
- "check:startbranch": "tsx test/startbranch.check.ts"
113
- },
114
- "dependencies": {
115
- "@nestjs/common": "^12.0.3",
116
- "@nestjs/core": "^12.0.3",
117
- "@nestjs/platform-express": "^12.0.3",
118
- "commander": "^15.0.0",
119
- "playwright": "^1.63.0",
120
- "reflect-metadata": "^0.2.2",
121
- "rxjs": "^7.8.2",
122
- "yaml": "^2.9.1",
123
- "zod": "^4.6.5"
124
- },
125
- "devDependencies": {
126
- "@types/express": "^5.0.6",
127
- "@types/node": "^22.10.2",
128
- "tsx": "^4.19.2",
129
- "typescript": "5.9"
130
- },
131
- "repository": {
132
- "type": "git",
133
- "url": "git+https://github.com/ivan-markov-666/copilot-operator.git"
134
- },
135
- "bin": {
136
- "cop": "dist/src/cli.js"
137
- },
138
- "files": [
139
- "dist/src",
140
- "dist/web",
141
- "prompts",
142
- "README.md",
143
- "LICENSE"
144
- ],
145
- "os": [
146
- "win32"
147
- ],
148
- "keywords": [
149
- "copilot",
150
- "microsoft-365",
151
- "automation",
152
- "playwright",
153
- "agent"
154
- ],
155
- "workspaces": [
156
- "web"
157
- ]
158
- }
1
+ {
2
+ "name": "copilot-operator",
3
+ "version": "0.1.42",
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: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",
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:review-evidence": "tsx test/review-evidence.check.ts",
43
+ "check:settings-precedence": "tsx test/settings-precedence.check.ts",
44
+ "check:suite": "tsx test/suite.check.ts",
45
+ "check:model-help": "tsx test/model-help.check.ts",
46
+ "check:shells": "tsx test/shells.check.ts",
47
+ "check:save": "tsx test/save.check.ts",
48
+ "check:guide": "tsx test/guide.check.ts",
49
+ "typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json && npm run typecheck --workspace web",
50
+ "check:bundle": "tsx test/bundle.check.ts",
51
+ "check:runname": "tsx test/runname.check.ts",
52
+ "update": "node scripts/update.mjs",
53
+ "check:dangerous": "tsx test/dangerous.check.ts",
54
+ "check:programs": "tsx test/programs.check.ts",
55
+ "check:manifest": "tsx test/manifest.check.ts",
56
+ "check:lock": "tsx test/lock.check.ts",
57
+ "check:isolation": "tsx test/isolation.check.ts",
58
+ "check:security": "tsx test/security.check.ts",
59
+ "check:update": "tsx test/update.check.ts",
60
+ "check:persona": "tsx test/persona.check.ts",
61
+ "check:script": "tsx test/script.check.ts",
62
+ "check:batch": "tsx test/batch.check.ts",
63
+ "check:confinement": "tsx test/confinement.check.ts",
64
+ "check:network": "tsx test/network.check.ts",
65
+ "check:hardening": "tsx test/hardening.check.ts",
66
+ "check:package": "tsx test/package.check.ts",
67
+ "check:models": "tsx test/models.check.ts",
68
+ "check:continue": "tsx test/continue.check.ts",
69
+ "check:startfrom": "tsx test/startfrom.check.ts",
70
+ "check:diff": "tsx test/diff.check.ts",
71
+ "check:integrity": "tsx test/integrity.check.ts",
72
+ "check:scope": "tsx test/scope.check.ts",
73
+ "check:progress": "tsx test/progress.check.ts",
74
+ "check:metrics": "tsx test/metrics.check.ts",
75
+ "check:modelpicker": "tsx test/modelpicker.check.ts",
76
+ "check:formatrepair": "tsx test/formatrepair.check.ts",
77
+ "check:intent": "tsx test/intent.check.ts",
78
+ "check:sync": "tsx test/sync.check.ts",
79
+ "check:prepare": "tsx test/prepare.check.ts",
80
+ "check:live-fixes": "tsx test/live-fixes.check.ts",
81
+ "check:live-models": "tsx test/live-models.check.ts",
82
+ "check:live-chat": "tsx test/live-chatname.check.ts",
83
+ "check:e2e-run": "tsx test/e2e-run.check.ts",
84
+ "check:e2e-continue": "tsx test/e2e-continue.check.ts",
85
+ "check:e2e-planmode": "tsx test/e2e-planmode.check.ts",
86
+ "check:e2e-interrupt": "tsx test/e2e-interrupt.check.ts",
87
+ "check:ui": "node scripts/build-package.mjs && tsx test/ui.check.ts && tsx test/ui-flows.check.ts",
88
+ "check:all": "npm run check && npm run check:ui && npm run check:release",
89
+ "check:e2e-vcs": "tsx test/e2e-vcs.check.ts",
90
+ "check:noattach": "tsx test/noattach.check.ts",
91
+ "check:guard": "tsx test/guard.check.ts",
92
+ "check:gate": "tsx test/gate.check.ts",
93
+ "check:e2e-batch": "tsx test/e2e-batch.check.ts",
94
+ "check:e2e-review": "tsx test/e2e-review.check.ts",
95
+ "check:e2e-branches": "tsx test/e2e-branches.check.ts",
96
+ "check:e2e-loop": "tsx test/e2e-loop.check.ts",
97
+ "check:transport": "tsx test/transport.check.ts",
98
+ "check:e2e-plan": "tsx test/e2e-plan.check.ts",
99
+ "check:exec": "tsx test/exec.check.ts",
100
+ "check:pins": "tsx test/pins.check.ts",
101
+ "check:release": "tsx test/release.check.ts",
102
+ "check:ui-flows": "tsx test/ui-flows.check.ts",
103
+ "check:login": "tsx test/login.check.ts",
104
+ "check:order": "tsx test/order.check.ts",
105
+ "check:snapshot": "tsx test/snapshot.check.ts",
106
+ "check:inputs": "tsx test/inputs.check.ts",
107
+ "check:e2e-inputs": "tsx test/e2e-inputs.check.ts",
108
+ "check:attempts": "tsx test/attempts.check.ts",
109
+ "check:finding-ids": "tsx test/finding-ids.check.ts",
110
+ "check:e2e-commit": "tsx test/e2e-commit.check.ts",
111
+ "check:e2e-retry-inputs": "tsx test/e2e-retry-inputs.check.ts",
112
+ "check:e2e-run-vcs": "tsx test/e2e-run-vcs.check.ts",
113
+ "check:startbranch": "tsx test/startbranch.check.ts"
114
+ },
115
+ "dependencies": {
116
+ "@nestjs/common": "^12.0.3",
117
+ "@nestjs/core": "^12.0.3",
118
+ "@nestjs/platform-express": "^12.0.3",
119
+ "commander": "^15.0.0",
120
+ "playwright": "^1.63.0",
121
+ "reflect-metadata": "^0.2.2",
122
+ "rxjs": "^7.8.2",
123
+ "yaml": "^2.9.1",
124
+ "zod": "^4.6.5"
125
+ },
126
+ "devDependencies": {
127
+ "@types/express": "^5.0.6",
128
+ "@types/node": "^22.10.2",
129
+ "tsx": "^4.19.2",
130
+ "typescript": "5.9"
131
+ },
132
+ "repository": {
133
+ "type": "git",
134
+ "url": "git+https://github.com/ivan-markov-666/copilot-operator.git"
135
+ },
136
+ "bin": {
137
+ "cop": "dist/src/cli.js"
138
+ },
139
+ "files": [
140
+ "dist/src",
141
+ "dist/web",
142
+ "prompts",
143
+ "README.md",
144
+ "LICENSE"
145
+ ],
146
+ "os": [
147
+ "win32"
148
+ ],
149
+ "keywords": [
150
+ "copilot",
151
+ "microsoft-365",
152
+ "automation",
153
+ "playwright",
154
+ "agent"
155
+ ],
156
+ "workspaces": [
157
+ "web"
158
+ ]
159
+ }
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[499],{1035:(e,l,s)=>{s.d(l,{DialogHost:()=>d,Z:()=>c});var t=s(3365),n=s(1521),a=s(867),r=s(4969);let i=null,o=[];function c(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(s=>{var t;return t={kind:"confirm",message:e,...l,resolve:s},void(i?i(t):o.push(t))})}function d(e){var l,s;let{children:c}=e,{t:d}=(0,a.kj)(),[h,u]=(0,n.useState)([]),m=(0,n.useRef)(null),p=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(i=e=>u(l=>[...l,e]),o.length>0){let e=o.splice(0,o.length);u(l=>[...l,...e])}return()=>{i=null}},[]);let g=h[0],x=(0,n.useCallback)(e=>{g&&(g.resolve(e),u(e=>e.slice(1)))},[g]);return(0,r.V)(p,!!g,m),(0,n.useEffect)(()=>{if(!g)return;let e=e=>{"Escape"===e.key&&(e.preventDefault(),x(!1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[g,x]),(0,t.jsxs)(t.Fragment,{children:[c,g&&(0,t.jsx)("div",{className:"modal-backdrop",onClick:()=>x(!1),role:"presentation",children:(0,t.jsxs)("div",{ref:p,className:"modal".concat(g.danger?" danger":""),role:"confirm"===g.kind?"alertdialog":"dialog","aria-modal":"true","aria-labelledby":"modal-title","aria-describedby":"modal-body",onClick:e=>e.stopPropagation(),children:[(0,t.jsx)("h2",{id:"modal-title",children:null!=(l=g.title)?l:d("confirm"===g.kind?"dialog.confirmTitle":"dialog.noticeTitle")}),(0,t.jsx)("div",{id:"modal-body",className:"modal-body",children:g.message}),(0,t.jsxs)("div",{className:"row modal-actions",children:["confirm"===g.kind&&(0,t.jsx)("button",{type:"button",className:"quiet",onClick:()=>x(!1),children:d("dialog.cancel")}),(0,t.jsx)("button",{ref:m,type:"button",className:g.danger?"danger":"primary",onClick:()=>x(!0),children:null!=(s=g.okLabel)?s:d("dialog.ok")})]})]})})]})}},1701:(e,l,s)=>{s.d(l,{L:()=>m,StartDialogHost:()=>p});var t=s(3365),n=s(1521),a=s(5549),r=s(867),i=s(4969),o=s(3486),c=s(3069);let d=null,h=[],u=1;function m(e){return new Promise(l=>{let s={...e,id:u++,resolve:l};d?d(s):h.push(s)})}function p(){let[e,l]=(0,n.useState)([]);(0,n.useEffect)(()=>{if(d=e=>l(l=>[...l,e]),h.length>0){let e=h.splice(0,h.length);l(l=>[...l,...e])}return()=>{d=null}},[]);let s=e[0];return s?(0,t.jsx)(x,{req:s,onDone:e=>{s.resolve(e),l(e=>e.slice(1))}},s.id):null}let g=e=>e.trim().replace(/[\\/]+$/,"").replace(/\//g,"\\").toLowerCase();function x(e){var l,s,d,h,u;let{req:m,onDone:p}=e,{t:x}=(0,r.kj)(),f=(0,r.W3)(),j=(0,n.useId)(),v=(0,n.useRef)(null),b=(0,n.useRef)(null),[y,k]=(0,n.useState)(null),[w,N]=(0,n.useState)(""),[F,C]=(0,n.useState)({}),[B,S]=(0,n.useState)({}),[D,E]=(0,n.useState)({kind:"choose"}),[T,H]=(0,n.useState)(""),[W,I]=(0,n.useState)(""),[L,R]=(0,n.useState)({}),[A,O]=(0,n.useState)([]),[P,q]=(0,n.useState)(!1),z=(0,n.useRef)(new Set),V=(0,n.useRef)(void 0),K=e=>p({started:e,...V.current?{reply:V.current}:{}}),U="fetching"===D.kind||"starting"===D.kind||""!==W,_=()=>a.FH.startOptions(m.sessionIds).then(e=>{k(e);let l={};for(let s of e.repos)l[g(s.repoDir)]=s;C(l);let s={};for(let t of e.sessions){if(!t.vcs||t.fixed||!t.repoDir)continue;let e=function(e,l){var s,t,n,a,r,i,o;let c=null!=(r=null!=(a=null==l||null==(s=l.remotes.find(e=>"origin"===e.name))?void 0:s.name)?a:null==l||null==(t=l.remotes[0])?void 0:t.name)?r:"",d=null!=(o=null!=(i=null==l?void 0:l.current)?i:null==l||null==(n=l.local[0])?void 0:n.name)?o:"main";return e?"previous-session"===e.from?{from:"previous-session",local:d,remote:c,remoteBranch:d,onBranch:!1}:"local"===e.from?{from:"local",local:e.branch,remote:c,remoteBranch:e.branch,onBranch:!!e.onBranch}:{from:"remote",local:(null==l?void 0:l.local.some(l=>l.name===e.branch))?e.branch:d,remote:e.remote,remoteBranch:e.branch,onBranch:!!e.onBranch}:{from:"local",local:d,remote:c,remoteBranch:"main",onBranch:!1}}(t.choice,l[g(t.repoDir)]);s[t.id]=t.prepared?{...e,from:"keep"}:e}S(s)}).catch(e=>N(e.message));(0,n.useEffect)(()=>{_()},[m.sessionIds]),(0,i.V)(v,!0,b),(0,n.useEffect)(()=>{let e=e=>{"Escape"===e.key&&!e.defaultPrevented&&(e.preventDefault(),U||K(!1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[U,K]);let X=e=>e?F[g(e)]:void 0,J=(e,l)=>S(s=>({...s,[e]:{...s[e],...l}})),M=e=>{e&&C(l=>({...l,[g(e.repoDir)]:e}))},Z=()=>{a.FH.runVcs(m.sessionIds).then(O).catch(()=>O([]))},$=()=>{z.current.clear(),E({kind:"choose"})},G=async function(){var e;let l,s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};H("");let t=(()=>{var e,l;let s={},t=new Map;for(let n of null!=(e=null==y?void 0:y.sessions)?e:[]){let e=B[n.id],a=X(n.repoDir);if(e&&n.repoDir&&a&&!a.problem&&"keep"!==e.from)if("previous-session"===e.from)s[n.id]={from:"previous-session"};else if("local"===e.from){if(!e.local||!a.local.some(l=>l.name===e.local))return{problem:x("startdlg.needBranch",{name:n.name})};s[n.id]={from:"local",branch:e.local,...e.onBranch?{onBranch:!0}:{}}}else{let r=e.remoteBranch.trim();if(!e.remote||!r)return{problem:x("startdlg.needBranch",{name:n.name})};s[n.id]={from:"remote",remote:e.remote,branch:r,...e.onBranch?{onBranch:!0}:{}};let i="".concat(g(n.repoDir),"|").concat(e.remote),o=null!=(l=t.get(i))?l:{key:i,dir:a.repoDir,remote:e.remote,branches:[]};o.branches.includes(r)||o.branches.push(r),t.set(i,o)}}return{starts:s,groups:[...t.values()].map(e=>({...e,key:"".concat(e.key,"|").concat([...e.branches].sort().join(","))}))}})();if("problem"in t)return void H(t.problem);if(!s.skipFetch)for(let e of t.groups){if(z.current.has(e.key))continue;E({kind:"fetching",what:e.branches.map(l=>"".concat(e.remote,"/").concat(l)).join(", ")});let l=await a.FH.startFetch(e.dir,e.remote,e.branches).catch(e=>({ok:!1,problem:e.message,missing:[]}));if(M(l.repo),!l.ok)return void E({kind:"fetchFailed",group:e,result:l})}E({kind:"starting"});try{l=await m.start(t.starts)}catch(e){l={started:!1,reason:e.message}}if(V.current=l,l.started)return void K(!0);E({kind:"failed",reply:l}),(null==(e=l.failure)?void 0:e.stage)==="preflight"&&Z()},Q=async(e,l)=>{I("".concat(g(e),"|").concat(l)),R(s=>({...s,[g(e)]:x("startdlg.fetching",{what:l})}));try{let s=await a.FH.startFetch(e,l);M(s.repo),R(t=>{var n,a,r,i;return{...t,[g(e)]:s.ok?"":"".concat(x("startdlg.fetchFailed",{what:l})," ").concat(null!=(i=null!=(r=s.problem)?r:null==(n=s.fetched)?void 0:n.detail)?i:"").concat((null==(a=s.fetched)?void 0:a.auth)?" ".concat(x("prep.fetchAuth")):"")}})}catch(l){R(s=>({...s,[g(e)]:l.message}))}finally{I("")}},Y=async e=>{try{await navigator.clipboard.writeText(e),q(!0),window.setTimeout(()=>q(!1),2500)}catch(e){H(x("plan.copyFailed"))}},ee=Object.values(B).some(e=>"remote"===e.from),el="unattended"===m.mode?x("startdlg.goUnattended"):x("startdlg.goStep");return(0,t.jsx)("div",{className:"modal-backdrop",role:"presentation",onClick:()=>!U&&K(!1),children:(0,t.jsxs)("div",{ref:v,className:"modal wide start-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"".concat(j,"-title"),onClick:e=>e.stopPropagation(),style:{overflowWrap:"anywhere"},children:[(0,t.jsx)("h2",{id:"".concat(j,"-title"),children:x("startdlg.title")}),(0,t.jsx)("p",{className:"small muted",style:{marginTop:0},children:x("startdlg.intro")}),w&&(0,t.jsx)(c.X,{reason:w}),!y&&!w&&(0,t.jsx)("p",{className:"small",role:"status",children:x("startdlg.loading")}),y&&("choose"===D.kind||"fetching"===D.kind||"starting"===D.kind)&&y.sessions.map(e=>{var l,s,n,a;let r=X(e.repoDir),i=B[e.id],o="start-".concat(j,"-").concat(e.id),c=null!=(s=null==r||null==(l=r.remotes.find(e=>e.name===(null==i?void 0:i.remote)))?void 0:l.branches)?s:[];return(0,t.jsxs)("fieldset",{className:"option",style:{border:"1px solid var(--line)",borderRadius:"var(--radius)",padding:"8px 12px",margin:"10px 0"},children:[(0,t.jsx)("legend",{style:{padding:"0 4px"},children:(0,t.jsx)("strong",{children:e.name})}),e.repoDir&&(0,t.jsx)("p",{className:"muted small",style:{margin:"2px 0 6px"},children:x("startdlg.repoOn",{repo:e.repoDir,branch:null!=(n=null==r?void 0:r.current)?n:"HEAD"})}),e.vcs?e.fixed?(0,t.jsx)("p",{className:"small",children:x("startdlg.fixed",{start:e.fixed})}):r&&!r.problem&&i?(0,t.jsxs)(t.Fragment,{children:[e.prepared&&(0,t.jsxs)("div",{className:"option",children:[(0,t.jsxs)("label",{children:[(0,t.jsx)("input",{type:"radio",name:o,checked:"keep"===i.from,onChange:()=>J(e.id,{from:"keep"}),disabled:U}),(0,t.jsx)("span",{children:x("startdlg.keep")})]}),(0,t.jsx)("p",{className:"why",children:x("startdlg.prepared",{start:e.prepared})})]}),(0,t.jsxs)("div",{className:"option",children:[(0,t.jsxs)("label",{children:[(0,t.jsx)("input",{type:"radio",name:o,checked:"local"===i.from,onChange:()=>J(e.id,{from:"local"}),disabled:U}),(0,t.jsx)("span",{children:x("startdlg.local")})]}),(0,t.jsx)("div",{className:"row",style:{marginTop:4},children:(0,t.jsxs)("select",{"aria-label":x("startdlg.localBranch"),value:i.local,onChange:l=>J(e.id,{from:"local",local:l.target.value}),disabled:U,style:{width:"auto",minWidth:240,maxWidth:"100%"},children:[!r.local.some(e=>e.name===i.local)&&(0,t.jsx)("option",{value:i.local,children:i.local}),r.local.map(e=>(0,t.jsxs)("option",{value:e.name,children:[e.name," \xb7 ",e.commit.slice(0,8)]},e.name))]})}),(0,t.jsx)("p",{className:"why",children:x("startdlg.localWhy")})]}),(0,t.jsxs)("div",{className:"option",children:[(0,t.jsxs)("label",{children:[(0,t.jsx)("input",{type:"radio",name:o,checked:"remote"===i.from,onChange:()=>J(e.id,{from:"remote"}),disabled:U||0===r.remotes.length}),(0,t.jsx)("span",{children:x("startdlg.remote")})]}),0===r.remotes.length?(0,t.jsx)("p",{className:"muted small",children:x("startdlg.noRemote")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"row",style:{marginTop:4},children:[r.remotes.length>1&&(0,t.jsx)("select",{"aria-label":x("startdlg.remoteName"),value:i.remote,onChange:l=>J(e.id,{from:"remote",remote:l.target.value}),disabled:U,style:{width:"auto"},children:r.remotes.map(e=>(0,t.jsx)("option",{value:e.name,children:e.name},e.name))}),1===r.remotes.length&&(0,t.jsxs)("code",{children:[i.remote,"/"]}),(0,t.jsx)("input",{type:"text","aria-label":x("startdlg.remoteBranch"),list:"".concat(o,"-remote"),value:i.remoteBranch,onChange:l=>J(e.id,{from:"remote",remoteBranch:l.target.value}),onFocus:()=>"remote"!==i.from&&J(e.id,{from:"remote"}),disabled:U,style:{width:"auto",minWidth:240,flex:"1 1 240px"},placeholder:"main"}),(0,t.jsx)("datalist",{id:"".concat(o,"-remote"),children:c.map(e=>(0,t.jsx)("option",{value:e.name},e.name))}),(0,t.jsx)("button",{type:"button",onClick:()=>void Q(r.repoDir,i.remote),disabled:U||!i.remote,children:x("startdlg.refreshRemote")})]}),(0,t.jsx)("p",{className:"why",children:x("startdlg.remoteWhy")}),(0,t.jsx)("p",{className:"muted small",style:{margin:"2px 0"},children:r.lastFetched?x("startdlg.lastFetched",{when:f(r.lastFetched)}):c.length>0?x("startdlg.lastFetchedUnknown"):x("startdlg.neverFetched")}),L[g(r.repoDir)]&&(0,t.jsx)("p",{className:"small",role:"status",children:L[g(r.repoDir)]})]})]}),e.previousOffered&&(0,t.jsxs)("div",{className:"option",children:[(0,t.jsxs)("label",{children:[(0,t.jsx)("input",{type:"radio",name:o,checked:"previous-session"===i.from,onChange:()=>J(e.id,{from:"previous-session"}),disabled:U}),(0,t.jsx)("span",{children:x("startdlg.previous")})]}),(0,t.jsx)("p",{className:"why",children:x("startdlg.previousWhy")})]}),(0,t.jsxs)("div",{className:"option",children:[(0,t.jsxs)("label",{children:[(0,t.jsx)("input",{type:"checkbox",checked:i.onBranch&&("local"===i.from||"remote"===i.from),onChange:l=>J(e.id,{onBranch:l.target.checked}),disabled:U||"local"!==i.from&&"remote"!==i.from}),(0,t.jsx)("span",{children:x("startdlg.onBranch")})]}),(0,t.jsx)("p",{className:"why",children:x("startdlg.onBranchWhy")})]})]}):(0,t.jsx)("p",{className:"err small",children:x("startdlg.repoProblem",{problem:null!=(a=null==r?void 0:r.problem)?a:""})}):(0,t.jsx)("p",{className:"small",children:x("startdlg.vcsOff")})]},e.id)}),"fetching"===D.kind&&(0,t.jsx)("p",{className:"notice small",role:"status",children:x("startdlg.fetching",{what:D.what})}),"starting"===D.kind&&(0,t.jsx)("p",{className:"notice small",role:"status",children:x("startdlg.starting")}),"fetchFailed"===D.kind&&(0,t.jsxs)("div",{className:"notice caution",role:"alert",children:[(0,t.jsxs)("p",{style:{marginTop:0},children:[(0,t.jsx)("strong",{children:x("startdlg.fetchFailed",{what:D.group.branches.map(e=>"".concat(D.group.remote,"/").concat(e)).join(", ")})})," ",(0,t.jsx)("code",{children:null!=(u=null!=(h=D.result.problem)?h:null==(l=D.result.fetched)?void 0:l.detail)?u:""})]}),D.result.missing.length>0&&(0,t.jsx)("p",{className:"small",children:x("startdlg.missing",{names:D.result.missing.join(", ")})}),(null==(s=D.result.fetched)?void 0:s.auth)&&(0,t.jsx)("p",{className:"small",children:x("prep.fetchAuth")}),(0,t.jsxs)("div",{className:"row",children:[(0,t.jsx)("button",{type:"button",className:"primary",onClick:()=>void G(),children:x("startdlg.retryFetch")}),(()=>{var e,l;let s=X(D.group.dir),n=null!=(l=null==s||null==(e=s.remotes.find(e=>e.name===D.group.remote))?void 0:e.branches)?l:[];return D.group.branches.every(e=>n.some(l=>l.name===e))?(0,t.jsx)("button",{type:"button",onClick:()=>{z.current.add(D.group.key),G()},children:x("startdlg.useFetched")}):null})(),(0,t.jsx)("button",{type:"button",className:"quiet",onClick:$,children:x("startdlg.back")})]}),(()=>{var e,l;let s=X(D.group.dir),n=null!=(l=null==s||null==(e=s.remotes.find(e=>e.name===D.group.remote))?void 0:e.branches)?l:[],a=D.group.branches.filter(e=>!n.some(l=>l.name===e));return a.length>0?(0,t.jsx)("p",{className:"muted small",children:x("startdlg.useFetchedNo",{what:a.map(e=>"".concat(D.group.remote,"/").concat(e)).join(", ")})}):D.result.lastFetched?(0,t.jsx)("p",{className:"muted small",children:x("prep.lastFetched",{when:f(D.result.lastFetched)})}):null})(),D.result.fetchCommand&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"small",style:{marginTop:8},children:x("prep.ownTerminal")}),(0,t.jsx)("pre",{className:"sync-cmd",children:D.result.fetchCommand}),(0,t.jsxs)("div",{className:"row",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{var e;Y(null!=(e=D.result.fetchCommand)?e:"")},children:x("prep.copyFetch")}),P&&(0,t.jsx)("span",{className:"badge done",children:x("prep.copied")})]})]})]}),"failed"===D.kind&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c.X,{failure:D.reply.failure,reason:D.reply.reason}),(null==(d=D.reply.failure)?void 0:d.stage)==="preflight"&&A.some(e=>!e.ready)&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"small",children:x("startdlg.vcsFix")}),(0,t.jsx)(o.w,{groups:A,sessionIds:m.sessionIds,onChange:()=>{Z(),_()}})]})]}),T&&(0,t.jsx)("p",{className:"err small",role:"alert",children:T}),"choose"===D.kind&&ee&&(0,t.jsx)("p",{className:"why",children:x("prep.password")}),(0,t.jsxs)("div",{className:"row modal-actions",children:[(0,t.jsx)("button",{type:"button",className:"quiet",onClick:()=>K(!1),disabled:U,children:x("dialog.cancel")}),"failed"===D.kind?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",onClick:$,children:x("startdlg.back")}),(0,t.jsx)("button",{type:"button",className:"primary",onClick:()=>void G({skipFetch:!0}),children:x("startdlg.tryAgain")})]}):"fetchFailed"!==D.kind&&(0,t.jsx)("button",{ref:b,type:"button",className:"primary",onClick:()=>void G(),disabled:U||!y,children:el})]})]})})}},3069:(e,l,s)=>{s.d(l,{StartFailureBanner:()=>h,X:()=>o});var t=s(3365),n=s(1521),a=s(5549),r=s(867),i=s(7527);function o(e){var l,s;let{failure:n,reason:i,onDismiss:o,intro:c,children:d}=e,{t:h}=(0,r.kj)(),u=(0,r.W3)(),m=null!=(s=null!=(l=null==n?void 0:n.message)?l:i)?s:"";return(0,t.jsxs)("div",{className:"notice caution start-failure",role:"alert",style:{overflowWrap:"anywhere"},children:[c&&(0,t.jsx)("p",{className:"small",style:{marginTop:0},children:c}),(0,t.jsx)("strong",{children:h("startfail.title")}),n&&(0,t.jsx)("p",{className:"small",style:{margin:"4px 0"},children:h("startfail.where",{stage:h("startfail.stage.".concat(n.stage))})}),(0,t.jsx)("pre",{className:"sync-cmd small",style:{margin:"6px 0"},children:m}),d,n&&(0,t.jsxs)("p",{className:"muted small",style:{margin:"4px 0"},children:[n.runId?h("startfail.when",{when:u(n.at),run:n.runId}):h("startfail.whenNoRun",{when:u(n.at)}),n.sessions.length>0?" \xb7 ".concat(n.sessions.map(e=>'"'.concat(e,'"')).join(", ")):""]}),(0,t.jsxs)("div",{className:"row",style:{marginTop:6},children:[n&&(0,t.jsx)("a",{className:"button-link",href:a.FH.startFailureUrl(n.id),download:!0,children:h("startfail.download")}),(0,t.jsx)("a",{className:n?"button-link":"button-link plain",href:a.FH.terminalUrl(),download:!0,children:h("startfail.terminal")}),o&&(0,t.jsx)("button",{type:"button",className:"quiet",onClick:o,children:h("startfail.dismiss")})]}),(0,t.jsx)("p",{className:"why",children:h("startfail.downloadWhy")})]})}let c="cop.startFailure.dismissed";function d(){try{var e;let l=JSON.parse(null!=(e=window.localStorage.getItem(c))?e:"[]");return Array.isArray(l)?l.filter(e=>"string"==typeof e):[]}catch(e){return[]}}function h(){let{t:e}=(0,r.kj)(),[l,s]=(0,n.useState)([]),[h,u]=(0,n.useState)([]);(0,i.z)(()=>a.FH.startFailures(!0).then(e=>{s(e),u(d())}).catch(()=>void 0),5e3);let m=l.find(e=>!h.includes(e.id));return m?(0,t.jsx)("div",{style:{marginBottom:12},children:(0,t.jsx)(o,{failure:m,intro:e("at-turn"===m.stage?"startfail.laterSession":"startfail.later"),onDismiss:()=>{let e=[...new Set([...d(),m.id])].slice(-50);try{window.localStorage.setItem(c,JSON.stringify(e))}catch(e){}u(e)}})}):null}},3486:(e,l,s)=>{s.d(l,{w:()=>o});var t=s(3365),n=s(1521),a=s(5549),r=s(867);let i={"review-inputs":"runvcs.review","snapshot-on-base":"runvcs.snapshotOnBase","snapshot-here":"runvcs.snapshotHere","use-current-branch":"runvcs.useCurrent","allow-snapshot":"runvcs.allowSnapshot"};function o(e){let{groups:l,sessionIds:s,onChange:a}=e,{t:i}=(0,r.kj)(),[o,d]=(0,n.useState)(""),h=l.filter(e=>!e.ready);return 0===h.length?o?(0,t.jsxs)("p",{className:"notice small",role:"status",children:[(0,t.jsx)("strong",{children:i("runvcs.ready")})," ",o]}):null:(0,t.jsxs)("section",{className:"notice caution","aria-labelledby":"runvcs-title",children:[(0,t.jsx)("h3",{id:"runvcs-title",style:{marginTop:0},children:i("runvcs.title")}),(0,t.jsx)("p",{className:"small",children:i("runvcs.why")}),h.map(e=>(0,t.jsx)(c,{group:e,sessionIds:s,onChange:a,onDone:d},e.repoDir))]})}function c(e){var l;let{group:s,sessionIds:o,onChange:c,onDone:d}=e,{t:h}=(0,r.kj)(),[u,m]=(0,n.useState)(!1),[p,g]=(0,n.useState)(!1),[x,f]=(0,n.useState)(!1),[j,v]=(0,n.useState)(""),[b,y]=(0,n.useState)({}),k=(e,l)=>{var s,t;return null!=(t=null!=(s=b[e])?s:l)?t:void 0},w=s.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 m(e=>!e);f(!0),v("");try{var l,t,n;let r="snapshot-on-base"===e?Object.fromEntries(s.inputs.map(e=>[e.path,"include"])):Object.fromEntries(s.entries.filter(e=>k(e.path,e.choice)).map(e=>[e.path,k(e.path,e.choice)])),i=await a.FH.runVcsPrepare(o,s.repoDir,e,r);v(i.ok?null!=(l=i.result)?l:"":null!=(t=i.problem)?t:""),i.ok&&d("".concat(s.repoDir,": ").concat(null!=(n=i.result)?n:"")),c()}catch(e){v(e.message)}finally{f(!1)}};return(0,t.jsxs)("div",{className:"option",style:{overflowWrap:"anywhere"},children:[(0,t.jsx)("table",{className:"small",children:(0,t.jsxs)("tbody",{children:[(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{children:h("runvcs.repo")}),(0,t.jsx)("td",{children:(0,t.jsx)("code",{children:s.repoDir})})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{children:h("runvcs.current")}),(0,t.jsxs)("td",{children:[(0,t.jsx)("code",{children:null!=(l=s.branch)?l:"HEAD"})," @ ",(0,t.jsx)("code",{children:N(s.head)})]})]}),s.workBranch&&(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{children:h("runvcs.workBranch")}),(0,t.jsxs)("td",{children:[(0,t.jsx)("code",{children:s.workBranch.name})," @ ",(0,t.jsx)("code",{children:N(s.workBranch.head)})]})]}),s.baseBranch&&(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{children:h("runvcs.base")}),(0,t.jsxs)("td",{children:[(0,t.jsx)("code",{children:s.baseBranch})," @ ",(0,t.jsx)("code",{children:N(s.baseHead)})]})]}),(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{children:h("runvcs.sessions")}),(0,t.jsx)("td",{children:s.sessions.map(e=>"".concat(e.name," (").concat(h("runvcs.role.".concat(e.role)),")")).join(", ")})]}),s.inputPatterns.length>0&&(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{children:h("runvcs.patterns")}),(0,t.jsx)("td",{children:s.inputPatterns.map(e=>(0,t.jsx)("code",{style:{marginRight:6},children:e},e))})]})]})}),s.problem&&(0,t.jsxs)("p",{className:"small",children:[(0,t.jsx)("strong",{children:h("runvcs.problem")})," ",s.problem]}),s.inputs.length>0&&(0,t.jsx)("p",{className:"small",children:h("runvcs.inputsCount",{n:s.inputs.length})}),u&&s.inputs.length>0&&(0,t.jsx)("ul",{className:"small",style:{margin:"4px 0"},children:s.inputs.map(e=>(0,t.jsxs)("li",{children:[(0,t.jsx)("code",{children:e.path})," — ",h("vcs.snapshotKind.".concat(e.kind)),void 0!==e.size?", ".concat((0,a.zi)(e.size)):"",0===e.allowed.length&&e.reason?(0,t.jsxs)("span",{className:"err",children:[" — ",e.reason]}):null]},e.path))}),s.unrelated.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"small",children:(0,t.jsx)("strong",{children:h("runvcs.unrelated",{n:s.unrelated.length})})}),(0,t.jsx)("ul",{className:"small",style:{margin:"4px 0"},children:s.unrelated.slice(0,30).map(e=>(0,t.jsxs)("li",{children:[(0,t.jsx)("code",{children:e.path}),e.reason?" — ".concat(e.reason):""]},e.path))})]}),w&&s.entries.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"small",children:(0,t.jsx)("strong",{children:h("runvcs.choose",{n:s.entries.length})})}),(0,t.jsx)("ul",{className:"small",style:{margin:"4px 0",paddingLeft:0,listStyle:"none"},children:s.entries.map(e=>{var l;return(0,t.jsxs)("li",{style:{marginBottom:4},children:[(0,t.jsx)("code",{children:e.path})," ",(0,t.jsxs)("span",{className:"muted",children:["(",e.input?"".concat(h("vcs.snapshotInput"),", "):"",h("vcs.snapshotKind.".concat(e.kind)),void 0!==e.size?", ".concat((0,a.zi)(e.size)):"",")"]})," ",0===e.allowed.length?(0,t.jsx)("span",{className:"err",children:h("vcs.snapshotBlocked")}):(0,t.jsx)("select",{"aria-label":e.path,value:null!=(l=k(e.path,e.choice))?l:"",onChange:l=>y({...b,[e.path]:l.target.value}),disabled:x||e.allowed.length<2,children:e.allowed.map(e=>(0,t.jsx)("option",{value:e,children:h("include"===e?"vcs.snapshotInclude":"vcs.snapshotLeaveOut")},e))}),e.reason&&(0,t.jsx)("div",{className:"muted",children:e.reason})]},e.path)})})]}),p?(0,t.jsxs)("p",{className:"small muted",children:[h("runvcs.cancelled")," ",(0,t.jsx)("button",{className:"quiet",onClick:()=>g(!1),children:h("runvcs.showAgain")})]}):(0,t.jsxs)("div",{children:[s.actions.map(e=>{var l,n,a;return(0,t.jsxs)("div",{style:{marginTop:8},children:[(0,t.jsxs)("button",{className:e.recommended?"primary":void 0,onClick:()=>void F(e.id),disabled:x||!e.available,children:[h(i[e.id],{branch:null!=(l=s.baseBranch)?l:"",current:null!=(n=s.branch)?n:"HEAD"}),"review-inputs"===e.id&&u?" ✓":""]}),e.recommended&&(0,t.jsx)("span",{className:"badge done",style:{marginLeft:6},children:h("runvcs.recommended")}),(0,t.jsx)("p",{className:"why",children:e.available?e.result:"".concat(h("runvcs.notNow")," ").concat(null!=(a=e.why)?a:"")})]},e.id)}),(0,t.jsxs)("div",{style:{marginTop:8},children:[(0,t.jsx)("button",{className:"quiet",onClick:()=>g(!0),disabled:x,children:h("runvcs.cancel")}),(0,t.jsx)("p",{className:"why",children:h("runvcs.cancelWhy")})]})]}),j&&(0,t.jsx)("p",{className:"small",role:"status",children:j})]})}},4969:(e,l,s)=>{s.d(l,{V:()=>a});var t=s(1521);let n='a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';function a(e,l,s){(0,t.useEffect)(()=>{var t,a;if(!l)return;let r=document.activeElement instanceof HTMLElement?document.activeElement:null,i=e.current,o=null!=(a=null!=(t=null==s?void 0:s.current)?t:null==i?void 0:i.querySelector(n))?a:null;null==o||o.focus();let c=e=>{if("Tab"!==e.key||!i)return;let l=Array.from(i.querySelectorAll(n)).filter(e=>null!==e.offsetParent);if(0===l.length)return;let s=l[0],t=l[l.length-1],a=i.contains(document.activeElement);e.shiftKey&&(document.activeElement===s||!a)?(e.preventDefault(),t.focus()):e.shiftKey||document.activeElement!==t&&a||(e.preventDefault(),s.focus())};return document.addEventListener("keydown",c),()=>{document.removeEventListener("keydown",c),r&&document.contains(r)&&r.focus()}},[e,l,s])}},7527:(e,l,s)=>{s.d(l,{z:()=>n});var t=s(1521);function n(e,l){let s=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=(0,t.useRef)(e);n.current=e,(0,t.useEffect)(()=>{let e;if(!s)return;let t=!1,a=async()=>{try{await n.current()}catch(e){}finally{t||(e=setTimeout(()=>void a(),l))}};return a(),()=>{t=!0,e&&clearTimeout(e)}},[l,s])}}}]);
@@ -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,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,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)}async function m(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 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,e)=>m("/presets/".concat(encodeURIComponent(t)),{method:"PUT",body:JSON.stringify({content:e})}),deletePreset:t=>m("/presets/".concat(encodeURIComponent(t)),{method:"DELETE"}),personas:()=>m("/personas"),savePersona:(t,e)=>m("/personas/".concat(encodeURIComponent(t)),{method:"PUT",body:JSON.stringify({content:e})}),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"),preparePreview:function(t){let e=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return m("/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 m("/repo/prepare",{method:"POST",body:JSON.stringify({dir:t,fingerprint:e,...o})})},session:t=>m("/sessions/".concat(t)),createSession:(t,e)=>m("/sessions",{method:"POST",body:JSON.stringify({name:t,projectDir:e})}),updateSession:(t,e)=>m("/sessions/".concat(t),{method:"PUT",body:JSON.stringify(e)}),deleteSession:t=>m("/sessions/".concat(t),{method:"DELETE"}),addTask:(t,e)=>m("/sessions/".concat(t,"/tasks"),{method:"POST",body:JSON.stringify(e)}),updateTask:(t,e,o)=>m("/sessions/".concat(t,"/tasks/").concat(e),{method:"PUT",body:JSON.stringify(o)}),deleteTask:(t,e)=>m("/sessions/".concat(t,"/tasks/").concat(e),{method:"DELETE"}),continueTask:(t,e)=>m("/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]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return m("/sessions/".concat(t,"/tasks/").concat(e,"/rerun"),{method:"POST",body:JSON.stringify({...o,...n.buildOnFinished?{buildOnFinished:!0}:{}})})},taskChanges:(t,e,o)=>m("/sessions/".concat(t,"/tasks/").concat(e,"/changes").concat(o?"?run=".concat(encodeURIComponent(o)):"")),taskChangeFile:(t,e,o,n)=>m("/sessions/".concat(t,"/tasks/").concat(e,"/changes/file?path=").concat(encodeURIComponent(o)).concat(n?"&run=".concat(encodeURIComponent(n)):"")),taskStory:(t,e,o)=>m("/sessions/".concat(t,"/tasks/").concat(e,"/story").concat(o?"?run=".concat(encodeURIComponent(o)):"")),taskFiles:(t,e,o)=>m("/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)=>m("/sessions/".concat(t,"/tasks/").concat(e,"/log").concat(o?"?run=".concat(encodeURIComponent(o)):""),{method:"POST",body:"{}"}),saveTaskFile:(t,e,o,n,s)=>m("/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)=>m("/sessions/".concat(t,"/start"),{method:"POST",body:JSON.stringify({mode:e,name:o,starts:n})},{timeoutMs:12e4}),startOptions:t=>m("/start/options?sessions=".concat(encodeURIComponent(t.join(",")))),startFetch:(t,e,o)=>m("/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 m("/start/failures".concat(t?"?unanswered=1":""))},startFailureUrl:t=>i("".concat(n,"/start/failures/").concat(encodeURIComponent(t),"/report")),terminalUrl:()=>i("".concat(n,"/terminal")),stop:t=>m("/sessions/".concat(t,"/stop"),{method:"POST",body:"{}"}),approvals:t=>m("/approvals".concat(t?"?session=".concat(encodeURIComponent(t)):"")),decide:(t,e)=>m("/approvals/".concat(t),{method:"POST",body:JSON.stringify({action:e})}),setRunMode:(t,e)=>m("/sessions/".concat(t,"/mode"),{method:"POST",body:JSON.stringify({mode:e})}),streamUrl:t=>i("".concat(n,"/sessions/").concat(t,"/stream")),batch:()=>m("/batch").then(t=>null!=t?t:null),startBatch:(t,e,o,n,s,c,a,i)=>m("/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=>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,e)=>m("/context/".concat(t,"?lang=").concat(encodeURIComponent(e))),setContext:(t,e)=>m("/context/".concat(t),{method:"PUT",body:JSON.stringify({content:e})}),resetContext:(t,e)=>m("/context/".concat(t,"?lang=").concat(encodeURIComponent(e)),{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 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=>m("/sessions/".concat(t,"/vcs")),runVcs:t=>m("/batch/vcs?ids=".concat(encodeURIComponent(t.join(",")))),runVcsPrepare:function(t,e,o){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return m("/batch/vcs/prepare",{method:"POST",body:JSON.stringify({sessionIds:t,repoDir:e,action:o,choices:n})})},vcsSnapshot:(t,e)=>m("/sessions/".concat(t,"/vcs/snapshot"),{method:"POST",body:JSON.stringify({choices:e})}),restorePreview:(t,e)=>m("/sessions/".concat(t,"/tasks/").concat(e,"/restore")),restore:(t,e)=>m("/sessions/".concat(t,"/tasks/").concat(e,"/restore"),{method:"POST",body:"{}"}),contractCheck:(t,e)=>m("/sessions/".concat(t,"/tasks/").concat(e,"/contract")),applyContractFix:(t,e,o,n)=>m("/sessions/".concat(t,"/tasks/").concat(e,"/contract-fix"),{method:"POST",body:JSON.stringify({choices:o,expect:n})}),restartPlan:(t,e)=>m("/sessions/".concat(t,"/tasks/").concat(e,"/restart")),restartFrom:function(t,e){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return m("/sessions/".concat(t,"/tasks/").concat(e,"/restart"),{method:"POST",body:JSON.stringify(o)})},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 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")}}}]);