copilot-operator 0.1.6 → 0.1.7
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.
- package/dist/src/api/operator.controller.js +32 -0
- package/dist/src/api/operator.service.js +76 -2
- package/dist/src/plan/systemGuide.js +94 -5
- package/dist/src/vcs/git.js +71 -0
- package/dist/web/404.html +2 -2
- package/dist/web/_next/static/chunks/549-33f0d3d53338b2f2.js +1 -0
- package/dist/web/_next/static/chunks/723-edc7b5709e5407ec.js +1 -0
- package/dist/web/_next/static/chunks/867-4aa80f5a32311bce.js +1 -0
- package/dist/web/_next/static/chunks/app/history/page-2251664c0abe3f11.js +1 -0
- package/dist/web/_next/static/chunks/app/sessions/view/page-9517dd74c6d00f85.js +1 -0
- package/dist/web/_next/static/css/{63fea96806e6b2cb.css → b67acb571615432b.css} +1 -1
- package/dist/web/appearance.html +2 -2
- package/dist/web/appearance.txt +12 -12
- package/dist/web/defaults.html +2 -2
- package/dist/web/defaults.txt +12 -12
- package/dist/web/history.html +2 -2
- package/dist/web/history.txt +12 -12
- package/dist/web/import.html +2 -2
- package/dist/web/import.txt +12 -12
- package/dist/web/index.html +2 -2
- package/dist/web/index.txt +12 -12
- package/dist/web/level1.html +2 -2
- package/dist/web/level1.txt +12 -12
- package/dist/web/presets.html +2 -2
- package/dist/web/presets.txt +12 -12
- package/dist/web/sessions/view.html +2 -2
- package/dist/web/sessions/view.txt +12 -12
- package/dist/web/system.html +2 -2
- package/dist/web/system.txt +12 -12
- package/package.json +4 -3
- package/dist/web/_next/static/chunks/549-afafecd6bfbb138e.js +0 -1
- package/dist/web/_next/static/chunks/56-91cd1709158ebf99.js +0 -1
- package/dist/web/_next/static/chunks/867-fc983d08916b4e28.js +0 -1
- package/dist/web/_next/static/chunks/app/history/page-b3b4af994c868b5d.js +0 -1
- package/dist/web/_next/static/chunks/app/sessions/view/page-d4213354730a945c.js +0 -1
- /package/dist/web/_next/static/{WJ_8hRZsp4VWiDZx8NMUw → DCpEMjhrg9APkRwBBw5Do}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{WJ_8hRZsp4VWiDZx8NMUw → DCpEMjhrg9APkRwBBw5Do}/_ssgManifest.js +0 -0
|
@@ -178,6 +178,19 @@ let OperatorController = class OperatorController {
|
|
|
178
178
|
throw new NotFoundException('This task has not run yet, or that attempt is not its own.');
|
|
179
179
|
return story;
|
|
180
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* What a task changed: the files between the commit it started from and the one it produced.
|
|
183
|
+
* `run` picks an earlier attempt. See `taskChanges`.
|
|
184
|
+
*/
|
|
185
|
+
taskChanges(id, taskId, run) {
|
|
186
|
+
return this.ops.taskChanges(id, taskId, run?.trim() || undefined).catch(fail);
|
|
187
|
+
}
|
|
188
|
+
/** One of those files, before and after. Only a file the task changed can be asked for. */
|
|
189
|
+
taskChangeFile(id, taskId, path, run) {
|
|
190
|
+
if (!path)
|
|
191
|
+
throw new BadRequestException('path is required');
|
|
192
|
+
return this.ops.taskChangeFile(id, taskId, path, run?.trim() || undefined).catch(fail);
|
|
193
|
+
}
|
|
181
194
|
taskFiles(id, taskId, run) {
|
|
182
195
|
return this.ops.taskFiles(id, taskId, run);
|
|
183
196
|
}
|
|
@@ -729,6 +742,25 @@ __decorate([
|
|
|
729
742
|
__metadata("design:paramtypes", [String, String, String]),
|
|
730
743
|
__metadata("design:returntype", Promise)
|
|
731
744
|
], OperatorController.prototype, "taskStory", null);
|
|
745
|
+
__decorate([
|
|
746
|
+
Get('sessions/:id/tasks/:taskId/changes'),
|
|
747
|
+
__param(0, Param('id')),
|
|
748
|
+
__param(1, Param('taskId')),
|
|
749
|
+
__param(2, Query('run')),
|
|
750
|
+
__metadata("design:type", Function),
|
|
751
|
+
__metadata("design:paramtypes", [String, String, String]),
|
|
752
|
+
__metadata("design:returntype", Promise)
|
|
753
|
+
], OperatorController.prototype, "taskChanges", null);
|
|
754
|
+
__decorate([
|
|
755
|
+
Get('sessions/:id/tasks/:taskId/changes/file'),
|
|
756
|
+
__param(0, Param('id')),
|
|
757
|
+
__param(1, Param('taskId')),
|
|
758
|
+
__param(2, Query('path')),
|
|
759
|
+
__param(3, Query('run')),
|
|
760
|
+
__metadata("design:type", Function),
|
|
761
|
+
__metadata("design:paramtypes", [String, String, String, String]),
|
|
762
|
+
__metadata("design:returntype", Promise)
|
|
763
|
+
], OperatorController.prototype, "taskChangeFile", null);
|
|
732
764
|
__decorate([
|
|
733
765
|
Get('sessions/:id/tasks/:taskId/files'),
|
|
734
766
|
__param(0, Param('id')),
|
|
@@ -36,8 +36,8 @@ function sameFolder(a, b) {
|
|
|
36
36
|
return a.trim() !== '' && norm(a) === norm(b);
|
|
37
37
|
}
|
|
38
38
|
import { importPlan, plannedSessionSignature, taskSignature } from '../plan/importPlan.js';
|
|
39
|
-
import { commitInterrupted, vcsPreflight, restorePreview, restoreToBase, sessionBranches } from '../vcs/taskVcs.js';
|
|
40
|
-
import { gitAvailable, repoUnusableReason } from '../vcs/git.js';
|
|
39
|
+
import { commitInterrupted, repoDirOf, vcsPreflight, restorePreview, restoreToBase, sessionBranches } from '../vcs/taskVcs.js';
|
|
40
|
+
import { changedFilesBetween, fileAt, gitAvailable, repoUnusableReason } from '../vcs/git.js';
|
|
41
41
|
import { makeAuthorizer } from '../exec/authorizer.js';
|
|
42
42
|
import { listSelectableDirs, collectFiles, findSelectionConflicts, describeConflicts, DEFAULT_IGNORE_DIRS } from '../context/projectMirror.js';
|
|
43
43
|
import { pickFolder } from './folderPicker.js';
|
|
@@ -388,6 +388,78 @@ let OperatorService = class OperatorService {
|
|
|
388
388
|
return await buildStory(cfg.resolved.runsDir, chosen, view, live);
|
|
389
389
|
}
|
|
390
390
|
/** Files a task produced, so the UI can list reports and downloaded scripts. */
|
|
391
|
+
/**
|
|
392
|
+
* What a task changed in the repository: the files, between the commit it started from and the
|
|
393
|
+
* commit it produced. `runId` picks an earlier attempt. Read from git each time rather than kept
|
|
394
|
+
* on the record, so what is shown is the repository's own account; the record only says which
|
|
395
|
+
* two commits to compare.
|
|
396
|
+
*
|
|
397
|
+
* There is something to show only when version control was on and the task committed: a task
|
|
398
|
+
* that changed nothing, or ran with version control off, left no commit to compare, and the
|
|
399
|
+
* answer says which.
|
|
400
|
+
*/
|
|
401
|
+
async taskChanges(sessionId, taskId, runId) {
|
|
402
|
+
const found = await this.changesOf(sessionId, taskId, runId);
|
|
403
|
+
if ('problem' in found)
|
|
404
|
+
return { ok: false, problem: found.problem, files: [] };
|
|
405
|
+
const listed = await changedFilesBetween(found.dir, found.base, found.commit);
|
|
406
|
+
if (listed.problem)
|
|
407
|
+
return { ok: false, problem: `the repository no longer has these commits: ${listed.problem}`, files: [] };
|
|
408
|
+
return { ok: true, repoDir: found.dir, branch: found.branch, base: found.base, commit: found.commit, files: listed.files };
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* One changed file, before and after, as text. Only a file the task changed can be asked for:
|
|
412
|
+
* the path is checked against that list, so this cannot be used to read anything else in the
|
|
413
|
+
* repository's history. A binary file, or one over 2 MB on either side, is said to be so rather
|
|
414
|
+
* than returned.
|
|
415
|
+
*/
|
|
416
|
+
async taskChangeFile(sessionId, taskId, path, runId) {
|
|
417
|
+
const found = await this.changesOf(sessionId, taskId, runId);
|
|
418
|
+
if ('problem' in found)
|
|
419
|
+
throw new Error(found.problem);
|
|
420
|
+
const listed = await changedFilesBetween(found.dir, found.base, found.commit);
|
|
421
|
+
const file = listed.files.find((f) => f.path === path);
|
|
422
|
+
if (!file)
|
|
423
|
+
throw new Error('That file is not one this task changed.');
|
|
424
|
+
const MAX = 2 * 1024 * 1024;
|
|
425
|
+
const before = file.status === 'A' ? { bytes: null, tooLarge: false } : await fileAt(found.dir, found.base, file.oldPath ?? file.path, MAX);
|
|
426
|
+
const after = file.status === 'D' ? { bytes: null, tooLarge: false } : await fileAt(found.dir, found.commit, file.path, MAX);
|
|
427
|
+
// Git's own test for binary: a NUL byte in the first 8000.
|
|
428
|
+
const binary = [before.bytes, after.bytes].some((b) => !!b && b.subarray(0, 8000).includes(0));
|
|
429
|
+
const text = (b) => (b === null || binary ? null : b.toString('utf8').replace(/^\uFEFF/, ''));
|
|
430
|
+
return {
|
|
431
|
+
path: file.path,
|
|
432
|
+
...(file.oldPath ? { oldPath: file.oldPath } : {}),
|
|
433
|
+
status: file.status,
|
|
434
|
+
before: text(before.bytes),
|
|
435
|
+
after: text(after.bytes),
|
|
436
|
+
binary,
|
|
437
|
+
tooLarge: before.tooLarge || after.tooLarge,
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
/** The repository and the two commits a task's changes lie between, or why there are none. */
|
|
441
|
+
async changesOf(sessionId, taskId, runId) {
|
|
442
|
+
await this.init();
|
|
443
|
+
const session = await this.store.getSession(sessionId);
|
|
444
|
+
const task = session?.tasks.find((t) => t.id === taskId);
|
|
445
|
+
if (!session || !task)
|
|
446
|
+
return { problem: 'No such task.' };
|
|
447
|
+
const chosen = runId ? resolveRunId(task, runId) : task.runId;
|
|
448
|
+
if (runId && !chosen)
|
|
449
|
+
return { problem: 'That attempt is not one of this task\'s.' };
|
|
450
|
+
const vcs = !chosen || chosen === task.runId ? task.vcs : (task.attempts ?? []).find((a) => a.runId === chosen)?.vcs;
|
|
451
|
+
if (!vcs?.baseCommit || !vcs.commit) {
|
|
452
|
+
return {
|
|
453
|
+
problem: vcs?.branch
|
|
454
|
+
? 'This attempt committed nothing, so there are no changes to show.'
|
|
455
|
+
: 'Version control was not on for this attempt, so its changes were not recorded.',
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
const dir = repoDirOf(session);
|
|
459
|
+
if (!dir)
|
|
460
|
+
return { problem: 'The session has no repository folder set.' };
|
|
461
|
+
return { dir, base: vcs.baseCommit, commit: vcs.commit, branch: vcs.branch };
|
|
462
|
+
}
|
|
391
463
|
async taskFiles(sessionId, taskId, runId) {
|
|
392
464
|
const cfg = await this.settings.load();
|
|
393
465
|
const s = await this.store.getSession(sessionId);
|
|
@@ -1947,6 +2019,7 @@ let OperatorService = class OperatorService {
|
|
|
1947
2019
|
readOnly: t.readOnly || undefined,
|
|
1948
2020
|
autoRetries: t.autoRetries || undefined,
|
|
1949
2021
|
attempt: t.attempt,
|
|
2022
|
+
changedFiles: t.vcs?.commit && t.vcs.baseCommit ? (t.vcs.files?.length ?? 0) : undefined,
|
|
1950
2023
|
attempts: (t.attempts ?? []).map((a, n) => {
|
|
1951
2024
|
const from = a.startedAt ? Date.parse(a.startedAt) : undefined;
|
|
1952
2025
|
const to = a.finishedAt ? Date.parse(a.finishedAt) : undefined;
|
|
@@ -1961,6 +2034,7 @@ let OperatorService = class OperatorService {
|
|
|
1961
2034
|
reason: a.reason,
|
|
1962
2035
|
runId: a.runId,
|
|
1963
2036
|
branch: a.vcs?.branch,
|
|
2037
|
+
changedFiles: a.vcs?.commit && a.vcs.baseCommit ? (a.vcs.files?.length ?? 0) : undefined,
|
|
1964
2038
|
};
|
|
1965
2039
|
}),
|
|
1966
2040
|
});
|
|
@@ -1549,6 +1549,14 @@ export const SYSTEM_GUIDE = [
|
|
|
1549
1549
|
doesEn: 'The files the task\'s commit changed.',
|
|
1550
1550
|
doesBg: 'Файловете, които комитът на задачата е променил.',
|
|
1551
1551
|
},
|
|
1552
|
+
{
|
|
1553
|
+
key: 'diff.open',
|
|
1554
|
+
kind: 'button',
|
|
1555
|
+
en: 'See the changes ({n} file(s))',
|
|
1556
|
+
bg: 'Виж промените ({n} файла)',
|
|
1557
|
+
doesEn: 'Where the attempt committed: every file it changed, before on the left and after on the right, scrolling together. Also under each earlier attempt.',
|
|
1558
|
+
doesBg: 'Където опитът е комитнал: всеки променен файл, преди вляво и след вдясно, превъртани заедно. И под всеки по-ранен опит.',
|
|
1559
|
+
},
|
|
1552
1560
|
{
|
|
1553
1561
|
key: 'task.deviations',
|
|
1554
1562
|
kind: 'disclosure',
|
|
@@ -2102,6 +2110,14 @@ export const SYSTEM_GUIDE = [
|
|
|
2102
2110
|
doesEn: 'Downloads what the runner did: the environment, every event and step with its exit code, the review machinery.',
|
|
2103
2111
|
doesBg: 'Изтегля какво е направил runner-ът: средата, всяко събитие и стъпка с кода на изход, механиката на рецензията.',
|
|
2104
2112
|
},
|
|
2113
|
+
{
|
|
2114
|
+
key: 'diff.open',
|
|
2115
|
+
kind: 'button',
|
|
2116
|
+
en: 'See the changes ({n} file(s))',
|
|
2117
|
+
bg: 'Виж промените ({n} файла)',
|
|
2118
|
+
doesEn: 'Where the attempt committed: every file it changed, before on the left and after on the right, scrolling together.',
|
|
2119
|
+
doesBg: 'Където опитът е комитнал: всеки променен файл, преди вляво и след вдясно, превъртани заедно.',
|
|
2120
|
+
},
|
|
2105
2121
|
{
|
|
2106
2122
|
key: 'story.show',
|
|
2107
2123
|
kind: 'button',
|
|
@@ -2476,6 +2492,77 @@ export const SYSTEM_GUIDE = [
|
|
|
2476
2492
|
},
|
|
2477
2493
|
],
|
|
2478
2494
|
},
|
|
2495
|
+
{
|
|
2496
|
+
headingKey: 'diff.title',
|
|
2497
|
+
en: 'Changes in "{title}"',
|
|
2498
|
+
bg: 'Промени в „{title}“',
|
|
2499
|
+
controls: [
|
|
2500
|
+
{
|
|
2501
|
+
key: 'diff.nextChange',
|
|
2502
|
+
kind: 'button',
|
|
2503
|
+
en: 'Next change',
|
|
2504
|
+
bg: 'Следваща промяна',
|
|
2505
|
+
doesEn: 'Jumps to the next edit (key n).',
|
|
2506
|
+
doesBg: 'Отива на следващата промяна (клавиш n).',
|
|
2507
|
+
},
|
|
2508
|
+
{
|
|
2509
|
+
key: 'diff.prevChange',
|
|
2510
|
+
kind: 'button',
|
|
2511
|
+
en: 'Previous change',
|
|
2512
|
+
bg: 'Предишна промяна',
|
|
2513
|
+
doesEn: 'The one before (key p).',
|
|
2514
|
+
doesBg: 'Предишната (клавиш p).',
|
|
2515
|
+
},
|
|
2516
|
+
{
|
|
2517
|
+
key: 'diff.nextFile',
|
|
2518
|
+
kind: 'button',
|
|
2519
|
+
en: 'Next file',
|
|
2520
|
+
bg: 'Следващ файл',
|
|
2521
|
+
doesEn: 'The next file in the list on the left (key ]).',
|
|
2522
|
+
doesBg: 'Следващият файл от списъка вляво (клавиш ]).',
|
|
2523
|
+
},
|
|
2524
|
+
{
|
|
2525
|
+
key: 'diff.prevFile',
|
|
2526
|
+
kind: 'button',
|
|
2527
|
+
en: 'Previous file',
|
|
2528
|
+
bg: 'Предишен файл',
|
|
2529
|
+
doesEn: 'The file before (key [).',
|
|
2530
|
+
doesBg: 'Предишният файл (клавиш [).',
|
|
2531
|
+
},
|
|
2532
|
+
{
|
|
2533
|
+
key: 'diff.gap',
|
|
2534
|
+
kind: 'button',
|
|
2535
|
+
en: '⋯ {n} unchanged line(s) — show them',
|
|
2536
|
+
bg: '⋯ {n} непроменени реда — покажи ги',
|
|
2537
|
+
doesEn: 'Opens a folded stretch of unchanged lines.',
|
|
2538
|
+
doesBg: 'Отваря сгънат участък непроменени редове.',
|
|
2539
|
+
},
|
|
2540
|
+
{
|
|
2541
|
+
key: 'diff.whole',
|
|
2542
|
+
kind: 'checkbox',
|
|
2543
|
+
en: 'Show the whole file',
|
|
2544
|
+
bg: 'Покажи целия файл',
|
|
2545
|
+
doesEn: 'Every line, nothing folded.',
|
|
2546
|
+
doesBg: 'Всички редове, нищо сгънато.',
|
|
2547
|
+
},
|
|
2548
|
+
{
|
|
2549
|
+
key: 'diff.wrap',
|
|
2550
|
+
kind: 'checkbox',
|
|
2551
|
+
en: 'Wrap long lines',
|
|
2552
|
+
bg: 'Пренасяй дългите редове',
|
|
2553
|
+
doesEn: 'Off: long lines stay on one line and the table scrolls sideways.',
|
|
2554
|
+
doesBg: 'Изключено: дългите редове остават на един ред и таблицата се превърта настрани.',
|
|
2555
|
+
},
|
|
2556
|
+
{
|
|
2557
|
+
key: 'diff.close',
|
|
2558
|
+
kind: 'button',
|
|
2559
|
+
en: 'Close',
|
|
2560
|
+
bg: 'Затвори',
|
|
2561
|
+
doesEn: 'Closes the view (Esc).',
|
|
2562
|
+
doesBg: 'Затваря изгледа (Esc).',
|
|
2563
|
+
},
|
|
2564
|
+
],
|
|
2565
|
+
},
|
|
2479
2566
|
],
|
|
2480
2567
|
},
|
|
2481
2568
|
{
|
|
@@ -3123,10 +3210,10 @@ const KIND_WORDS = {
|
|
|
3123
3210
|
tab: { en: 'tab', bg: 'раздел' },
|
|
3124
3211
|
badge: { en: 'badge', bg: 'етикет' },
|
|
3125
3212
|
disclosure: { en: 'fold', bg: 'разгъване' },
|
|
3126
|
-
note: { en: '
|
|
3213
|
+
note: { en: 'text', bg: 'текст' },
|
|
3127
3214
|
};
|
|
3128
|
-
const INTRO_EN = 'Every label in quotes below is the exact text on the screen. Name the control by that text — press "Check it" — instead of describing it, and give the route so the operator knows which page they are on. A label with {braces} in it is filled in with numbers or names at the time.';
|
|
3129
|
-
const INTRO_BG = 'Всеки надпис в кавички по-долу е точният текст на екрана. Назовавай контрола с този текст — натисни „Провери“ — вместо да го описваш, и казвай маршрута, за да знае операторът на коя страница е. Надпис с {скоби} се попълва с числа или имена в момента.';
|
|
3215
|
+
const INTRO_EN = 'Every label in quotes below is the exact text on the screen. Name the control by that text — press "Check it" — instead of describing it, and give the route so the operator knows which page they are on. A label with {braces} in it is filled in with numbers or names at the time. A label with no kind after it is a button.';
|
|
3216
|
+
const INTRO_BG = 'Всеки надпис в кавички по-долу е точният текст на екрана. Назовавай контрола с този текст — натисни „Провери“ — вместо да го описваш, и казвай маршрута, за да знае операторът на коя страница е. Надпис с {скоби} се попълва с числа или имена в момента. Надпис без вид след него е бутон.';
|
|
3130
3217
|
/**
|
|
3131
3218
|
* The guide as the Markdown section the brief embeds. Dense on purpose: the brief is pasted
|
|
3132
3219
|
* into a chat window by hand and read by a model, so the words and what they do earn their
|
|
@@ -3146,8 +3233,10 @@ export function systemGuideSection(lang) {
|
|
|
3146
3233
|
lines.push('');
|
|
3147
3234
|
lines.push(`**${bg ? section.bg : section.en}**`);
|
|
3148
3235
|
for (const control of section.controls) {
|
|
3149
|
-
|
|
3150
|
-
|
|
3236
|
+
// A button is the common case and is said once in the introduction instead of on 120 lines:
|
|
3237
|
+
// the brief is pasted into a chat whose composer has a limit, and this is where it goes.
|
|
3238
|
+
const kind = control.kind === 'button' ? '' : ` (${KIND_WORDS[control.kind][lang]})`;
|
|
3239
|
+
lines.push(`- "${bg ? control.bg : control.en}"${kind} — ${bg ? control.doesBg : control.doesEn}`);
|
|
3151
3240
|
}
|
|
3152
3241
|
}
|
|
3153
3242
|
}
|
package/dist/src/vcs/git.js
CHANGED
|
@@ -244,6 +244,77 @@ export async function commitFiles(dir, commit) {
|
|
|
244
244
|
removed: removed === '-' ? -1 : Number(removed) || 0,
|
|
245
245
|
}));
|
|
246
246
|
}
|
|
247
|
+
/**
|
|
248
|
+
* One git command, with its output as bytes and untouched.
|
|
249
|
+
*
|
|
250
|
+
* `git` trims what it returns, which is right for a branch name and wrong for a file: trimming
|
|
251
|
+
* takes the indentation off the first line and the newline off the last, and a diff built on that
|
|
252
|
+
* would show both as changes nobody made. Bytes also let a binary file be recognised rather than
|
|
253
|
+
* decoded into noise.
|
|
254
|
+
*/
|
|
255
|
+
export function gitBytes(cwd, args, timeoutMs = 60_000, maxBytes = 16 * 1024 * 1024) {
|
|
256
|
+
return new Promise((resolve) => {
|
|
257
|
+
execFile('git', [...SAFE_GIT, ...args], { cwd, timeout: timeoutMs, windowsHide: true, maxBuffer: maxBytes, encoding: 'buffer' }, (error, stdout, stderr) => {
|
|
258
|
+
resolve({ ok: !error, stdout: stdout ?? Buffer.alloc(0), stderr: String(stderr ?? '').trim() });
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* The files that differ between two commits, renames detected, in git's order.
|
|
264
|
+
*
|
|
265
|
+
* Read NUL-separated (`-z`) so a path with a space, a tab or a non-ASCII letter comes through as it
|
|
266
|
+
* is rather than quoted and escaped.
|
|
267
|
+
*/
|
|
268
|
+
export async function changedFilesBetween(dir, from, to) {
|
|
269
|
+
const names = await gitBytes(dir, ['diff', '--name-status', '-M', '-z', from, to]);
|
|
270
|
+
if (!names.ok)
|
|
271
|
+
return { files: [], problem: names.stderr || 'git could not compare the two commits' };
|
|
272
|
+
const tokens = names.stdout.toString('utf8').split('\0');
|
|
273
|
+
const files = [];
|
|
274
|
+
for (let i = 0; i < tokens.length;) {
|
|
275
|
+
const status = tokens[i] ?? '';
|
|
276
|
+
if (!status)
|
|
277
|
+
break;
|
|
278
|
+
const letter = status[0];
|
|
279
|
+
if (letter === 'R' || letter === 'C') {
|
|
280
|
+
files.push({ status: letter, oldPath: tokens[i + 1] ?? '', path: tokens[i + 2] ?? '', added: 0, removed: 0 });
|
|
281
|
+
i += 3;
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
files.push({ status: letter, path: tokens[i + 1] ?? '', added: 0, removed: 0 });
|
|
285
|
+
i += 2;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
const counts = await gitBytes(dir, ['diff', '--numstat', '-M', '-z', from, to]);
|
|
289
|
+
if (counts.ok) {
|
|
290
|
+
const parts = counts.stdout.toString('utf8').split('\0');
|
|
291
|
+
for (let i = 0; i < parts.length;) {
|
|
292
|
+
const head = parts[i] ?? '';
|
|
293
|
+
if (!head)
|
|
294
|
+
break;
|
|
295
|
+
const [added = '0', removed = '0', path = ''] = head.split('\t');
|
|
296
|
+
// A rename is written "added<TAB>removed<TAB>" followed by the old and the new path.
|
|
297
|
+
const newPath = path === '' ? (parts[i + 2] ?? '') : path;
|
|
298
|
+
i += path === '' ? 3 : 1;
|
|
299
|
+
const file = files.find((f) => f.path === newPath);
|
|
300
|
+
if (file) {
|
|
301
|
+
file.added = added === '-' ? -1 : Number(added) || 0;
|
|
302
|
+
file.removed = removed === '-' ? -1 : Number(removed) || 0;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return { files };
|
|
307
|
+
}
|
|
308
|
+
/** A file's bytes as they were in one commit, or null when it does not exist there. */
|
|
309
|
+
export async function fileAt(dir, commit, path, maxBytes) {
|
|
310
|
+
const size = await git(dir, ['cat-file', '-s', `${commit}:${path}`]);
|
|
311
|
+
if (!size.ok)
|
|
312
|
+
return { bytes: null, tooLarge: false };
|
|
313
|
+
if (Number(size.stdout) > maxBytes)
|
|
314
|
+
return { bytes: null, tooLarge: true };
|
|
315
|
+
const r = await gitBytes(dir, ['show', `${commit}:${path}`], 60_000, maxBytes + 1024);
|
|
316
|
+
return r.ok ? { bytes: r.stdout, tooLarge: false } : { bytes: null, tooLarge: false };
|
|
317
|
+
}
|
|
247
318
|
/** The subject line of one commit, or empty when it cannot be read. */
|
|
248
319
|
export async function commitSubject(dir, commit) {
|
|
249
320
|
const r = await git(dir, ['log', '-1', '--format=%s', commit]);
|
package/dist/web/404.html
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!DOCTYPE html><!--
|
|
1
|
+
<!DOCTYPE html><!--DCpEMjhrg9APkRwBBw5Do--><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/b67acb571615432b.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-4aa80f5a32311bce.js" async=""></script><script src="/_next/static/chunks/549-33f0d3d53338b2f2.js" async=""></script><script src="/_next/static/chunks/app/layout-e0174d863960f109.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;
|
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
d.dataset.focus = a.strongFocus ? 'strong' : 'normal';
|
|
13
13
|
} catch (e) {}
|
|
14
14
|
})();
|
|
15
|
-
</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,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";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[1205,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-fc983d08916b4e28.js\",\"549\",\"static/chunks/549-afafecd6bfbb138e.js\",\"177\",\"static/chunks/app/layout-e0174d863960f109.js\"],\"themeScript\"]\n3:I[1205,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-fc983d08916b4e28.js\",\"549\",\"static/chunks/549-afafecd6bfbb138e.js\",\"177\",\"static/chunks/app/layout-e0174d863960f109.js\"],\"AppearanceProvider\"]\n4:I[867,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-fc983d08916b4e28.js\",\"549\",\"static/chunks/549-afafecd6bfbb138e.js\",\"177\",\"static/chunks/app/layout-e0174d863960f109.js\"],\"LanguageProvider\"]\n5:I[1035,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-fc983d08916b4e28.js\",\"549\",\"static/chunks/549-afafecd6bfbb138e.js\",\"177\",\"static/chunks/app/layout-e0174d863960f109.js\"],\"DialogHost\"]\n6:I[8214,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-fc983d08916b4e28.js\",\"549\",\"static/chunks/549-afafecd6bfbb138e.js\",\"177\",\"static/chunks/app/layout-e0174d863960f109.js\"],\"SkipLink\"]\n7:I[8197,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-fc983d08916b4e28.js\",\"549\",\"static/chunks/549-afafecd6bfbb138e.js\",\"177\",\"static/chunks/app/layout-e0174d863960f109.js\"],\"\"]\n8:I[8214,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-fc983d08916b4e28.js\",\"549\",\"static/chunks/549-afafecd6bfbb138e.js\",\"177\",\"static/chunks/app/layout-e0174d863960f109.js\"],\"Nav\"]\n9:I[6657,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-fc983d08916b4e28.js\",\"549\",\"static/chunks/549-afafecd6bfbb138e.js\",\"177\",\"static/chunks/app/layout-e0174d863960f109.js\"],\"GlobalApprovals\"]\na:I[5204,[],\"\"]\nb:I[2642,[],\"\"]\nc:I[7712,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-fc983d08916b4e28.js\",\"549\",\"static/chunks/549-afafecd6bfbb138e.js\",\"177\",\"static/chunks/app/layout-e0174d863960f109.js\"],\"ScrollJump\"]\nd:I[433,[],\"OutletBoundary\"]\nf:I[9884,[],\"AsyncMeta"])</script><script>self.__next_f.push([1,"dataOutlet\"]\n11:I[433,[],\"ViewportBoundary\"]\n13:I[433,[],\"MetadataBoundary\"]\n14:\"$Sreact.suspense\"\n16:I[3536,[],\"\"]\n:HL[\"/_next/static/css/63fea96806e6b2cb.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"WJ_8hRZsp4VWiDZx8NMUw\",\"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/63fea96806e6b2cb.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"data-theme\":\"light\",\"data-textsize\":\"normal\",\"data-contrast\":\"normal\",\"data-motion\":\"normal\",\"data-links\":\"plain\",\"data-focus\":\"normal\",\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"$2\"}}]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"$L3\",null,{\"children\":[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$L5\",null,{\"children\":[[\"$\",\"$L6\",null,{}],[\"$\",\"div\",null,{\"className\":\"wrap\",\"children\":[[\"$\",\"header\",null,{\"className\":\"top\",\"children\":[[\"$\",\"h1\",null,{\"children\":[\"$\",\"$L7\",null,{\"href\":\"/\",\"children\":\"copilot-operator\"}]}],[\"$\",\"$L8\",null,{}]]}],[\"$\",\"$L9\",null,{}],[\"$\",\"main\",null,{\"id\":\"main\",\"children\":[\"$\",\"$La\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lb\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]]}],[\"$\",\"$Lc\",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,[\"$\",\"$Ld\",null,{\"children\":[\"$Le\",[\"$\",\"$Lf\",null,{\"promise\":\"$@10\"}]]}]]}],{},null,false]},null,false]},null,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[[\"$\",\"$L11\",null,{\"children\":\"$L12\"}],null],[\"$\",\"$L13\",null,{\"children\":[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$14\",null,{\"fallback\":null,\"children\":\"$L15\"}]}]}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$16\",[]],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"12:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\ne:null\n"])</script><script>self.__next_f.push([1,"10:{\"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,"15:\"$10:metadata\"\n"])</script></body></html>
|
|
15
|
+
</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,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";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[1205,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-4aa80f5a32311bce.js\",\"549\",\"static/chunks/549-33f0d3d53338b2f2.js\",\"177\",\"static/chunks/app/layout-e0174d863960f109.js\"],\"themeScript\"]\n3:I[1205,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-4aa80f5a32311bce.js\",\"549\",\"static/chunks/549-33f0d3d53338b2f2.js\",\"177\",\"static/chunks/app/layout-e0174d863960f109.js\"],\"AppearanceProvider\"]\n4:I[867,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-4aa80f5a32311bce.js\",\"549\",\"static/chunks/549-33f0d3d53338b2f2.js\",\"177\",\"static/chunks/app/layout-e0174d863960f109.js\"],\"LanguageProvider\"]\n5:I[1035,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-4aa80f5a32311bce.js\",\"549\",\"static/chunks/549-33f0d3d53338b2f2.js\",\"177\",\"static/chunks/app/layout-e0174d863960f109.js\"],\"DialogHost\"]\n6:I[8214,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-4aa80f5a32311bce.js\",\"549\",\"static/chunks/549-33f0d3d53338b2f2.js\",\"177\",\"static/chunks/app/layout-e0174d863960f109.js\"],\"SkipLink\"]\n7:I[8197,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-4aa80f5a32311bce.js\",\"549\",\"static/chunks/549-33f0d3d53338b2f2.js\",\"177\",\"static/chunks/app/layout-e0174d863960f109.js\"],\"\"]\n8:I[8214,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-4aa80f5a32311bce.js\",\"549\",\"static/chunks/549-33f0d3d53338b2f2.js\",\"177\",\"static/chunks/app/layout-e0174d863960f109.js\"],\"Nav\"]\n9:I[6657,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-4aa80f5a32311bce.js\",\"549\",\"static/chunks/549-33f0d3d53338b2f2.js\",\"177\",\"static/chunks/app/layout-e0174d863960f109.js\"],\"GlobalApprovals\"]\na:I[5204,[],\"\"]\nb:I[2642,[],\"\"]\nc:I[7712,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-4aa80f5a32311bce.js\",\"549\",\"static/chunks/549-33f0d3d53338b2f2.js\",\"177\",\"static/chunks/app/layout-e0174d863960f109.js\"],\"ScrollJump\"]\nd:I[433,[],\"OutletBoundary\"]\nf:I[9884,[],\"AsyncMeta"])</script><script>self.__next_f.push([1,"dataOutlet\"]\n11:I[433,[],\"ViewportBoundary\"]\n13:I[433,[],\"MetadataBoundary\"]\n14:\"$Sreact.suspense\"\n16:I[3536,[],\"\"]\n:HL[\"/_next/static/css/b67acb571615432b.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"DCpEMjhrg9APkRwBBw5Do\",\"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/b67acb571615432b.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"data-theme\":\"light\",\"data-textsize\":\"normal\",\"data-contrast\":\"normal\",\"data-motion\":\"normal\",\"data-links\":\"plain\",\"data-focus\":\"normal\",\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"$2\"}}]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"$L3\",null,{\"children\":[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$L5\",null,{\"children\":[[\"$\",\"$L6\",null,{}],[\"$\",\"div\",null,{\"className\":\"wrap\",\"children\":[[\"$\",\"header\",null,{\"className\":\"top\",\"children\":[[\"$\",\"h1\",null,{\"children\":[\"$\",\"$L7\",null,{\"href\":\"/\",\"children\":\"copilot-operator\"}]}],[\"$\",\"$L8\",null,{}]]}],[\"$\",\"$L9\",null,{}],[\"$\",\"main\",null,{\"id\":\"main\",\"children\":[\"$\",\"$La\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lb\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]]}],[\"$\",\"$Lc\",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,[\"$\",\"$Ld\",null,{\"children\":[\"$Le\",[\"$\",\"$Lf\",null,{\"promise\":\"$@10\"}]]}]]}],{},null,false]},null,false]},null,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[[\"$\",\"$L11\",null,{\"children\":\"$L12\"}],null],[\"$\",\"$L13\",null,{\"children\":[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$14\",null,{\"fallback\":null,\"children\":\"$L15\"}]}]}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$16\",[]],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"12:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\ne:null\n"])</script><script>self.__next_f.push([1,"10:{\"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,"15:\"$10:metadata\"\n"])</script></body></html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[549],{5549:(t,e,o)=>{o.d(e,{AV:()=>i,FH:()=>h,FZ:()=>d,aT:()=>c,c5:()=>y,dK:()=>u,nC:()=>s,rt:()=>l,ub:()=>r,zi:()=>p});var n=o(986);let s="/api";function c(t,e){return"/sessions/view?id=".concat(encodeURIComponent(t)).concat(e?"#".concat(e):"")}let a="cop-api-token";function i(){try{var t;let e=/(?:^#|&)token=([0-9a-f]{16,})/i.exec(window.location.hash);if(e)return window.localStorage.setItem(a,e[1]),window.history.replaceState(null,"",window.location.pathname+window.location.search),e[1];return window.localStorage.getItem(a)||(null!=(t=n.env.NEXT_PUBLIC_COP_TOKEN)?t:"")}catch(t){return""}}function r(t){let e=i();return e?"".concat(t).concat(t.includes("?")?"&":"?","token=").concat(encodeURIComponent(e)):t}let d=["exit-zero","exit-nonzero","output-contains","output-omits","output-matches","file-exists","file-missing","file-contains"];function l(t){return t.startsWith("exit-")||t.startsWith("output-")}function u(t){return"output-contains"===t||"output-omits"===t||"output-matches"===t||"file-contains"===t}async function m(t,e){var o;let n=await fetch("".concat(s).concat(t),{...e,headers:{"content-type":"application/json",...i()?{"x-cop-token":i()}:{},...null!=(o=null==e?void 0:e.headers)?o:{}}});if(!n.ok){let t="".concat(n.status," ").concat(n.statusText);try{let e=await n.json();(null==e?void 0:e.message)&&(t=Array.isArray(e.message)?e.message.join("; "):e.message)}catch(t){}throw Error(t)}let c=await n.text();return c?JSON.parse(c):void 0}let h={health:()=>m("/health"),doctor:()=>m("/doctor"),settings:()=>m("/settings"),saveSettings:t=>m("/settings",{method:"PUT",body:JSON.stringify(t)}),level1:()=>m("/level1"),setLevel1:t=>m("/level1",{method:"PUT",body:JSON.stringify({content:t})}),resetLevel1:()=>m("/level1",{method:"DELETE"}),presets:()=>m("/presets"),savePreset:(t,e)=>m("/presets/".concat(encodeURIComponent(t)),{method:"PUT",body:JSON.stringify({content:e})}),deletePreset:t=>m("/presets/".concat(encodeURIComponent(t)),{method:"DELETE"}),personas:()=>m("/personas"),savePersona:(t,e)=>m("/personas/".concat(encodeURIComponent(t)),{method:"PUT",body:JSON.stringify({content:e})}),deletePersona:t=>m("/personas/".concat(encodeURIComponent(t)),{method:"DELETE"}),sessions:()=>m("/sessions"),session:t=>m("/sessions/".concat(t)),createSession:(t,e)=>m("/sessions",{method:"POST",body:JSON.stringify({name:t,mirror:e})}),updateSession:(t,e)=>m("/sessions/".concat(t),{method:"PUT",body:JSON.stringify(e)}),deleteSession:t=>m("/sessions/".concat(t),{method:"DELETE"}),addTask:(t,e)=>m("/sessions/".concat(t,"/tasks"),{method:"POST",body:JSON.stringify(e)}),updateTask:(t,e,o)=>m("/sessions/".concat(t,"/tasks/").concat(e),{method:"PUT",body:JSON.stringify(o)}),deleteTask:(t,e)=>m("/sessions/".concat(t,"/tasks/").concat(e),{method:"DELETE"}),continueTask:(t,e)=>m("/sessions/".concat(t,"/tasks/").concat(e,"/continue"),{method:"POST",body:"{}"}),rerunTask:function(t,e){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return m("/sessions/".concat(t,"/tasks/").concat(e,"/rerun"),{method:"POST",body:JSON.stringify({...o,...n.buildOnFinished?{buildOnFinished:!0}:{}})})},taskChanges:(t,e,o)=>m("/sessions/".concat(t,"/tasks/").concat(e,"/changes").concat(o?"?run=".concat(encodeURIComponent(o)):"")),taskChangeFile:(t,e,o,n)=>m("/sessions/".concat(t,"/tasks/").concat(e,"/changes/file?path=").concat(encodeURIComponent(o)).concat(n?"&run=".concat(encodeURIComponent(n)):"")),taskStory:(t,e,o)=>m("/sessions/".concat(t,"/tasks/").concat(e,"/story").concat(o?"?run=".concat(encodeURIComponent(o)):"")),taskFiles:(t,e,o)=>m("/sessions/".concat(t,"/tasks/").concat(e,"/files").concat(o?"?run=".concat(encodeURIComponent(o)):"")),taskLogUrl:(t,e,o)=>"".concat(s,"/sessions/").concat(t,"/tasks/").concat(e,"/log").concat(o?"?run=".concat(encodeURIComponent(o)):""),taskFileUrl:(t,e,o,n,c)=>"".concat(s,"/sessions/").concat(t,"/tasks/").concat(e,"/files/").concat(o,"/").concat(encodeURIComponent(n)).concat(c?"?run=".concat(encodeURIComponent(c)):""),saveTaskLog:(t,e,o)=>m("/sessions/".concat(t,"/tasks/").concat(e,"/log").concat(o?"?run=".concat(encodeURIComponent(o)):""),{method:"POST",body:"{}"}),saveTaskFile:(t,e,o,n,s)=>m("/sessions/".concat(t,"/tasks/").concat(e,"/files/").concat(o,"/").concat(encodeURIComponent(n)).concat(s?"?run=".concat(encodeURIComponent(s)):""),{method:"POST",body:"{}"}),start:(t,e,o)=>m("/sessions/".concat(t,"/start"),{method:"POST",body:JSON.stringify({mode:e,name:o})}),stop:t=>m("/sessions/".concat(t,"/stop"),{method:"POST",body:"{}"}),approvals:t=>m("/approvals".concat(t?"?session=".concat(encodeURIComponent(t)):"")),decide:(t,e)=>m("/approvals/".concat(t),{method:"POST",body:JSON.stringify({action:e})}),setRunMode:(t,e)=>m("/sessions/".concat(t,"/mode"),{method:"POST",body:JSON.stringify({mode:e})}),streamUrl:t=>r("".concat(s,"/sessions/").concat(t,"/stream")),batch:()=>m("/batch").then(t=>null!=t?t:null),startBatch:(t,e,o,n,s,c,a)=>m("/batch/start",{method:"POST",body:JSON.stringify({sessionIds:t,mode:e,onFailure:o,model:n,reviewModel:s,name:c,taskIds:a})}),suggestedRunName:t=>m("/batch/name?sessions=".concat(encodeURIComponent(t.join(",")))),stopBatch:()=>m("/batch/stop",{method:"POST",body:"{}"}),pauseBatch:()=>m("/batch/pause",{method:"POST",body:"{}"}),resumeBatch:()=>m("/batch/resume",{method:"POST",body:"{}"}),planBrief:t=>m("/plan/brief?lang=".concat(encodeURIComponent(t))),context:(t,e)=>m("/context/".concat(t,"?lang=").concat(encodeURIComponent(e))),setContext:(t,e)=>m("/context/".concat(t),{method:"PUT",body:JSON.stringify({content:e})}),resetContext:(t,e)=>m("/context/".concat(t,"?lang=").concat(encodeURIComponent(e)),{method:"DELETE"}),checkPlan:t=>m("/plan/check",{method:"POST",body:JSON.stringify({text:t})}),importPlan:t=>m("/plan/import",{method:"POST",body:JSON.stringify({text:t})}),dirs:function(t){let e=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return m("/dirs?root=".concat(encodeURIComponent(t),"&gitignore=").concat(e?"1":"0"))},browseFolder:t=>m("/browse-folder",{method:"POST",body:JSON.stringify({start:t})}),previewMirror:t=>m("/mirror/preview",{method:"POST",body:JSON.stringify(t)}),tasks:()=>m("/tasks"),activity:()=>m("/activity"),downloadBundle:async t=>{var e,o,n;let c=await fetch("".concat(s,"/export/bundle"),{method:"POST",headers:{"content-type":"application/json",...i()?{"x-cop-token":i()}:{}},body:JSON.stringify({tasks:t})});if(!c.ok)throw Error(await c.text()||"".concat(c.status," ").concat(c.statusText));let a=null!=(n=c.headers.get("content-disposition"))?n:"",r=null==(e=/filename\*=UTF-8''([^;]+)/i.exec(a))?void 0:e[1],d=null==(o=/filename="([^"]+)"/i.exec(a))?void 0:o[1],l=null!=d?d:"copilot-operator-bundle.json";if(r)try{l=decodeURIComponent(r)}catch(t){}let u=URL.createObjectURL(await c.blob()),m=document.createElement("a");return m.href=u,m.download=l,document.body.appendChild(m),m.click(),m.remove(),setTimeout(()=>URL.revokeObjectURL(u),1e4),l},exportUrl:(t,e)=>{let o=new URLSearchParams;return e.run&&o.set("run",e.run),e.session&&o.set("session",e.session),e.task&&o.set("task",e.task),r("".concat(s,"/export/").concat(t,"?").concat(o.toString()))},debugExportUrl:t=>r("".concat(s,"/debug/export").concat(t.length>0?"?sessions=".concat(encodeURIComponent(t.join(","))):"")),vcsStatus:t=>m("/sessions/".concat(t,"/vcs")),restorePreview:(t,e)=>m("/sessions/".concat(t,"/tasks/").concat(e,"/restore")),restore:(t,e)=>m("/sessions/".concat(t,"/tasks/").concat(e,"/restore"),{method:"POST",body:"{}"}),restartPlan:(t,e)=>m("/sessions/".concat(t,"/tasks/").concat(e,"/restart")),restartFrom:function(t,e){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return m("/sessions/".concat(t,"/tasks/").concat(e,"/restart"),{method:"POST",body:JSON.stringify(o)})},repoCheck:t=>m("/repo?dir=".concat(encodeURIComponent(t))),project:()=>m("/project"),setProject:t=>m("/project",{method:"PUT",body:JSON.stringify(t)}),models:()=>m("/models"),setDefaultModel:t=>m("/models/default",{method:"PUT",body:JSON.stringify({model:t})}),setDefaultReviewModel:t=>m("/models/review-default",{method:"PUT",body:JSON.stringify({model:t})}),refreshModels:()=>m("/models/refresh",{method:"POST",body:"{}"})};function p(t){return t<1024?"".concat(t," B"):t<1048576?"".concat((t/1024).toFixed(1)," KB"):"".concat((t/1048576).toFixed(1)," MB")}function y(t){if(void 0===t)return"";let e=Math.round(t/1e3);if(e<60)return"".concat(e,"s");let o=Math.floor(e/60);return o<60?"".concat(o,"m ").concat(e%60,"s"):"".concat(Math.floor(o/60),"h ").concat(o%60,"m")}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[723],{1035:(e,t,n)=>{n.d(t,{DialogHost:()=>c,Z:()=>o});var s=n(3365),l=n(1521),a=n(867);let r=null,i=[];function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(n=>{var s;return s={kind:"confirm",message:e,...t,resolve:n},void(r?r(s):i.push(s))})}function c(e){var t,n;let{children:o}=e,{t:c}=(0,a.kj)(),[d,u]=(0,l.useState)([]),h=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(r=e=>u(t=>[...t,e]),i.length>0){let e=i.splice(0,i.length);u(t=>[...t,...e])}return()=>{r=null}},[]);let m=d[0],f=(0,l.useCallback)(e=>{m&&(m.resolve(e),u(e=>e.slice(1)))},[m]);return(0,l.useEffect)(()=>{var e;if(!m)return;null==(e=h.current)||e.focus();let t=e=>{"Escape"===e.key&&(e.preventDefault(),f(!1))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[m,f]),(0,s.jsxs)(s.Fragment,{children:[o,m&&(0,s.jsx)("div",{className:"modal-backdrop",onClick:()=>f(!1),role:"presentation",children:(0,s.jsxs)("div",{className:"modal".concat(m.danger?" danger":""),role:"confirm"===m.kind?"alertdialog":"dialog","aria-modal":"true","aria-labelledby":"modal-title",onClick:e=>e.stopPropagation(),children:[(0,s.jsx)("h2",{id:"modal-title",children:null!=(t=m.title)?t:c("confirm"===m.kind?"dialog.confirmTitle":"dialog.noticeTitle")}),(0,s.jsx)("div",{className:"modal-body",children:m.message}),(0,s.jsxs)("div",{className:"row modal-actions",children:["confirm"===m.kind&&(0,s.jsx)("button",{type:"button",className:"quiet",onClick:()=>f(!1),children:c("dialog.cancel")}),(0,s.jsx)("button",{ref:h,type:"button",className:m.danger?"danger":"primary",onClick:()=>f(!0),children:null!=(n=m.okLabel)?n:c("dialog.ok")})]})]})})]})}},1910:(e,t,n)=>{n.d(t,{H:()=>o,u:()=>i});var s=n(3365),l=n(1521),a=n(867),r=n(5549);function i(e){let{label:t,save:n}=e,{t:r}=(0,a.kj)(),[i,o]=(0,l.useState)(!1),[c,d]=(0,l.useState)(""),[u,h]=(0,l.useState)(!1),m=async()=>{o(!0),d("");try{var e;let t=await n();h(!1),d(t.revealed?r("save.done",{path:t.path}):r("save.savedOnly",{path:t.path,note:null!=(e=t.note)?e:""}))}catch(e){h(!0),d(r("save.failed",{problem:e.message}))}finally{o(!1)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{type:"button",className:"linkish",disabled:i,title:r("save.why"),onClick:()=>void m(),children:i?r("save.saving"):t}),c&&(0,s.jsx)("span",{className:u?"err small":"muted small",children:c})]})}function o(e){let{sessionId:t,taskId:n,attempt:i}=e,{t:o}=(0,a.kj)(),[c,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 r.FH.downloadBundle([{sessionId:t,taskId:n,attempt:i}]);f(!1),h(o("reg.bundleSaved",{name:e}))}catch(e){f(!0),h(o("save.failed",{problem:e.message}))}finally{d(!1)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{type:"button",className:"linkish",disabled:c,title:o("save.attemptRecordWhy"),onClick:()=>void p(),children:c?o("save.saving"):o("save.attemptRecord")}),u&&(0,s.jsx)("span",{className:m?"err small":"muted small",children:u})]})}},2876:(e,t,n)=>{n.d(t,{P:()=>d});var s=n(3365),l=n(1521),a=n(5549),r=n(867);function i(e,t){let[n,s]=(0,l.useState)(null),a=(0,l.useRef)(!0),[r,i]=(0,l.useState)(!0),o=(0,l.useCallback)(e=>s(e),[]);return(0,l.useLayoutEffect)(()=>{if(!n)return;let e=()=>{let e=n.scrollHeight-n.scrollTop-n.clientHeight<=24;a.current=e,i(e)};return n.addEventListener("scroll",e,{passive:!0}),()=>n.removeEventListener("scroll",e)},[n]),(0,l.useLayoutEffect)(()=>{n&&e&&a.current&&(n.scrollTop=n.scrollHeight)},[n,e,t]),{ref:o,following:r,follow:(0,l.useCallback)(()=>{a.current=!0,i(!0),n&&(n.scrollTop=n.scrollHeight)},[n])}}var o=n(5132);function c(e){let{text:t,follow:n}=e,{ref:l}=i(n,t);return(0,s.jsx)("pre",{ref:l,className:"story-out".concat(n?" terminal":""),children:t})}function d(e){let{sessionId:t,taskId:n,runId:d,live:u}=e,{t:h}=(0,r.kj)(),[m,f]=(0,l.useState)(null),[p,x]=(0,l.useState)(""),[g,v]=(0,l.useState)(!0),[j,y]=(0,l.useState)(!0),[k,b]=(0,l.useState)(new Set),[N,w]=(0,l.useState)(new Set),[S,C]=(0,l.useState)(new Set),E=!!(null==m?void 0:m.live),F=(0,l.useRef)(0);F.current+=1;let M=i(E,F.current),L=(0,l.useRef)(null),D=(0,l.useRef)(!1);if((0,l.useEffect)(()=>{if(!m)return;let e=[],t=(n,s)=>n.forEach((n,l)=>{let a="".concat(s).concat(l);"review"===n.kind?t(n.entries,"".concat(a,"-")):"step"!==n.kind||n.outcome||e.push(a)});t(m.entries,"e"),e.some(e=>!N.has(e))&&w(t=>new Set([...t,...e])),m.live&&!D.current&&L.current&&(D.current=!0,L.current.scrollIntoView({block:"nearest",behavior:"smooth"}))},[m,N]),(0,l.useEffect)(()=>{let e,s=!0,l=async()=>{try{let r=await a.FH.taskStory(t,n,d);if(!s)return;f(r),x(""),r.live&&(e=setTimeout(l,2e3))}catch(t){if(!s)return;x(t.message),u&&(e=setTimeout(l,2e3))}};return l(),()=>{s=!1,e&&clearTimeout(e)}},[t,n,d,u]),p&&!m)return(0,s.jsx)("div",{className:"err small",children:p});if(!m)return(0,s.jsx)("div",{className:"muted small",children:h("story.loading")});let H=e=>k.has(e)||N.has(e)&&!S.has(e),I=e=>{let t=H(e);b(n=>{let s=new Set(n);return t?s.delete(e):s.add(e),s}),C(n=>{let s=new Set(n);return t?s.add(e):s.delete(e),s})},R=(e,t)=>{if(!("review"===e.kind?g||j:"step"===e.kind?j:g))return null;if("review"===e.kind)return(0,s.jsxs)("li",{className:"story-review",children:[(0,s.jsx)("div",{className:"story-head",children:(0,s.jsx)("span",{className:"chip",children:h("story.review",{n:e.round})})}),(0,s.jsx)("ol",{className:"story",children:e.entries.map((e,n)=>R(e,"".concat(t,"-").concat(n)))})]},t);if("step"===e.kind){let n=H(t),l=!e.outcome&&m.live;return(0,s.jsxs)("li",{className:"story-step".concat(e.failed?" failed":""),children:[(0,s.jsxs)("div",{className:"story-head",children:[(0,s.jsx)("span",{className:"chip",children:h("story.step",{it:e.iteration,id:e.id})}),e.outcome&&(0,s.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,s.jsx)("span",{className:"badge running",children:h("story.running")}),e.failed&&(0,s.jsx)("span",{className:"badge failed",children:h("story.failedHere")})]}),(0,s.jsx)("pre",{className:"story-cmd",children:e.command}),e.output&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{type:"button",className:"linkish small",onClick:()=>I(t),children:n?h("story.hideOutput"):h("story.showOutput",{n:e.output.length})}),n&&(0,s.jsx)(c,{text:e.output,follow:l})]})]},t)}let n=k.has(t),l="sent"===e.kind?h("story.bot"):h("story.chat"),r="reply"===e.kind&&("blocked"===e.status||"failed"===e.status);return(0,s.jsxs)("li",{className:"story-msg ".concat(e.kind).concat(r?" failed":""),children:[(0,s.jsxs)("div",{className:"story-head",children:[(0,s.jsx)("strong",{children:l}),(0,s.jsx)("span",{className:"muted small",children:e.label}),"reply"===e.kind&&e.status&&(0,s.jsx)("span",{className:"badge ".concat(r?"failed":"done"===e.status?"done":""),children:e.status})]}),"reply"===e.kind&&e.notes&&(0,s.jsx)("p",{className:"story-notes",children:e.notes}),(0,s.jsx)("button",{type:"button",className:"linkish small",onClick:()=>I(t),children:n?h("story.hideText"):h("story.showText",{n:e.text.length})}),n&&(0,s.jsx)("pre",{className:"story-out",children:e.text})]},t)},T=m.close,q=T&&"done"!==T.status;return(0,s.jsxs)("div",{className:"story-box",ref:L,children:[(0,s.jsxs)("div",{className:"row small",style:{marginBottom:6},children:[(0,s.jsxs)("label",{className:"option-inline",children:[(0,s.jsx)("input",{type:"checkbox",checked:g,onChange:e=>v(e.target.checked)})," ",h("story.showChat")]}),(0,s.jsxs)("label",{className:"option-inline",children:[(0,s.jsx)("input",{type:"checkbox",checked:j,onChange:e=>y(e.target.checked)})," ",h("story.showCommands")]}),m.live&&(0,s.jsxs)("span",{className:"live",children:[(0,s.jsx)("span",{className:"dot","aria-hidden":"true"})," ",h("story.live")]}),m.live&&!M.following&&(0,s.jsx)("button",{type:"button",className:"quiet small",onClick:M.follow,title:h("story.followWhy"),children:h("story.follow")}),p&&(0,s.jsx)("span",{className:"err",children:p})]}),(0,s.jsxs)("div",{className:"story-fixed",children:[(0,s.jsx)("strong",{children:h("story.prompt")}),(0,s.jsx)("pre",{className:"story-out always",children:m.prompt})]}),(0,s.jsx)("div",{ref:M.ref,className:"story-scroll".concat(m.live?" live":""),children:(0,s.jsx)("ol",{className:"story",children:m.entries.map((e,t)=>R(e,"e".concat(t)))})}),T?(0,s.jsxs)("div",{className:"story-fixed close".concat(q?" failed":""),children:[(0,s.jsx)("strong",{children:q?h("story.endedBadly",{status:T.status}):h("story.ended")}),T.reason&&(0,s.jsx)("p",{className:"err small",children:T.reason}),T.summary&&(0,s.jsx)(o.s,{text:T.summary,className:"what"}),T.checks&&T.checks.length>0&&(0,s.jsx)("ul",{className:"small",style:{margin:"6px 0 0",paddingLeft:18},children:T.checks.map((e,t)=>(0,s.jsxs)("li",{className:e.passed?"":"err",children:[e.passed?"✓":"✗"," ",e.name,!e.passed&&e.detail?" — ".concat(e.detail):""]},t))})]}):(0,s.jsx)("div",{className:"story-fixed muted small",children:h("story.notEnded")})]})}},3041:(e,t,n)=>{n.d(t,{e:()=>i});var s=n(1521),l=n(5549),a=n(1035),r=n(867);function i(e){let{t}=(0,r.kj)(),[n,i]=(0,s.useState)(""),[o,c]=(0,s.useState)("");return{busy:n,message:o,clearMessage:()=>c(""),restore:(0,s.useCallback)(async n=>{i("restore"),c("");try{var s,r,o,d,u,h,m,f,p,x,g,v,j,y;let i=await l.FH.restorePreview(n.sessionId,n.taskId);if(!i.ok)return void c(t("restore.cannot",{problem:null!=(o=i.problem)?o:""}));let k={repo:i.repoDir,title:n.title,branch:null!=(d=i.branchName)?d:"",commit:(null!=(u=i.baseCommit)?u:"").slice(0,8)},b=i.leftBehind.length>0?t("restore.confirmLosing",{...k,n:i.leftBehind.length,kept:null!=(h=i.keptOn)?h:"",list:i.leftBehind.slice(0,10).join("\n")}):t("restore.confirm",k);if(!await (0,a.Z)(b))return;let N=await l.FH.restore(n.sessionId,n.taskId);if(!N.ok)return void c(t("restore.failed",{problem:null!=(m=N.problem)?m:""}));c((null!=(f=null==(s=N.leftBehind)?void 0:s.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==(r=N.leftBehind)?void 0:r.length)?g:0,kept:null!=(v=N.keptOn)?v:""}):t("restore.doneNothing",{branch:null!=(j=N.branch)?j:"",commit:(null!=(y=N.commit)?y:"").slice(0,8)})),e()}catch(e){c(e.message)}finally{i("")}},[t,e]),restartFrom:(0,s.useCallback)(async n=>{i("restart"),c("");try{var s,r;let i=await l.FH.restartPlan(n.sessionId,n.taskId);if(!i.ok)return void c(t("restart.cannot",{problem:null!=(s=i.problem)?s:""}));let o=i.restores.filter(e=>!e.ok);if(o.length>0)return void c(t("restart.cannot",{problem:o.map(e=>{var t;return"".concat(e.repoDir,": ").concat(null!=(t=e.problem)?t:"")}).join(" | ")}));let d=i.restores.map(e=>{var n,s,l;return t("restart.repoLine",{repo:e.repoDir,commit:(null!=(n=e.baseCommit)?n:"").slice(0,8),branch:null!=(s=e.branchName)?s:"",n:e.leftBehind.length,kept:null!=(l=e.keptOn)?l:""})}).join("\n"),u=i.tasks.map(e=>" ".concat(e.sessionName," / ").concat(e.title).concat(e.alreadyQueued?t("restart.alreadyQueued"):"")).join("\n"),h=t("restart.confirm",{title:i.from.title,tasks:i.tasks.length,sessions:i.sessions.length,list:u,repos:d||t("restart.noRepo"),mode:t("unattended"===i.mode?"run.unattended":"run.confirm")});if(!await (0,a.Z)(h))return;let m=await l.FH.restartFrom(n.sessionId,n.taskId);if(!m.started){c(t("restart.failed",{problem:null!=(r=m.reason)?r:""})),e();return}c(t("restart.started",{requeued:m.requeued,repos:m.restored.length})),e()}catch(e){c(e.message)}finally{i("")}},[t,e])}}},3374:(e,t,n)=>{n.d(t,{c:()=>l});var s=n(1521);function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,[n,l]=(0,s.useState)(()=>Date.now());return(0,s.useEffect)(()=>{if(!e)return;l(Date.now());let n=window.setInterval(()=>l(Date.now()),t);return()=>window.clearInterval(n)},[e,t]),n}},3523:(e,t,n)=>{function s(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now();if(!e)return;let s=Date.parse(e);if(Number.isNaN(s))return;let l=t?Date.parse(t):n;return Number.isNaN(l)?void 0:Math.max(0,l-s)}function l(e){return!!e.startedAt&&!e.finishedAt&&"queued"!==e.status}function a(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now(),s=t.some(e=>l(e)),a=t.map(e=>e.finishedAt?Date.parse(e.finishedAt):NaN).filter(e=>!Number.isNaN(e)),r=Date.parse(e.startedAt),i=s||0===a.length?n:Math.max(...a);return{ms:Number.isNaN(r)?0:Math.max(0,i-r),live:s,tasks:t.length}}function r(e){var t,n;let s=new Map;for(let n of e){if(!n.runGroup)continue;let e=null!=(t=s.get(n.runGroup.id))?t:{run:n.runGroup,tasks:[]};e.tasks.push(n),s.set(n.runGroup.id,e)}return null!=(n=[...s.values()].sort((e,t)=>Date.parse(t.run.startedAt)-Date.parse(e.run.startedAt))[0])?n:null}n.d(t,{DG:()=>l,d5:()=>s,eZ:()=>a,hH:()=>r})},4811:(e,t,n)=>{n.d(t,{p:()=>a});var s=n(1521),l=n(5549);function a(){let[e,t]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let e=!0;return l.FH.settings().then(n=>{var s;let l=null!=(s=n.raw.execution)?s:{};e&&t("unattended"===l.mode)}).catch(()=>void 0),()=>{e=!1}},[]),e}},5132:(e,t,n)=>{n.d(t,{s:()=>i});var s=n(3365),l=n(1521);function a(e,t){let n,l=[],a=/(`[^`\n]+`)|(\*\*[^*\n]+\*\*)|(\*[^*\n]+\*)/g,r=0,i=0;for(;null!==(n=a.exec(e));){n.index>r&&l.push(e.slice(r,n.index));let a=n[0],o="".concat(t,"-i").concat(i+=1);a.startsWith("`")?l.push((0,s.jsx)("code",{children:a.slice(1,-1)},o)):a.startsWith("**")?l.push((0,s.jsx)("strong",{children:a.slice(2,-2)},o)):l.push((0,s.jsx)("em",{children:a.slice(1,-1)},o)),r=n.index+a.length}return r<e.length&&l.push(e.slice(r)),l}function r(e){let t=/^\s*[-*•]\s+(.*)$/.exec(e);if(t)return t[1];let n=/^\s*\d+[.)]\s+(.*)$/.exec(e);return n?n[1]:null}function i(e){let{text:t,className:n}=e,i=[],o=t.replace(/\r\n/g,"\n").split("\n"),c=0,d=0;for(;c<o.length;){let e=o[c];if(e.trim().startsWith("```")){let e=[];for(c+=1;c<o.length&&!o[c].trim().startsWith("```");)e.push(o[c++]);c+=1,e.length>0&&i.push((0,s.jsx)("pre",{children:e.join("\n")},"b".concat(d+=1)));continue}if(null!==r(e)){let e=[];for(;c<o.length&&null!==r(o[c]);)e.push(r(o[c++]));i.push((0,s.jsx)("ul",{children:e.map((e,t)=>(0,s.jsx)("li",{children:a(e,"b".concat(d,"-").concat(t))},t))},"b".concat(d+=1)));continue}if(""===e.trim()){c+=1;continue}let t=[];for(;c<o.length&&""!==o[c].trim()&&null===r(o[c])&&!o[c].trim().startsWith("```");)t.push(o[c++]);let n=d+=1;i.push((0,s.jsx)("p",{children:t.map((e,t)=>(0,s.jsxs)(l.Fragment,{children:[t>0&&(0,s.jsx)("br",{}),a(e,"b".concat(n,"-").concat(t))]},t))},"b".concat(n)))}return(0,s.jsx)("div",{className:"rich ".concat(null!=n?n:""),children:i})}},8934:(e,t,n)=>{n.d(t,{C:()=>o});var s=n(3365),l=n(1521),a=n(5549),r=n(867);function i(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:n,runId:a,title:i,files:o}=e,{t:d}=(0,r.kj)(),[u,h]=(0,l.useState)(!1);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{type:"button",className:"linkish",onClick:()=>h(!0),title:d("diff.openWhy"),children:d("diff.open",{n:o})}),u&&(0,s.jsx)(c,{sessionId:t,taskId:n,runId:a,title:i,onClose:()=>h(!1)})]})}function c(e){var t,n,o,c,u,h,m;let{sessionId:f,taskId:p,runId:x,title:g,onClose:v}=e,{t:j}=(0,r.kj)(),[y,k]=(0,l.useState)(null),[b,N]=(0,l.useState)(""),[w,S]=(0,l.useState)(0),[C,E]=(0,l.useState)(new Map),[F,M]=(0,l.useState)(!1),[L,D]=(0,l.useState)(!0),[H,I]=(0,l.useState)(new Map),[R,T]=(0,l.useState)(-1),q=(0,l.useRef)(null);(0,l.useEffect)(()=>{a.FH.taskChanges(f,p,x).then(k).catch(e=>N(e.message))},[f,p,x]);let A=null!=(o=null==y?void 0:y.files)?o:[],B=A[w];(0,l.useEffect)(()=>{!B||C.has(B.path)||a.FH.taskChangeFile(f,p,B.path,x).then(e=>E(t=>new Map(t).set(B.path,e))).catch(e=>E(t=>new Map(t).set(B.path,e.message)))},[B,C,f,p,x]);let P=B?C.get(B.path):void 0,W=(0,l.useMemo)(()=>!P||"string"==typeof P||P.binary||P.tooLarge?[]:function(e,t){let n=function(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n+=1;let s=e.length,l=t.length;for(;s>n&&l>n&&e[s-1]===t[l-1];)s-=1,l-=1;let a=[];for(let e=0;e<n;e+=1)a.push({kind:"same",a:e,b:e});for(let r of function(e,t){let n=e.length,s=t.length;if(0===n)return t.map((e,t)=>({kind:"add",b:t}));if(0===s)return e.map((e,t)=>({kind:"del",a:t}));let l=n+s,a=l+1,r=new Int32Array(2*l+3),i=[];for(let o=0;o<=Math.min(l,2e3);o+=1){i.push(r.slice(a-o-1,a+o+2));for(let l=-o;l<=o;l+=2){let c=l===-o||l!==o&&r[a+l-1]<r[a+l+1]?r[a+l+1]:r[a+l-1]+1,d=c-l;for(;c<n&&d<s&&e[c]===t[d];)c+=1,d+=1;if(r[a+l]=c,c>=n&&d>=s)return function(e,t,n,s){let l=[],a=t.length,r=n.length;for(let t=s;t>0;t-=1){let n=e[t],s=e=>n[e+t+1],i=a-r,o=i===-t||i!==t&&s(i-1)<s(i+1)?i+1:i-1,c=s(o),d=c-o;for(;a>c&&r>d;)a-=1,r-=1,l.push({kind:"same",a:a,b:r});a===c?l.push({kind:"add",b:d}):l.push({kind:"del",a:c}),a=c,r=d}for(;a>0&&r>0;)a-=1,r-=1,l.push({kind:"same",a:a,b:r});return l.reverse()}(i,e,t,o)}}return[...e.map((e,t)=>({kind:"del",a:t})),...t.map((e,t)=>({kind:"add",b:t}))]}(e.slice(n,s),t.slice(n,l)))a.push({kind:r.kind,...void 0!==r.a?{a:r.a+n}:{},...void 0!==r.b?{b:r.b+n}:{}});for(let t=0;s+t<e.length;t+=1)a.push({kind:"same",a:s+t,b:l+t});return a}(e,t),s=[];for(let l=0;l<n.length;){let a=n[l];if("same"===a.kind){s.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 r=[],i=[];for(;l<n.length&&"same"!==n[l].kind;){let e=n[l];"del"===e.kind?r.push(e.a):i.push(e.b),l+=1}let o=Math.max(r.length,i.length);for(let n=0;n<o;n+=1){let l=r[n],a=i[n];s.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 s}(i(P.before),i(P.after)),[P]),O=B&&H.get(B.path)||new Set,G=(0,l.useMemo)(()=>(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(s)return e.map((e,t)=>({type:"row",row:e,index:t}));let l=[];for(let s=0;s<e.length;){if("same"!==e[s].kind){l.push({type:"row",row:e[s],index:s}),s+=1;continue}let a=s;for(;a<e.length&&"same"===e[a].kind;)a+=1;let r=0===s?0:t,i=a===e.length?0:t,o=a-s-r-i;if(o>1&&!n.has(s+r)){for(let t=s;t<s+r;t+=1)l.push({type:"row",row:e[t],index:t});l.push({type:"gap",from:s+r,count:o});for(let t=a-i;t<a;t+=1)l.push({type:"row",row:e[t],index:t})}else for(let t=s;t<a;t+=1)l.push({type:"row",row:e[t],index:t});s=a}return l})(W,3,O,F),[W,O,F]),Z=(0,l.useMemo)(()=>W.flatMap((e,t)=>"same"!==e.kind&&(0===t||"same"===W[t-1].kind)?[t]:[]),[W]);(0,l.useEffect)(()=>{T(-1),q.current&&(q.current.scrollTop=0)},[w]);let _=(0,l.useCallback)(e=>{var t;if(0===Z.length)return;let n=R<0?1===e?0:Z.length-1:Math.min(Z.length-1,Math.max(0,R+e));T(n);let s=null==(t=q.current)?void 0:t.querySelector('[data-row="'.concat(Z[n],'"]'));null==s||s.scrollIntoView({block:"center"})},[R,Z]),K=(0,l.useCallback)(e=>S(t=>Math.min(Math.max(0,t+e),Math.max(0,A.length-1))),[A.length]);(0,l.useEffect)(()=>{let e=e=>{if(!e.ctrlKey&&!e.metaKey&&!e.altKey){if("Escape"===e.key)v();else if("n"===e.key)_(1);else if("p"===e.key)_(-1);else if("]"===e.key)K(1);else{if("["!==e.key)return;K(-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,v]);let Q=A.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,s.jsxs)("div",{className:"diff-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"diff-title",children:[(0,s.jsxs)("div",{className:"diff-head",children:[(0,s.jsx)("h2",{id:"diff-title",children:j("diff.title",{title:g})}),(null==y?void 0:y.ok)&&(0,s.jsxs)("span",{className:"muted small",children:[y.branch?"".concat(y.branch," \xb7 "):"",null==(t=y.base)?void 0:t.slice(0,8)," → ",null==(n=y.commit)?void 0:n.slice(0,8)," \xb7 ",j("diff.summary",{n:A.length,a:Q.added,r:Q.removed})]}),(0,s.jsx)("span",{className:"grow"}),(0,s.jsx)("span",{className:"muted small",children:j("diff.keys")}),(0,s.jsx)("button",{type:"button",onClick:v,children:j("diff.close")})]}),b&&(0,s.jsx)("div",{className:"err",style:{padding:12},children:b}),!y&&!b&&(0,s.jsx)("div",{className:"muted",style:{padding:12},children:j("diff.loading")}),y&&!y.ok&&(0,s.jsx)("div",{className:"notice caution",style:{margin:12},children:y.problem}),(null==y?void 0:y.ok)&&0===A.length&&(0,s.jsx)("div",{className:"notice",style:{margin:12},children:j("diff.nothing")}),(null==y?void 0:y.ok)&&A.length>0&&(0,s.jsxs)("div",{className:"diff-body",children:[(0,s.jsx)("nav",{className:"diff-files","aria-label":j("diff.files"),children:A.map((e,t)=>{let n=e.path.lastIndexOf("/");return(0,s.jsxs)("button",{type:"button",className:"diff-file".concat(t===w?" on":""),onClick:()=>S(t),title:e.oldPath?"".concat(e.oldPath," → ").concat(e.path):e.path,children:[(0,s.jsx)("span",{className:"diff-status s-".concat(e.status),children:e.status}),(0,s.jsxs)("span",{className:"diff-path",children:[n>=0&&(0,s.jsx)("span",{className:"muted",children:e.path.slice(0,n+1)}),(0,s.jsx)("strong",{children:e.path.slice(n+1)})]}),(0,s.jsx)("span",{className:"diff-counts",children:e.added<0?j("diff.binaryShort"):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("span",{className:"plus",children:["+",e.added]})," ",(0,s.jsxs)("span",{className:"minus",children:["−",e.removed]})]})})]},e.path)})}),(0,s.jsxs)("div",{className:"diff-main",children:[B&&(0,s.jsxs)("div",{className:"diff-toolbar",children:[(0,s.jsx)("strong",{className:"diff-name",children:B.oldPath?"".concat(B.oldPath," → ").concat(B.path):B.path}),(0,s.jsx)("span",{className:"muted small",children:"A"===B.status?j("diff.added"):"D"===B.status?j("diff.deleted"):"R"===B.status?j("diff.renamed"):""}),(0,s.jsx)("span",{className:"grow"}),(0,s.jsx)("button",{type:"button",className:"quiet",onClick:()=>_(-1),disabled:0===Z.length,children:j("diff.prevChange")}),(0,s.jsx)("button",{type:"button",className:"quiet",onClick:()=>_(1),disabled:0===Z.length,children:j("diff.nextChange")}),(0,s.jsx)("span",{className:"muted small",children:Z.length>0?j("diff.changeN",{i:R<0?"–":R+1,n:Z.length}):""}),(0,s.jsx)("button",{type:"button",className:"quiet",onClick:()=>K(-1),disabled:0===w,children:j("diff.prevFile")}),(0,s.jsx)("button",{type:"button",className:"quiet",onClick:()=>K(1),disabled:w>=A.length-1,children:j("diff.nextFile")}),(0,s.jsxs)("label",{className:"option-inline",children:[(0,s.jsx)("input",{type:"checkbox",checked:F,onChange:e=>M(e.target.checked)})," ",j("diff.whole")]}),(0,s.jsxs)("label",{className:"option-inline",children:[(0,s.jsx)("input",{type:"checkbox",checked:L,onChange:e=>D(e.target.checked)})," ",j("diff.wrap")]})]}),(0,s.jsxs)("div",{className:"diff-scroll",ref:q,children:[void 0===P&&(0,s.jsx)("div",{className:"muted",style:{padding:12},children:j("diff.loading")}),"string"==typeof P&&(0,s.jsx)("div",{className:"err",style:{padding:12},children:P}),P&&"string"!=typeof P&&P.binary&&(0,s.jsx)("div",{className:"notice",style:{margin:12},children:j("diff.binary")}),P&&"string"!=typeof P&&P.tooLarge&&(0,s.jsx)("div",{className:"notice",style:{margin:12},children:j("diff.tooLarge")}),P&&"string"!=typeof P&&!P.binary&&!P.tooLarge&&(0,s.jsxs)(s.Fragment,{children:[(null!=(c=P.before)?c:"").includes("\r\n")!==(null!=(u=P.after)?u:"").includes("\r\n")&&null!==P.before&&null!==P.after&&(0,s.jsx)("div",{className:"notice small",style:{margin:8},children:j("diff.eol",{from:(null!=(h=P.before)?h:"").includes("\r\n")?"CRLF":"LF",to:(null!=(m=P.after)?m:"").includes("\r\n")?"CRLF":"LF"})}),W.length>0&&0===Z.length&&(0,s.jsx)("div",{className:"notice small",style:{margin:8},children:j("diff.sameText")}),(0,s.jsxs)("table",{className:"diff-table".concat(L?"":" nowrap"),children:[(0,s.jsxs)("colgroup",{children:[(0,s.jsx)("col",{className:"num"}),(0,s.jsx)("col",{}),(0,s.jsx)("col",{className:"num"}),(0,s.jsx)("col",{})]}),(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{colSpan:2,children:j("diff.before")}),(0,s.jsx)("th",{colSpan:2,children:j("diff.after")})]})}),(0,s.jsx)("tbody",{children:G.map(e=>"gap"===e.type?(0,s.jsx)("tr",{className:"diff-gap",children:(0,s.jsx)("td",{colSpan:4,children:(0,s.jsx)("button",{type:"button",className:"linkish small",onClick:()=>{var t;return t=e.from,void(B&&I(e=>{var n;return new Map(e).set(B.path,new Set([...null!=(n=e.get(B.path))?n:[],t]))}))},children:j("diff.gap",{n:e.count})})})},"g".concat(e.from)):(0,s.jsx)(d,{row:e.row,index:e.index,current:R>=0&&Z[R]===e.index},e.index))})]})]})]})]})]})]})}function d(e){var t,n,a,r;let{row:i,index:o,current:c}=e,d="change"===i.kind?function(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n+=1;let s=e.length,l=t.length;for(;s>n&&l>n&&e[s-1]===t[l-1];)s-=1,l-=1;return{start:n,leftEnd:s,rightEnd:l}}(i.left.text,i.right.text):null,u=e=>{let t=i[e];if(!t)return null;if(!d)return t.text;let n="left"===e?d.leftEnd:d.rightEnd;return(0,s.jsxs)(l.Fragment,{children:[t.text.slice(0,d.start),(0,s.jsx)("mark",{children:t.text.slice(d.start,n)}),t.text.slice(n)]})};return(0,s.jsxs)("tr",{className:"diff-row ".concat(i.kind).concat(c?" current":""),"data-row":o,children:[(0,s.jsx)("td",{className:"num",children:null!=(a=null==(t=i.left)?void 0:t.no)?a:""}),(0,s.jsx)("td",{className:"code l".concat(i.left?"":" empty"),children:u("left")}),(0,s.jsx)("td",{className:"num",children:null!=(r=null==(n=i.right)?void 0:n.no)?r:""}),(0,s.jsx)("td",{className:"code r".concat(i.right?"":" empty"),children:u("right")})]})}}}]);
|