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
@@ -1,6 +1,6 @@
1
- import { git, isAncestor, isValidBranchName, lastFetchedAt } from './git.js';
1
+ import { freeBranchName, git, isAncestor, isValidBranchName, lastFetchedAt } from './git.js';
2
2
  import { fetchAsOperator, fetchCommandFor } from './remoteAuth.js';
3
- import { describeStart, remoteTip, repoDirOf } from './taskVcs.js';
3
+ import { describeStart, remoteTip, repoDirOf, sessionBranchName } from './taskVcs.js';
4
4
  const lines = (s) => s.split(/\r?\n/).map((l) => l.trim()).filter(Boolean);
5
5
  const norm = (dir) => dir.trim().replace(/[\\/]+$/, '').replace(/\//g, '\\').toLowerCase();
6
6
  /** A task of the session has run: a start recorded since then is the one its work stands on. */
@@ -109,10 +109,17 @@ export async function startOptions(sessions) {
109
109
  repoDir: repo.repoDir,
110
110
  previousOffered: s.vcs?.startFrom === 'previous-session' || earlierHere,
111
111
  };
112
- if (startIsFixed(s) && s.vcsStart)
113
- entry.fixed = describeStart(s.vcsStart);
114
- else if (startIsFixed(s))
115
- entry.fixed = `it started from ${s.vcsBaseCommit?.slice(0, 8)}`;
112
+ if (startIsFixed(s)) {
113
+ entry.fixed = s.vcsStart ? describeStart(s.vcsStart) : `it started from ${s.vcsBaseCommit?.slice(0, 8)}`;
114
+ if (!repo.problem) {
115
+ entry.started = await startedOn(s, repo);
116
+ // What "another branch" offers first: the session's own setting, as for a session that has not run.
117
+ entry.choice = defaultChoice(s, repo);
118
+ const carries = carriedOn(s);
119
+ if (carries.length > 0)
120
+ entry.rechooseBlocked = carries.join(', ');
121
+ }
122
+ }
116
123
  else {
117
124
  if (s.vcsStart)
118
125
  entry.prepared = describeStart(s.vcsStart);
@@ -123,6 +130,32 @@ export async function startOptions(sessions) {
123
130
  }
124
131
  return { repos: [...repos.values()], sessions: out };
125
132
  }
133
+ /** The queued tasks that carry an earlier attempt on, on that attempt's branch: by title, quoted. */
134
+ function carriedOn(s) {
135
+ return s.tasks.filter((t) => t.status === 'queued' && (t.continuing || t.buildsOn)).map((t) => `"${t.title}"`);
136
+ }
137
+ /** Where a session that has run stands: see `StartOptionSession.started`. */
138
+ async function startedOn(s, repo) {
139
+ const dir = repo.repoDir;
140
+ const mode = s.vcs?.startFrom === 'existing-branch' ? 'existing-branch' : s.vcs?.branchMode === 'per-session' ? 'per-session' : 'per-task';
141
+ const branch = mode === 'existing-branch' ? s.vcs?.existingBranch?.trim() : mode === 'per-session' ? sessionBranchName(s) : s.vcsStart?.branch;
142
+ const recorded = s.vcsStart?.commit ?? s.vcsBaseCommit;
143
+ let tipNow = null;
144
+ let remote;
145
+ if (branch) {
146
+ if (mode === 'per-task' && s.vcsStart?.remote && branch.startsWith(`${s.vcsStart.remote}/`)) {
147
+ tipNow = await remoteTip(dir, s.vcsStart.remote, branch.slice(s.vcsStart.remote.length + 1));
148
+ }
149
+ else {
150
+ tipNow = repo.local.find((b) => b.name === branch)?.commit ?? null;
151
+ const r = s.vcs?.baseRemote?.trim() || defaultRemote(repo);
152
+ const theirs = r ? repo.remotes.find((x) => x.name === r)?.branches.find((b) => b.name === branch) : undefined;
153
+ if (r && theirs)
154
+ remote = { name: `${r}/${branch}`, commit: theirs.commit };
155
+ }
156
+ }
157
+ return { mode, ...(branch ? { branch } : {}), ...(recorded ? { recorded } : {}), tipNow, ...(remote ? { remote } : {}) };
158
+ }
126
159
  /**
127
160
  * Checks a choice against the repository and works out what it sets. Nothing is written to the session
128
161
  * here; for `remote` with `onBranch` the local branch is made, or moved forward, since that is the
@@ -130,8 +163,47 @@ export async function startOptions(sessions) {
130
163
  * only says whether it could be done (every session of a run is checked so before any branch moves).
131
164
  */
132
165
  export async function applyStartChoice(session, choice, opts = {}) {
133
- // Nothing to choose without version control, or once the start is fixed: see `startIsFixed`.
134
- if (!session.vcs?.enabled || startIsFixed(session))
166
+ // Nothing to choose without version control; a start that is fixed is kept unless chosen again.
167
+ if (!session.vcs?.enabled)
168
+ return { ok: true };
169
+ if (!startIsFixed(session))
170
+ return await chooseStart(session, choice, opts);
171
+ if (!choice.rechoose)
172
+ return { ok: true };
173
+ /*
174
+ * Chosen again after the session ran (operator's report, 2026-10-13: "the retry remains permanently bound
175
+ * to the session's original branch and commit"). Not while a queued task carries an earlier attempt on:
176
+ * that attempt's work is on its own branch, and the task goes on there.
177
+ */
178
+ const carries = carriedOn(session);
179
+ if (carries.length > 0) {
180
+ return {
181
+ ok: false,
182
+ problem: `${carries.join(', ')} ${carries.length === 1 ? 'carries' : 'carry'} an earlier attempt on, on its own branch, so where "${session.name}" starts stays as it is. ` +
183
+ 'To start it from another branch, queue it with "Fix the prompt and queue it again" instead.',
184
+ };
185
+ }
186
+ const done = await chooseStart(session, choice, opts);
187
+ if (!done.ok || !done.applied)
188
+ return done;
189
+ const applied = done.applied;
190
+ // A branch carried on is the new one itself; the one branch of a per-session session goes on under a new name.
191
+ const perSession = session.vcs.branchMode === 'per-session' && (applied.vcs.startFrom ?? session.vcs.startFrom) !== 'existing-branch';
192
+ const freshBranch = perSession && !opts.dry ? await freeBranchName(repoDirOf(session), sessionBranchName(session)) : undefined;
193
+ return {
194
+ ok: true,
195
+ applied: {
196
+ ...applied,
197
+ clearStart: true,
198
+ restart: freshBranch ? { freshBranch } : {},
199
+ said: `${applied.said} — chosen again after the session had run: the tasks that run next start from it, a task run again included` +
200
+ (freshBranch ? `, on the new branch ${freshBranch} (${sessionBranchName(session)} keeps what was done on it)` : ''),
201
+ },
202
+ };
203
+ }
204
+ /** `applyStartChoice` for a session whose start is not fixed: see there. */
205
+ async function chooseStart(session, choice, opts) {
206
+ if (!session.vcs?.enabled)
135
207
  return { ok: true };
136
208
  const dir = repoDirOf(session);
137
209
  const before = pointOf(session.vcs);
@@ -225,7 +225,7 @@ async function prepare(session, task, bus, saveSession, allSessions) {
225
225
  const previous = task.attempts?.at(-1);
226
226
  const startedFirst = task.attempts?.[0]?.startedAt;
227
227
  const laterRan = !!startedFirst && session.tasks.some((t) => t.id !== task.id && t.startedAt && t.startedAt > startedFirst);
228
- const restartAt = !task.continuing && !task.buildsOn && previous && previous.status !== 'done' ? firstAttemptBase(task) : undefined;
228
+ const restartAt = !task.continuing && !task.buildsOn && previous && previous.status !== 'done' ? firstAttemptBase(task, session.startRechosenAt) : undefined;
229
229
  // Already there — "Run again from here" or a Restore moved the session onto a branch at that point — then nothing to move.
230
230
  const tipNow = (await git(dir, ['rev-parse', '--verify', '--quiet', `refs/heads/${sessionBranchName(session)}^{commit}`])).stdout;
231
231
  if (restartAt && !laterRan && tipNow && tipNow !== restartAt) {
@@ -267,7 +267,7 @@ async function prepare(session, task, bus, saveSession, allSessions) {
267
267
  * about where the attempt stands.
268
268
  */
269
269
  const prev = task.attempts?.at(-1);
270
- if (prev?.vcs?.branch && prev.vcs.baseCommit && !prev.vcs.commit && prev.vcs.baseCommit === firstAttemptBase(task)) {
270
+ if (prev?.vcs?.branch && prev.vcs.baseCommit && !prev.vcs.commit && prev.vcs.baseCommit === firstAttemptBase(task, session.startRechosenAt)) {
271
271
  const tip = (await git(dir, ['rev-parse', '--verify', '--quiet', `refs/heads/${prev.vcs.branch}^{commit}`])).stdout;
272
272
  if (tip && tip === prev.vcs.baseCommit) {
273
273
  return await switchTo(session, task, dir, prev.vcs.branch, prev.vcs.baseCommit, bus, { reuseExisting: true, start, stage: carryInputs });
@@ -275,7 +275,7 @@ async function prepare(session, task, bus, saveSession, allSessions) {
275
275
  }
276
276
  // A re-run starts from where that task started the first time, not from where the previous
277
277
  // attempt ended. That is the whole point of recording the base commit.
278
- const from = firstAttemptBase(task) ?? base;
278
+ const from = firstAttemptBase(task, session.startRechosenAt) ?? base;
279
279
  return await switchTo(session, task, dir, wanted, from, bus, { reuseExisting: false, start, stage: carryInputs });
280
280
  }
281
281
  /**
@@ -628,9 +628,18 @@ export function sessionBranches(session) {
628
628
  }
629
629
  return { mode, branches };
630
630
  }
631
- /** The commit the task's first attempt started from, if it has one. */
632
- function firstAttemptBase(task) {
633
- return earliestBase(task);
631
+ /**
632
+ * The commit the task's first attempt started from, if it has one — counting only attempts made since the
633
+ * operator last chose where the session starts (`Session.startRechosenAt`): before that choice they stood
634
+ * on the old start, and a re-run that went back to them ignored the new one (operator's report, 2026-10-13).
635
+ */
636
+ function firstAttemptBase(task, since) {
637
+ if (!since)
638
+ return earliestBase(task);
639
+ return [...(task.attempts ?? []), { startedAt: task.startedAt, vcs: task.vcs }]
640
+ .filter((a) => !!a.startedAt && a.startedAt >= since)
641
+ .map((a) => a.vcs?.baseCommit)
642
+ .find(Boolean);
634
643
  }
635
644
  /**
636
645
  * The branch a per-task session's task will be put on when its next attempt starts, worked out before the
@@ -648,7 +657,7 @@ export function nextAttemptBranch(session, task) {
648
657
  const carried = !ran && (task.continuing || task.buildsOn) ? task.attempts?.at(-1)?.vcs?.branch : undefined;
649
658
  if (carried)
650
659
  return carried;
651
- if (prev?.vcs?.branch && prev.vcs.baseCommit && !prev.vcs.commit && prev.vcs.baseCommit === firstAttemptBase(task))
660
+ if (prev?.vcs?.branch && prev.vcs.baseCommit && !prev.vcs.commit && prev.vcs.baseCommit === firstAttemptBase(task, session.startRechosenAt))
652
661
  return prev.vcs.branch;
653
662
  const planned = task.vcsPlan?.branch?.trim();
654
663
  return planned ? plannedBranchName(planned, prefix, attempt) : branchNameFrom([session.name, task.title, attempt > 1 ? `a${attempt}` : undefined], prefix);
package/dist/web/404.html CHANGED
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html><!--_htN5GTSrd3W3f5j_QC2y--><html lang="en" data-theme="light" data-textsize="normal" data-contrast="normal" data-motion="normal" data-links="plain" data-focus="normal"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/css/cea7913ba416dbb7.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-0f31b926d9a9c5a4.js"/><script src="/_next/static/chunks/c7879cf7-b5ab1053c1d9a2e7.js" async=""></script><script src="/_next/static/chunks/131-bae98f790a541679.js" async=""></script><script src="/_next/static/chunks/main-app-e3a5f713ba31557e.js" async=""></script><script src="/_next/static/chunks/197-f7c33a0114fc3db3.js" async=""></script><script src="/_next/static/chunks/867-8dc5bbb092ca2c5c.js" async=""></script><script src="/_next/static/chunks/549-f295c8429e83b25b.js" async=""></script><script src="/_next/static/chunks/499-28e118e33ce07935.js" async=""></script><script src="/_next/static/chunks/app/layout-73f28bc065a46ed3.js" async=""></script><meta name="robots" content="noindex"/><title>404: This page could not be found.</title><title>copilot-operator</title><meta name="description" content="Runs task loops with Microsoft 365 Copilot on this machine."/><script>
1
+ <!DOCTYPE html><!--lDmqS7pWU_B_Ac5idPvdS--><html lang="en" data-theme="light" data-textsize="normal" data-contrast="normal" data-motion="normal" data-links="plain" data-focus="normal"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/css/0e55721108c300f2.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-0f31b926d9a9c5a4.js"/><script src="/_next/static/chunks/c7879cf7-b5ab1053c1d9a2e7.js" async=""></script><script src="/_next/static/chunks/131-bae98f790a541679.js" async=""></script><script src="/_next/static/chunks/main-app-e3a5f713ba31557e.js" async=""></script><script src="/_next/static/chunks/197-f7c33a0114fc3db3.js" async=""></script><script src="/_next/static/chunks/867-7d86a692260006f1.js" async=""></script><script src="/_next/static/chunks/549-348b0a1404407e5a.js" async=""></script><script src="/_next/static/chunks/499-39b2c00bda3656f0.js" async=""></script><script src="/_next/static/chunks/app/layout-6ee612d25e78b246.js" async=""></script><meta name="robots" content="noindex"/><title>404: This page could not be found.</title><title>copilot-operator</title><meta name="description" content="Runs task loops with Microsoft 365 Copilot on this machine."/><script>
2
2
  (function () {
3
3
  try {
4
4
  var d = document.documentElement;
@@ -13,4 +13,4 @@
13
13
  d.dataset.focus = a.strongFocus ? 'strong' : 'normal';
14
14
  } catch (e) {}
15
15
  })();
16
- </script><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><a class="skip-link" href="#main">Skip to the content</a><div class="wrap"><header class="top"><h1><a href="/">copilot-operator</a></h1><nav aria-label="Main"><a href="/"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M4 5h16v4H4zM4 11h16v4H4zM4 17h10v2H4z"></path></svg><span>Sessions</span></a><a href="/defaults"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8zm8.5 4 1.5 1-1.6 2.8-1.8-.4a7 7 0 0 1-1.5 1.5l.4 1.8L14.7 21l-1-1.5a7 7 0 0 1-3.4 0l-1 1.5-2.8-1.6.4-1.8A7 7 0 0 1 5.4 16l-1.8.4L2 13.6 3.5 12.6V11.4L2 10.4l1.6-2.8 1.8.4A7 7 0 0 1 6.9 6.5l-.4-1.8L9.3 3l1 1.5a7 7 0 0 1 3.4 0l1-1.5 2.8 1.6-.4 1.8a7 7 0 0 1 1.5 1.5l1.8-.4L22 10.4l-1.5 1z"></path></svg><span>Settings</span></a><a href="/import"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 3v10m0 0 4-4m-4 4-4-4M4 15v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg><span>Plan from JSON</span></a><a href="/history"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 3a9 9 0 1 0 8.5 6M12 7v5l3 2M3 4v5h5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg><span>Task register</span></a><a href="/level1"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M6 3h9l5 5v13H6zM14 3v6h6M9 13h7M9 17h7" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"></path></svg><span>Level 1 prompt</span></a><a href="/presets"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M5 4h14v4H5zM5 10h14v4H5zM5 16h9v4H5z" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"></path></svg><span>Level 2 presets</span></a><a href="/appearance"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 3a9 9 0 0 0 0 18c1.5 0 2-1 2-2s-1-1.5-1-2.5S14 15 15.5 15H17a4 4 0 0 0 4-4 8 8 0 0 0-9-8zM8 9a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm4-3a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm4 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"></path></svg><span>Appearance</span></a><a href="/system"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M4 5h16v10H4zM2 19h20M9 15v4M15 15v4" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"></path></svg><span>System</span></a><select aria-label="Language" style="width:auto"><option value="en" selected="">English</option><option value="bg">Български</option></select></nav></header><main id="main"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>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)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--></main></div><script src="/_next/static/chunks/webpack-0f31b926d9a9c5a4.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[8078,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-8dc5bbb092ca2c5c.js\",\"549\",\"static/chunks/549-f295c8429e83b25b.js\",\"499\",\"static/chunks/499-28e118e33ce07935.js\",\"177\",\"static/chunks/app/layout-73f28bc065a46ed3.js\"],\"AppearanceProvider\"]\n3:I[867,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-8dc5bbb092ca2c5c.js\",\"549\",\"static/chunks/549-f295c8429e83b25b.js\",\"499\",\"static/chunks/499-28e118e33ce07935.js\",\"177\",\"static/chunks/app/layout-73f28bc065a46ed3.js\"],\"LanguageProvider\"]\n4:I[1035,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-8dc5bbb092ca2c5c.js\",\"549\",\"static/chunks/549-f295c8429e83b25b.js\",\"499\",\"static/chunks/499-28e118e33ce07935.js\",\"177\",\"static/chunks/app/layout-73f28bc065a46ed3.js\"],\"DialogHost\"]\n5:I[8214,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-8dc5bbb092ca2c5c.js\",\"549\",\"static/chunks/549-f295c8429e83b25b.js\",\"499\",\"static/chunks/499-28e118e33ce07935.js\",\"177\",\"static/chunks/app/layout-73f28bc065a46ed3.js\"],\"SkipLink\"]\n6:I[8197,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-8dc5bbb092ca2c5c.js\",\"549\",\"static/chunks/549-f295c8429e83b25b.js\",\"499\",\"static/chunks/499-28e118e33ce07935.js\",\"177\",\"static/chunks/app/layout-73f28bc065a46ed3.js\"],\"\"]\n7:I[8214,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-8dc5bbb092ca2c5c.js\",\"549\",\"static/chunks/549-f295c8429e83b25b.js\",\"499\",\"static/chunks/499-28e118e33ce07935.js\",\"177\",\"static/chunks/app/layout-73f28bc065a46ed3.js\"],\"Nav\"]\n8:I[6657,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-8dc5bbb092ca2c5c.js\",\"549\",\"static/chunks/549-f295c8429e83b25b.js\",\"499\",\"static/chunks/499-28e118e33ce07935.js\",\"177\",\"static/chunks/app/layout-73f28bc065a46ed3.js\"],\"GlobalApprovals\"]\n9:I[3069,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-8dc5bbb092ca2c5c.js\",\"549\",\"static/chunks/549-f295c8429e83b25b.js\",\"499\",\"static/chunks/499-28e118e33ce07935.js\","])</script><script>self.__next_f.push([1,"\"177\",\"static/chunks/app/layout-73f28bc065a46ed3.js\"],\"StartFailureBanner\"]\na:I[5204,[],\"\"]\nb:I[2642,[],\"\"]\nc:I[7712,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-8dc5bbb092ca2c5c.js\",\"549\",\"static/chunks/549-f295c8429e83b25b.js\",\"499\",\"static/chunks/499-28e118e33ce07935.js\",\"177\",\"static/chunks/app/layout-73f28bc065a46ed3.js\"],\"ScrollJump\"]\nd:I[1701,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-8dc5bbb092ca2c5c.js\",\"549\",\"static/chunks/549-f295c8429e83b25b.js\",\"499\",\"static/chunks/499-28e118e33ce07935.js\",\"177\",\"static/chunks/app/layout-73f28bc065a46ed3.js\"],\"StartDialogHost\"]\ne:I[433,[],\"OutletBoundary\"]\n10:I[9884,[],\"AsyncMetadataOutlet\"]\n12:I[433,[],\"ViewportBoundary\"]\n14:I[433,[],\"MetadataBoundary\"]\n15:\"$Sreact.suspense\"\n17:I[3536,[],\"\"]\n:HL[\"/_next/static/css/cea7913ba416dbb7.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"-htN5GTSrd3W3f5j_QC2y\",\"p\":\"\",\"c\":[\"\",\"_not-found\"],\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[\"\",[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/cea7913ba416dbb7.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"data-theme\":\"light\",\"data-textsize\":\"normal\",\"data-contrast\":\"normal\",\"data-motion\":\"normal\",\"data-links\":\"plain\",\"data-focus\":\"normal\",\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"\\n(function () {\\n try {\\n var d = document.documentElement;\\n var raw = localStorage.getItem('cop.appearance');\\n var a = raw ? JSON.parse(raw) : {};\\n if (!a || typeof a !== 'object') a = {};\\n d.dataset.theme = a.theme === 'dark' ? 'dark' : 'light';\\n d.dataset.textsize = [\\\"small\\\",\\\"normal\\\",\\\"large\\\",\\\"huge\\\",\\\"giant\\\"].indexOf(a.textSize) \u003e= 0 ? a.textSize : 'normal';\\n d.dataset.contrast = a.highContrast ? 'high' : 'normal';\\n d.dataset.motion = a.reduceMotion ? 'reduced' : 'normal';\\n d.dataset.links = a.underlineLinks ? 'underline' : 'plain';\\n d.dataset.focus = a.strongFocus ? 'strong' : 'normal';\\n } catch (e) {}\\n})();\\n\"}}]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"$L2\",null,{\"children\":[\"$\",\"$L3\",null,{\"children\":[\"$\",\"$L4\",null,{\"children\":[[\"$\",\"$L5\",null,{}],[\"$\",\"div\",null,{\"className\":\"wrap\",\"children\":[[\"$\",\"header\",null,{\"className\":\"top\",\"children\":[[\"$\",\"h1\",null,{\"children\":[\"$\",\"$L6\",null,{\"href\":\"/\",\"children\":\"copilot-operator\"}]}],[\"$\",\"$L7\",null,{}]]}],[\"$\",\"$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\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]]}],[\"$\",\"$Lc\",null,{}],[\"$\",\"$Ld\",null,{}]]}]}]}]}]]}]]}],{\"children\":[\"/_not-found\",[\"$\",\"$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\":[[[\"$\",\"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.\"}]}]]}]}]],null,[\"$\",\"$Le\",null,{\"children\":[\"$Lf\",[\"$\",\"$L10\",null,{\"promise\":\"$@11\"}]]}]]}],{},null,false]},null,false]},null,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[[\"$\",\"$L12\",null,{\"children\":\"$L13\"}],null],[\"$\",\"$L14\",null,{\"children\":[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$15\",null,{\"fallback\":null,\"children\":\"$L16\"}]}]}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$17\",[]],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"13:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\nf:null\n"])</script><script>self.__next_f.push([1,"11:{\"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\"}\n"])</script><script>self.__next_f.push([1,"16:\"$11:metadata\"\n"])</script></body></html>
16
+ </script><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><a class="skip-link" href="#main">Skip to the content</a><div class="wrap"><header class="top"><h1><a href="/">copilot-operator</a></h1><nav aria-label="Main"><a href="/"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M4 5h16v4H4zM4 11h16v4H4zM4 17h10v2H4z"></path></svg><span>Sessions</span></a><a href="/defaults"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8zm8.5 4 1.5 1-1.6 2.8-1.8-.4a7 7 0 0 1-1.5 1.5l.4 1.8L14.7 21l-1-1.5a7 7 0 0 1-3.4 0l-1 1.5-2.8-1.6.4-1.8A7 7 0 0 1 5.4 16l-1.8.4L2 13.6 3.5 12.6V11.4L2 10.4l1.6-2.8 1.8.4A7 7 0 0 1 6.9 6.5l-.4-1.8L9.3 3l1 1.5a7 7 0 0 1 3.4 0l1-1.5 2.8 1.6-.4 1.8a7 7 0 0 1 1.5 1.5l1.8-.4L22 10.4l-1.5 1z"></path></svg><span>Settings</span></a><a href="/import"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 3v10m0 0 4-4m-4 4-4-4M4 15v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg><span>Plan from JSON</span></a><a href="/history"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 3a9 9 0 1 0 8.5 6M12 7v5l3 2M3 4v5h5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg><span>Task register</span></a><a href="/level1"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M6 3h9l5 5v13H6zM14 3v6h6M9 13h7M9 17h7" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"></path></svg><span>Level 1 prompt</span></a><a href="/presets"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M5 4h14v4H5zM5 10h14v4H5zM5 16h9v4H5z" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"></path></svg><span>Level 2 presets</span></a><a href="/appearance"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 3a9 9 0 0 0 0 18c1.5 0 2-1 2-2s-1-1.5-1-2.5S14 15 15.5 15H17a4 4 0 0 0 4-4 8 8 0 0 0-9-8zM8 9a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm4-3a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm4 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"></path></svg><span>Appearance</span></a><a href="/system"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M4 5h16v10H4zM2 19h20M9 15v4M15 15v4" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"></path></svg><span>System</span></a><select aria-label="Language" style="width:auto"><option value="en" selected="">English</option><option value="bg">Български</option></select></nav></header><main id="main"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>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)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--></main></div><script src="/_next/static/chunks/webpack-0f31b926d9a9c5a4.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[8078,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-7d86a692260006f1.js\",\"549\",\"static/chunks/549-348b0a1404407e5a.js\",\"499\",\"static/chunks/499-39b2c00bda3656f0.js\",\"177\",\"static/chunks/app/layout-6ee612d25e78b246.js\"],\"AppearanceProvider\"]\n3:I[867,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-7d86a692260006f1.js\",\"549\",\"static/chunks/549-348b0a1404407e5a.js\",\"499\",\"static/chunks/499-39b2c00bda3656f0.js\",\"177\",\"static/chunks/app/layout-6ee612d25e78b246.js\"],\"LanguageProvider\"]\n4:I[1035,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-7d86a692260006f1.js\",\"549\",\"static/chunks/549-348b0a1404407e5a.js\",\"499\",\"static/chunks/499-39b2c00bda3656f0.js\",\"177\",\"static/chunks/app/layout-6ee612d25e78b246.js\"],\"DialogHost\"]\n5:I[8214,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-7d86a692260006f1.js\",\"549\",\"static/chunks/549-348b0a1404407e5a.js\",\"499\",\"static/chunks/499-39b2c00bda3656f0.js\",\"177\",\"static/chunks/app/layout-6ee612d25e78b246.js\"],\"SkipLink\"]\n6:I[8197,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-7d86a692260006f1.js\",\"549\",\"static/chunks/549-348b0a1404407e5a.js\",\"499\",\"static/chunks/499-39b2c00bda3656f0.js\",\"177\",\"static/chunks/app/layout-6ee612d25e78b246.js\"],\"\"]\n7:I[8214,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-7d86a692260006f1.js\",\"549\",\"static/chunks/549-348b0a1404407e5a.js\",\"499\",\"static/chunks/499-39b2c00bda3656f0.js\",\"177\",\"static/chunks/app/layout-6ee612d25e78b246.js\"],\"Nav\"]\n8:I[6657,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-7d86a692260006f1.js\",\"549\",\"static/chunks/549-348b0a1404407e5a.js\",\"499\",\"static/chunks/499-39b2c00bda3656f0.js\",\"177\",\"static/chunks/app/layout-6ee612d25e78b246.js\"],\"GlobalApprovals\"]\n9:I[3069,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-7d86a692260006f1.js\",\"549\",\"static/chunks/549-348b0a1404407e5a.js\",\"499\",\"static/chunks/499-39b2c00bda3656f0.js\","])</script><script>self.__next_f.push([1,"\"177\",\"static/chunks/app/layout-6ee612d25e78b246.js\"],\"StartFailureBanner\"]\na:I[5204,[],\"\"]\nb:I[2642,[],\"\"]\nc:I[7712,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-7d86a692260006f1.js\",\"549\",\"static/chunks/549-348b0a1404407e5a.js\",\"499\",\"static/chunks/499-39b2c00bda3656f0.js\",\"177\",\"static/chunks/app/layout-6ee612d25e78b246.js\"],\"ScrollJump\"]\nd:I[1701,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-7d86a692260006f1.js\",\"549\",\"static/chunks/549-348b0a1404407e5a.js\",\"499\",\"static/chunks/499-39b2c00bda3656f0.js\",\"177\",\"static/chunks/app/layout-6ee612d25e78b246.js\"],\"StartDialogHost\"]\ne:I[433,[],\"OutletBoundary\"]\n10:I[9884,[],\"AsyncMetadataOutlet\"]\n12:I[433,[],\"ViewportBoundary\"]\n14:I[433,[],\"MetadataBoundary\"]\n15:\"$Sreact.suspense\"\n17:I[3536,[],\"\"]\n:HL[\"/_next/static/css/0e55721108c300f2.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"lDmqS7pWU_B_Ac5idPvdS\",\"p\":\"\",\"c\":[\"\",\"_not-found\"],\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[\"\",[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/0e55721108c300f2.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"data-theme\":\"light\",\"data-textsize\":\"normal\",\"data-contrast\":\"normal\",\"data-motion\":\"normal\",\"data-links\":\"plain\",\"data-focus\":\"normal\",\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"\\n(function () {\\n try {\\n var d = document.documentElement;\\n var raw = localStorage.getItem('cop.appearance');\\n var a = raw ? JSON.parse(raw) : {};\\n if (!a || typeof a !== 'object') a = {};\\n d.dataset.theme = a.theme === 'dark' ? 'dark' : 'light';\\n d.dataset.textsize = [\\\"small\\\",\\\"normal\\\",\\\"large\\\",\\\"huge\\\",\\\"giant\\\"].indexOf(a.textSize) \u003e= 0 ? a.textSize : 'normal';\\n d.dataset.contrast = a.highContrast ? 'high' : 'normal';\\n d.dataset.motion = a.reduceMotion ? 'reduced' : 'normal';\\n d.dataset.links = a.underlineLinks ? 'underline' : 'plain';\\n d.dataset.focus = a.strongFocus ? 'strong' : 'normal';\\n } catch (e) {}\\n})();\\n\"}}]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"$L2\",null,{\"children\":[\"$\",\"$L3\",null,{\"children\":[\"$\",\"$L4\",null,{\"children\":[[\"$\",\"$L5\",null,{}],[\"$\",\"div\",null,{\"className\":\"wrap\",\"children\":[[\"$\",\"header\",null,{\"className\":\"top\",\"children\":[[\"$\",\"h1\",null,{\"children\":[\"$\",\"$L6\",null,{\"href\":\"/\",\"children\":\"copilot-operator\"}]}],[\"$\",\"$L7\",null,{}]]}],[\"$\",\"$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\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]]}],[\"$\",\"$Lc\",null,{}],[\"$\",\"$Ld\",null,{}]]}]}]}]}]]}]]}],{\"children\":[\"/_not-found\",[\"$\",\"$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\":[[[\"$\",\"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.\"}]}]]}]}]],null,[\"$\",\"$Le\",null,{\"children\":[\"$Lf\",[\"$\",\"$L10\",null,{\"promise\":\"$@11\"}]]}]]}],{},null,false]},null,false]},null,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[[\"$\",\"$L12\",null,{\"children\":\"$L13\"}],null],[\"$\",\"$L14\",null,{\"children\":[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$15\",null,{\"fallback\":null,\"children\":\"$L16\"}]}]}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$17\",[]],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"13:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\nf:null\n"])</script><script>self.__next_f.push([1,"11:{\"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\"}\n"])</script><script>self.__next_f.push([1,"16:\"$11:metadata\"\n"])</script></body></html>
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[584],{287:(e,t,s)=>{s.d(t,{y:()=>h,f:()=>u});var n=s(3365),l=s(1521),a=s(5549),i=s(867),r=s(7527),c=s(1035),o=s(1701),d=s(4811);function u(e){var t,s,u;let{target:m,intro:f,initial:p="one",focusFirst:x=!1,checkContract:g=!0,onClose:j}=e,{t:y}=(0,i.kj)(),k=(0,d.p)(),[v,b]=(0,l.useState)(null),[N,w]=(0,l.useState)(p),[S,I]=(0,l.useState)(!1),[C,q]=(0,l.useState)(""),[F,R]=(0,l.useState)(!1),E=(0,l.useRef)(null),M=(0,l.useRef)(null),L=(0,l.useRef)(null),H=(0,l.useId)(),T=()=>a.FH.session(m.sessionId).then(b).catch(e=>q(e.message));(0,l.useEffect)(()=>{T(),g&&a.FH.contractCheck(m.sessionId,m.taskId).then(e=>R(e.conflicts.length>0)).catch(()=>void 0)},[m.sessionId,m.taskId]),(0,r.z)(T,3e3,!!(null==v?void 0:v.running));let D=null!==v;if((0,l.useEffect)(()=>{var e,t,s;if(!D||(null==(t=E.current)||null==(e=t.scrollIntoView)||e.call(t,{block:"nearest"}),!x))return;let n=M.current;n&&!n.disabled?n.focus():null==(s=L.current)||s.focus()},[D,x]),!v)return(0,n.jsx)("div",{className:"notice calm",style:{marginTop:8},children:(0,n.jsx)("span",{className:"small",children:C||y("runq.loading")})});let O=function(e,t){let s=e.tasks.findIndex(e=>e.id===t),n=s>=0?e.tasks[s]:void 0,l=s>=0?e.tasks.slice(0,s):[],a=s>=0?e.tasks.slice(s+1):[],i="continue"!==e.onFailure,r=-1;return a.forEach((e,t)=>{"queued"===e.status&&(r=t)}),{task:n,followingQueued:a.filter(e=>"queued"===e.status),laterRan:a.filter(e=>"queued"!==e.status),earlierRan:l.filter(e=>"queued"!==e.status),chain:i,chainGap:i?l.find(e=>"done"!==e.status):void 0,chainGapLater:i&&r>0?a.slice(0,r).find(e=>"queued"!==e.status&&"done"!==e.status):void 0}}(v,m.taskId),B=(null==(t=O.task)?void 0:t.status)==="queued",G="following"===N?[O.task,...O.followingQueued]:O.task?[O.task]:[],W=v.running?y("runq.sessionRunning"):!1===v.active?y("runq.sessionInactive"):"",A=async e=>{if("unattended"!==e||k||await (0,c.Z)(y("batch.unattendedConfirm",{n:1}))){I(!0),q(""),R(!1);try{var t,s;let n=await a.FH.suggestedRunName([m.sessionId]).then(e=>e.name).catch(()=>void 0),l=await (0,o.L)({sessionIds:[m.sessionId],mode:e,start:t=>a.FH.startBatch([m.sessionId],e,"stop",void 0,void 0,n,G.map(e=>e.id),t)});if(!l.started&&!l.reply)return;let i=null!=(t=l.reply)?t:{started:!0};if(!l.started){q(y("batch.notStarted",{reason:null!=(s=i.reason)?s:""}));let e=await a.FH.contractCheck(m.sessionId,m.taskId).catch(()=>({conflicts:[]}));R(e.conflicts.length>0);return}q(y("runq.started",{n:G.length})),j(!0)}catch(e){q(e.message)}finally{I(!1)}}},Q=y("runq.title",{title:m.title});return(0,n.jsxs)("div",{ref:E,className:"notice calm",role:"group","aria-label":Q,style:{marginTop:8},children:[f&&(0,n.jsx)("p",{className:"small",style:{marginTop:0},children:f}),(0,n.jsx)("strong",{children:Q}),B?(0,n.jsxs)(n.Fragment,{children:[O.followingQueued.length>0&&(0,n.jsxs)("div",{className:"small",role:"radiogroup","aria-label":Q,style:{marginTop:6},children:[(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"radio",name:"runq-".concat(H),checked:"one"===N,onChange:()=>w("one"),disabled:S}),y("runq.onlyThis")]}),(0,n.jsxs)("label",{className:"option-inline",title:y("runq.followingWhy"),children:[(0,n.jsx)("input",{type:"radio",name:"runq-".concat(H),checked:"following"===N,onChange:()=>w("following"),disabled:S}),y("runq.following",{n:O.followingQueued.length,session:v.name})]})]}),(0,n.jsx)("div",{className:"small",style:{marginTop:6},children:y("runq.willRun")}),(0,n.jsx)("ol",{className:"small",style:{margin:"4px 0",paddingLeft:22},children:G.map(e=>(0,n.jsx)("li",{children:e.title},e.id))}),(0,n.jsxs)("ul",{className:"small",style:{margin:"4px 0",paddingLeft:18},children:[O.chain&&G.length>1&&(0,n.jsx)("li",{children:y("runq.chainStops")}),O.earlierRan.length>0&&(0,n.jsx)("li",{children:y("runq.untouched",{n:O.earlierRan.length})}),O.laterRan.length>0&&(0,n.jsx)("li",{children:y("runq.laterRan",{list:O.laterRan.map(e=>'"'.concat(e.title,'"')).join(", ")})}),"one"===N&&O.followingQueued.length>0&&(0,n.jsx)("li",{children:y("runq.restWait",{n:O.followingQueued.length})})]}),O.chainGap&&(0,n.jsx)("div",{className:"notice caution small",style:{marginTop:6},children:y("runq.chainGap",{before:O.chainGap.title,status:y("status.".concat(O.chainGap.status))})}),"following"===N&&O.chainGapLater&&(0,n.jsx)("div",{className:"notice caution small",style:{marginTop:6},children:y("runq.chainGapLater",{between:O.chainGapLater.title,status:y("status.".concat(O.chainGapLater.status))})}),W&&(0,n.jsx)("p",{className:"small",children:W})]}):(0,n.jsx)("p",{className:"small",children:y("runq.notQueued",{status:y("status.".concat(null!=(u=null==(s=O.task)?void 0:s.status)?u:"queued"))})}),(0,n.jsxs)("div",{className:"row",style:{marginTop:8},children:[B&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{ref:M,className:"primary",disabled:S||!!W,onClick:()=>void A("confirm"),title:y("runq.goWhy"),children:y("runq.go")}),(0,n.jsx)("button",{disabled:S||!!W,onClick:()=>void A("unattended"),title:y("runq.unattendedWhy"),children:y("runq.unattended")})]}),(0,n.jsx)("button",{ref:L,className:"quiet",disabled:S,onClick:()=>j(!1),children:f?y("runq.later"):y("dialog.cancel")}),C&&(0,n.jsx)("span",{className:"small",role:"status",children:C})]}),F&&(0,n.jsx)(h,{target:m,onApplied:(e,t)=>{T(),0===e&&(R(!1),q(t))}})]})}function h(e){let{target:t,onApplied:s}=e,{t:r}=(0,i.kj)(),[c,o]=(0,l.useState)(null),[d,u]=(0,l.useState)([]),[h,m]=(0,l.useState)(!1),[f,p]=(0,l.useState)(""),[x,g]=(0,l.useState)(null),[j,y]=(0,l.useState)(null),k=(0,l.useId)();(0,l.useEffect)(()=>{o(null),Promise.all([a.FH.contractCheck(t.sessionId,t.taskId),a.FH.session(t.sessionId)]).then(e=>{var s;let[n,l]=e,a=l.tasks.find(e=>e.id===t.taskId);o(n.conflicts),u(n.conflicts.map(e=>e.fixes.length>0?0:-1)),g(null!=(s=null==a?void 0:a.status)?s:null),y(a?{readOnly:a.readOnly,scope:a.scope,checks:a.checks}:null)}).catch(e=>p(e.message))},[t.sessionId,t.taskId]);let v=async()=>{if(c){m(!0),p("");try{let e=await a.FH.applyContractFix(t.sessionId,t.taskId,d,c.map(e=>e.text)),n=r("cfix.applied",{list:(j?function(e,t,s){var n,l,a,i;let r=[];!!t.readOnly!=!!s.readOnly&&r.push(e(s.readOnly?"cfix.chReadOnlyOn":"cfix.chReadOnlyOff"));let c=(null!=(n=t.scope)?n:[]).join(", "),o=(null!=(l=s.scope)?l:[]).join(", ");c!==o&&r.push(o?e("cfix.chScope",{paths:o}):e("cfix.chScopeRemoved"));let d=new Set((null!=(a=s.checks)?a:[]).map(e=>e.name));for(let s of null!=(i=t.checks)?i:[])d.has(s.name)||r.push(e("cfix.chDropped",{check:s.name}));return r.join("; ")}(r,j,e.task):e.applied.join("; "))||r("cfix.chNothing")});p(n+(e.remaining.length>0?" ".concat(r("cfix.remaining",{n:e.remaining.length})):"")),o(e.remaining),u(e.remaining.map(e=>e.fixes.length>0?0:-1)),g("queued"),y({readOnly:e.task.readOnly,scope:e.task.scope,checks:e.task.checks}),s(e.remaining.length,n)}catch(e){p(e.message)}finally{m(!1)}}},b=r("cfix.title",{title:t.title});return(0,n.jsxs)("div",{className:"notice caution",role:"group","aria-label":b,style:{marginTop:8},children:[(0,n.jsx)("strong",{children:b}),(0,n.jsx)("p",{className:"why",children:r("cfix.why")}),null===c?(0,n.jsx)("p",{className:"small",children:f||r("cfix.loading")}):0===c.length?(0,n.jsx)("p",{className:"small",role:"status",children:f||r("cfix.none")}):(0,n.jsxs)(n.Fragment,{children:[c.map((e,t)=>(0,n.jsxs)("fieldset",{className:"small",style:{margin:"8px 0",border:0,padding:0},children:[(0,n.jsx)("legend",{style:{fontWeight:600},children:e.text}),e.fixes.map((e,s)=>(0,n.jsxs)("label",{className:"option-inline",style:{display:"block"},children:[(0,n.jsx)("input",{type:"radio",name:"cfix-".concat(k,"-").concat(t),checked:d[t]===s,onChange:()=>u(e=>e.map((e,n)=>n===t?s:e)),disabled:h}),"add-to-scope"===e.kind?r("cfix.addToScope",{path:e.path}):"not-read-only"===e.kind?e.scope.length>0?r("cfix.notReadOnly",{paths:e.scope.join(", ")}):r("cfix.notReadOnlyAll"):"drop-scope"===e.kind?r("cfix.dropScope"):r("cfix.dropCheck",{check:e.check}),0===s&&(0,n.jsxs)("span",{className:"muted",children:[" ",r("cfix.minimal")]})]},s)),(0,n.jsxs)("label",{className:"option-inline",style:{display:"block"},children:[(0,n.jsx)("input",{type:"radio",name:"cfix-".concat(k,"-").concat(t),checked:-1===d[t],onChange:()=>u(e=>e.map((e,s)=>s===t?-1:e)),disabled:h}),e.fixes.length>0?r("cfix.leave"):r("cfix.noFix")]})]},t)),(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("button",{className:"primary",disabled:h||d.every(e=>-1===e),onClick:()=>void v(),children:"queued"===x?r("cfix.applyQueued"):r("cfix.apply")}),f&&(0,n.jsx)("span",{className:"small",role:"status",children:f})]})]})]})}},1366:(e,t,s)=>{s.d(t,{w:()=>r,y:()=>i});var n=s(3365),l=s(1521),a=s(867);function i(e){let{readOnly:t,scope:s,onReadOnly:i,onScope:r}=e,{t:c}=(0,a.kj)(),o=(0,l.useId)();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"option",style:{marginTop:10},children:[(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"checkbox",checked:t,onChange:e=>i(e.target.checked)}),(0,n.jsx)("span",{children:c("task.readOnlyEdit")})]}),(0,n.jsx)("p",{className:"why",children:c("task.readOnlyEditWhy")})]}),(0,n.jsx)("label",{htmlFor:"".concat(o,"-scope"),children:c("task.scopeEdit")}),(0,n.jsx)("textarea",{id:"".concat(o,"-scope"),value:s,onChange:e=>r(e.target.value),placeholder:"tests/e2e/\nsrc/**/*.ts",style:{minHeight:60},disabled:t}),(0,n.jsx)("p",{className:"why",children:c("task.scopeEditWhy")})]})}function r(e){return e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean)}},1910:(e,t,s)=>{s.d(t,{H:()=>c,u:()=>r});var n=s(3365),l=s(1521),a=s(867),i=s(5549);function r(e){let{label:t,save:s}=e,{t:i}=(0,a.kj)(),[r,c]=(0,l.useState)(!1),[o,d]=(0,l.useState)(""),[u,h]=(0,l.useState)(!1),m=async()=>{c(!0),d("");try{var e;let t=await s();h(!1),d(t.revealed?i("save.done",{path:t.path}):i("save.savedOnly",{path:t.path,note:null!=(e=t.note)?e:""}))}catch(e){h(!0),d(i("save.failed",{problem:e.message}))}finally{c(!1)}};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",className:"linkish",disabled:r,title:i("save.why"),onClick:()=>void m(),children:r?i("save.saving"):t}),o&&(0,n.jsx)("span",{className:u?"err small":"muted small",children:o})]})}function c(e){let{sessionId:t,taskId:s,attempt:r}=e,{t:c}=(0,a.kj)(),[o,d]=(0,l.useState)(!1),[u,h]=(0,l.useState)(""),[m,f]=(0,l.useState)(!1),p=async()=>{d(!0),h("");try{let e=await i.FH.downloadBundle([{sessionId:t,taskId:s,attempt:r}]);f(!1),h(c("reg.bundleSaved",{name:e}))}catch(e){f(!0),h(c("save.failed",{problem:e.message}))}finally{d(!1)}};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",className:"linkish",disabled:o,title:c("save.attemptRecordWhy"),onClick:()=>void p(),children:o?c("save.saving"):c("save.attemptRecord")}),u&&(0,n.jsx)("span",{className:m?"err small":"muted small",children:u})]})}},2876:(e,t,s)=>{s.d(t,{P:()=>d});var n=s(3365),l=s(1521),a=s(5549),i=s(867);function r(e,t){let[s,n]=(0,l.useState)(null),a=(0,l.useRef)(!0),[i,r]=(0,l.useState)(!0),c=(0,l.useCallback)(e=>n(e),[]);return(0,l.useLayoutEffect)(()=>{if(!s)return;let e=()=>{let e=s.scrollHeight-s.scrollTop-s.clientHeight<=24;a.current=e,r(e)};return s.addEventListener("scroll",e,{passive:!0}),()=>s.removeEventListener("scroll",e)},[s]),(0,l.useLayoutEffect)(()=>{s&&e&&a.current&&(s.scrollTop=s.scrollHeight)},[s,e,t]),{ref:c,following:i,follow:(0,l.useCallback)(()=>{a.current=!0,r(!0),s&&(s.scrollTop=s.scrollHeight)},[s])}}var c=s(5132);function o(e){let{text:t,follow:s}=e,{ref:l}=r(s,t);return(0,n.jsx)("pre",{ref:l,className:"story-out".concat(s?" terminal":""),children:t})}function d(e){let{sessionId:t,taskId:s,runId:d,live:h}=e,{t:m}=(0,i.kj)(),[f,p]=(0,l.useState)(null),[x,g]=(0,l.useState)(""),[j,y]=(0,l.useState)(!0),[k,v]=(0,l.useState)(!0),[b,N]=(0,l.useState)(new Set),[w,S]=(0,l.useState)(new Set),[I,C]=(0,l.useState)(new Set),q=!!(null==f?void 0:f.live),F=(0,l.useRef)(0);F.current+=1;let R=r(q,F.current),E=(0,l.useRef)(null),M=(0,l.useRef)(!1);if((0,l.useEffect)(()=>{if(!f)return;let e=[],t=(s,n)=>s.forEach((s,l)=>{let a="".concat(n).concat(l);"review"===s.kind?t(s.entries,"".concat(a,"-")):"step"!==s.kind||s.outcome||e.push(a)});t(f.entries,"e"),e.some(e=>!w.has(e))&&S(t=>new Set([...t,...e])),f.live&&!M.current&&E.current&&(M.current=!0,E.current.scrollIntoView({block:"nearest",behavior:"smooth"}))},[f,w]),(0,l.useEffect)(()=>{let e,n=!0,l=async()=>{try{let i=await a.FH.taskStory(t,s,d);if(!n)return;p(i),g(""),(i.live||h)&&(e=setTimeout(l,2e3))}catch(t){if(!n)return;g(t.message),h&&(e=setTimeout(l,2e3))}};return l(),()=>{n=!1,e&&clearTimeout(e)}},[t,s,d,h]),x&&!f)return(0,n.jsx)("div",{className:"err small",children:x});if(!f)return(0,n.jsx)("div",{className:"muted small",children:m("story.loading")});let L=e=>b.has(e)||w.has(e)&&!I.has(e),H=e=>{let t=L(e);N(s=>{let n=new Set(s);return t?n.delete(e):n.add(e),n}),C(s=>{let n=new Set(s);return t?n.add(e):n.delete(e),n})},T=(e,t)=>{if(!("review"===e.kind?j||k:"step"===e.kind?k:j))return null;if("review"===e.kind)return(0,n.jsxs)("li",{className:"story-review",children:[(0,n.jsxs)("div",{className:"story-head",children:[(0,n.jsx)(u,{at:e.at}),(0,n.jsx)("span",{className:"chip",children:m("story.review",{n:e.round})})]}),(0,n.jsx)("ol",{className:"story",children:e.entries.map((e,s)=>T(e,"".concat(t,"-").concat(s)))})]},t);if("step"===e.kind){let s=L(t),l=!e.outcome&&f.live;return(0,n.jsxs)("li",{className:"story-step".concat(e.failed?" failed":""),children:[(0,n.jsxs)("div",{className:"story-head",children:[(0,n.jsx)(u,{at:e.at}),(0,n.jsx)("span",{className:"chip",children:m("story.step",{it:e.iteration,id:e.id})}),e.outcome&&(0,n.jsxs)("span",{className:"badge ".concat(e.failed?"failed":"done"),children:[e.outcome,void 0!==e.exitCode?" \xb7 exit ".concat(e.exitCode):"",void 0!==e.durationMs?" \xb7 ".concat((0,a.c5)(e.durationMs)):""]}),!e.outcome&&(0,n.jsx)("span",{className:"badge running",children:m("story.running")}),e.failed&&(0,n.jsx)("span",{className:"badge failed",children:m("story.failedHere")})]}),(0,n.jsx)("pre",{className:"story-cmd",children:e.command}),e.output&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",className:"linkish small",onClick:()=>H(t),children:s?m("story.hideOutput"):m("story.showOutput",{n:e.output.length})}),s&&(0,n.jsx)(o,{text:e.output,follow:l})]})]},t)}let s=b.has(t),l="sent"===e.kind?m("story.bot"):m("story.chat"),i="reply"===e.kind&&("blocked"===e.status||"failed"===e.status);return(0,n.jsxs)("li",{className:"story-msg ".concat(e.kind).concat(i?" failed":""),children:[(0,n.jsxs)("div",{className:"story-head",children:[(0,n.jsx)(u,{at:e.at}),(0,n.jsx)("strong",{children:l}),(0,n.jsx)("span",{className:"muted small",children:e.label}),"reply"===e.kind&&e.status&&(0,n.jsx)("span",{className:"badge ".concat(i?"failed":"done"===e.status?"done":""),children:e.status})]}),"reply"===e.kind&&e.notes&&(0,n.jsx)("p",{className:"story-notes",children:e.notes}),(0,n.jsx)("button",{type:"button",className:"linkish small",onClick:()=>H(t),children:s?m("story.hideText"):m("story.showText",{n:e.text.length})}),s&&(0,n.jsx)("pre",{className:"story-out",children:e.text})]},t)},D=f.close,O=D&&"done"!==D.status;return(0,n.jsxs)("div",{className:"story-box",ref:E,children:[(0,n.jsxs)("div",{className:"row small",style:{marginBottom:6},children:[(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"checkbox",checked:j,onChange:e=>y(e.target.checked)})," ",m("story.showChat")]}),(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"checkbox",checked:k,onChange:e=>v(e.target.checked)})," ",m("story.showCommands")]}),f.live&&(0,n.jsxs)("span",{className:"live",children:[(0,n.jsx)("span",{className:"dot","aria-hidden":"true"})," ",m("story.live")]}),f.live&&!R.following&&(0,n.jsx)("button",{type:"button",className:"quiet small",onClick:R.follow,title:m("story.followWhy"),children:m("story.follow")}),x&&(0,n.jsx)("span",{className:"err",children:x})]}),(0,n.jsxs)("div",{className:"story-fixed",children:[(0,n.jsx)("strong",{children:m("story.prompt")}),(0,n.jsx)("pre",{className:"story-out always",children:f.prompt})]}),(0,n.jsx)("div",{ref:R.ref,className:"story-scroll".concat(f.live?" live":""),children:(0,n.jsx)("ol",{className:"story",children:f.entries.map((e,t)=>T(e,"e".concat(t)))})}),D?(0,n.jsxs)("div",{className:"story-fixed close".concat(O?" failed":""),children:[(0,n.jsx)("strong",{children:O?m("story.endedBadly",{status:D.status}):m("story.ended")}),D.reason&&(0,n.jsx)("p",{className:"err small",children:D.reason}),D.summary&&(0,n.jsx)(c.s,{text:D.summary,className:"what"}),D.checks&&D.checks.length>0&&(0,n.jsx)("ul",{className:"small",style:{margin:"6px 0 0",paddingLeft:18},children:D.checks.map((e,t)=>(0,n.jsxs)("li",{className:e.passed?"":"err",children:[e.passed?"✓":"✗"," ",e.name,!e.passed&&e.detail?" — ".concat(e.detail):""]},t))})]}):(0,n.jsx)("div",{className:"story-fixed muted small",children:m("story.notEnded")})]})}function u(e){let{at:t}=e,s=(0,i.W3)(),{locale:l}=(0,i.kj)();if(!t)return null;let a=new Date(t),r="bg"===l?"bg-BG":void 0,c=a.toLocaleTimeString(r,{hour12:!1}),o=new Date().toDateString()===a.toDateString();return(0,n.jsx)("time",{className:"story-when",dateTime:t,title:s(t),children:o?c:"".concat(a.toLocaleDateString(r)," ").concat(c)})}},3041:(e,t,s)=>{s.d(t,{e:()=>r});var n=s(1521),l=s(5549),a=s(1035),i=s(867);function r(e){let{t}=(0,i.kj)(),[s,r]=(0,n.useState)(""),[c,o]=(0,n.useState)({taskId:"",text:""}),d=(e,t)=>o({taskId:e,text:t}),u=(0,n.useCallback)(async s=>{r("restore"),d(s.taskId,"");try{var n,i,c,o,u,h,m,f,p,x,g,j,y,k;let r=await l.FH.restorePreview(s.sessionId,s.taskId);if(!r.ok)return void d(s.taskId,t("restore.cannot",{problem:null!=(c=r.problem)?c:""}));let v={repo:r.repoDir,title:s.title,branch:null!=(o=r.branchName)?o:"",commit:(null!=(u=r.baseCommit)?u:"").slice(0,8)},b=r.leftBehind.length>0?t("restore.confirmLosing",{...v,n:r.leftBehind.length,kept:null!=(h=r.keptOn)?h:"",list:r.leftBehind.slice(0,10).join("\n")}):t("restore.confirm",v);if(!await (0,a.Z)(b))return;let N=await l.FH.restore(s.sessionId,s.taskId);if(!N.ok)return void d(s.taskId,t("restore.failed",{problem:null!=(m=N.problem)?m:""}));d(s.taskId,(null!=(f=null==(n=N.leftBehind)?void 0:n.length)?f:0)>0?t("restore.done",{branch:null!=(p=N.branch)?p:"",commit:(null!=(x=N.commit)?x:"").slice(0,8),n:null!=(g=null==(i=N.leftBehind)?void 0:i.length)?g:0,kept:null!=(j=N.keptOn)?j:""}):t("restore.doneNothing",{branch:null!=(y=N.branch)?y:"",commit:(null!=(k=N.commit)?k:"").slice(0,8)})),e()}catch(e){d(s.taskId,e.message)}finally{r("")}},[t,e]),h=(0,n.useCallback)(async s=>{r("restart"),d(s.taskId,"");try{var n,i,c;let r=await l.FH.restartPlan(s.sessionId,s.taskId);if(!r.ok)return void d(s.taskId,t("restart.cannot",{problem:null!=(n=r.problem)?n:""}));let o=r.restores.filter(e=>!e.ok);if(o.length>0)return void d(s.taskId,t("restart.cannot",{problem:o.map(e=>{var t;return"".concat(e.repoDir,": ").concat(null!=(t=e.problem)?t:"")}).join(" | ")}));let u=r.restores.map(e=>{var s,n,l,a,i;return[t("restart.repoLine",{repo:e.repoDir,commit:(null!=(s=e.baseCommit)?s:"").slice(0,8),branch:null!=(n=e.branchName)?n:"",n:e.leftBehind.length,kept:null!=(l=e.keptOn)?l:""}),...e.leftBehind.length>0?[t("restart.commitsHead",{kept:null!=(a=e.keptOn)?a:""})]:[],...e.leftBehind.slice(0,15).map(e=>" ".concat(e)),...e.leftBehind.length>15?[t("restart.commitsMore",{n:e.leftBehind.length-15})]:[],...(null!=(i=e.laterSessions)?i:[]).flatMap(e=>[t("restart.laterSession",{session:e.sessionName,n:e.commits.length,branch:e.branch}),...e.commits.slice(0,15).map(e=>" ".concat(e)),...e.commits.length>15?[t("restart.commitsMore",{n:e.commits.length-15})]:[]])].join("\n")}).join("\n"),h=r.tasks.map(e=>" ".concat(e.sessionName," / ").concat(e.title).concat(e.alreadyQueued?t("restart.alreadyQueued"):t("restart.taskRedo",{status:t("status.".concat(e.status))}))).join("\n"),m="unattended"===r.mode&&!!r.unattendedRefused,f=t("restart.confirm",{title:r.from.title,tasks:r.tasks.length,sessions:r.sessions.length,list:h,repos:u||t("restart.noRepo"),mode:t("unattended"!==r.mode||m?"run.confirm":"run.unattended")})+(m?t("restart.stepByStep",{reason:null!=(i=r.unattendedRefused)?i:""}):"");if(!await (0,a.Z)(f))return;let p=await l.FH.restartFrom(s.sessionId,s.taskId,m?{mode:"confirm"}:{});if(!p.started){d(s.taskId,t("restart.failed",{problem:null!=(c=p.reason)?c:""})),e();return}d(s.taskId,t("restart.started",{requeued:p.requeued,repos:p.restored.length})),e()}catch(e){d(s.taskId,e.message)}finally{r("")}},[t,e]);return{busy:s,message:c.text,messageTask:c.taskId,clearMessage:()=>d("",""),restore:u,restartFrom:h}}},3374:(e,t,s)=>{s.d(t,{c:()=>l});var n=s(1521);function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,[s,l]=(0,n.useState)(()=>Date.now());return(0,n.useEffect)(()=>{if(!e)return;l(Date.now());let s=window.setInterval(()=>l(Date.now()),t);return()=>window.clearInterval(s)},[e,t]),s}},3523:(e,t,s)=>{function n(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now();if(!e)return;let n=Date.parse(e);if(Number.isNaN(n))return;let l=t?Date.parse(t):s;return Number.isNaN(l)?void 0:Math.max(0,l-n)}function l(e){return!!e.startedAt&&!e.finishedAt&&"queued"!==e.status}function a(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now(),n=t.some(e=>l(e)),a=t.map(e=>e.finishedAt?Date.parse(e.finishedAt):NaN).filter(e=>!Number.isNaN(e)),i=Date.parse(e.startedAt),r=n||0===a.length?s:Math.max(...a);return{ms:Number.isNaN(i)?0:Math.max(0,r-i),live:n,tasks:t.length}}function i(e){var t,s;let n=new Map;for(let s of e){if(!s.runGroup)continue;let e=null!=(t=n.get(s.runGroup.id))?t:{run:s.runGroup,tasks:[]};e.tasks.push(s),n.set(s.runGroup.id,e)}return null!=(s=[...n.values()].sort((e,t)=>Date.parse(t.run.startedAt)-Date.parse(e.run.startedAt))[0])?s:null}s.d(t,{DG:()=>l,d5:()=>n,eZ:()=>a,hH:()=>i})},4811:(e,t,s)=>{s.d(t,{p:()=>a});var n=s(1521),l=s(5549);function a(){let[e,t]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let e=!0;return l.FH.settings().then(s=>{var n;let l=null!=(n=s.raw.execution)?n:{};e&&t("unattended"===l.mode)}).catch(()=>void 0),()=>{e=!1}},[]),e}},5132:(e,t,s)=>{s.d(t,{s:()=>r});var n=s(3365),l=s(1521);function a(e,t){let s,l=[],a=/(`[^`\n]+`)|(\*\*[^*\n]+\*\*)|(\*[^*\n]+\*)/g,i=0,r=0;for(;null!==(s=a.exec(e));){s.index>i&&l.push(e.slice(i,s.index));let a=s[0],c="".concat(t,"-i").concat(r+=1);a.startsWith("`")?l.push((0,n.jsx)("code",{children:a.slice(1,-1)},c)):a.startsWith("**")?l.push((0,n.jsx)("strong",{children:a.slice(2,-2)},c)):l.push((0,n.jsx)("em",{children:a.slice(1,-1)},c)),i=s.index+a.length}return i<e.length&&l.push(e.slice(i)),l}function i(e){let t=/^\s*[-*•]\s+(.*)$/.exec(e);if(t)return t[1];let s=/^\s*\d+[.)]\s+(.*)$/.exec(e);return s?s[1]:null}function r(e){let{text:t,className:s}=e,r=[],c=t.replace(/\r\n/g,"\n").split("\n"),o=0,d=0;for(;o<c.length;){let e=c[o];if(e.trim().startsWith("```")){let e=[];for(o+=1;o<c.length&&!c[o].trim().startsWith("```");)e.push(c[o++]);o+=1,e.length>0&&r.push((0,n.jsx)("pre",{children:e.join("\n")},"b".concat(d+=1)));continue}if(null!==i(e)){let e=[];for(;o<c.length&&null!==i(c[o]);)e.push(i(c[o++]));r.push((0,n.jsx)("ul",{children:e.map((e,t)=>(0,n.jsx)("li",{children:a(e,"b".concat(d,"-").concat(t))},t))},"b".concat(d+=1)));continue}if(""===e.trim()){o+=1;continue}let t=[];for(;o<c.length&&""!==c[o].trim()&&null===i(c[o])&&!c[o].trim().startsWith("```");)t.push(c[o++]);let s=d+=1;r.push((0,n.jsx)("p",{children:t.map((e,t)=>(0,n.jsxs)(l.Fragment,{children:[t>0&&(0,n.jsx)("br",{}),a(e,"b".concat(s,"-").concat(t))]},t))},"b".concat(s)))}return(0,n.jsx)("div",{className:"rich ".concat(null!=s?s:""),children:r})}},8934:(e,t,s)=>{s.d(t,{C:()=>o});var n=s(3365),l=s(1521),a=s(5549),i=s(4969),r=s(867);function c(e){if(null===e||""===e)return[];let t=e.split(/\r?\n/);return""===t[t.length-1]&&t.pop(),t}function o(e){let{sessionId:t,taskId:s,runId:a,title:i,files:c}=e,{t:o}=(0,r.kj)(),[u,h]=(0,l.useState)(!1);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",className:"linkish",onClick:()=>h(!0),title:o("diff.openWhy"),children:o("diff.open",{n:c})}),u&&(0,n.jsx)(d,{sessionId:t,taskId:s,runId:a,title:i,onClose:()=>h(!1)})]})}function d(e){var t,s,o,d,h,m,f;let{sessionId:p,taskId:x,runId:g,title:j,onClose:y}=e,{t:k}=(0,r.kj)(),[v,b]=(0,l.useState)(null),[N,w]=(0,l.useState)(""),[S,I]=(0,l.useState)(0),[C,q]=(0,l.useState)(new Map),[F,R]=(0,l.useState)(!1),[E,M]=(0,l.useState)(!0),[L,H]=(0,l.useState)(new Map),[T,D]=(0,l.useState)(-1),O=(0,l.useRef)(null),B=(0,l.useRef)(null),G=(0,l.useRef)(null);(0,i.V)(B,!0,G),(0,l.useEffect)(()=>{a.FH.taskChanges(p,x,g).then(b).catch(e=>w(e.message))},[p,x,g]);let W=null!=(o=null==v?void 0:v.files)?o:[],A=W[S];(0,l.useEffect)(()=>{!A||C.has(A.path)||a.FH.taskChangeFile(p,x,A.path,g).then(e=>q(t=>new Map(t).set(A.path,e))).catch(e=>q(t=>new Map(t).set(A.path,e.message)))},[A,C,p,x,g]);let Q=A?C.get(A.path):void 0,P=(0,l.useMemo)(()=>!Q||"string"==typeof Q||Q.binary||Q.tooLarge?[]:function(e,t){let s=function(e,t){let s=0;for(;s<e.length&&s<t.length&&e[s]===t[s];)s+=1;let n=e.length,l=t.length;for(;n>s&&l>s&&e[n-1]===t[l-1];)n-=1,l-=1;let a=[];for(let e=0;e<s;e+=1)a.push({kind:"same",a:e,b:e});for(let i of function(e,t){let s=e.length,n=t.length;if(0===s)return t.map((e,t)=>({kind:"add",b:t}));if(0===n)return e.map((e,t)=>({kind:"del",a:t}));let l=s+n,a=l+1,i=new Int32Array(2*l+3),r=[];for(let c=0;c<=Math.min(l,2e3);c+=1){r.push(i.slice(a-c-1,a+c+2));for(let l=-c;l<=c;l+=2){let o=l===-c||l!==c&&i[a+l-1]<i[a+l+1]?i[a+l+1]:i[a+l-1]+1,d=o-l;for(;o<s&&d<n&&e[o]===t[d];)o+=1,d+=1;if(i[a+l]=o,o>=s&&d>=n)return function(e,t,s,n){let l=[],a=t.length,i=s.length;for(let t=n;t>0;t-=1){let s=e[t],n=e=>s[e+t+1],r=a-i,c=r===-t||r!==t&&n(r-1)<n(r+1)?r+1:r-1,o=n(c),d=o-c;for(;a>o&&i>d;)a-=1,i-=1,l.push({kind:"same",a:a,b:i});a===o?l.push({kind:"add",b:d}):l.push({kind:"del",a:o}),a=o,i=d}for(;a>0&&i>0;)a-=1,i-=1,l.push({kind:"same",a:a,b:i});return l.reverse()}(r,e,t,c)}}return[...e.map((e,t)=>({kind:"del",a:t})),...t.map((e,t)=>({kind:"add",b:t}))]}(e.slice(s,n),t.slice(s,l)))a.push({kind:i.kind,...void 0!==i.a?{a:i.a+s}:{},...void 0!==i.b?{b:i.b+s}:{}});for(let t=0;n+t<e.length;t+=1)a.push({kind:"same",a:n+t,b:l+t});return a}(e,t),n=[];for(let l=0;l<s.length;){let a=s[l];if("same"===a.kind){n.push({kind:"same",left:{no:a.a+1,text:e[a.a]},right:{no:a.b+1,text:t[a.b]}}),l+=1;continue}let i=[],r=[];for(;l<s.length&&"same"!==s[l].kind;){let e=s[l];"del"===e.kind?i.push(e.a):r.push(e.b),l+=1}let c=Math.max(i.length,r.length);for(let s=0;s<c;s+=1){let l=i[s],a=r[s];n.push({kind:void 0!==l&&void 0!==a?"change":void 0!==l?"del":"add",...void 0!==l?{left:{no:l+1,text:e[l]}}:{},...void 0!==a?{right:{no:a+1,text:t[a]}}:{}})}}return n}(c(Q.before),c(Q.after)),[Q]),V=A&&L.get(A.path)||new Set,Z=(0,l.useMemo)(()=>(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(n)return e.map((e,t)=>({type:"row",row:e,index:t}));let l=[];for(let n=0;n<e.length;){if("same"!==e[n].kind){l.push({type:"row",row:e[n],index:n}),n+=1;continue}let a=n;for(;a<e.length&&"same"===e[a].kind;)a+=1;let i=0===n?0:t,r=a===e.length?0:t,c=a-n-i-r;if(c>1&&!s.has(n+i)){for(let t=n;t<n+i;t+=1)l.push({type:"row",row:e[t],index:t});l.push({type:"gap",from:n+i,count:c});for(let t=a-r;t<a;t+=1)l.push({type:"row",row:e[t],index:t})}else for(let t=n;t<a;t+=1)l.push({type:"row",row:e[t],index:t});n=a}return l})(P,3,V,F),[P,V,F]),_=(0,l.useMemo)(()=>P.flatMap((e,t)=>"same"!==e.kind&&(0===t||"same"===P[t-1].kind)?[t]:[]),[P]);(0,l.useEffect)(()=>{D(-1),O.current&&(O.current.scrollTop=0)},[S]);let K=(0,l.useCallback)(e=>{var t;if(0===_.length)return;let s=T<0?1===e?0:_.length-1:Math.min(_.length-1,Math.max(0,T+e));D(s);let n=null==(t=O.current)?void 0:t.querySelector('[data-row="'.concat(_[s],'"]'));null==n||n.scrollIntoView({block:"center"})},[T,_]),$=(0,l.useCallback)(e=>I(t=>Math.min(Math.max(0,t+e),Math.max(0,W.length-1))),[W.length]);(0,l.useEffect)(()=>{let e=e=>{if(!e.ctrlKey&&!e.metaKey&&!e.altKey){if("Escape"===e.key)y();else if("n"===e.key)K(1);else if("p"===e.key)K(-1);else if("]"===e.key)$(1);else{if("["!==e.key)return;$(-1)}e.preventDefault()}};window.addEventListener("keydown",e);let t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",e),document.body.style.overflow=t}},[K,$,y]);let z=W.reduce((e,t)=>({added:e.added+Math.max(0,t.added),removed:e.removed+Math.max(0,t.removed)}),{added:0,removed:0});return(0,n.jsxs)("div",{ref:B,className:"diff-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"diff-title",children:[(0,n.jsxs)("div",{className:"diff-head",children:[(0,n.jsx)("h2",{id:"diff-title",children:k("diff.title",{title:j})}),(null==v?void 0:v.ok)&&(0,n.jsxs)("span",{className:"muted small",children:[v.branch?"".concat(v.branch," \xb7 "):"",null==(t=v.base)?void 0:t.slice(0,8)," → ",null==(s=v.commit)?void 0:s.slice(0,8)," \xb7 ",k("diff.summary",{n:W.length,a:z.added,r:z.removed})]}),(0,n.jsx)("span",{className:"grow"}),(0,n.jsx)("span",{className:"muted small",children:k("diff.keys")}),(0,n.jsx)("button",{ref:G,type:"button",onClick:y,children:k("diff.close")})]}),N&&(0,n.jsx)("div",{className:"err",style:{padding:12},children:N}),!v&&!N&&(0,n.jsx)("div",{className:"muted",style:{padding:12},children:k("diff.loading")}),v&&!v.ok&&(0,n.jsx)("div",{className:"notice caution",style:{margin:12},children:v.problem}),(null==v?void 0:v.ok)&&0===W.length&&(0,n.jsx)("div",{className:"notice",style:{margin:12},children:k("diff.nothing")}),(null==v?void 0:v.ok)&&W.length>0&&(0,n.jsxs)("div",{className:"diff-body",children:[(0,n.jsx)("nav",{className:"diff-files","aria-label":k("diff.files"),children:W.map((e,t)=>{let s=e.path.lastIndexOf("/");return(0,n.jsxs)("button",{type:"button",className:"diff-file".concat(t===S?" on":""),onClick:()=>I(t),title:e.oldPath?"".concat(e.oldPath," → ").concat(e.path):e.path,children:[(0,n.jsx)("span",{className:"diff-status s-".concat(e.status),children:e.status}),(0,n.jsxs)("span",{className:"diff-path",children:[s>=0&&(0,n.jsx)("span",{className:"muted",children:e.path.slice(0,s+1)}),(0,n.jsx)("strong",{children:e.path.slice(s+1)})]}),(0,n.jsx)("span",{className:"diff-counts",children:e.added<0?k("diff.binaryShort"):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("span",{className:"plus",children:["+",e.added]})," ",(0,n.jsxs)("span",{className:"minus",children:["−",e.removed]})]})})]},e.path)})}),(0,n.jsxs)("div",{className:"diff-main",children:[A&&(0,n.jsxs)("div",{className:"diff-toolbar",children:[(0,n.jsx)("strong",{className:"diff-name",children:A.oldPath?"".concat(A.oldPath," → ").concat(A.path):A.path}),(0,n.jsx)("span",{className:"muted small",children:"A"===A.status?k("diff.added"):"D"===A.status?k("diff.deleted"):"R"===A.status?k("diff.renamed"):""}),(0,n.jsx)("span",{className:"grow"}),(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>K(-1),disabled:0===_.length,children:k("diff.prevChange")}),(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>K(1),disabled:0===_.length,children:k("diff.nextChange")}),(0,n.jsx)("span",{className:"muted small",children:_.length>0?k("diff.changeN",{i:T<0?"–":T+1,n:_.length}):""}),(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>$(-1),disabled:0===S,children:k("diff.prevFile")}),(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>$(1),disabled:S>=W.length-1,children:k("diff.nextFile")}),(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"checkbox",checked:F,onChange:e=>R(e.target.checked)})," ",k("diff.whole")]}),(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"checkbox",checked:E,onChange:e=>M(e.target.checked)})," ",k("diff.wrap")]})]}),(0,n.jsxs)("div",{className:"diff-scroll",ref:O,children:[void 0===Q&&(0,n.jsx)("div",{className:"muted",style:{padding:12},children:k("diff.loading")}),"string"==typeof Q&&(0,n.jsx)("div",{className:"err",style:{padding:12},children:Q}),Q&&"string"!=typeof Q&&Q.binary&&(0,n.jsx)("div",{className:"notice",style:{margin:12},children:k("diff.binary")}),Q&&"string"!=typeof Q&&Q.tooLarge&&(0,n.jsx)("div",{className:"notice",style:{margin:12},children:k("diff.tooLarge")}),Q&&"string"!=typeof Q&&!Q.binary&&!Q.tooLarge&&(0,n.jsxs)(n.Fragment,{children:[(null!=(d=Q.before)?d:"").includes("\r\n")!==(null!=(h=Q.after)?h:"").includes("\r\n")&&null!==Q.before&&null!==Q.after&&(0,n.jsx)("div",{className:"notice small",style:{margin:8},children:k("diff.eol",{from:(null!=(m=Q.before)?m:"").includes("\r\n")?"CRLF":"LF",to:(null!=(f=Q.after)?f:"").includes("\r\n")?"CRLF":"LF"})}),P.length>0&&0===_.length&&(0,n.jsx)("div",{className:"notice small",style:{margin:8},children:k("diff.sameText")}),(0,n.jsxs)("table",{className:"diff-table".concat(E?"":" nowrap"),children:[(0,n.jsxs)("colgroup",{children:[(0,n.jsx)("col",{className:"num"}),(0,n.jsx)("col",{}),(0,n.jsx)("col",{className:"num"}),(0,n.jsx)("col",{})]}),(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{colSpan:2,children:k("diff.before")}),(0,n.jsx)("th",{colSpan:2,children:k("diff.after")})]})}),(0,n.jsx)("tbody",{children:Z.map(e=>"gap"===e.type?(0,n.jsx)("tr",{className:"diff-gap",children:(0,n.jsx)("td",{colSpan:4,children:(0,n.jsx)("button",{type:"button",className:"linkish small",onClick:()=>{var t;return t=e.from,void(A&&H(e=>{var s;return new Map(e).set(A.path,new Set([...null!=(s=e.get(A.path))?s:[],t]))}))},children:k("diff.gap",{n:e.count})})})},"g".concat(e.from)):(0,n.jsx)(u,{row:e.row,index:e.index,current:T>=0&&_[T]===e.index},e.index))})]})]})]})]})]})]})}function u(e){var t,s,a,i;let{row:r,index:c,current:o}=e,d="change"===r.kind?function(e,t){let s=0;for(;s<e.length&&s<t.length&&e[s]===t[s];)s+=1;let n=e.length,l=t.length;for(;n>s&&l>s&&e[n-1]===t[l-1];)n-=1,l-=1;return{start:s,leftEnd:n,rightEnd:l}}(r.left.text,r.right.text):null,u=e=>{let t=r[e];if(!t)return null;if(!d)return t.text;let s="left"===e?d.leftEnd:d.rightEnd;return(0,n.jsxs)(l.Fragment,{children:[t.text.slice(0,d.start),(0,n.jsx)("mark",{children:t.text.slice(d.start,s)}),t.text.slice(s)]})};return(0,n.jsxs)("tr",{className:"diff-row ".concat(r.kind).concat(o?" current":""),"data-row":c,children:[(0,n.jsx)("td",{className:"num",children:null!=(a=null==(t=r.left)?void 0:t.no)?a:""}),(0,n.jsx)("td",{className:"code l".concat(r.left?"":" empty"),children:u("left")}),(0,n.jsx)("td",{className:"num",children:null!=(i=null==(s=r.right)?void 0:s.no)?i:""}),(0,n.jsx)("td",{className:"code r".concat(r.right?"":" empty"),children:u("right")})]})}}}]);
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[204],{287:(e,t,s)=>{s.d(t,{y:()=>h,f:()=>u});var n=s(3365),l=s(1521),a=s(5549),i=s(867),r=s(7527),c=s(1035),o=s(1701),d=s(4811);function u(e){var t,s,u;let{target:m,intro:f,initial:p="one",focusFirst:x=!1,checkContract:g=!0,onClose:j}=e,{t:y}=(0,i.kj)(),k=(0,d.p)(),[v,b]=(0,l.useState)(null),[N,w]=(0,l.useState)(p),[S,C]=(0,l.useState)(!1),[I,F]=(0,l.useState)(""),[q,R]=(0,l.useState)(!1),E=(0,l.useRef)(null),L=(0,l.useRef)(null),H=(0,l.useRef)(null),T=(0,l.useId)(),M=()=>a.FH.session(m.sessionId).then(b).catch(e=>F(e.message));(0,l.useEffect)(()=>{M(),g&&a.FH.contractCheck(m.sessionId,m.taskId).then(e=>R(e.conflicts.length>0)).catch(()=>void 0)},[m.sessionId,m.taskId]),(0,r.z)(M,3e3,!!(null==v?void 0:v.running));let O=null!==v;if((0,l.useEffect)(()=>{var e,t,s;if(!O||(null==(t=E.current)||null==(e=t.scrollIntoView)||e.call(t,{block:"nearest"}),!x))return;let n=L.current;n&&!n.disabled?n.focus():null==(s=H.current)||s.focus()},[O,x]),!v)return(0,n.jsx)("div",{className:"notice calm",style:{marginTop:8},children:(0,n.jsx)("span",{className:"small",children:I||y("runq.loading")})});let D=function(e,t){let s=e.tasks.findIndex(e=>e.id===t),n=s>=0?e.tasks[s]:void 0,l=s>=0?e.tasks.slice(0,s):[],a=s>=0?e.tasks.slice(s+1):[],i="continue"!==e.onFailure,r=-1;return a.forEach((e,t)=>{"queued"===e.status&&(r=t)}),{task:n,followingQueued:a.filter(e=>"queued"===e.status),laterRan:a.filter(e=>"queued"!==e.status),earlierRan:l.filter(e=>"queued"!==e.status),chain:i,chainGap:i?l.find(e=>"done"!==e.status):void 0,chainGapLater:i&&r>0?a.slice(0,r).find(e=>"queued"!==e.status&&"done"!==e.status):void 0}}(v,m.taskId),B=(null==(t=D.task)?void 0:t.status)==="queued",W="following"===N?[D.task,...D.followingQueued]:D.task?[D.task]:[],G=v.running?y("runq.sessionRunning"):!1===v.active?y("runq.sessionInactive"):"",A=async e=>{if("unattended"!==e||k||await (0,c.Z)(y("batch.unattendedConfirm",{n:1}))){C(!0),F(""),R(!1);try{var t,s;let n=await a.FH.suggestedRunName([m.sessionId]).then(e=>e.name).catch(()=>void 0),l=await (0,o.L)({sessionIds:[m.sessionId],mode:e,start:t=>a.FH.startBatch([m.sessionId],e,"stop",void 0,void 0,n,W.map(e=>e.id),t)});if(!l.started&&!l.reply)return;let i=null!=(t=l.reply)?t:{started:!0};if(!l.started){F(y("batch.notStarted",{reason:null!=(s=i.reason)?s:""}));let e=await a.FH.contractCheck(m.sessionId,m.taskId).catch(()=>({conflicts:[]}));R(e.conflicts.length>0);return}F(y("runq.started",{n:W.length})),j(!0)}catch(e){F(e.message)}finally{C(!1)}}},P=y("runq.title",{title:m.title});return(0,n.jsxs)("div",{ref:E,className:"notice calm",role:"group","aria-label":P,style:{marginTop:8},children:[f&&(0,n.jsx)("p",{className:"small",style:{marginTop:0},children:f}),(0,n.jsx)("strong",{children:P}),B?(0,n.jsxs)(n.Fragment,{children:[D.followingQueued.length>0&&(0,n.jsxs)("div",{className:"small",role:"radiogroup","aria-label":P,style:{marginTop:6},children:[(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"radio",name:"runq-".concat(T),checked:"one"===N,onChange:()=>w("one"),disabled:S}),y("runq.onlyThis")]}),(0,n.jsxs)("label",{className:"option-inline",title:y("runq.followingWhy"),children:[(0,n.jsx)("input",{type:"radio",name:"runq-".concat(T),checked:"following"===N,onChange:()=>w("following"),disabled:S}),y("runq.following",{n:D.followingQueued.length,session:v.name})]})]}),(0,n.jsx)("div",{className:"small",style:{marginTop:6},children:y("runq.willRun")}),(0,n.jsx)("ol",{className:"small",style:{margin:"4px 0",paddingLeft:22},children:W.map(e=>(0,n.jsx)("li",{children:e.title},e.id))}),(0,n.jsxs)("ul",{className:"small",style:{margin:"4px 0",paddingLeft:18},children:[D.chain&&W.length>1&&(0,n.jsx)("li",{children:y("runq.chainStops")}),D.earlierRan.length>0&&(0,n.jsx)("li",{children:y("runq.untouched",{n:D.earlierRan.length})}),D.laterRan.length>0&&(0,n.jsx)("li",{children:y("runq.laterRan",{list:D.laterRan.map(e=>'"'.concat(e.title,'"')).join(", ")})}),"one"===N&&D.followingQueued.length>0&&(0,n.jsx)("li",{children:y("runq.restWait",{n:D.followingQueued.length})})]}),D.chainGap&&(0,n.jsx)("div",{className:"notice caution small",style:{marginTop:6},children:y("runq.chainGap",{before:D.chainGap.title,status:y("status.".concat(D.chainGap.status))})}),"following"===N&&D.chainGapLater&&(0,n.jsx)("div",{className:"notice caution small",style:{marginTop:6},children:y("runq.chainGapLater",{between:D.chainGapLater.title,status:y("status.".concat(D.chainGapLater.status))})}),G&&(0,n.jsx)("p",{className:"small",children:G})]}):(0,n.jsx)("p",{className:"small",children:y("runq.notQueued",{status:y("status.".concat(null!=(u=null==(s=D.task)?void 0:s.status)?u:"queued"))})}),(0,n.jsxs)("div",{className:"row",style:{marginTop:8},children:[B&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{ref:L,className:"primary",disabled:S||!!G,onClick:()=>void A("confirm"),title:y("runq.goWhy"),children:y("runq.go")}),(0,n.jsx)("button",{disabled:S||!!G,onClick:()=>void A("unattended"),title:y("runq.unattendedWhy"),children:y("runq.unattended")})]}),(0,n.jsx)("button",{ref:H,className:"quiet",disabled:S,onClick:()=>j(!1),children:f?y("runq.later"):y("dialog.cancel")}),I&&(0,n.jsx)("span",{className:"small",role:"status",children:I})]}),q&&(0,n.jsx)(h,{target:m,onApplied:(e,t)=>{M(),0===e&&(R(!1),F(t))}})]})}function h(e){let{target:t,onApplied:s}=e,{t:r}=(0,i.kj)(),[c,o]=(0,l.useState)(null),[d,u]=(0,l.useState)([]),[h,m]=(0,l.useState)(!1),[f,p]=(0,l.useState)(""),[x,g]=(0,l.useState)(null),[j,y]=(0,l.useState)(null),k=(0,l.useId)();(0,l.useEffect)(()=>{o(null),Promise.all([a.FH.contractCheck(t.sessionId,t.taskId),a.FH.session(t.sessionId)]).then(e=>{var s;let[n,l]=e,a=l.tasks.find(e=>e.id===t.taskId);o(n.conflicts),u(n.conflicts.map(e=>e.fixes.length>0?0:-1)),g(null!=(s=null==a?void 0:a.status)?s:null),y(a?{readOnly:a.readOnly,scope:a.scope,checks:a.checks}:null)}).catch(e=>p(e.message))},[t.sessionId,t.taskId]);let v=async()=>{if(c){m(!0),p("");try{let e=await a.FH.applyContractFix(t.sessionId,t.taskId,d,c.map(e=>e.text)),n=r("cfix.applied",{list:(j?function(e,t,s){var n,l,a,i;let r=[];!!t.readOnly!=!!s.readOnly&&r.push(e(s.readOnly?"cfix.chReadOnlyOn":"cfix.chReadOnlyOff"));let c=(null!=(n=t.scope)?n:[]).join(", "),o=(null!=(l=s.scope)?l:[]).join(", ");c!==o&&r.push(o?e("cfix.chScope",{paths:o}):e("cfix.chScopeRemoved"));let d=new Set((null!=(a=s.checks)?a:[]).map(e=>e.name));for(let s of null!=(i=t.checks)?i:[])d.has(s.name)||r.push(e("cfix.chDropped",{check:s.name}));return r.join("; ")}(r,j,e.task):e.applied.join("; "))||r("cfix.chNothing")});p(n+(e.remaining.length>0?" ".concat(r("cfix.remaining",{n:e.remaining.length})):"")),o(e.remaining),u(e.remaining.map(e=>e.fixes.length>0?0:-1)),g("queued"),y({readOnly:e.task.readOnly,scope:e.task.scope,checks:e.task.checks}),s(e.remaining.length,n)}catch(e){p(e.message)}finally{m(!1)}}},b=r("cfix.title",{title:t.title});return(0,n.jsxs)("div",{className:"notice caution",role:"group","aria-label":b,style:{marginTop:8},children:[(0,n.jsx)("strong",{children:b}),(0,n.jsx)("p",{className:"why",children:r("cfix.why")}),null===c?(0,n.jsx)("p",{className:"small",children:f||r("cfix.loading")}):0===c.length?(0,n.jsx)("p",{className:"small",role:"status",children:f||r("cfix.none")}):(0,n.jsxs)(n.Fragment,{children:[c.map((e,t)=>(0,n.jsxs)("fieldset",{className:"small",style:{margin:"8px 0",border:0,padding:0},children:[(0,n.jsx)("legend",{style:{fontWeight:600},children:e.text}),e.fixes.map((e,s)=>(0,n.jsxs)("label",{className:"option-inline",style:{display:"block"},children:[(0,n.jsx)("input",{type:"radio",name:"cfix-".concat(k,"-").concat(t),checked:d[t]===s,onChange:()=>u(e=>e.map((e,n)=>n===t?s:e)),disabled:h}),"add-to-scope"===e.kind?r("cfix.addToScope",{path:e.path}):"not-read-only"===e.kind?e.scope.length>0?r("cfix.notReadOnly",{paths:e.scope.join(", ")}):r("cfix.notReadOnlyAll"):"drop-scope"===e.kind?r("cfix.dropScope"):r("cfix.dropCheck",{check:e.check}),0===s&&(0,n.jsxs)("span",{className:"muted",children:[" ",r("cfix.minimal")]})]},s)),(0,n.jsxs)("label",{className:"option-inline",style:{display:"block"},children:[(0,n.jsx)("input",{type:"radio",name:"cfix-".concat(k,"-").concat(t),checked:-1===d[t],onChange:()=>u(e=>e.map((e,s)=>s===t?-1:e)),disabled:h}),e.fixes.length>0?r("cfix.leave"):r("cfix.noFix")]})]},t)),(0,n.jsxs)("div",{className:"row",children:[(0,n.jsx)("button",{className:"primary",disabled:h||d.every(e=>-1===e),onClick:()=>void v(),children:"queued"===x?r("cfix.applyQueued"):r("cfix.apply")}),f&&(0,n.jsx)("span",{className:"small",role:"status",children:f})]})]})]})}},1366:(e,t,s)=>{s.d(t,{w:()=>r,y:()=>i});var n=s(3365),l=s(1521),a=s(867);function i(e){let{readOnly:t,scope:s,onReadOnly:i,onScope:r}=e,{t:c}=(0,a.kj)(),o=(0,l.useId)();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"option",style:{marginTop:10},children:[(0,n.jsxs)("label",{children:[(0,n.jsx)("input",{type:"checkbox",checked:t,onChange:e=>i(e.target.checked)}),(0,n.jsx)("span",{children:c("task.readOnlyEdit")})]}),(0,n.jsx)("p",{className:"why",children:c("task.readOnlyEditWhy")})]}),(0,n.jsx)("label",{htmlFor:"".concat(o,"-scope"),children:c("task.scopeEdit")}),(0,n.jsx)("textarea",{id:"".concat(o,"-scope"),value:s,onChange:e=>r(e.target.value),placeholder:"tests/e2e/\nsrc/**/*.ts",style:{minHeight:60},disabled:t}),(0,n.jsx)("p",{className:"why",children:c("task.scopeEditWhy")})]})}function r(e){return e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean)}},1910:(e,t,s)=>{s.d(t,{H:()=>c,u:()=>r});var n=s(3365),l=s(1521),a=s(867),i=s(5549);function r(e){let{label:t,save:s}=e,{t:i}=(0,a.kj)(),[r,c]=(0,l.useState)(!1),[o,d]=(0,l.useState)(""),[u,h]=(0,l.useState)(!1),m=async()=>{c(!0),d("");try{var e;let t=await s();h(!1),d(t.revealed?i("save.done",{path:t.path}):i("save.savedOnly",{path:t.path,note:null!=(e=t.note)?e:""}))}catch(e){h(!0),d(i("save.failed",{problem:e.message}))}finally{c(!1)}};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",className:"linkish",disabled:r,title:i("save.why"),onClick:()=>void m(),children:r?i("save.saving"):t}),o&&(0,n.jsx)("span",{className:u?"err small":"muted small",children:o})]})}function c(e){let{sessionId:t,taskId:s,attempt:r}=e,{t:c}=(0,a.kj)(),[o,d]=(0,l.useState)(!1),[u,h]=(0,l.useState)(""),[m,f]=(0,l.useState)(!1),p=async()=>{d(!0),h("");try{let e=await i.FH.downloadBundle([{sessionId:t,taskId:s,attempt:r}]);f(!1),h(c("reg.bundleSaved",{name:e}))}catch(e){f(!0),h(c("save.failed",{problem:e.message}))}finally{d(!1)}};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",className:"linkish",disabled:o,title:c("save.attemptRecordWhy"),onClick:()=>void p(),children:o?c("save.saving"):c("save.attemptRecord")}),u&&(0,n.jsx)("span",{className:m?"err small":"muted small",children:u})]})}},2876:(e,t,s)=>{s.d(t,{P:()=>d});var n=s(3365),l=s(1521),a=s(5549),i=s(867);function r(e,t){let[s,n]=(0,l.useState)(null),a=(0,l.useRef)(!0),[i,r]=(0,l.useState)(!0),c=(0,l.useCallback)(e=>n(e),[]);return(0,l.useLayoutEffect)(()=>{if(!s)return;let e=()=>{let e=s.scrollHeight-s.scrollTop-s.clientHeight<=24;a.current=e,r(e)};return s.addEventListener("scroll",e,{passive:!0}),()=>s.removeEventListener("scroll",e)},[s]),(0,l.useLayoutEffect)(()=>{s&&e&&a.current&&(s.scrollTop=s.scrollHeight)},[s,e,t]),{ref:c,following:i,follow:(0,l.useCallback)(()=>{a.current=!0,r(!0),s&&(s.scrollTop=s.scrollHeight)},[s])}}var c=s(5132);function o(e){let{text:t,follow:s}=e,{ref:l}=r(s,t);return(0,n.jsx)("pre",{ref:l,className:"story-out".concat(s?" terminal":""),children:t})}function d(e){let{sessionId:t,taskId:s,runId:d,live:h}=e,{t:m}=(0,i.kj)(),[f,p]=(0,l.useState)(null),[x,g]=(0,l.useState)(""),[j,y]=(0,l.useState)(!0),[k,v]=(0,l.useState)(!0),[b,N]=(0,l.useState)(new Set),[w,S]=(0,l.useState)(new Set),[C,I]=(0,l.useState)(new Set),F=!!(null==f?void 0:f.live),q=(0,l.useRef)(0);q.current+=1;let R=r(F,q.current),E=(0,l.useRef)(null),L=(0,l.useRef)(!1);if((0,l.useEffect)(()=>{if(!f)return;let e=[],t=(s,n)=>s.forEach((s,l)=>{let a="".concat(n).concat(l);"review"===s.kind?t(s.entries,"".concat(a,"-")):"step"!==s.kind||s.outcome||e.push(a)});t(f.entries,"e"),e.some(e=>!w.has(e))&&S(t=>new Set([...t,...e])),f.live&&!L.current&&E.current&&(L.current=!0,E.current.scrollIntoView({block:"nearest",behavior:"smooth"}))},[f,w]),(0,l.useEffect)(()=>{let e,n=!0,l=async()=>{try{let i=await a.FH.taskStory(t,s,d);if(!n)return;p(i),g(""),(i.live||h)&&(e=setTimeout(l,2e3))}catch(t){if(!n)return;g(t.message),h&&(e=setTimeout(l,2e3))}};return l(),()=>{n=!1,e&&clearTimeout(e)}},[t,s,d,h]),x&&!f)return(0,n.jsx)("div",{className:"err small",children:x});if(!f)return(0,n.jsx)("div",{className:"muted small",children:m("story.loading")});let H=e=>b.has(e)||w.has(e)&&!C.has(e),T=e=>{let t=H(e);N(s=>{let n=new Set(s);return t?n.delete(e):n.add(e),n}),I(s=>{let n=new Set(s);return t?n.add(e):n.delete(e),n})},M=(e,t)=>{if(!("review"===e.kind?j||k:"step"===e.kind?k:j))return null;if("review"===e.kind)return(0,n.jsxs)("li",{className:"story-review",children:[(0,n.jsxs)("div",{className:"story-head",children:[(0,n.jsx)(u,{at:e.at}),(0,n.jsx)("span",{className:"chip",children:m("story.review",{n:e.round})})]}),(0,n.jsx)("ol",{className:"story",children:e.entries.map((e,s)=>M(e,"".concat(t,"-").concat(s)))})]},t);if("step"===e.kind){let s=H(t),l=!e.outcome&&f.live;return(0,n.jsxs)("li",{className:"story-step".concat(e.failed?" failed":""),children:[(0,n.jsxs)("div",{className:"story-head",children:[(0,n.jsx)(u,{at:e.at}),(0,n.jsx)("span",{className:"chip",children:m("story.step",{it:e.iteration,id:e.id})}),e.outcome&&(0,n.jsxs)("span",{className:"badge ".concat(e.failed?"failed":"done"),children:[e.outcome,void 0!==e.exitCode?" \xb7 exit ".concat(e.exitCode):"",void 0!==e.durationMs?" \xb7 ".concat((0,a.c5)(e.durationMs)):""]}),!e.outcome&&(0,n.jsx)("span",{className:"badge running",children:m("story.running")}),e.failed&&(0,n.jsx)("span",{className:"badge failed",children:m("story.failedHere")})]}),(0,n.jsx)("pre",{className:"story-cmd",children:e.command}),e.output&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",className:"linkish small",onClick:()=>T(t),children:s?m("story.hideOutput"):m("story.showOutput",{n:e.output.length})}),s&&(0,n.jsx)(o,{text:e.output,follow:l})]})]},t)}let s=b.has(t),l="sent"===e.kind?m("story.bot"):m("story.chat"),i="reply"===e.kind&&("blocked"===e.status||"failed"===e.status);return(0,n.jsxs)("li",{className:"story-msg ".concat(e.kind).concat(i?" failed":""),children:[(0,n.jsxs)("div",{className:"story-head",children:[(0,n.jsx)(u,{at:e.at}),(0,n.jsx)("strong",{children:l}),(0,n.jsx)("span",{className:"muted small",children:e.label}),"reply"===e.kind&&e.status&&(0,n.jsx)("span",{className:"badge ".concat(i?"failed":"done"===e.status?"done":""),children:e.status})]}),"reply"===e.kind&&e.notes&&(0,n.jsx)("p",{className:"story-notes",children:e.notes}),(0,n.jsx)("button",{type:"button",className:"linkish small",onClick:()=>T(t),children:s?m("story.hideText"):m("story.showText",{n:e.text.length})}),s&&(0,n.jsx)("pre",{className:"story-out",children:e.text})]},t)},O=f.close,D=O&&"done"!==O.status;return(0,n.jsxs)("div",{className:"story-box",ref:E,children:[(0,n.jsxs)("div",{className:"row small",style:{marginBottom:6},children:[(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"checkbox",checked:j,onChange:e=>y(e.target.checked)})," ",m("story.showChat")]}),(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"checkbox",checked:k,onChange:e=>v(e.target.checked)})," ",m("story.showCommands")]}),f.live&&(0,n.jsxs)("span",{className:"live",children:[(0,n.jsx)("span",{className:"dot","aria-hidden":"true"})," ",m("story.live")]}),f.live&&!R.following&&(0,n.jsx)("button",{type:"button",className:"quiet small",onClick:R.follow,title:m("story.followWhy"),children:m("story.follow")}),x&&(0,n.jsx)("span",{className:"err",children:x})]}),(0,n.jsxs)("div",{className:"story-fixed",children:[(0,n.jsx)("strong",{children:m("story.prompt")}),(0,n.jsx)("pre",{className:"story-out always",children:f.prompt})]}),(0,n.jsx)("div",{ref:R.ref,className:"story-scroll".concat(f.live?" live":""),children:(0,n.jsx)("ol",{className:"story",children:f.entries.map((e,t)=>M(e,"e".concat(t)))})}),O?(0,n.jsxs)("div",{className:"story-fixed close".concat(D?" failed":""),children:[(0,n.jsx)("strong",{children:D?m("story.endedBadly",{status:O.status}):m("story.ended")}),O.reason&&(0,n.jsx)("p",{className:"err small",children:O.reason}),O.summary&&(0,n.jsx)(c.s,{text:O.summary,className:"what"}),O.checks&&O.checks.length>0&&(0,n.jsx)("ul",{className:"small",style:{margin:"6px 0 0",paddingLeft:18},children:O.checks.map((e,t)=>(0,n.jsxs)("li",{className:e.passed?"":"err",children:[e.passed?"✓":"✗"," ",e.name,!e.passed&&e.detail?" — ".concat(e.detail):""]},t))})]}):(0,n.jsx)("div",{className:"story-fixed muted small",children:m("story.notEnded")})]})}function u(e){let{at:t}=e,s=(0,i.W3)(),{locale:l}=(0,i.kj)();if(!t)return null;let a=new Date(t),r="bg"===l?"bg-BG":void 0,c=a.toLocaleTimeString(r,{hour12:!1}),o=new Date().toDateString()===a.toDateString();return(0,n.jsx)("time",{className:"story-when",dateTime:t,title:s(t),children:o?c:"".concat(a.toLocaleDateString(r)," ").concat(c)})}},3041:(e,t,s)=>{s.d(t,{e:()=>r});var n=s(1521),l=s(5549),a=s(1035),i=s(867);function r(e){let{t}=(0,i.kj)(),[s,r]=(0,n.useState)(""),[c,o]=(0,n.useState)({taskId:"",text:""}),d=(e,t)=>o({taskId:e,text:t}),u=(0,n.useCallback)(async s=>{r("restore"),d(s.taskId,"");try{var n,i,c,o,u,h,m,f,p,x,g,j,y,k;let r=await l.FH.restorePreview(s.sessionId,s.taskId);if(!r.ok)return void d(s.taskId,t("restore.cannot",{problem:null!=(c=r.problem)?c:""}));let v={repo:r.repoDir,title:s.title,branch:null!=(o=r.branchName)?o:"",commit:(null!=(u=r.baseCommit)?u:"").slice(0,8)},b=r.leftBehind.length>0?t("restore.confirmLosing",{...v,n:r.leftBehind.length,kept:null!=(h=r.keptOn)?h:"",list:r.leftBehind.slice(0,10).join("\n")}):t("restore.confirm",v);if(!await (0,a.Z)(b))return;let N=await l.FH.restore(s.sessionId,s.taskId);if(!N.ok)return void d(s.taskId,t("restore.failed",{problem:null!=(m=N.problem)?m:""}));d(s.taskId,(null!=(f=null==(n=N.leftBehind)?void 0:n.length)?f:0)>0?t("restore.done",{branch:null!=(p=N.branch)?p:"",commit:(null!=(x=N.commit)?x:"").slice(0,8),n:null!=(g=null==(i=N.leftBehind)?void 0:i.length)?g:0,kept:null!=(j=N.keptOn)?j:""}):t("restore.doneNothing",{branch:null!=(y=N.branch)?y:"",commit:(null!=(k=N.commit)?k:"").slice(0,8)})),e()}catch(e){d(s.taskId,e.message)}finally{r("")}},[t,e]),h=(0,n.useCallback)(async s=>{r("restart"),d(s.taskId,"");try{var n,i,c;let r=await l.FH.restartPlan(s.sessionId,s.taskId);if(!r.ok)return void d(s.taskId,t("restart.cannot",{problem:null!=(n=r.problem)?n:""}));let o=r.restores.filter(e=>!e.ok);if(o.length>0)return void d(s.taskId,t("restart.cannot",{problem:o.map(e=>{var t;return"".concat(e.repoDir,": ").concat(null!=(t=e.problem)?t:"")}).join(" | ")}));let u=r.restores.map(e=>{var s,n,l,a,i;return[t("restart.repoLine",{repo:e.repoDir,commit:(null!=(s=e.baseCommit)?s:"").slice(0,8),branch:null!=(n=e.branchName)?n:"",n:e.leftBehind.length,kept:null!=(l=e.keptOn)?l:""}),...e.leftBehind.length>0?[t("restart.commitsHead",{kept:null!=(a=e.keptOn)?a:""})]:[],...e.leftBehind.slice(0,15).map(e=>" ".concat(e)),...e.leftBehind.length>15?[t("restart.commitsMore",{n:e.leftBehind.length-15})]:[],...(null!=(i=e.laterSessions)?i:[]).flatMap(e=>[t("restart.laterSession",{session:e.sessionName,n:e.commits.length,branch:e.branch}),...e.commits.slice(0,15).map(e=>" ".concat(e)),...e.commits.length>15?[t("restart.commitsMore",{n:e.commits.length-15})]:[]])].join("\n")}).join("\n"),h=r.tasks.map(e=>" ".concat(e.sessionName," / ").concat(e.title).concat(e.alreadyQueued?t("restart.alreadyQueued"):t("restart.taskRedo",{status:t("status.".concat(e.status))}))).join("\n"),m="unattended"===r.mode&&!!r.unattendedRefused,f=t("restart.confirm",{title:r.from.title,tasks:r.tasks.length,sessions:r.sessions.length,list:h,repos:u||t("restart.noRepo"),mode:t("unattended"!==r.mode||m?"run.confirm":"run.unattended")})+(m?t("restart.stepByStep",{reason:null!=(i=r.unattendedRefused)?i:""}):"");if(!await (0,a.Z)(f))return;let p=await l.FH.restartFrom(s.sessionId,s.taskId,m?{mode:"confirm"}:{});if(!p.started){d(s.taskId,t("restart.failed",{problem:null!=(c=p.reason)?c:""})),e();return}d(s.taskId,t("restart.started",{requeued:p.requeued,repos:p.restored.length})),e()}catch(e){d(s.taskId,e.message)}finally{r("")}},[t,e]);return{busy:s,message:c.text,messageTask:c.taskId,clearMessage:()=>d("",""),restore:u,restartFrom:h}}},3374:(e,t,s)=>{s.d(t,{c:()=>l});var n=s(1521);function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,[s,l]=(0,n.useState)(()=>Date.now());return(0,n.useEffect)(()=>{if(!e)return;l(Date.now());let s=window.setInterval(()=>l(Date.now()),t);return()=>window.clearInterval(s)},[e,t]),s}},3523:(e,t,s)=>{function n(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now();if(!e)return;let n=Date.parse(e);if(Number.isNaN(n))return;let l=t?Date.parse(t):s;return Number.isNaN(l)?void 0:Math.max(0,l-n)}function l(e){return!!e.startedAt&&!e.finishedAt&&"queued"!==e.status}function a(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now(),n=t.some(e=>l(e)),a=t.map(e=>e.finishedAt?Date.parse(e.finishedAt):NaN).filter(e=>!Number.isNaN(e)),i=Date.parse(e.startedAt),r=n||0===a.length?s:Math.max(...a);return{ms:Number.isNaN(i)?0:Math.max(0,r-i),live:n,tasks:t.length}}function i(e){var t,s;let n=new Map;for(let s of e){if(!s.runGroup)continue;let e=null!=(t=n.get(s.runGroup.id))?t:{run:s.runGroup,tasks:[]};e.tasks.push(s),n.set(s.runGroup.id,e)}return null!=(s=[...n.values()].sort((e,t)=>Date.parse(t.run.startedAt)-Date.parse(e.run.startedAt))[0])?s:null}s.d(t,{DG:()=>l,d5:()=>n,eZ:()=>a,hH:()=>i})},4811:(e,t,s)=>{s.d(t,{p:()=>a});var n=s(1521),l=s(5549);function a(){let[e,t]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let e=!0;return l.FH.settings().then(s=>{var n;let l=null!=(n=s.raw.execution)?n:{};e&&t("unattended"===l.mode)}).catch(()=>void 0),()=>{e=!1}},[]),e}},5132:(e,t,s)=>{s.d(t,{s:()=>r});var n=s(3365),l=s(1521);function a(e,t){let s,l=[],a=/(`[^`\n]+`)|(\*\*[^*\n]+\*\*)|(\*[^*\n]+\*)/g,i=0,r=0;for(;null!==(s=a.exec(e));){s.index>i&&l.push(e.slice(i,s.index));let a=s[0],c="".concat(t,"-i").concat(r+=1);a.startsWith("`")?l.push((0,n.jsx)("code",{children:a.slice(1,-1)},c)):a.startsWith("**")?l.push((0,n.jsx)("strong",{children:a.slice(2,-2)},c)):l.push((0,n.jsx)("em",{children:a.slice(1,-1)},c)),i=s.index+a.length}return i<e.length&&l.push(e.slice(i)),l}function i(e){let t=/^\s*[-*•]\s+(.*)$/.exec(e);if(t)return t[1];let s=/^\s*\d+[.)]\s+(.*)$/.exec(e);return s?s[1]:null}function r(e){let{text:t,className:s}=e,r=[],c=t.replace(/\r\n/g,"\n").split("\n"),o=0,d=0;for(;o<c.length;){let e=c[o];if(e.trim().startsWith("```")){let e=[];for(o+=1;o<c.length&&!c[o].trim().startsWith("```");)e.push(c[o++]);o+=1,e.length>0&&r.push((0,n.jsx)("pre",{children:e.join("\n")},"b".concat(d+=1)));continue}if(null!==i(e)){let e=[];for(;o<c.length&&null!==i(c[o]);)e.push(i(c[o++]));r.push((0,n.jsx)("ul",{children:e.map((e,t)=>(0,n.jsx)("li",{children:a(e,"b".concat(d,"-").concat(t))},t))},"b".concat(d+=1)));continue}if(""===e.trim()){o+=1;continue}let t=[];for(;o<c.length&&""!==c[o].trim()&&null===i(c[o])&&!c[o].trim().startsWith("```");)t.push(c[o++]);let s=d+=1;r.push((0,n.jsx)("p",{children:t.map((e,t)=>(0,n.jsxs)(l.Fragment,{children:[t>0&&(0,n.jsx)("br",{}),a(e,"b".concat(s,"-").concat(t))]},t))},"b".concat(s)))}return(0,n.jsx)("div",{className:"rich ".concat(null!=s?s:""),children:r})}},6983:(e,t,s)=>{s.d(t,{J:()=>o});var n=s(3365),l=s(1521),a=s(5549),i=s(867),r=s(4969),c=s(287);function o(e){var t,s,o,d,u;let{sessionId:h,taskId:m,title:f,onClose:p}=e,{t:x}=(0,i.kj)(),g=(0,l.useId)(),[j,y]=(0,l.useState)(null),[k,v]=(0,l.useState)(""),[b,N]=(0,l.useState)(""),[w,S]=(0,l.useState)(!1),[C,I]=(0,l.useState)(!1),F=(0,l.useRef)(null),q=(0,l.useRef)(null);(0,r.V)(F,!0,q),(0,l.useEffect)(()=>{let e=!0;return a.FH.session(h).then(t=>{var s;e&&y(null!=(s=t.tasks.find(e=>e.id===m))?s:null)}).catch(t=>{e&&N(t.message)}),()=>{e=!1}},[h,m]),(0,l.useEffect)(()=>{let e=e=>{"Escape"!==e.key||e.defaultPrevented||w||document.querySelector('[role="alertdialog"]')||p(C)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[w,C,p]);let R=async()=>{if(k.trim()){S(!0),N("");try{await a.FH.continueTask(h,m,k),N(x("fup.saved",{title:f})),I(!0)}catch(e){N(e.message)}finally{S(!1)}}},E=(null!=(d=null==j?void 0:j.checkResults)?d:[]).filter(e=>!e.passed),L=(null==j||null==(t=j.review)?void 0:t.verdict)==="fail"&&null!=(u=j.review.findings)?u:[],H=null==j||null==(s=j.vcs)?void 0:s.branch,T=null==j||null==(o=j.vcs)?void 0:o.commit;return(0,n.jsx)("div",{className:"modal-backdrop",role:"presentation",onClick:()=>!w&&p(C),children:(0,n.jsxs)("div",{ref:F,className:"modal wide",role:"dialog","aria-modal":"true","aria-labelledby":"".concat(g,"-title"),onClick:e=>e.stopPropagation(),style:{overflowWrap:"anywhere"},children:[(0,n.jsx)("h2",{id:"".concat(g,"-title"),children:x("fup.title",{title:f})}),C?(0,n.jsx)(c.f,{target:{sessionId:h,taskId:m,title:f},intro:"".concat(b," ").concat(x("runq.ask")),focusFirst:!0,onClose:()=>p(!0)}):j?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"notice caution small",children:[(0,n.jsx)("strong",{children:x("fup.ended",{status:x("status.".concat(j.status))})}),j.reason&&(0,n.jsx)("p",{style:{margin:"4px 0"},children:j.reason}),E.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{style:{marginTop:6},children:x("fup.failedChecks")}),(0,n.jsx)("ul",{style:{margin:"2px 0",paddingLeft:18},children:E.slice(0,10).map(e=>(0,n.jsxs)("li",{children:[(0,n.jsx)("code",{children:e.name}),": ",e.detail]},e.name))})]}),L.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{style:{marginTop:6},children:x("fup.findings")}),(0,n.jsx)("ul",{style:{margin:"2px 0",paddingLeft:18},children:L.slice(0,10).map((e,t)=>(0,n.jsxs)("li",{children:[e.what,e.where?" (".concat(e.where,")"):""]},t))})]}),j.summary&&j.summary!==j.reason&&(0,n.jsxs)("p",{style:{margin:"6px 0 0"},children:[x("fup.summary")," ",j.summary]})]}),(0,n.jsxs)("ul",{className:"small",style:{margin:"8px 0",paddingLeft:18},children:[(0,n.jsx)("li",{children:x("fup.chat")}),(0,n.jsx)("li",{children:H?T?x("fup.branch",{branch:H,commit:T.slice(0,8)}):x("fup.branchNotCommitted",{branch:H}):x("fup.noVcs")}),(0,n.jsx)("li",{children:x("fup.kept")})]}),(0,n.jsxs)("details",{className:"small",children:[(0,n.jsx)("summary",{children:x("fup.original")}),(0,n.jsx)("pre",{className:"tall",children:j.prompt})]}),(0,n.jsx)("label",{htmlFor:"".concat(g,"-prompt"),style:{marginTop:10},children:x("fup.prompt")}),(0,n.jsx)("textarea",{id:"".concat(g,"-prompt"),ref:q,className:"prose",value:k,onChange:e=>v(e.target.value),placeholder:x("fup.placeholder"),style:{minHeight:180},disabled:w}),(0,n.jsx)("p",{className:"why",children:x("fup.startOver",{fix:x("reg.fixPrompt")})}),(0,n.jsxs)("div",{className:"row modal-actions",children:[b&&(0,n.jsx)("span",{className:"small grow err",children:b}),(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>p(!1),disabled:w,children:x("dialog.cancel")}),(0,n.jsx)("button",{type:"button",className:"primary",onClick:()=>void R(),disabled:w||!k.trim(),children:x("fup.save")})]})]}):(0,n.jsx)("p",{className:"muted small",children:b||x("fup.loading")})]})})}},8934:(e,t,s)=>{s.d(t,{C:()=>o});var n=s(3365),l=s(1521),a=s(5549),i=s(4969),r=s(867);function c(e){if(null===e||""===e)return[];let t=e.split(/\r?\n/);return""===t[t.length-1]&&t.pop(),t}function o(e){let{sessionId:t,taskId:s,runId:a,title:i,files:c}=e,{t:o}=(0,r.kj)(),[u,h]=(0,l.useState)(!1);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",className:"linkish",onClick:()=>h(!0),title:o("diff.openWhy"),children:o("diff.open",{n:c})}),u&&(0,n.jsx)(d,{sessionId:t,taskId:s,runId:a,title:i,onClose:()=>h(!1)})]})}function d(e){var t,s,o,d,h,m,f;let{sessionId:p,taskId:x,runId:g,title:j,onClose:y}=e,{t:k}=(0,r.kj)(),[v,b]=(0,l.useState)(null),[N,w]=(0,l.useState)(""),[S,C]=(0,l.useState)(0),[I,F]=(0,l.useState)(new Map),[q,R]=(0,l.useState)(!1),[E,L]=(0,l.useState)(!0),[H,T]=(0,l.useState)(new Map),[M,O]=(0,l.useState)(-1),D=(0,l.useRef)(null),B=(0,l.useRef)(null),W=(0,l.useRef)(null);(0,i.V)(B,!0,W),(0,l.useEffect)(()=>{a.FH.taskChanges(p,x,g).then(b).catch(e=>w(e.message))},[p,x,g]);let G=null!=(o=null==v?void 0:v.files)?o:[],A=G[S];(0,l.useEffect)(()=>{!A||I.has(A.path)||a.FH.taskChangeFile(p,x,A.path,g).then(e=>F(t=>new Map(t).set(A.path,e))).catch(e=>F(t=>new Map(t).set(A.path,e.message)))},[A,I,p,x,g]);let P=A?I.get(A.path):void 0,Q=(0,l.useMemo)(()=>!P||"string"==typeof P||P.binary||P.tooLarge?[]:function(e,t){let s=function(e,t){let s=0;for(;s<e.length&&s<t.length&&e[s]===t[s];)s+=1;let n=e.length,l=t.length;for(;n>s&&l>s&&e[n-1]===t[l-1];)n-=1,l-=1;let a=[];for(let e=0;e<s;e+=1)a.push({kind:"same",a:e,b:e});for(let i of function(e,t){let s=e.length,n=t.length;if(0===s)return t.map((e,t)=>({kind:"add",b:t}));if(0===n)return e.map((e,t)=>({kind:"del",a:t}));let l=s+n,a=l+1,i=new Int32Array(2*l+3),r=[];for(let c=0;c<=Math.min(l,2e3);c+=1){r.push(i.slice(a-c-1,a+c+2));for(let l=-c;l<=c;l+=2){let o=l===-c||l!==c&&i[a+l-1]<i[a+l+1]?i[a+l+1]:i[a+l-1]+1,d=o-l;for(;o<s&&d<n&&e[o]===t[d];)o+=1,d+=1;if(i[a+l]=o,o>=s&&d>=n)return function(e,t,s,n){let l=[],a=t.length,i=s.length;for(let t=n;t>0;t-=1){let s=e[t],n=e=>s[e+t+1],r=a-i,c=r===-t||r!==t&&n(r-1)<n(r+1)?r+1:r-1,o=n(c),d=o-c;for(;a>o&&i>d;)a-=1,i-=1,l.push({kind:"same",a:a,b:i});a===o?l.push({kind:"add",b:d}):l.push({kind:"del",a:o}),a=o,i=d}for(;a>0&&i>0;)a-=1,i-=1,l.push({kind:"same",a:a,b:i});return l.reverse()}(r,e,t,c)}}return[...e.map((e,t)=>({kind:"del",a:t})),...t.map((e,t)=>({kind:"add",b:t}))]}(e.slice(s,n),t.slice(s,l)))a.push({kind:i.kind,...void 0!==i.a?{a:i.a+s}:{},...void 0!==i.b?{b:i.b+s}:{}});for(let t=0;n+t<e.length;t+=1)a.push({kind:"same",a:n+t,b:l+t});return a}(e,t),n=[];for(let l=0;l<s.length;){let a=s[l];if("same"===a.kind){n.push({kind:"same",left:{no:a.a+1,text:e[a.a]},right:{no:a.b+1,text:t[a.b]}}),l+=1;continue}let i=[],r=[];for(;l<s.length&&"same"!==s[l].kind;){let e=s[l];"del"===e.kind?i.push(e.a):r.push(e.b),l+=1}let c=Math.max(i.length,r.length);for(let s=0;s<c;s+=1){let l=i[s],a=r[s];n.push({kind:void 0!==l&&void 0!==a?"change":void 0!==l?"del":"add",...void 0!==l?{left:{no:l+1,text:e[l]}}:{},...void 0!==a?{right:{no:a+1,text:t[a]}}:{}})}}return n}(c(P.before),c(P.after)),[P]),V=A&&H.get(A.path)||new Set,Z=(0,l.useMemo)(()=>(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(n)return e.map((e,t)=>({type:"row",row:e,index:t}));let l=[];for(let n=0;n<e.length;){if("same"!==e[n].kind){l.push({type:"row",row:e[n],index:n}),n+=1;continue}let a=n;for(;a<e.length&&"same"===e[a].kind;)a+=1;let i=0===n?0:t,r=a===e.length?0:t,c=a-n-i-r;if(c>1&&!s.has(n+i)){for(let t=n;t<n+i;t+=1)l.push({type:"row",row:e[t],index:t});l.push({type:"gap",from:n+i,count:c});for(let t=a-r;t<a;t+=1)l.push({type:"row",row:e[t],index:t})}else for(let t=n;t<a;t+=1)l.push({type:"row",row:e[t],index:t});n=a}return l})(Q,3,V,q),[Q,V,q]),_=(0,l.useMemo)(()=>Q.flatMap((e,t)=>"same"!==e.kind&&(0===t||"same"===Q[t-1].kind)?[t]:[]),[Q]);(0,l.useEffect)(()=>{O(-1),D.current&&(D.current.scrollTop=0)},[S]);let K=(0,l.useCallback)(e=>{var t;if(0===_.length)return;let s=M<0?1===e?0:_.length-1:Math.min(_.length-1,Math.max(0,M+e));O(s);let n=null==(t=D.current)?void 0:t.querySelector('[data-row="'.concat(_[s],'"]'));null==n||n.scrollIntoView({block:"center"})},[M,_]),$=(0,l.useCallback)(e=>C(t=>Math.min(Math.max(0,t+e),Math.max(0,G.length-1))),[G.length]);(0,l.useEffect)(()=>{let e=e=>{if(!e.ctrlKey&&!e.metaKey&&!e.altKey){if("Escape"===e.key)y();else if("n"===e.key)K(1);else if("p"===e.key)K(-1);else if("]"===e.key)$(1);else{if("["!==e.key)return;$(-1)}e.preventDefault()}};window.addEventListener("keydown",e);let t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",e),document.body.style.overflow=t}},[K,$,y]);let z=G.reduce((e,t)=>({added:e.added+Math.max(0,t.added),removed:e.removed+Math.max(0,t.removed)}),{added:0,removed:0});return(0,n.jsxs)("div",{ref:B,className:"diff-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"diff-title",children:[(0,n.jsxs)("div",{className:"diff-head",children:[(0,n.jsx)("h2",{id:"diff-title",children:k("diff.title",{title:j})}),(null==v?void 0:v.ok)&&(0,n.jsxs)("span",{className:"muted small",children:[v.branch?"".concat(v.branch," \xb7 "):"",null==(t=v.base)?void 0:t.slice(0,8)," → ",null==(s=v.commit)?void 0:s.slice(0,8)," \xb7 ",k("diff.summary",{n:G.length,a:z.added,r:z.removed})]}),(0,n.jsx)("span",{className:"grow"}),(0,n.jsx)("span",{className:"muted small",children:k("diff.keys")}),(0,n.jsx)("button",{ref:W,type:"button",onClick:y,children:k("diff.close")})]}),N&&(0,n.jsx)("div",{className:"err",style:{padding:12},children:N}),!v&&!N&&(0,n.jsx)("div",{className:"muted",style:{padding:12},children:k("diff.loading")}),v&&!v.ok&&(0,n.jsx)("div",{className:"notice caution",style:{margin:12},children:v.problem}),(null==v?void 0:v.ok)&&0===G.length&&(0,n.jsx)("div",{className:"notice",style:{margin:12},children:k("diff.nothing")}),(null==v?void 0:v.ok)&&G.length>0&&(0,n.jsxs)("div",{className:"diff-body",children:[(0,n.jsx)("nav",{className:"diff-files","aria-label":k("diff.files"),children:G.map((e,t)=>{let s=e.path.lastIndexOf("/");return(0,n.jsxs)("button",{type:"button",className:"diff-file".concat(t===S?" on":""),onClick:()=>C(t),title:e.oldPath?"".concat(e.oldPath," → ").concat(e.path):e.path,children:[(0,n.jsx)("span",{className:"diff-status s-".concat(e.status),children:e.status}),(0,n.jsxs)("span",{className:"diff-path",children:[s>=0&&(0,n.jsx)("span",{className:"muted",children:e.path.slice(0,s+1)}),(0,n.jsx)("strong",{children:e.path.slice(s+1)})]}),(0,n.jsx)("span",{className:"diff-counts",children:e.added<0?k("diff.binaryShort"):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("span",{className:"plus",children:["+",e.added]})," ",(0,n.jsxs)("span",{className:"minus",children:["−",e.removed]})]})})]},e.path)})}),(0,n.jsxs)("div",{className:"diff-main",children:[A&&(0,n.jsxs)("div",{className:"diff-toolbar",children:[(0,n.jsx)("strong",{className:"diff-name",children:A.oldPath?"".concat(A.oldPath," → ").concat(A.path):A.path}),(0,n.jsx)("span",{className:"muted small",children:"A"===A.status?k("diff.added"):"D"===A.status?k("diff.deleted"):"R"===A.status?k("diff.renamed"):""}),(0,n.jsx)("span",{className:"grow"}),(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>K(-1),disabled:0===_.length,children:k("diff.prevChange")}),(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>K(1),disabled:0===_.length,children:k("diff.nextChange")}),(0,n.jsx)("span",{className:"muted small",children:_.length>0?k("diff.changeN",{i:M<0?"–":M+1,n:_.length}):""}),(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>$(-1),disabled:0===S,children:k("diff.prevFile")}),(0,n.jsx)("button",{type:"button",className:"quiet",onClick:()=>$(1),disabled:S>=G.length-1,children:k("diff.nextFile")}),(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"checkbox",checked:q,onChange:e=>R(e.target.checked)})," ",k("diff.whole")]}),(0,n.jsxs)("label",{className:"option-inline",children:[(0,n.jsx)("input",{type:"checkbox",checked:E,onChange:e=>L(e.target.checked)})," ",k("diff.wrap")]})]}),(0,n.jsxs)("div",{className:"diff-scroll",ref:D,children:[void 0===P&&(0,n.jsx)("div",{className:"muted",style:{padding:12},children:k("diff.loading")}),"string"==typeof P&&(0,n.jsx)("div",{className:"err",style:{padding:12},children:P}),P&&"string"!=typeof P&&P.binary&&(0,n.jsx)("div",{className:"notice",style:{margin:12},children:k("diff.binary")}),P&&"string"!=typeof P&&P.tooLarge&&(0,n.jsx)("div",{className:"notice",style:{margin:12},children:k("diff.tooLarge")}),P&&"string"!=typeof P&&!P.binary&&!P.tooLarge&&(0,n.jsxs)(n.Fragment,{children:[(null!=(d=P.before)?d:"").includes("\r\n")!==(null!=(h=P.after)?h:"").includes("\r\n")&&null!==P.before&&null!==P.after&&(0,n.jsx)("div",{className:"notice small",style:{margin:8},children:k("diff.eol",{from:(null!=(m=P.before)?m:"").includes("\r\n")?"CRLF":"LF",to:(null!=(f=P.after)?f:"").includes("\r\n")?"CRLF":"LF"})}),Q.length>0&&0===_.length&&(0,n.jsx)("div",{className:"notice small",style:{margin:8},children:k("diff.sameText")}),(0,n.jsxs)("table",{className:"diff-table".concat(E?"":" nowrap"),children:[(0,n.jsxs)("colgroup",{children:[(0,n.jsx)("col",{className:"num"}),(0,n.jsx)("col",{}),(0,n.jsx)("col",{className:"num"}),(0,n.jsx)("col",{})]}),(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{colSpan:2,children:k("diff.before")}),(0,n.jsx)("th",{colSpan:2,children:k("diff.after")})]})}),(0,n.jsx)("tbody",{children:Z.map(e=>"gap"===e.type?(0,n.jsx)("tr",{className:"diff-gap",children:(0,n.jsx)("td",{colSpan:4,children:(0,n.jsx)("button",{type:"button",className:"linkish small",onClick:()=>{var t;return t=e.from,void(A&&T(e=>{var s;return new Map(e).set(A.path,new Set([...null!=(s=e.get(A.path))?s:[],t]))}))},children:k("diff.gap",{n:e.count})})})},"g".concat(e.from)):(0,n.jsx)(u,{row:e.row,index:e.index,current:M>=0&&_[M]===e.index},e.index))})]})]})]})]})]})]})}function u(e){var t,s,a,i;let{row:r,index:c,current:o}=e,d="change"===r.kind?function(e,t){let s=0;for(;s<e.length&&s<t.length&&e[s]===t[s];)s+=1;let n=e.length,l=t.length;for(;n>s&&l>s&&e[n-1]===t[l-1];)n-=1,l-=1;return{start:s,leftEnd:n,rightEnd:l}}(r.left.text,r.right.text):null,u=e=>{let t=r[e];if(!t)return null;if(!d)return t.text;let s="left"===e?d.leftEnd:d.rightEnd;return(0,n.jsxs)(l.Fragment,{children:[t.text.slice(0,d.start),(0,n.jsx)("mark",{children:t.text.slice(d.start,s)}),t.text.slice(s)]})};return(0,n.jsxs)("tr",{className:"diff-row ".concat(r.kind).concat(o?" current":""),"data-row":c,children:[(0,n.jsx)("td",{className:"num",children:null!=(a=null==(t=r.left)?void 0:t.no)?a:""}),(0,n.jsx)("td",{className:"code l".concat(r.left?"":" empty"),children:u("left")}),(0,n.jsx)("td",{className:"num",children:null!=(i=null==(s=r.right)?void 0:s.no)?i:""}),(0,n.jsx)("td",{className:"code r".concat(r.right?"":" empty"),children:u("right")})]})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[499],{1035:(e,t,r)=>{r.d(t,{DialogHost:()=>d,Z:()=>o});var l=r(3365),n=r(1521),s=r(867),a=r(4969);let c=null,i=[];function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(r=>{var l;return l={kind:"confirm",message:e,...t,resolve:r},void(c?c(l):i.push(l))})}function d(e){var t,r;let{children:o}=e,{t:d}=(0,s.kj)(),[h,m]=(0,n.useState)([]),u=(0,n.useRef)(null),p=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(c=e=>m(t=>[...t,e]),i.length>0){let e=i.splice(0,i.length);m(t=>[...t,...e])}return()=>{c=null}},[]);let x=h[0],g=(0,n.useCallback)(e=>{x&&(x.resolve(e),m(e=>e.slice(1)))},[x]);return(0,a.V)(p,!!x,u),(0,n.useEffect)(()=>{if(!x)return;let e=e=>{"Escape"===e.key&&(e.preventDefault(),g(!1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[x,g]),(0,l.jsxs)(l.Fragment,{children:[o,x&&(0,l.jsx)("div",{className:"modal-backdrop",onClick:()=>g(!1),role:"presentation",children:(0,l.jsxs)("div",{ref:p,className:"modal".concat(x.danger?" danger":""),role:"confirm"===x.kind?"alertdialog":"dialog","aria-modal":"true","aria-labelledby":"modal-title","aria-describedby":"modal-body",onClick:e=>e.stopPropagation(),children:[(0,l.jsx)("h2",{id:"modal-title",children:null!=(t=x.title)?t:d("confirm"===x.kind?"dialog.confirmTitle":"dialog.noticeTitle")}),(0,l.jsx)("div",{id:"modal-body",className:"modal-body",children:x.message}),(0,l.jsxs)("div",{className:"row modal-actions",children:["confirm"===x.kind&&(0,l.jsx)("button",{type:"button",className:"quiet",onClick:()=>g(!1),children:d("dialog.cancel")}),(0,l.jsx)("button",{ref:u,type:"button",className:x.danger?"danger":"primary",onClick:()=>g(!0),children:null!=(r=x.okLabel)?r:d("dialog.ok")})]})]})})]})}},1701:(e,t,r)=>{r.d(t,{L:()=>u,StartDialogHost:()=>p});var l=r(3365),n=r(1521),s=r(5549),a=r(867),c=r(4969),i=r(3486),o=r(3069);let d=null,h=[],m=1;function u(e){return new Promise(t=>{let r={...e,id:m++,resolve:t};d?d(r):h.push(r)})}function p(){let[e,t]=(0,n.useState)([]);(0,n.useEffect)(()=>{if(d=e=>t(t=>[...t,e]),h.length>0){let e=h.splice(0,h.length);t(t=>[...t,...e])}return()=>{d=null}},[]);let r=e[0];return r?(0,l.jsx)(g,{req:r,onDone:e=>{r.resolve(e),t(e=>e.slice(1))}},r.id):null}let x=e=>e.trim().replace(/[\\/]+$/,"").replace(/\//g,"\\").toLowerCase();function g(e){var t,r,d,h,m,u;let{req:p,onDone:g}=e,{t:f}=(0,a.kj)(),j=(0,a.W3)(),v=(0,n.useId)(),b=(0,n.useRef)(null),y=(0,n.useRef)(null),[k,w]=(0,n.useState)(null),[N,F]=(0,n.useState)(""),[B,C]=(0,n.useState)({}),[S,D]=(0,n.useState)({}),[E,T]=(0,n.useState)({kind:"choose"}),[H,O]=(0,n.useState)(""),[W,I]=(0,n.useState)(""),[L,R]=(0,n.useState)({}),[A,q]=(0,n.useState)([]),[P,z]=(0,n.useState)(!1),U=(0,n.useRef)(new Set),V=(0,n.useRef)(void 0),K=e=>g({started:e,...V.current?{reply:V.current}:{}}),_="fetching"===E.kind||"starting"===E.kind||""!==W,X=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return s.FH.startOptions(p.sessionIds).then(t=>{w(t);let r={};for(let e of t.repos)r[x(e.repoDir)]=e;C(r);let l={};for(let e of t.sessions){if(!e.vcs||!e.repoDir||e.fixed&&!e.choice)continue;let t=function(e,t){var r,l,n,s,a,c,i;let o=null!=(a=null!=(s=null==t||null==(r=t.remotes.find(e=>"origin"===e.name))?void 0:r.name)?s:null==t||null==(l=t.remotes[0])?void 0:l.name)?a:"",d=null!=(i=null!=(c=null==t?void 0:t.current)?c:null==t||null==(n=t.local[0])?void 0:n.name)?i:"main";return e?"previous-session"===e.from?{from:"previous-session",local:d,remote:o,remoteBranch:d,onBranch:!1}:"local"===e.from?{from:"local",local:e.branch,remote:o,remoteBranch:e.branch,onBranch:!!e.onBranch}:{from:"remote",local:(null==t?void 0:t.local.some(t=>t.name===e.branch))?e.branch:d,remote:e.remote,remoteBranch:e.branch,onBranch:!!e.onBranch}:{from:"local",local:d,remote:o,remoteBranch:"main",onBranch:!1}}(e.choice,r[x(e.repoDir)]);l[e.id]=e.prepared||e.fixed?{...t,from:"keep"}:t}D(t=>e?{...l,...Object.fromEntries(Object.entries(t).filter(e=>{let[t]=e;return t in l}))}:l)}).catch(e=>F(e.message))};(0,n.useEffect)(()=>{X()},[p.sessionIds]),(0,c.V)(b,!0,y),(0,n.useEffect)(()=>{let e=e=>{"Escape"===e.key&&!e.defaultPrevented&&(e.preventDefault(),_||K(!1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[_,K]);let J=e=>e?B[x(e)]:void 0,M=(e,t)=>D(r=>({...r,[e]:{...r[e],...t}})),G=e=>{e&&C(t=>({...t,[x(e.repoDir)]:e}))},Z=()=>{s.FH.runVcs(p.sessionIds).then(q).catch(()=>q([]))},$=()=>{U.current.clear(),T({kind:"choose"})},Q=async function(){var e;let t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};O("");let l=(()=>{var e,t;let r={},l=new Map;for(let n of null!=(e=null==k?void 0:k.sessions)?e:[]){let e=S[n.id],s=J(n.repoDir);if(!e||!n.repoDir||!s||s.problem||"keep"===e.from)continue;let a=n.fixed?{rechoose:!0}:{};if("previous-session"===e.from)r[n.id]={from:"previous-session",...a};else if("current"===e.from){if(!s.current)return{problem:f("startdlg.needBranch",{name:n.name})};r[n.id]={from:"local",branch:s.current,...e.onBranch?{onBranch:!0}:{},...a}}else if("local"===e.from){if(!e.local||!s.local.some(t=>t.name===e.local))return{problem:f("startdlg.needBranch",{name:n.name})};r[n.id]={from:"local",branch:e.local,...e.onBranch?{onBranch:!0}:{},...a}}else{let c=e.remoteBranch.trim();if(!e.remote||!c)return{problem:f("startdlg.needBranch",{name:n.name})};r[n.id]={from:"remote",remote:e.remote,branch:c,...e.onBranch?{onBranch:!0}:{},...a};let i="".concat(x(n.repoDir),"|").concat(e.remote),o=null!=(t=l.get(i))?t:{key:i,dir:s.repoDir,remote:e.remote,branches:[]};o.branches.includes(c)||o.branches.push(c),l.set(i,o)}}return{starts:r,groups:[...l.values()].map(e=>({...e,key:"".concat(e.key,"|").concat([...e.branches].sort().join(","))}))}})();if("problem"in l)return void O(l.problem);if(!r.skipFetch)for(let e of l.groups){if(U.current.has(e.key))continue;T({kind:"fetching",what:e.branches.map(t=>"".concat(e.remote,"/").concat(t)).join(", ")});let t=await s.FH.startFetch(e.dir,e.remote,e.branches).catch(e=>({ok:!1,problem:e.message,missing:[]}));if(G(t.repo),!t.ok)return void T({kind:"fetchFailed",group:e,result:t})}T({kind:"starting"});try{t=await p.start(l.starts)}catch(e){t={started:!1,reason:e.message}}if(V.current=t,t.started)return void K(!0);T({kind:"failed",reply:t}),(null==(e=t.failure)?void 0:e.stage)==="preflight"&&Z()},Y=async(e,t)=>{I("".concat(x(e),"|").concat(t)),R(r=>({...r,[x(e)]:f("startdlg.fetching",{what:t})}));try{let r=await s.FH.startFetch(e,t);G(r.repo),R(l=>{var n,s,a,c;return{...l,[x(e)]:r.ok?"":"".concat(f("startdlg.fetchFailed",{what:t})," ").concat(null!=(c=null!=(a=r.problem)?a:null==(n=r.fetched)?void 0:n.detail)?c:"").concat((null==(s=r.fetched)?void 0:s.auth)?" ".concat(f("prep.fetchAuth")):"")}})}catch(t){R(r=>({...r,[x(e)]:t.message}))}finally{I("")}},ee=async e=>{try{await navigator.clipboard.writeText(e),z(!0),window.setTimeout(()=>z(!1),2500)}catch(e){O(f("plan.copyFailed"))}},et=Object.values(S).some(e=>"remote"===e.from),er=(null!=(h=null==k?void 0:k.sessions)?h:[]).filter(e=>e.vcs),el=1===er.length?(e=>{var t,r,l;let n=S[e.id],s=J(e.repoDir);if(!n||!s)return;let a=e=>e?" @ ".concat(e.slice(0,8)):"";return"keep"===n.from?e.fixed&&(null==(t=e.started)?void 0:t.branch)?"".concat(e.started.branch).concat(a(null!=(l=e.started.tipNow)?l:e.started.recorded)):void 0:"current"===n.from?s.current?"".concat(s.current).concat(a(s.head)):void 0:"local"===n.from?"".concat(n.local).concat(a(null==(r=s.local.find(e=>e.name===n.local))?void 0:r.commit)):"remote"===n.from&&n.remoteBranch.trim()?"".concat(n.remote,"/").concat(n.remoteBranch.trim()):void 0})(er[0]):void 0,en=el?f("unattended"===p.mode?"startdlg.goUnattendedOn":"startdlg.goStepOn",{where:el}):"unattended"===p.mode?f("startdlg.goUnattended"):f("startdlg.goStep");return(0,l.jsx)("div",{className:"modal-backdrop",role:"presentation",onClick:()=>!_&&K(!1),children:(0,l.jsxs)("div",{ref:b,className:"modal wide start-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"".concat(v,"-title"),onClick:e=>e.stopPropagation(),style:{overflowWrap:"anywhere"},children:[(0,l.jsx)("h2",{id:"".concat(v,"-title"),children:f("startdlg.title")}),(0,l.jsxs)("p",{className:"small muted",style:{marginTop:0},children:[f("startdlg.intro")," ",k&&"choose"===E.kind&&(0,l.jsx)("button",{type:"button",className:"quiet",onClick:()=>void X(!0),disabled:_,children:f("startdlg.refresh")})]}),N&&(0,l.jsx)(o.X,{reason:N}),!k&&!N&&(0,l.jsx)("p",{className:"small",role:"status",children:f("startdlg.loading")}),k&&("choose"===E.kind||"fetching"===E.kind||"starting"===E.kind)&&k.sessions.map(e=>{var t,r,n,s,a,c,i,o,d,h,m,u;let p=J(e.repoDir),g=S[e.id],b="start-".concat(v,"-").concat(e.id),y=null!=(c=null==p||null==(t=p.remotes.find(e=>e.name===(null==g?void 0:g.remote)))?void 0:t.branches)?c:[];return(0,l.jsxs)("fieldset",{className:"option",style:{border:"1px solid var(--line)",borderRadius:"var(--radius)",padding:"8px 12px",margin:"10px 0"},children:[(0,l.jsx)("legend",{style:{padding:"0 4px"},children:(0,l.jsx)("strong",{children:e.name})}),e.repoDir&&(0,l.jsx)("p",{className:"muted small",style:{margin:"2px 0 6px"},children:f("startdlg.repoOn",{repo:e.repoDir,branch:null!=(i=null==p?void 0:p.current)?i:"HEAD"})}),e.vcs?p&&!p.problem&&g?e.fixed&&e.rechooseBlocked?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{className:"small",children:f("startdlg.fixed",{start:e.fixed})}),(0,l.jsx)("p",{className:"muted small",children:f("startdlg.rechooseBlocked",{tasks:e.rechooseBlocked})})]}):(0,l.jsxs)(l.Fragment,{children:[e.fixed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{className:"small",style:{margin:"2px 0"},children:f("startdlg.fixed",{start:e.fixed})}),(null==(r=e.started)?void 0:r.branch)&&(0,l.jsxs)("p",{className:"small",style:{margin:"2px 0"},children:[e.started.tipNow?f("startdlg.branchNow",{branch:e.started.branch,now:e.started.tipNow.slice(0,8),recorded:(null!=(d=e.started.recorded)?d:"").slice(0,8)}):f("startdlg.branchGone",{branch:e.started.branch,recorded:(null!=(h=e.started.recorded)?h:"").slice(0,8)}),e.started.remote?" ".concat(f("startdlg.branchRemote",{name:e.started.remote.name,commit:e.started.remote.commit.slice(0,8)})):""]}),p.current&&(null==(n=e.started)?void 0:n.branch)&&p.current!==e.started.branch&&"per-task"!==e.started.mode&&(0,l.jsx)("p",{className:"notice caution small",style:{margin:"4px 0"},children:f("startdlg.differs",{current:p.current,head:(null!=(m=p.head)?m:"").slice(0,8),branch:e.started.branch})}),(0,l.jsx)("div",{className:"option",children:(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:b,checked:"keep"===g.from,onChange:()=>M(e.id,{from:"keep"}),disabled:_}),(0,l.jsx)("span",{children:(null==(s=e.started)?void 0:s.branch)?f("startdlg.keepStarted",{branch:e.started.branch}):f("startdlg.keepStartedNoBranch")})]})}),p.current&&p.current!==(null==(a=e.started)?void 0:a.branch)&&(0,l.jsx)("div",{className:"option",children:(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:b,checked:"current"===g.from,onChange:()=>M(e.id,{from:"current"}),disabled:_}),(0,l.jsx)("span",{children:f("startdlg.useCurrent",{branch:p.current,commit:(null!=(u=p.head)?u:"").slice(0,8)})})]})})]}),e.prepared&&(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:b,checked:"keep"===g.from,onChange:()=>M(e.id,{from:"keep"}),disabled:_}),(0,l.jsx)("span",{children:f("startdlg.keep")})]}),(0,l.jsx)("p",{className:"why",children:f("startdlg.prepared",{start:e.prepared})})]}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:b,checked:"local"===g.from,onChange:()=>M(e.id,{from:"local"}),disabled:_}),(0,l.jsx)("span",{children:f("startdlg.local")})]}),(0,l.jsx)("div",{className:"row",style:{marginTop:4},children:(0,l.jsxs)("select",{"aria-label":f("startdlg.localBranch"),value:g.local,onChange:t=>M(e.id,{from:"local",local:t.target.value}),disabled:_,style:{width:"auto",minWidth:240,maxWidth:"100%"},children:[!p.local.some(e=>e.name===g.local)&&(0,l.jsx)("option",{value:g.local,children:g.local}),p.local.map(e=>(0,l.jsxs)("option",{value:e.name,children:[e.name," \xb7 ",e.commit.slice(0,8)]},e.name))]})}),(0,l.jsx)("p",{className:"why",children:f("startdlg.localWhy")})]}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:b,checked:"remote"===g.from,onChange:()=>M(e.id,{from:"remote"}),disabled:_||0===p.remotes.length}),(0,l.jsx)("span",{children:f("startdlg.remote")})]}),0===p.remotes.length?(0,l.jsx)("p",{className:"muted small",children:f("startdlg.noRemote")}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"row",style:{marginTop:4},children:[p.remotes.length>1&&(0,l.jsx)("select",{"aria-label":f("startdlg.remoteName"),value:g.remote,onChange:t=>M(e.id,{from:"remote",remote:t.target.value}),disabled:_,style:{width:"auto"},children:p.remotes.map(e=>(0,l.jsx)("option",{value:e.name,children:e.name},e.name))}),1===p.remotes.length&&(0,l.jsxs)("code",{children:[g.remote,"/"]}),(0,l.jsx)("input",{type:"text","aria-label":f("startdlg.remoteBranch"),list:"".concat(b,"-remote"),value:g.remoteBranch,onChange:t=>M(e.id,{from:"remote",remoteBranch:t.target.value}),onFocus:()=>"remote"!==g.from&&M(e.id,{from:"remote"}),disabled:_,style:{width:"auto",minWidth:240,flex:"1 1 240px"},placeholder:"main"}),(0,l.jsx)("datalist",{id:"".concat(b,"-remote"),children:y.map(e=>(0,l.jsx)("option",{value:e.name},e.name))}),(0,l.jsx)("button",{type:"button",onClick:()=>void Y(p.repoDir,g.remote),disabled:_||!g.remote,children:f("startdlg.refreshRemote")})]}),(0,l.jsx)("p",{className:"why",children:f("startdlg.remoteWhy")}),(0,l.jsx)("p",{className:"muted small",style:{margin:"2px 0"},children:p.lastFetched?f("startdlg.lastFetched",{when:j(p.lastFetched)}):y.length>0?f("startdlg.lastFetchedUnknown"):f("startdlg.neverFetched")}),L[x(p.repoDir)]&&(0,l.jsx)("p",{className:"small",role:"status",children:L[x(p.repoDir)]})]})]}),e.previousOffered&&(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"radio",name:b,checked:"previous-session"===g.from,onChange:()=>M(e.id,{from:"previous-session"}),disabled:_}),(0,l.jsx)("span",{children:f("startdlg.previous")})]}),(0,l.jsx)("p",{className:"why",children:f("startdlg.previousWhy")})]}),(0,l.jsxs)("div",{className:"option",children:[(0,l.jsxs)("label",{children:[(0,l.jsx)("input",{type:"checkbox",checked:g.onBranch&&("local"===g.from||"remote"===g.from||"current"===g.from),onChange:t=>M(e.id,{onBranch:t.target.checked}),disabled:_||"local"!==g.from&&"remote"!==g.from&&"current"!==g.from}),(0,l.jsx)("span",{children:f("startdlg.onBranch")})]}),(0,l.jsx)("p",{className:"why",children:f("startdlg.onBranchWhy")})]}),e.fixed&&"keep"!==g.from&&(0,l.jsx)("p",{className:"notice caution small",children:f("startdlg.rechooseNote")})]}):e.fixed?(0,l.jsx)("p",{className:"small",children:f("startdlg.fixed",{start:e.fixed})}):(0,l.jsx)("p",{className:"err small",children:f("startdlg.repoProblem",{problem:null!=(o=null==p?void 0:p.problem)?o:""})}):(0,l.jsx)("p",{className:"small",children:f("startdlg.vcsOff")})]},e.id)}),"fetching"===E.kind&&(0,l.jsx)("p",{className:"notice small",role:"status",children:f("startdlg.fetching",{what:E.what})}),"starting"===E.kind&&(0,l.jsx)("p",{className:"notice small",role:"status",children:f("startdlg.starting")}),"fetchFailed"===E.kind&&(0,l.jsxs)("div",{className:"notice caution",role:"alert",children:[(0,l.jsxs)("p",{style:{marginTop:0},children:[(0,l.jsx)("strong",{children:f("startdlg.fetchFailed",{what:E.group.branches.map(e=>"".concat(E.group.remote,"/").concat(e)).join(", ")})})," ",(0,l.jsx)("code",{children:null!=(u=null!=(m=E.result.problem)?m:null==(t=E.result.fetched)?void 0:t.detail)?u:""})]}),E.result.missing.length>0&&(0,l.jsx)("p",{className:"small",children:f("startdlg.missing",{names:E.result.missing.join(", ")})}),(null==(r=E.result.fetched)?void 0:r.auth)&&(0,l.jsx)("p",{className:"small",children:f("prep.fetchAuth")}),(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("button",{type:"button",className:"primary",onClick:()=>void Q(),children:f("startdlg.retryFetch")}),(()=>{var e,t;let r=J(E.group.dir),n=null!=(t=null==r||null==(e=r.remotes.find(e=>e.name===E.group.remote))?void 0:e.branches)?t:[];return E.group.branches.every(e=>n.some(t=>t.name===e))?(0,l.jsx)("button",{type:"button",onClick:()=>{U.current.add(E.group.key),Q()},children:f("startdlg.useFetched")}):null})(),(0,l.jsx)("button",{type:"button",className:"quiet",onClick:$,children:f("startdlg.back")})]}),(()=>{var e,t;let r=J(E.group.dir),n=null!=(t=null==r||null==(e=r.remotes.find(e=>e.name===E.group.remote))?void 0:e.branches)?t:[],s=E.group.branches.filter(e=>!n.some(t=>t.name===e));return s.length>0?(0,l.jsx)("p",{className:"muted small",children:f("startdlg.useFetchedNo",{what:s.map(e=>"".concat(E.group.remote,"/").concat(e)).join(", ")})}):E.result.lastFetched?(0,l.jsx)("p",{className:"muted small",children:f("prep.lastFetched",{when:j(E.result.lastFetched)})}):null})(),E.result.fetchCommand&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{className:"small",style:{marginTop:8},children:f("prep.ownTerminal")}),(0,l.jsx)("pre",{className:"sync-cmd",children:E.result.fetchCommand}),(0,l.jsxs)("div",{className:"row",children:[(0,l.jsx)("button",{type:"button",onClick:()=>{var e;ee(null!=(e=E.result.fetchCommand)?e:"")},children:f("prep.copyFetch")}),P&&(0,l.jsx)("span",{className:"badge done",children:f("prep.copied")})]})]})]}),"failed"===E.kind&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(o.X,{failure:E.reply.failure,reason:E.reply.reason}),(null==(d=E.reply.failure)?void 0:d.stage)==="preflight"&&A.some(e=>!e.ready)&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{className:"small",children:f("startdlg.vcsFix")}),(0,l.jsx)(i.w,{groups:A,sessionIds:p.sessionIds,onChange:()=>{Z(),X()}})]})]}),H&&(0,l.jsx)("p",{className:"err small",role:"alert",children:H}),"choose"===E.kind&&et&&(0,l.jsx)("p",{className:"why",children:f("prep.password")}),(0,l.jsxs)("div",{className:"row modal-actions",children:[(0,l.jsx)("button",{type:"button",className:"quiet",onClick:()=>K(!1),disabled:_,children:f("dialog.cancel")}),"failed"===E.kind?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{type:"button",onClick:$,children:f("startdlg.back")}),(0,l.jsx)("button",{type:"button",className:"primary",onClick:()=>void Q({skipFetch:!0}),children:f("startdlg.tryAgain")})]}):"fetchFailed"!==E.kind&&(0,l.jsx)("button",{ref:y,type:"button",className:"primary",onClick:()=>void Q(),disabled:_||!k,children:en})]})]})})}},3069:(e,t,r)=>{r.d(t,{StartFailureBanner:()=>h,X:()=>i});var l=r(3365),n=r(1521),s=r(5549),a=r(867),c=r(7527);function i(e){var t,r;let{failure:n,reason:c,onDismiss:i,intro:o,children:d}=e,{t:h}=(0,a.kj)(),m=(0,a.W3)(),u=null!=(r=null!=(t=null==n?void 0:n.message)?t:c)?r:"";return(0,l.jsxs)("div",{className:"notice caution start-failure",role:"alert",style:{overflowWrap:"anywhere"},children:[o&&(0,l.jsx)("p",{className:"small",style:{marginTop:0},children:o}),(0,l.jsx)("strong",{children:h("startfail.title")}),n&&(0,l.jsx)("p",{className:"small",style:{margin:"4px 0"},children:h("startfail.where",{stage:h("startfail.stage.".concat(n.stage))})}),(0,l.jsx)("pre",{className:"sync-cmd small",style:{margin:"6px 0"},children:u}),d,n&&(0,l.jsxs)("p",{className:"muted small",style:{margin:"4px 0"},children:[n.runId?h("startfail.when",{when:m(n.at),run:n.runId}):h("startfail.whenNoRun",{when:m(n.at)}),n.sessions.length>0?" \xb7 ".concat(n.sessions.map(e=>'"'.concat(e,'"')).join(", ")):""]}),(0,l.jsxs)("div",{className:"row",style:{marginTop:6},children:[n&&(0,l.jsx)("a",{className:"button-link",href:s.FH.startFailureUrl(n.id),download:!0,children:h("startfail.download")}),(0,l.jsx)("a",{className:n?"button-link":"button-link plain",href:s.FH.terminalUrl(),download:!0,children:h("startfail.terminal")}),i&&(0,l.jsx)("button",{type:"button",className:"quiet",onClick:i,children:h("startfail.dismiss")})]}),(0,l.jsx)("p",{className:"why",children:h("startfail.downloadWhy")})]})}let o="cop.startFailure.dismissed";function d(){try{var e;let t=JSON.parse(null!=(e=window.localStorage.getItem(o))?e:"[]");return Array.isArray(t)?t.filter(e=>"string"==typeof e):[]}catch(e){return[]}}function h(){let{t:e}=(0,a.kj)(),[t,r]=(0,n.useState)([]),[h,m]=(0,n.useState)([]);(0,c.z)(()=>s.FH.startFailures(!0).then(e=>{r(e),m(d())}).catch(()=>void 0),5e3);let u=t.find(e=>!h.includes(e.id));return u?(0,l.jsx)("div",{style:{marginBottom:12},children:(0,l.jsx)(i,{failure:u,intro:e("at-turn"===u.stage?"startfail.laterSession":"startfail.later"),onDismiss:()=>{let e=[...new Set([...d(),u.id])].slice(-50);try{window.localStorage.setItem(o,JSON.stringify(e))}catch(e){}m(e)}})}):null}},3486:(e,t,r)=>{r.d(t,{w:()=>i});var l=r(3365),n=r(1521),s=r(5549),a=r(867);let c={"review-inputs":"runvcs.review","snapshot-on-base":"runvcs.snapshotOnBase","snapshot-here":"runvcs.snapshotHere","use-current-branch":"runvcs.useCurrent","allow-snapshot":"runvcs.allowSnapshot"};function i(e){let{groups:t,sessionIds:r,onChange:s}=e,{t:c}=(0,a.kj)(),[i,d]=(0,n.useState)(""),h=t.filter(e=>!e.ready);return 0===h.length?i?(0,l.jsxs)("p",{className:"notice small",role:"status",children:[(0,l.jsx)("strong",{children:c("runvcs.ready")})," ",i]}):null:(0,l.jsxs)("section",{className:"notice caution","aria-labelledby":"runvcs-title",children:[(0,l.jsx)("h3",{id:"runvcs-title",style:{marginTop:0},children:c("runvcs.title")}),(0,l.jsx)("p",{className:"small",children:c("runvcs.why")}),h.map(e=>(0,l.jsx)(o,{group:e,sessionIds:r,onChange:s,onDone:d},e.repoDir))]})}function o(e){var t;let{group:r,sessionIds:i,onChange:o,onDone:d}=e,{t:h}=(0,a.kj)(),[m,u]=(0,n.useState)(!1),[p,x]=(0,n.useState)(!1),[g,f]=(0,n.useState)(!1),[j,v]=(0,n.useState)(""),[b,y]=(0,n.useState)({}),k=(e,t)=>{var r,l;return null!=(l=null!=(r=b[e])?r:t)?l:void 0},w=r.actions.find(e=>"snapshot-here"===e.id&&e.available),N=e=>(null!=e?e:"—").slice(0,8),F=async e=>{if("review-inputs"===e)return void u(e=>!e);f(!0),v("");try{var t,l,n;let a="snapshot-on-base"===e?Object.fromEntries(r.inputs.map(e=>[e.path,"include"])):Object.fromEntries(r.entries.filter(e=>k(e.path,e.choice)).map(e=>[e.path,k(e.path,e.choice)])),c=await s.FH.runVcsPrepare(i,r.repoDir,e,a);v(c.ok?null!=(t=c.result)?t:"":null!=(l=c.problem)?l:""),c.ok&&d("".concat(r.repoDir,": ").concat(null!=(n=c.result)?n:"")),o()}catch(e){v(e.message)}finally{f(!1)}};return(0,l.jsxs)("div",{className:"option",style:{overflowWrap:"anywhere"},children:[(0,l.jsx)("table",{className:"small",children:(0,l.jsxs)("tbody",{children:[(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:h("runvcs.repo")}),(0,l.jsx)("td",{children:(0,l.jsx)("code",{children:r.repoDir})})]}),(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:h("runvcs.current")}),(0,l.jsxs)("td",{children:[(0,l.jsx)("code",{children:null!=(t=r.branch)?t:"HEAD"})," @ ",(0,l.jsx)("code",{children:N(r.head)})]})]}),r.workBranch&&(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:h("runvcs.workBranch")}),(0,l.jsxs)("td",{children:[(0,l.jsx)("code",{children:r.workBranch.name})," @ ",(0,l.jsx)("code",{children:N(r.workBranch.head)})]})]}),r.baseBranch&&(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:h("runvcs.base")}),(0,l.jsxs)("td",{children:[(0,l.jsx)("code",{children:r.baseBranch})," @ ",(0,l.jsx)("code",{children:N(r.baseHead)})]})]}),(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:h("runvcs.sessions")}),(0,l.jsx)("td",{children:r.sessions.map(e=>"".concat(e.name," (").concat(h("runvcs.role.".concat(e.role)),")")).join(", ")})]}),r.inputPatterns.length>0&&(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:h("runvcs.patterns")}),(0,l.jsx)("td",{children:r.inputPatterns.map(e=>(0,l.jsx)("code",{style:{marginRight:6},children:e},e))})]})]})}),r.problem&&(0,l.jsxs)("p",{className:"small",children:[(0,l.jsx)("strong",{children:h("runvcs.problem")})," ",r.problem]}),r.inputs.length>0&&(0,l.jsx)("p",{className:"small",children:h("runvcs.inputsCount",{n:r.inputs.length})}),m&&r.inputs.length>0&&(0,l.jsx)("ul",{className:"small",style:{margin:"4px 0"},children:r.inputs.map(e=>(0,l.jsxs)("li",{children:[(0,l.jsx)("code",{children:e.path})," — ",h("vcs.snapshotKind.".concat(e.kind)),void 0!==e.size?", ".concat((0,s.zi)(e.size)):"",0===e.allowed.length&&e.reason?(0,l.jsxs)("span",{className:"err",children:[" — ",e.reason]}):null]},e.path))}),r.unrelated.length>0&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{className:"small",children:(0,l.jsx)("strong",{children:h("runvcs.unrelated",{n:r.unrelated.length})})}),(0,l.jsx)("ul",{className:"small",style:{margin:"4px 0"},children:r.unrelated.slice(0,30).map(e=>(0,l.jsxs)("li",{children:[(0,l.jsx)("code",{children:e.path}),e.reason?" — ".concat(e.reason):""]},e.path))})]}),w&&r.entries.length>0&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("p",{className:"small",children:(0,l.jsx)("strong",{children:h("runvcs.choose",{n:r.entries.length})})}),(0,l.jsx)("ul",{className:"small",style:{margin:"4px 0",paddingLeft:0,listStyle:"none"},children:r.entries.map(e=>{var t;return(0,l.jsxs)("li",{style:{marginBottom:4},children:[(0,l.jsx)("code",{children:e.path})," ",(0,l.jsxs)("span",{className:"muted",children:["(",e.input?"".concat(h("vcs.snapshotInput"),", "):"",h("vcs.snapshotKind.".concat(e.kind)),void 0!==e.size?", ".concat((0,s.zi)(e.size)):"",")"]})," ",0===e.allowed.length?(0,l.jsx)("span",{className:"err",children:h("vcs.snapshotBlocked")}):(0,l.jsx)("select",{"aria-label":e.path,value:null!=(t=k(e.path,e.choice))?t:"",onChange:t=>y({...b,[e.path]:t.target.value}),disabled:g||e.allowed.length<2,children:e.allowed.map(e=>(0,l.jsx)("option",{value:e,children:h("include"===e?"vcs.snapshotInclude":"vcs.snapshotLeaveOut")},e))}),e.reason&&(0,l.jsx)("div",{className:"muted",children:e.reason})]},e.path)})})]}),p?(0,l.jsxs)("p",{className:"small muted",children:[h("runvcs.cancelled")," ",(0,l.jsx)("button",{className:"quiet",onClick:()=>x(!1),children:h("runvcs.showAgain")})]}):(0,l.jsxs)("div",{children:[r.actions.map(e=>{var t,n,s;return(0,l.jsxs)("div",{style:{marginTop:8},children:[(0,l.jsxs)("button",{className:e.recommended?"primary":void 0,onClick:()=>void F(e.id),disabled:g||!e.available,children:[h(c[e.id],{branch:null!=(t=r.baseBranch)?t:"",current:null!=(n=r.branch)?n:"HEAD"}),"review-inputs"===e.id&&m?" ✓":""]}),e.recommended&&(0,l.jsx)("span",{className:"badge done",style:{marginLeft:6},children:h("runvcs.recommended")}),(0,l.jsx)("p",{className:"why",children:e.available?e.result:"".concat(h("runvcs.notNow")," ").concat(null!=(s=e.why)?s:"")})]},e.id)}),(0,l.jsxs)("div",{style:{marginTop:8},children:[(0,l.jsx)("button",{className:"quiet",onClick:()=>x(!0),disabled:g,children:h("runvcs.cancel")}),(0,l.jsx)("p",{className:"why",children:h("runvcs.cancelWhy")})]})]}),j&&(0,l.jsx)("p",{className:"small",role:"status",children:j})]})}},4969:(e,t,r)=>{r.d(t,{V:()=>s});var l=r(1521);let n='a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';function s(e,t,r){(0,l.useEffect)(()=>{var l,s;if(!t)return;let a=document.activeElement instanceof HTMLElement?document.activeElement:null,c=e.current,i=null!=(s=null!=(l=null==r?void 0:r.current)?l:null==c?void 0:c.querySelector(n))?s:null;null==i||i.focus();let o=e=>{if("Tab"!==e.key||!c)return;let t=Array.from(c.querySelectorAll(n)).filter(e=>null!==e.offsetParent);if(0===t.length)return;let r=t[0],l=t[t.length-1],s=c.contains(document.activeElement);e.shiftKey&&(document.activeElement===r||!s)?(e.preventDefault(),l.focus()):e.shiftKey||document.activeElement!==l&&s||(e.preventDefault(),r.focus())};return document.addEventListener("keydown",o),()=>{document.removeEventListener("keydown",o),a&&document.contains(a)&&a.focus()}},[e,t,r])}},7527:(e,t,r)=>{r.d(t,{z:()=>n});var l=r(1521);function n(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=(0,l.useRef)(e);n.current=e,(0,l.useEffect)(()=>{let e;if(!r)return;let l=!1,s=async()=>{try{await n.current()}catch(e){}finally{l||(e=setTimeout(()=>void s(),t))}};return s(),()=>{l=!0,e&&clearTimeout(e)}},[t,r])}}}]);