copilot-operator 0.1.11 → 0.1.12
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 +1 -1
- package/dist/src/api/operator.service.js +64 -6
- package/dist/src/config/schema.js +14 -3
- package/dist/src/context/desktopMirror.js +34 -12
- package/dist/src/context/projectMirror.js +69 -1
- package/dist/src/orchestrator/contract.js +56 -1
- package/dist/src/orchestrator/taskRunner.js +116 -11
- package/dist/src/plan/brief.js +20 -8
- package/dist/src/plan/systemGuide.js +42 -10
- package/dist/src/session/compose.js +16 -1
- package/dist/src/session/exportRecord.js +8 -1
- package/dist/src/session/handoff.js +41 -3
- package/dist/src/session/model.js +9 -0
- package/dist/src/session/store.js +11 -7
- package/dist/src/session/story.js +74 -18
- package/dist/src/transport/chatTransport.js +1 -0
- package/dist/src/transport/copilotTransport.js +80 -61
- package/dist/src/vcs/git.js +15 -0
- package/dist/src/vcs/taskVcs.js +29 -6
- package/dist/web/404.html +2 -2
- package/dist/web/_next/static/chunks/36-c3dd06c6a459c114.js +1 -0
- package/dist/web/_next/static/chunks/549-a5a59a94f92bb3eb.js +1 -0
- package/dist/web/_next/static/chunks/867-b64c436f5b25f39e.js +1 -0
- package/dist/web/_next/static/chunks/app/defaults/page-5f180a88398be4c9.js +1 -0
- package/dist/web/_next/static/chunks/app/history/page-854e3dde672e38a2.js +1 -0
- package/dist/web/_next/static/chunks/app/page-13572a726de0b7db.js +1 -0
- package/dist/web/_next/static/chunks/app/sessions/view/{page-d7e1f83d13c6356b.js → page-cc99401da5173b36.js} +1 -1
- package/dist/web/_next/static/css/{2ad2a74b7e07dcc9.css → a0642fdb8adf9edb.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 +6 -3
- package/dist/web/_next/static/chunks/36-17a3bcb0c2553c7c.js +0 -1
- package/dist/web/_next/static/chunks/549-8f69ef8086802748.js +0 -1
- package/dist/web/_next/static/chunks/867-f82c74b7b2ed5c54.js +0 -1
- package/dist/web/_next/static/chunks/app/defaults/page-abfa73fb08822e36.js +0 -1
- package/dist/web/_next/static/chunks/app/history/page-a9f2060f86a4a10e.js +0 -1
- package/dist/web/_next/static/chunks/app/page-2ac6b67f4ddcb808.js +0 -1
- /package/dist/web/_next/static/{oyfXbuB_cq0sRZP7ukHlQ → bcBE4tY_aNh6kzLzN1luP}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{oyfXbuB_cq0sRZP7ukHlQ → bcBE4tY_aNh6kzLzN1luP}/_ssgManifest.js +0 -0
|
@@ -12,9 +12,42 @@
|
|
|
12
12
|
* Nothing here is inferred. An entry is a file, or a section of the task log, or a field of
|
|
13
13
|
* the task record; the reader decides what it means.
|
|
14
14
|
*/
|
|
15
|
-
import { readdir,
|
|
15
|
+
import { readFile, readdir, stat } from 'node:fs/promises';
|
|
16
16
|
import { join } from 'node:path';
|
|
17
17
|
const MAX_TEXT = 60_000;
|
|
18
|
+
/*
|
|
19
|
+
* When each thing happened.
|
|
20
|
+
*
|
|
21
|
+
* Every entry of the story is a file the runner wrote at the moment it happened: a reply is saved
|
|
22
|
+
* as it arrives, a step's log is opened as the step starts, a results file is written just before
|
|
23
|
+
* it is sent. So a file's creation time is the entry's time, for runs recorded long before anyone
|
|
24
|
+
* asked for times as much as for new ones — nothing had to be recorded differently. The modification
|
|
25
|
+
* time is the fallback on a file system that keeps no creation time. The opening message has no file
|
|
26
|
+
* of its own and takes its time from the transcript's first "message-sent".
|
|
27
|
+
*/
|
|
28
|
+
async function createdAt(path) {
|
|
29
|
+
const info = await stat(path).catch(() => null);
|
|
30
|
+
if (!info)
|
|
31
|
+
return undefined;
|
|
32
|
+
const ms = info.birthtimeMs > 0 ? info.birthtimeMs : info.mtimeMs;
|
|
33
|
+
return new Date(ms).toISOString();
|
|
34
|
+
}
|
|
35
|
+
async function firstSentAt(dir) {
|
|
36
|
+
const text = await readFile(join(dir, 'transcript.jsonl'), 'utf8').catch(() => '');
|
|
37
|
+
for (const line of text.split('\n')) {
|
|
38
|
+
if (!line.includes('"message-sent"'))
|
|
39
|
+
continue;
|
|
40
|
+
try {
|
|
41
|
+
const e = JSON.parse(line);
|
|
42
|
+
if (e.type === 'message-sent' && e.at)
|
|
43
|
+
return e.at;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
/* a line cut off by a crash */
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
18
51
|
function clip(text) {
|
|
19
52
|
return text.length > MAX_TEXT ? `${text.slice(0, MAX_TEXT)}\n… (${text.length - MAX_TEXT} more characters in the run folder)` : text;
|
|
20
53
|
}
|
|
@@ -73,6 +106,7 @@ async function stepsIn(dir) {
|
|
|
73
106
|
const iteration = Number(m[1]);
|
|
74
107
|
const parsed = parseStepLog(await readFile(join(dir, name), 'utf8').catch(() => ''));
|
|
75
108
|
const entry = {
|
|
109
|
+
at: await createdAt(join(dir, name)),
|
|
76
110
|
kind: 'step',
|
|
77
111
|
iteration,
|
|
78
112
|
id: Number(m[2]),
|
|
@@ -103,21 +137,41 @@ async function reviewRound(dir, round) {
|
|
|
103
137
|
const read = async (name) => clip(await readFile(join(dir, name), 'utf8').catch(() => ''));
|
|
104
138
|
const names = (await readdir(dir).catch(() => [])).sort();
|
|
105
139
|
if (names.includes('00-brief.md'))
|
|
106
|
-
entries.push({ kind: 'sent', iteration: 0, label: 'brief', text: await read('00-brief.md') });
|
|
140
|
+
entries.push({ kind: 'sent', iteration: 0, label: 'brief', text: await read('00-brief.md'), at: await createdAt(join(dir, '00-brief.md')) });
|
|
107
141
|
const steps = await stepsIn(join(dir, 'steps'));
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
142
|
+
/*
|
|
143
|
+
* The replies, by what they answer. `00-opening.md` is the answer to the brief — the one that
|
|
144
|
+
* proposes the first steps — and `NN-review.md` the answer to the results of iteration NN (the
|
|
145
|
+
* review saves it after sending them). So after reply k come the steps of iteration k + 1 and
|
|
146
|
+
* their results, then reply k + 1. The story used to read only the `NN-review` files and put each
|
|
147
|
+
* before the steps it came after; the times on the entries are what showed it.
|
|
148
|
+
*/
|
|
149
|
+
const replyFor = new Map();
|
|
150
|
+
if (names.includes('00-opening.md'))
|
|
151
|
+
replyFor.set(0, '00-opening.md');
|
|
152
|
+
for (const n of names) {
|
|
153
|
+
const m = n.match(/^(\d+)-review\.md$/);
|
|
154
|
+
if (m)
|
|
155
|
+
replyFor.set(Number(m[1]), n);
|
|
156
|
+
}
|
|
157
|
+
const last = Math.max(0, ...replyFor.keys(), ...steps.keys());
|
|
158
|
+
for (let k = 0; k <= last; k += 1) {
|
|
159
|
+
const name = replyFor.get(k);
|
|
160
|
+
if (name) {
|
|
161
|
+
const text = await read(name);
|
|
162
|
+
entries.push({ kind: 'reply', iteration: k, label: `review ${round}, reply ${k + 1}`, text, ...parseReply(text), at: await createdAt(join(dir, name)) });
|
|
163
|
+
}
|
|
164
|
+
for (const step of steps.get(k + 1) ?? [])
|
|
114
165
|
entries.push(step);
|
|
115
|
-
if (names.includes(`iteration-${
|
|
116
|
-
entries.push({ kind: 'sent', iteration:
|
|
166
|
+
if (names.includes(`iteration-${k + 1}.txt`)) {
|
|
167
|
+
entries.push({ kind: 'sent', iteration: k + 1, label: `results ${k + 1}`, text: await read(`iteration-${k + 1}.txt`), at: await createdAt(join(dir, `iteration-${k + 1}.txt`)) });
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const replies = [...replyFor.values()];
|
|
171
|
+
if (names.includes('findings-sent.md')) {
|
|
172
|
+
entries.push({ kind: 'sent', iteration: replies.length, label: 'findings sent to the implementer', text: await read('findings-sent.md'), at: await createdAt(join(dir, 'findings-sent.md')) });
|
|
117
173
|
}
|
|
118
|
-
|
|
119
|
-
entries.push({ kind: 'sent', iteration: replies.length, label: 'findings sent to the implementer', text: await read('findings-sent.md') });
|
|
120
|
-
return { kind: 'review', round, entries };
|
|
174
|
+
return { kind: 'review', round, entries, at: entries.find((e) => e.at)?.at };
|
|
121
175
|
}
|
|
122
176
|
export async function buildStory(runsDir, runId, task, live) {
|
|
123
177
|
const dir = join(runsDir, runId);
|
|
@@ -126,7 +180,9 @@ export async function buildStory(runsDir, runId, task, live) {
|
|
|
126
180
|
const entries = [];
|
|
127
181
|
const opening = sections.find((s) => s.name === 'OPENING MESSAGE');
|
|
128
182
|
if (opening)
|
|
129
|
-
entries.push({ kind: 'sent', iteration: 0, label: 'opening message', text: clip(opening.text) });
|
|
183
|
+
entries.push({ kind: 'sent', iteration: 0, label: 'opening message', text: clip(opening.text), at: (await firstSentAt(dir)) ?? task.startedAt });
|
|
184
|
+
/** The results file of iteration k, as the report writer names it by default; its creation is when it was sent. */
|
|
185
|
+
const resultsAt = async (k) => await createdAt(join(dir, 'reports', `iteration-${k}.txt`));
|
|
130
186
|
const steps = await stepsIn(join(dir, 'steps'));
|
|
131
187
|
const reports = new Map();
|
|
132
188
|
for (const s of sections) {
|
|
@@ -161,7 +217,7 @@ export async function buildStory(runsDir, runId, task, live) {
|
|
|
161
217
|
for (const step of steps.get(k) ?? [])
|
|
162
218
|
entries.push(step);
|
|
163
219
|
if (reports.has(k))
|
|
164
|
-
entries.push({ kind: 'sent', iteration: k, label: `results ${k}`, text: clip(reports.get(k)) });
|
|
220
|
+
entries.push({ kind: 'sent', iteration: k, label: `results ${k}`, text: clip(reports.get(k)), at: await resultsAt(k) });
|
|
165
221
|
lastIteration = k;
|
|
166
222
|
}
|
|
167
223
|
else if (rv) {
|
|
@@ -170,14 +226,14 @@ export async function buildStory(runsDir, runId, task, live) {
|
|
|
170
226
|
for (const step of steps.get(lastIteration + 1) ?? [])
|
|
171
227
|
entries.push(step);
|
|
172
228
|
if (reports.has(lastIteration + 1))
|
|
173
|
-
entries.push({ kind: 'sent', iteration: lastIteration + 1, label: `results ${lastIteration + 1}`, text: clip(reports.get(lastIteration + 1)) });
|
|
229
|
+
entries.push({ kind: 'sent', iteration: lastIteration + 1, label: `results ${lastIteration + 1}`, text: clip(reports.get(lastIteration + 1)), at: await resultsAt(lastIteration + 1) });
|
|
174
230
|
lastIteration += reports.has(lastIteration + 1) ? 1 : 0;
|
|
175
231
|
if (!placedReviews.has(round)) {
|
|
176
232
|
entries.push(await reviewRound(join(dir, 'review', String(round)), round));
|
|
177
233
|
placedReviews.add(round);
|
|
178
234
|
}
|
|
179
235
|
}
|
|
180
|
-
entries.push({ kind: 'reply', iteration: it ? Number(it[1]) : 0, label, text, ...parsed });
|
|
236
|
+
entries.push({ kind: 'reply', iteration: it ? Number(it[1]) : 0, label, text, ...parsed, at: await createdAt(join(dir, 'replies', name)) });
|
|
181
237
|
}
|
|
182
238
|
// Steps and results after the last reply (a task that ended without another reply), and
|
|
183
239
|
// review rounds nobody replied to yet (one still going, or the last one that passed).
|
|
@@ -186,7 +242,7 @@ export async function buildStory(runsDir, runId, task, live) {
|
|
|
186
242
|
for (const step of list)
|
|
187
243
|
entries.push(step);
|
|
188
244
|
if (reports.has(k))
|
|
189
|
-
entries.push({ kind: 'sent', iteration: k, label: `results ${k}`, text: clip(reports.get(k)) });
|
|
245
|
+
entries.push({ kind: 'sent', iteration: k, label: `results ${k}`, text: clip(reports.get(k)), at: await resultsAt(k) });
|
|
190
246
|
}
|
|
191
247
|
}
|
|
192
248
|
for (const round of reviewDirs) {
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
* running in this process — a check script — can call `setTransportFactory`.
|
|
21
21
|
*/
|
|
22
22
|
import { CopilotTransport } from './copilotTransport.js';
|
|
23
|
+
export { ReplyTimeoutError, isReplyTimeout } from './copilotTransport.js';
|
|
23
24
|
const realChat = (opts) => new CopilotTransport(opts);
|
|
24
25
|
let factory = realChat;
|
|
25
26
|
/** A chat for these options: the real Copilot window, unless a check has put a scripted one in. */
|
|
@@ -18,6 +18,25 @@ import { landed } from './acceptance.js';
|
|
|
18
18
|
import { Blocker, Css, Label, Model, Rename, Sidebar, Signal, Surface, TestId, Upload, Url } from './locators.js';
|
|
19
19
|
import { acquireProfileLock } from './profileLock.js';
|
|
20
20
|
import { parseChatId } from './chatSession.js';
|
|
21
|
+
/**
|
|
22
|
+
* The chat did not finish a reply within `copilot.replyTimeoutSec`.
|
|
23
|
+
*
|
|
24
|
+
* Its own class because it is a limit from the settings, not a fault: the runner ends the task
|
|
25
|
+
* `limit-reached` on it, so "Continue" carries the task on in the same chat, where the reply may
|
|
26
|
+
* well have finished by then. Any other error from the transport still fails the task.
|
|
27
|
+
*/
|
|
28
|
+
export class ReplyTimeoutError extends Error {
|
|
29
|
+
seconds;
|
|
30
|
+
constructor(seconds, message) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.seconds = seconds;
|
|
33
|
+
this.name = 'ReplyTimeoutError';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** Recognised by name as well: a copy of this module loaded twice makes `instanceof` miss its own class. */
|
|
37
|
+
export function isReplyTimeout(e) {
|
|
38
|
+
return e instanceof ReplyTimeoutError || (e instanceof Error && e.name === 'ReplyTimeoutError' && typeof e.seconds === 'number');
|
|
39
|
+
}
|
|
21
40
|
const ORIGIN = 'https://m365.cloud.microsoft';
|
|
22
41
|
/** Escapes a model name so it can be matched literally inside a regular expression. */
|
|
23
42
|
function escapeForRegExp(text) {
|
|
@@ -57,65 +76,65 @@ export class SendRejectedError extends Error {
|
|
|
57
76
|
* impossible — the runner notes it before the click and waits for it to move, so a copy that
|
|
58
77
|
* did not happen reads as a failure rather than as the previous answer.
|
|
59
78
|
*/
|
|
60
|
-
export const CLIPBOARD_GUARD = `(() => {
|
|
61
|
-
const state = { text: '', seq: 0 };
|
|
62
|
-
try {
|
|
63
|
-
Object.defineProperty(window, '__copClipboard', { value: state, enumerable: false });
|
|
64
|
-
} catch (e) {
|
|
65
|
-
window.__copClipboard = state;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const remember = (text) => {
|
|
69
|
-
if (typeof text !== 'string' || text.length === 0) return;
|
|
70
|
-
state.text = text;
|
|
71
|
-
state.seq += 1;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const clip = navigator.clipboard;
|
|
75
|
-
if (clip) {
|
|
76
|
-
try {
|
|
77
|
-
Object.defineProperty(clip, 'writeText', {
|
|
78
|
-
configurable: true,
|
|
79
|
-
writable: true,
|
|
80
|
-
value: (text) => {
|
|
81
|
-
remember(String(text));
|
|
82
|
-
return Promise.resolve();
|
|
83
|
-
},
|
|
84
|
-
});
|
|
85
|
-
} catch (e) { /* a frame that will not let its clipboard be replaced reads as a failure later */ }
|
|
86
|
-
|
|
87
|
-
try {
|
|
88
|
-
Object.defineProperty(clip, 'write', {
|
|
89
|
-
configurable: true,
|
|
90
|
-
writable: true,
|
|
91
|
-
value: async (items) => {
|
|
92
|
-
for (const item of items || []) {
|
|
93
|
-
try {
|
|
94
|
-
if (item && item.types && item.types.indexOf('text/plain') >= 0) {
|
|
95
|
-
remember(await (await item.getType('text/plain')).text());
|
|
96
|
-
}
|
|
97
|
-
} catch (e) { /* one unreadable item is not a reason to drop the rest */ }
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
} catch (e) { /* as above */ }
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// The old way: select text in a hidden field, then execCommand('copy'). The selection is
|
|
105
|
-
// exactly the text being copied, so it is taken and the command is never run.
|
|
106
|
-
try {
|
|
107
|
-
const realExec = document.execCommand.bind(document);
|
|
108
|
-
document.execCommand = (command, ...rest) => {
|
|
109
|
-
if (String(command).toLowerCase() === 'copy') {
|
|
110
|
-
const selected = String(window.getSelection() || '');
|
|
111
|
-
if (selected.length > 0) {
|
|
112
|
-
remember(selected);
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return realExec(command, ...rest);
|
|
117
|
-
};
|
|
118
|
-
} catch (e) { /* as above */ }
|
|
79
|
+
export const CLIPBOARD_GUARD = `(() => {
|
|
80
|
+
const state = { text: '', seq: 0 };
|
|
81
|
+
try {
|
|
82
|
+
Object.defineProperty(window, '__copClipboard', { value: state, enumerable: false });
|
|
83
|
+
} catch (e) {
|
|
84
|
+
window.__copClipboard = state;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const remember = (text) => {
|
|
88
|
+
if (typeof text !== 'string' || text.length === 0) return;
|
|
89
|
+
state.text = text;
|
|
90
|
+
state.seq += 1;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const clip = navigator.clipboard;
|
|
94
|
+
if (clip) {
|
|
95
|
+
try {
|
|
96
|
+
Object.defineProperty(clip, 'writeText', {
|
|
97
|
+
configurable: true,
|
|
98
|
+
writable: true,
|
|
99
|
+
value: (text) => {
|
|
100
|
+
remember(String(text));
|
|
101
|
+
return Promise.resolve();
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
} catch (e) { /* a frame that will not let its clipboard be replaced reads as a failure later */ }
|
|
105
|
+
|
|
106
|
+
try {
|
|
107
|
+
Object.defineProperty(clip, 'write', {
|
|
108
|
+
configurable: true,
|
|
109
|
+
writable: true,
|
|
110
|
+
value: async (items) => {
|
|
111
|
+
for (const item of items || []) {
|
|
112
|
+
try {
|
|
113
|
+
if (item && item.types && item.types.indexOf('text/plain') >= 0) {
|
|
114
|
+
remember(await (await item.getType('text/plain')).text());
|
|
115
|
+
}
|
|
116
|
+
} catch (e) { /* one unreadable item is not a reason to drop the rest */ }
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
} catch (e) { /* as above */ }
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// The old way: select text in a hidden field, then execCommand('copy'). The selection is
|
|
124
|
+
// exactly the text being copied, so it is taken and the command is never run.
|
|
125
|
+
try {
|
|
126
|
+
const realExec = document.execCommand.bind(document);
|
|
127
|
+
document.execCommand = (command, ...rest) => {
|
|
128
|
+
if (String(command).toLowerCase() === 'copy') {
|
|
129
|
+
const selected = String(window.getSelection() || '');
|
|
130
|
+
if (selected.length > 0) {
|
|
131
|
+
remember(selected);
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return realExec(command, ...rest);
|
|
136
|
+
};
|
|
137
|
+
} catch (e) { /* as above */ }
|
|
119
138
|
})();`;
|
|
120
139
|
export class CopilotTransport {
|
|
121
140
|
opts;
|
|
@@ -271,7 +290,7 @@ export class CopilotTransport {
|
|
|
271
290
|
'sign-in': 'The profile is signed out. Run "cop login".',
|
|
272
291
|
unknown: 'The page is not the Microsoft 365 Copilot chat.',
|
|
273
292
|
};
|
|
274
|
-
throw new Error(`${explain[where] ?? explain.unknown}
|
|
293
|
+
throw new Error(`${explain[where] ?? explain.unknown}
|
|
275
294
|
Current URL: ${url}`);
|
|
276
295
|
}
|
|
277
296
|
/**
|
|
@@ -1119,7 +1138,7 @@ Current URL: ${url}`);
|
|
|
1119
1138
|
}
|
|
1120
1139
|
if (!sawNewTurn || !last.finished) {
|
|
1121
1140
|
await this.dumpFailure(join(this.opts.transportDir, '..', 'failures'), 'reply-timeout').catch(() => undefined);
|
|
1122
|
-
throw new
|
|
1141
|
+
throw new ReplyTimeoutError(Math.round(this.opts.replyTimeoutMs / 1000), `Copilot did not finish a reply within ${Math.round(this.opts.replyTimeoutMs / 1000)}s ` +
|
|
1123
1142
|
`(new turn seen: ${sawNewTurn}, still streaming: ${last.streaming}). ` +
|
|
1124
1143
|
'A screenshot and an HTML dump are in the run folder.');
|
|
1125
1144
|
}
|
package/dist/src/vcs/git.js
CHANGED
|
@@ -155,6 +155,21 @@ export function branchNameFrom(parts, prefix = 'cop/') {
|
|
|
155
155
|
*/
|
|
156
156
|
export function plannedBranchName(raw, prefix = 'cop/', attempt = 1) {
|
|
157
157
|
const trimmed = raw.trim();
|
|
158
|
+
/*
|
|
159
|
+
* A name with its own namespace — `recovery/apz-migration`, `feature/JIRA-123-schemas` — is the
|
|
160
|
+
* team's convention, and it is used as written: the prefix is only for names that have none.
|
|
161
|
+
* Flattening it to `cop/recovery-apz-migration` made a different branch from the one asked for,
|
|
162
|
+
* so a plan continuing a recovery branch worked beside it instead of on it (2026-09-30). Each
|
|
163
|
+
* segment is still made safe, keeping its case; git itself has the last word in `switchTo`.
|
|
164
|
+
*/
|
|
165
|
+
if (trimmed.includes('/')) {
|
|
166
|
+
const segments = trimmed
|
|
167
|
+
.split('/')
|
|
168
|
+
.map((seg) => seg.replace(/[^\p{L}\p{N}._-]+/gu, '-').replace(/^[-.]+|[-.]+$/g, ''))
|
|
169
|
+
.filter(Boolean);
|
|
170
|
+
if (segments.length > 1)
|
|
171
|
+
return `${segments.join('/')}${attempt > 1 ? `-a${attempt}` : ''}`.replace(/\.\.+/g, '.').slice(0, 200);
|
|
172
|
+
}
|
|
158
173
|
const p = prefix.trim();
|
|
159
174
|
const body = p && trimmed.toLowerCase().startsWith(p.toLowerCase()) ? trimmed.slice(p.length) : trimmed;
|
|
160
175
|
return branchNameFrom([body, attempt > 1 ? `a${attempt}` : undefined], prefix);
|
package/dist/src/vcs/taskVcs.js
CHANGED
|
@@ -282,6 +282,15 @@ export function noteFor(repoDir, vcs, ctx = { mode: 'per-task', earlier: [] }) {
|
|
|
282
282
|
`The runner has already put ${repoDir} on the branch \`${vcs.branch}\`, created for this task from ${base},`,
|
|
283
283
|
'and it will commit whatever you change when the task finishes.',
|
|
284
284
|
'',
|
|
285
|
+
/*
|
|
286
|
+
* Said outright because a plan's text may still name the branch the work came from: a task that
|
|
287
|
+
* was told to continue a recovery branch went on asking for it, on a branch the runner had made
|
|
288
|
+
* (2026-09-30). The branch above is where the work goes; what it must contain is a commit.
|
|
289
|
+
*/
|
|
290
|
+
`\`${vcs.branch}\` is where this work goes, whatever branch the task or the project instructions name: do not ask for`,
|
|
291
|
+
'another branch, switch to it or check that you are on it. When earlier work must be included, check its',
|
|
292
|
+
'commit instead: `git merge-base --is-ancestor <commit> HEAD` exits 0 when it is.',
|
|
293
|
+
'',
|
|
285
294
|
...(began ? [began, ''] : []),
|
|
286
295
|
standing,
|
|
287
296
|
'',
|
|
@@ -320,19 +329,33 @@ export async function commitTaskResult(session, task, outcome, bus) {
|
|
|
320
329
|
* (they are already there; refusing would not remove them) and named on the task.
|
|
321
330
|
*/
|
|
322
331
|
const state = await repoState(dir);
|
|
332
|
+
/*
|
|
333
|
+
* The repository before the commit and after it, kept apart on the record. A task's own claims
|
|
334
|
+
* ("nothing committed, the tree is dirty") were written before this runs; without both states
|
|
335
|
+
* the export read as contradicting itself. See `TaskVcs.beforeCommit`.
|
|
336
|
+
*/
|
|
337
|
+
const beforeCommit = { changed: state.changed.slice(0, 200) };
|
|
338
|
+
const withStates = async (v) => {
|
|
339
|
+
const after = await repoState(dir).catch(() => null);
|
|
340
|
+
return {
|
|
341
|
+
...v,
|
|
342
|
+
beforeCommit,
|
|
343
|
+
...(after ? { afterCommit: { branch: after.branch ?? undefined, head: after.head ?? undefined, clean: !after.dirty, changed: after.changed.slice(0, 200) } } : {}),
|
|
344
|
+
};
|
|
345
|
+
};
|
|
323
346
|
if (state.branch !== current.branch) {
|
|
324
347
|
const problem = `the repository is on ${state.branch ?? 'a detached HEAD'}, not on the task's branch ${current.branch}: it was moved while the task ran. ` +
|
|
325
348
|
'Nothing was committed; the changes are left in the working tree for you to look at.';
|
|
326
349
|
bus.publish({ sessionId: session.id, taskId: task.id, type: 'vcs-provenance', level: 'error', message: problem,
|
|
327
350
|
data: { expected: current.branch, actual: state.branch } });
|
|
328
|
-
return { ...current, problem };
|
|
351
|
+
return await withStates({ ...current, problem });
|
|
329
352
|
}
|
|
330
353
|
if (current.baseCommit && state.head && !(await isAncestor(dir, current.baseCommit))) {
|
|
331
354
|
const problem = `the task's branch ${current.branch} no longer contains the commit it started from (${current.baseCommit.slice(0, 8)}): ` +
|
|
332
355
|
'it was reset or rewritten while the task ran. Nothing was committed; the changes are left in the working tree.';
|
|
333
356
|
bus.publish({ sessionId: session.id, taskId: task.id, type: 'vcs-provenance', level: 'error', message: problem,
|
|
334
357
|
data: { base: current.baseCommit, head: state.head } });
|
|
335
|
-
return { ...current, problem };
|
|
358
|
+
return await withStates({ ...current, problem });
|
|
336
359
|
}
|
|
337
360
|
const foreign = current.baseCommit ? await foreignCommits(dir, current.baseCommit) : [];
|
|
338
361
|
if (foreign.length > 0) {
|
|
@@ -345,12 +368,12 @@ export async function commitTaskResult(session, task, outcome, bus) {
|
|
|
345
368
|
if (result.problem) {
|
|
346
369
|
bus.publish({ sessionId: session.id, taskId: task.id, type: 'vcs-problem', level: 'warn',
|
|
347
370
|
message: `nothing was committed: ${result.problem}` });
|
|
348
|
-
return { ...current, problem: result.problem };
|
|
371
|
+
return await withStates({ ...current, problem: result.problem });
|
|
349
372
|
}
|
|
350
373
|
if (!result.committed) {
|
|
351
374
|
bus.publish({ sessionId: session.id, taskId: task.id, type: 'vcs-nothing', level: 'info',
|
|
352
375
|
message: `nothing to commit on ${current.branch}: the task changed no files` });
|
|
353
|
-
return current;
|
|
376
|
+
return await withStates(current);
|
|
354
377
|
}
|
|
355
378
|
const commits = current.baseCommit ? await commitsBetween(dir, current.baseCommit) : [];
|
|
356
379
|
const files = result.commit ? await commitFiles(dir, result.commit) : [];
|
|
@@ -367,14 +390,14 @@ export async function commitTaskResult(session, task, outcome, bus) {
|
|
|
367
390
|
suspicious.map((s) => `${s.path} (${s.reason})`).join('; '),
|
|
368
391
|
data: { commit: result.commit, suspicious } });
|
|
369
392
|
}
|
|
370
|
-
return {
|
|
393
|
+
return await withStates({
|
|
371
394
|
...current,
|
|
372
395
|
commit: result.commit,
|
|
373
396
|
commits,
|
|
374
397
|
files,
|
|
375
398
|
...(suspicious.length > 0 ? { suspicious } : {}),
|
|
376
399
|
...(foreign.length > 0 ? { foreignCommits: foreign } : {}),
|
|
377
|
-
};
|
|
400
|
+
});
|
|
378
401
|
}
|
|
379
402
|
/**
|
|
380
403
|
* Commits what a task left behind when the process running it ended before it could.
|
package/dist/web/404.html
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!DOCTYPE html><!--
|
|
1
|
+
<!DOCTYPE html><!--bcBE4tY_aNh6kzLzN1luP--><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/a0642fdb8adf9edb.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-b64c436f5b25f39e.js" async=""></script><script src="/_next/static/chunks/549-a5a59a94f92bb3eb.js" async=""></script><script src="/_next/static/chunks/app/layout-560bd6d173302e5a.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,"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-f82c74b7b2ed5c54.js\",\"549\",\"static/chunks/549-8f69ef8086802748.js\",\"177\",\"static/chunks/app/layout-560bd6d173302e5a.js\"],\"themeScript\"]\n3:I[1205,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-f82c74b7b2ed5c54.js\",\"549\",\"static/chunks/549-8f69ef8086802748.js\",\"177\",\"static/chunks/app/layout-560bd6d173302e5a.js\"],\"AppearanceProvider\"]\n4:I[867,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-f82c74b7b2ed5c54.js\",\"549\",\"static/chunks/549-8f69ef8086802748.js\",\"177\",\"static/chunks/app/layout-560bd6d173302e5a.js\"],\"LanguageProvider\"]\n5:I[1035,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-f82c74b7b2ed5c54.js\",\"549\",\"static/chunks/549-8f69ef8086802748.js\",\"177\",\"static/chunks/app/layout-560bd6d173302e5a.js\"],\"DialogHost\"]\n6:I[8214,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-f82c74b7b2ed5c54.js\",\"549\",\"static/chunks/549-8f69ef8086802748.js\",\"177\",\"static/chunks/app/layout-560bd6d173302e5a.js\"],\"SkipLink\"]\n7:I[8197,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-f82c74b7b2ed5c54.js\",\"549\",\"static/chunks/549-8f69ef8086802748.js\",\"177\",\"static/chunks/app/layout-560bd6d173302e5a.js\"],\"\"]\n8:I[8214,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-f82c74b7b2ed5c54.js\",\"549\",\"static/chunks/549-8f69ef8086802748.js\",\"177\",\"static/chunks/app/layout-560bd6d173302e5a.js\"],\"Nav\"]\n9:I[6657,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-f82c74b7b2ed5c54.js\",\"549\",\"static/chunks/549-8f69ef8086802748.js\",\"177\",\"static/chunks/app/layout-560bd6d173302e5a.js\"],\"GlobalApprovals\"]\na:I[5204,[],\"\"]\nb:I[2642,[],\"\"]\nc:I[7712,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-f82c74b7b2ed5c54.js\",\"549\",\"static/chunks/549-8f69ef8086802748.js\",\"177\",\"static/chunks/app/layout-560bd6d173302e5a.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/2ad2a74b7e07dcc9.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"oyfXbuB_cq0sRZP7ukHlQ\",\"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/2ad2a74b7e07dcc9.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>
|
|
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,"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-b64c436f5b25f39e.js\",\"549\",\"static/chunks/549-a5a59a94f92bb3eb.js\",\"177\",\"static/chunks/app/layout-560bd6d173302e5a.js\"],\"themeScript\"]\n3:I[1205,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-b64c436f5b25f39e.js\",\"549\",\"static/chunks/549-a5a59a94f92bb3eb.js\",\"177\",\"static/chunks/app/layout-560bd6d173302e5a.js\"],\"AppearanceProvider\"]\n4:I[867,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-b64c436f5b25f39e.js\",\"549\",\"static/chunks/549-a5a59a94f92bb3eb.js\",\"177\",\"static/chunks/app/layout-560bd6d173302e5a.js\"],\"LanguageProvider\"]\n5:I[1035,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-b64c436f5b25f39e.js\",\"549\",\"static/chunks/549-a5a59a94f92bb3eb.js\",\"177\",\"static/chunks/app/layout-560bd6d173302e5a.js\"],\"DialogHost\"]\n6:I[8214,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-b64c436f5b25f39e.js\",\"549\",\"static/chunks/549-a5a59a94f92bb3eb.js\",\"177\",\"static/chunks/app/layout-560bd6d173302e5a.js\"],\"SkipLink\"]\n7:I[8197,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-b64c436f5b25f39e.js\",\"549\",\"static/chunks/549-a5a59a94f92bb3eb.js\",\"177\",\"static/chunks/app/layout-560bd6d173302e5a.js\"],\"\"]\n8:I[8214,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-b64c436f5b25f39e.js\",\"549\",\"static/chunks/549-a5a59a94f92bb3eb.js\",\"177\",\"static/chunks/app/layout-560bd6d173302e5a.js\"],\"Nav\"]\n9:I[6657,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-b64c436f5b25f39e.js\",\"549\",\"static/chunks/549-a5a59a94f92bb3eb.js\",\"177\",\"static/chunks/app/layout-560bd6d173302e5a.js\"],\"GlobalApprovals\"]\na:I[5204,[],\"\"]\nb:I[2642,[],\"\"]\nc:I[7712,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-b64c436f5b25f39e.js\",\"549\",\"static/chunks/549-a5a59a94f92bb3eb.js\",\"177\",\"static/chunks/app/layout-560bd6d173302e5a.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/a0642fdb8adf9edb.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"bcBE4tY_aNh6kzLzN1luP\",\"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/a0642fdb8adf9edb.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([[36],{1035:(e,t,n)=>{n.d(t,{DialogHost:()=>d,Z:()=>c});var s=n(3365),l=n(1521),a=n(867),r=n(4969);let i=null,o=[];function c(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(i?i(s):o.push(s))})}function d(e){var t,n;let{children:c}=e,{t:d}=(0,a.kj)(),[u,h]=(0,l.useState)([]),m=(0,l.useRef)(null),f=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(i=e=>h(t=>[...t,e]),o.length>0){let e=o.splice(0,o.length);h(t=>[...t,...e])}return()=>{i=null}},[]);let p=u[0],x=(0,l.useCallback)(e=>{p&&(p.resolve(e),h(e=>e.slice(1)))},[p]);return(0,r.V)(f,!!p,m),(0,l.useEffect)(()=>{if(!p)return;let e=e=>{"Escape"===e.key&&(e.preventDefault(),x(!1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[p,x]),(0,s.jsxs)(s.Fragment,{children:[c,p&&(0,s.jsx)("div",{className:"modal-backdrop",onClick:()=>x(!1),role:"presentation",children:(0,s.jsxs)("div",{ref:f,className:"modal".concat(p.danger?" danger":""),role:"confirm"===p.kind?"alertdialog":"dialog","aria-modal":"true","aria-labelledby":"modal-title","aria-describedby":"modal-body",onClick:e=>e.stopPropagation(),children:[(0,s.jsx)("h2",{id:"modal-title",children:null!=(t=p.title)?t:d("confirm"===p.kind?"dialog.confirmTitle":"dialog.noticeTitle")}),(0,s.jsx)("div",{id:"modal-body",className:"modal-body",children:p.message}),(0,s.jsxs)("div",{className:"row modal-actions",children:["confirm"===p.kind&&(0,s.jsx)("button",{type:"button",className:"quiet",onClick:()=>x(!1),children:d("dialog.cancel")}),(0,s.jsx)("button",{ref:m,type:"button",className:p.danger?"danger":"primary",onClick:()=>x(!0),children:null!=(n=p.okLabel)?n:d("dialog.ok")})]})]})})]})}},1366:(e,t,n)=>{n.d(t,{w:()=>i,y:()=>r});var s=n(3365),l=n(1521),a=n(867);function r(e){let{readOnly:t,scope:n,onReadOnly:r,onScope:i}=e,{t:o}=(0,a.kj)(),c=(0,l.useId)();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"option",style:{marginTop:10},children:[(0,s.jsxs)("label",{children:[(0,s.jsx)("input",{type:"checkbox",checked:t,onChange:e=>r(e.target.checked)}),(0,s.jsx)("span",{children:o("task.readOnlyEdit")})]}),(0,s.jsx)("p",{className:"why",children:o("task.readOnlyEditWhy")})]}),(0,s.jsx)("label",{htmlFor:"".concat(c,"-scope"),children:o("task.scopeEdit")}),(0,s.jsx)("textarea",{id:"".concat(c,"-scope"),value:n,onChange:e=>i(e.target.value),placeholder:"tests/e2e/\nsrc/**/*.ts",style:{minHeight:60},disabled:t}),(0,s.jsx)("p",{className:"why",children:o("task.scopeEditWhy")})]})}function i(e){return e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean)}},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:h}=e,{t:m}=(0,r.kj)(),[f,p]=(0,l.useState)(null),[x,g]=(0,l.useState)(""),[v,y]=(0,l.useState)(!0),[j,k]=(0,l.useState)(!0),[b,N]=(0,l.useState)(new Set),[w,S]=(0,l.useState)(new Set),[C,E]=(0,l.useState)(new Set),I=!!(null==f?void 0:f.live),F=(0,l.useRef)(0);F.current+=1;let D=i(I,F.current),M=(0,l.useRef)(null),L=(0,l.useRef)(!1);if((0,l.useEffect)(()=>{if(!f)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(f.entries,"e"),e.some(e=>!w.has(e))&&S(t=>new Set([...t,...e])),f.live&&!L.current&&M.current&&(L.current=!0,M.current.scrollIntoView({block:"nearest",behavior:"smooth"}))},[f,w]),(0,l.useEffect)(()=>{let e,s=!0,l=async()=>{try{let r=await a.FH.taskStory(t,n,d);if(!s)return;p(r),g(""),(r.live||h)&&(e=setTimeout(l,2e3))}catch(t){if(!s)return;g(t.message),h&&(e=setTimeout(l,2e3))}};return l(),()=>{s=!1,e&&clearTimeout(e)}},[t,n,d,h]),x&&!f)return(0,s.jsx)("div",{className:"err small",children:x});if(!f)return(0,s.jsx)("div",{className:"muted small",children:m("story.loading")});let T=e=>b.has(e)||w.has(e)&&!C.has(e),H=e=>{let t=T(e);N(n=>{let s=new Set(n);return t?s.delete(e):s.add(e),s}),E(n=>{let s=new Set(n);return t?s.add(e):s.delete(e),s})},R=(e,t)=>{if(!("review"===e.kind?v||j:"step"===e.kind?j:v))return null;if("review"===e.kind)return(0,s.jsxs)("li",{className:"story-review",children:[(0,s.jsxs)("div",{className:"story-head",children:[(0,s.jsx)(u,{at:e.at}),(0,s.jsx)("span",{className:"chip",children:m("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=T(t),l=!e.outcome&&f.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)(u,{at:e.at}),(0,s.jsx)("span",{className:"chip",children:m("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:m("story.running")}),e.failed&&(0,s.jsx)("span",{className:"badge failed",children:m("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:()=>H(t),children:n?m("story.hideOutput"):m("story.showOutput",{n:e.output.length})}),n&&(0,s.jsx)(c,{text:e.output,follow:l})]})]},t)}let n=b.has(t),l="sent"===e.kind?m("story.bot"):m("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)(u,{at:e.at}),(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:()=>H(t),children:n?m("story.hideText"):m("story.showText",{n:e.text.length})}),n&&(0,s.jsx)("pre",{className:"story-out",children:e.text})]},t)},q=f.close,A=q&&"done"!==q.status;return(0,s.jsxs)("div",{className:"story-box",ref:M,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:v,onChange:e=>y(e.target.checked)})," ",m("story.showChat")]}),(0,s.jsxs)("label",{className:"option-inline",children:[(0,s.jsx)("input",{type:"checkbox",checked:j,onChange:e=>k(e.target.checked)})," ",m("story.showCommands")]}),f.live&&(0,s.jsxs)("span",{className:"live",children:[(0,s.jsx)("span",{className:"dot","aria-hidden":"true"})," ",m("story.live")]}),f.live&&!D.following&&(0,s.jsx)("button",{type:"button",className:"quiet small",onClick:D.follow,title:m("story.followWhy"),children:m("story.follow")}),x&&(0,s.jsx)("span",{className:"err",children:x})]}),(0,s.jsxs)("div",{className:"story-fixed",children:[(0,s.jsx)("strong",{children:m("story.prompt")}),(0,s.jsx)("pre",{className:"story-out always",children:f.prompt})]}),(0,s.jsx)("div",{ref:D.ref,className:"story-scroll".concat(f.live?" live":""),children:(0,s.jsx)("ol",{className:"story",children:f.entries.map((e,t)=>R(e,"e".concat(t)))})}),q?(0,s.jsxs)("div",{className:"story-fixed close".concat(A?" failed":""),children:[(0,s.jsx)("strong",{children:A?m("story.endedBadly",{status:q.status}):m("story.ended")}),q.reason&&(0,s.jsx)("p",{className:"err small",children:q.reason}),q.summary&&(0,s.jsx)(o.s,{text:q.summary,className:"what"}),q.checks&&q.checks.length>0&&(0,s.jsx)("ul",{className:"small",style:{margin:"6px 0 0",paddingLeft:18},children:q.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:m("story.notEnded")})]})}function u(e){let{at:t}=e,n=(0,r.W3)(),{locale:l}=(0,r.kj)();if(!t)return null;let a=new Date(t),i="bg"===l?"bg-BG":void 0,o=a.toLocaleTimeString(i,{hour12:!1}),c=new Date().toDateString()===a.toDateString();return(0,s.jsx)("time",{className:"story-when",dateTime:t,title:n(t),children:c?o:"".concat(a.toLocaleDateString(i)," ").concat(o)})}},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)({taskId:"",text:""}),d=(e,t)=>c({taskId:e,text:t}),u=(0,s.useCallback)(async n=>{i("restore"),d(n.taskId,"");try{var s,r,o,c,u,h,m,f,p,x,g,v,y,j;let i=await l.FH.restorePreview(n.sessionId,n.taskId);if(!i.ok)return void d(n.taskId,t("restore.cannot",{problem:null!=(o=i.problem)?o:""}));let k={repo:i.repoDir,title:n.title,branch:null!=(c=i.branchName)?c:"",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 d(n.taskId,t("restore.failed",{problem:null!=(m=N.problem)?m:""}));d(n.taskId,(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!=(y=N.branch)?y:"",commit:(null!=(j=N.commit)?j:"").slice(0,8)})),e()}catch(e){d(n.taskId,e.message)}finally{i("")}},[t,e]),h=(0,s.useCallback)(async n=>{i("restart"),d(n.taskId,"");try{var s,r;let i=await l.FH.restartPlan(n.sessionId,n.taskId);if(!i.ok)return void d(n.taskId,t("restart.cannot",{problem:null!=(s=i.problem)?s:""}));let o=i.restores.filter(e=>!e.ok);if(o.length>0)return void d(n.taskId,t("restart.cannot",{problem:o.map(e=>{var t;return"".concat(e.repoDir,": ").concat(null!=(t=e.problem)?t:"")}).join(" | ")}));let c=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:c||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){d(n.taskId,t("restart.failed",{problem:null!=(r=m.reason)?r:""})),e();return}d(n.taskId,t("restart.started",{requeued:m.requeued,repos:m.restored.length})),e()}catch(e){d(n.taskId,e.message)}finally{i("")}},[t,e]);return{busy:n,message:o.text,messageTask:o.taskId,clearMessage:()=>d("",""),restore:u,restartFrom:h}}},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}},4969:(e,t,n)=>{n.d(t,{V:()=>a});var s=n(1521);let l='a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';function a(e,t,n){(0,s.useEffect)(()=>{var s,a;if(!t)return;let r=document.activeElement instanceof HTMLElement?document.activeElement:null,i=e.current,o=null!=(a=null!=(s=null==n?void 0:n.current)?s:null==i?void 0:i.querySelector(l))?a:null;null==o||o.focus();let c=e=>{if("Tab"!==e.key||!i)return;let t=Array.from(i.querySelectorAll(l)).filter(e=>null!==e.offsetParent);if(0===t.length)return;let n=t[0],s=t[t.length-1],a=i.contains(document.activeElement);e.shiftKey&&(document.activeElement===n||!a)?(e.preventDefault(),s.focus()):e.shiftKey||document.activeElement!==s&&a||(e.preventDefault(),n.focus())};return document.addEventListener("keydown",c),()=>{document.removeEventListener("keydown",c),r&&document.contains(r)&&r.focus()}},[e,t,n])}},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})}},7527:(e,t,n)=>{n.d(t,{z:()=>l});var s=n(1521);function l(e,t){let n=!(arguments.length>2)||void 0===arguments[2]||arguments[2],l=(0,s.useRef)(e);l.current=e,(0,s.useEffect)(()=>{let e;if(!n)return;let s=!1,a=async()=>{try{await l.current()}catch(e){}finally{s||(e=setTimeout(()=>void a(),t))}};return a(),()=>{s=!0,e&&clearTimeout(e)}},[t,n])}},8934:(e,t,n)=>{n.d(t,{C:()=>c});var s=n(3365),l=n(1521),a=n(5549),r=n(4969),i=n(867);function o(e){if(null===e||""===e)return[];let t=e.split(/\r?\n/);return""===t[t.length-1]&&t.pop(),t}function c(e){let{sessionId:t,taskId:n,runId:a,title:r,files:o}=e,{t:c}=(0,i.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:c("diff.openWhy"),children:c("diff.open",{n:o})}),u&&(0,s.jsx)(d,{sessionId:t,taskId:n,runId:a,title:r,onClose:()=>h(!1)})]})}function d(e){var t,n,c,d,h,m,f;let{sessionId:p,taskId:x,runId:g,title:v,onClose:y}=e,{t:j}=(0,i.kj)(),[k,b]=(0,l.useState)(null),[N,w]=(0,l.useState)(""),[S,C]=(0,l.useState)(0),[E,I]=(0,l.useState)(new Map),[F,D]=(0,l.useState)(!1),[M,L]=(0,l.useState)(!0),[T,H]=(0,l.useState)(new Map),[R,q]=(0,l.useState)(-1),A=(0,l.useRef)(null),B=(0,l.useRef)(null),W=(0,l.useRef)(null);(0,r.V)(B,!0,W),(0,l.useEffect)(()=>{a.FH.taskChanges(p,x,g).then(b).catch(e=>w(e.message))},[p,x,g]);let P=null!=(c=null==k?void 0:k.files)?c:[],O=P[S];(0,l.useEffect)(()=>{!O||E.has(O.path)||a.FH.taskChangeFile(p,x,O.path,g).then(e=>I(t=>new Map(t).set(O.path,e))).catch(e=>I(t=>new Map(t).set(O.path,e.message)))},[O,E,p,x,g]);let G=O?E.get(O.path):void 0,K=(0,l.useMemo)(()=>!G||"string"==typeof G||G.binary||G.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}(o(G.before),o(G.after)),[G]),V=O&&T.get(O.path)||new Set,Z=(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})(K,3,V,F),[K,V,F]),_=(0,l.useMemo)(()=>K.flatMap((e,t)=>"same"!==e.kind&&(0===t||"same"===K[t-1].kind)?[t]:[]),[K]);(0,l.useEffect)(()=>{q(-1),A.current&&(A.current.scrollTop=0)},[S]);let Q=(0,l.useCallback)(e=>{var t;if(0===_.length)return;let n=R<0?1===e?0:_.length-1:Math.min(_.length-1,Math.max(0,R+e));q(n);let s=null==(t=A.current)?void 0:t.querySelector('[data-row="'.concat(_[n],'"]'));null==s||s.scrollIntoView({block:"center"})},[R,_]),$=(0,l.useCallback)(e=>C(t=>Math.min(Math.max(0,t+e),Math.max(0,P.length-1))),[P.length]);(0,l.useEffect)(()=>{let e=e=>{if(!e.ctrlKey&&!e.metaKey&&!e.altKey){if("Escape"===e.key)y();else if("n"===e.key)Q(1);else if("p"===e.key)Q(-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}},[Q,$,y]);let z=P.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",{ref:B,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:v})}),(null==k?void 0:k.ok)&&(0,s.jsxs)("span",{className:"muted small",children:[k.branch?"".concat(k.branch," \xb7 "):"",null==(t=k.base)?void 0:t.slice(0,8)," → ",null==(n=k.commit)?void 0:n.slice(0,8)," \xb7 ",j("diff.summary",{n:P.length,a:z.added,r:z.removed})]}),(0,s.jsx)("span",{className:"grow"}),(0,s.jsx)("span",{className:"muted small",children:j("diff.keys")}),(0,s.jsx)("button",{ref:W,type:"button",onClick:y,children:j("diff.close")})]}),N&&(0,s.jsx)("div",{className:"err",style:{padding:12},children:N}),!k&&!N&&(0,s.jsx)("div",{className:"muted",style:{padding:12},children:j("diff.loading")}),k&&!k.ok&&(0,s.jsx)("div",{className:"notice caution",style:{margin:12},children:k.problem}),(null==k?void 0:k.ok)&&0===P.length&&(0,s.jsx)("div",{className:"notice",style:{margin:12},children:j("diff.nothing")}),(null==k?void 0:k.ok)&&P.length>0&&(0,s.jsxs)("div",{className:"diff-body",children:[(0,s.jsx)("nav",{className:"diff-files","aria-label":j("diff.files"),children:P.map((e,t)=>{let n=e.path.lastIndexOf("/");return(0,s.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,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:[O&&(0,s.jsxs)("div",{className:"diff-toolbar",children:[(0,s.jsx)("strong",{className:"diff-name",children:O.oldPath?"".concat(O.oldPath," → ").concat(O.path):O.path}),(0,s.jsx)("span",{className:"muted small",children:"A"===O.status?j("diff.added"):"D"===O.status?j("diff.deleted"):"R"===O.status?j("diff.renamed"):""}),(0,s.jsx)("span",{className:"grow"}),(0,s.jsx)("button",{type:"button",className:"quiet",onClick:()=>Q(-1),disabled:0===_.length,children:j("diff.prevChange")}),(0,s.jsx)("button",{type:"button",className:"quiet",onClick:()=>Q(1),disabled:0===_.length,children:j("diff.nextChange")}),(0,s.jsx)("span",{className:"muted small",children:_.length>0?j("diff.changeN",{i:R<0?"–":R+1,n:_.length}):""}),(0,s.jsx)("button",{type:"button",className:"quiet",onClick:()=>$(-1),disabled:0===S,children:j("diff.prevFile")}),(0,s.jsx)("button",{type:"button",className:"quiet",onClick:()=>$(1),disabled:S>=P.length-1,children:j("diff.nextFile")}),(0,s.jsxs)("label",{className:"option-inline",children:[(0,s.jsx)("input",{type:"checkbox",checked:F,onChange:e=>D(e.target.checked)})," ",j("diff.whole")]}),(0,s.jsxs)("label",{className:"option-inline",children:[(0,s.jsx)("input",{type:"checkbox",checked:M,onChange:e=>L(e.target.checked)})," ",j("diff.wrap")]})]}),(0,s.jsxs)("div",{className:"diff-scroll",ref:A,children:[void 0===G&&(0,s.jsx)("div",{className:"muted",style:{padding:12},children:j("diff.loading")}),"string"==typeof G&&(0,s.jsx)("div",{className:"err",style:{padding:12},children:G}),G&&"string"!=typeof G&&G.binary&&(0,s.jsx)("div",{className:"notice",style:{margin:12},children:j("diff.binary")}),G&&"string"!=typeof G&&G.tooLarge&&(0,s.jsx)("div",{className:"notice",style:{margin:12},children:j("diff.tooLarge")}),G&&"string"!=typeof G&&!G.binary&&!G.tooLarge&&(0,s.jsxs)(s.Fragment,{children:[(null!=(d=G.before)?d:"").includes("\r\n")!==(null!=(h=G.after)?h:"").includes("\r\n")&&null!==G.before&&null!==G.after&&(0,s.jsx)("div",{className:"notice small",style:{margin:8},children:j("diff.eol",{from:(null!=(m=G.before)?m:"").includes("\r\n")?"CRLF":"LF",to:(null!=(f=G.after)?f:"").includes("\r\n")?"CRLF":"LF"})}),K.length>0&&0===_.length&&(0,s.jsx)("div",{className:"notice small",style:{margin:8},children:j("diff.sameText")}),(0,s.jsxs)("table",{className:"diff-table".concat(M?"":" 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:Z.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(O&&H(e=>{var n;return new Map(e).set(O.path,new Set([...null!=(n=e.get(O.path))?n:[],t]))}))},children:j("diff.gap",{n:e.count})})})},"g".concat(e.from)):(0,s.jsx)(u,{row:e.row,index:e.index,current:R>=0&&_[R]===e.index},e.index))})]})]})]})]})]})]})}function u(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")})]})}}}]);
|