copilot-operator 0.1.90 → 0.1.93
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 +26 -0
- package/dist/src/api/operator.service.js +55 -14
- package/dist/src/cli.js +3 -0
- package/dist/src/config/live.js +6 -3
- package/dist/src/config/schema.js +23 -0
- package/dist/src/orchestrator/taskRunner.js +25 -3
- package/dist/src/plan/systemGuide.js +220 -13
- package/dist/src/session/chatNotice.js +4 -1
- package/dist/src/session/chatbotFile.js +117 -0
- package/dist/src/session/events.js +5 -1
- package/dist/src/session/locatorFailures.js +2 -1
- package/dist/src/transport/chatSteps.js +74 -0
- package/dist/src/transport/copilotTransport.js +288 -31
- package/dist/src/transport/keptWindow.js +4 -0
- package/dist/src/transport/locators.js +106 -5
- package/dist/src/transport/pageHtml.js +36 -2
- package/dist/web/404.html +2 -2
- package/dist/web/_next/static/chunks/{1077.1cc6d439e3dd0fa9.js → 1077.626a11362f53d35c.js} +1 -1
- package/dist/web/_next/static/chunks/{1548.3de9dc874e47558e.js → 1548.79f05ff765581b0a.js} +1 -1
- package/dist/web/_next/static/chunks/{2163.66458fb9c54fb52d.js → 2163.09f1212655504f3a.js} +1 -1
- package/dist/web/_next/static/chunks/{714.cffed2b87154be0f.js → 714.acea3698b6af7a61.js} +1 -1
- package/dist/web/_next/static/chunks/{7220.30b6a3e1bd41e51a.js → 7220.1eba10bd9d449cea.js} +1 -1
- package/dist/web/_next/static/chunks/7921-29256ac683ea4bc5.js +1 -0
- package/dist/web/_next/static/chunks/{8584.36422ed19d6c43e9.js → 8584.b5aac5354f124d4b.js} +1 -1
- package/dist/web/_next/static/chunks/{9067.e579f97591576de2.js → 9067.177163495f3bd8fa.js} +1 -1
- package/dist/web/_next/static/chunks/{9747.11247f0e21542f6d.js → 9747.5b9d763e89abc7e4.js} +1 -1
- package/dist/web/_next/static/chunks/app/layout-1b7d13f7b2efd008.js +1 -0
- package/dist/web/_next/static/chunks/app/settings/page-c92548f9c6318962.js +1 -0
- package/dist/web/_next/static/chunks/{webpack-78ec62098b09e4a0.js → webpack-33252b1a0a7d93ba.js} +1 -1
- package/dist/web/_next/static/css/{d74aa18c98dacdb4.css → 6b92f118889ca88b.css} +1 -1
- package/dist/web/defaults.html +2 -2
- package/dist/web/defaults.txt +8 -8
- package/dist/web/index.html +3 -3
- package/dist/web/index.txt +9 -9
- package/dist/web/queue.html +2 -2
- package/dist/web/queue.txt +9 -9
- package/dist/web/settings.html +2 -2
- package/dist/web/settings.txt +9 -9
- package/dist/web/system.html +2 -2
- package/dist/web/system.txt +9 -9
- package/package.json +1 -1
- package/dist/web/_next/static/chunks/7921-d3a4a261e08950e0.js +0 -1
- package/dist/web/_next/static/chunks/app/layout-7b5fa7c74ecd6939.js +0 -1
- package/dist/web/_next/static/chunks/app/settings/page-7651920337bbb580.js +0 -1
- /package/dist/web/_next/static/{3VkK1sxEugkae88HSFR-i → ZrEcjGdZEXe66UUxUqine}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{3VkK1sxEugkae88HSFR-i → ZrEcjGdZEXe66UUxUqine}/_ssgManifest.js +0 -0
|
@@ -202,6 +202,23 @@ let OperatorController = class OperatorController {
|
|
|
202
202
|
failText(res, e);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* The one file for a chatbot (2026-11-18): everything it needs to give the right locator, the piece of the page and
|
|
207
|
+
* the whole page included (see `session/chatbotFile.ts`). A download, like the HTML; `lang` is the language the
|
|
208
|
+
* chatbot is told to speak to the operator in.
|
|
209
|
+
*/
|
|
210
|
+
async locatorFailureChatbotFile(key, lang, res) {
|
|
211
|
+
try {
|
|
212
|
+
const { fileName, content } = await this.ops.locatorFailureChatbotFile(key, typeof lang === 'string' ? lang.slice(0, 8) : undefined);
|
|
213
|
+
res.type('application/octet-stream');
|
|
214
|
+
res.setHeader('content-disposition', contentDisposition(fileName));
|
|
215
|
+
res.setHeader('x-content-type-options', 'nosniff');
|
|
216
|
+
res.send(Buffer.from(content, 'utf8'));
|
|
217
|
+
}
|
|
218
|
+
catch (e) {
|
|
219
|
+
failText(res, e);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
205
222
|
/**
|
|
206
223
|
* "Check the locators" (2026-11-17): the Copilot window opened, each of the chat's locators looked for, and what each
|
|
207
224
|
* found. Takes as long as the window takes to open, a sign-in included.
|
|
@@ -717,6 +734,15 @@ __decorate([
|
|
|
717
734
|
__metadata("design:paramtypes", [String, Object]),
|
|
718
735
|
__metadata("design:returntype", Promise)
|
|
719
736
|
], OperatorController.prototype, "locatorFailureHtml", null);
|
|
737
|
+
__decorate([
|
|
738
|
+
Get('locators/failures/:key/chatbot'),
|
|
739
|
+
__param(0, Param('key')),
|
|
740
|
+
__param(1, Query('lang')),
|
|
741
|
+
__param(2, Res()),
|
|
742
|
+
__metadata("design:type", Function),
|
|
743
|
+
__metadata("design:paramtypes", [String, Object, Object]),
|
|
744
|
+
__metadata("design:returntype", Promise)
|
|
745
|
+
], OperatorController.prototype, "locatorFailureChatbotFile", null);
|
|
720
746
|
__decorate([
|
|
721
747
|
Post('locators/check'),
|
|
722
748
|
__metadata("design:type", Function),
|
|
@@ -18,8 +18,10 @@ import { existsSync } from 'node:fs';
|
|
|
18
18
|
import { isAbsolute, relative } from 'node:path';
|
|
19
19
|
import { readFile as readFileText } from 'node:fs/promises';
|
|
20
20
|
import { LocatorFailures } from '../session/locatorFailures.js';
|
|
21
|
+
import { chatbotFile } from '../session/chatbotFile.js';
|
|
21
22
|
import { CHAT_LOCATOR_KEYS, locatorPrompt, resolveChatLocators } from '../transport/locators.js';
|
|
22
23
|
import { LocatorMissing } from '../transport/copilotTransport.js';
|
|
24
|
+
import { isStepKey, stepKey, stepPrompt } from '../transport/chatSteps.js';
|
|
23
25
|
import { readFile } from 'node:fs/promises';
|
|
24
26
|
import { join, resolve } from 'node:path';
|
|
25
27
|
import { chosenHome, defaultHome, installLayout } from '../config/layout.js';
|
|
@@ -891,15 +893,18 @@ let OperatorService = class OperatorService {
|
|
|
891
893
|
*/
|
|
892
894
|
recordLocatorFailure(detail) {
|
|
893
895
|
const key = detail.key;
|
|
894
|
-
if (typeof key !== 'string' || !CHAT_LOCATOR_KEYS.includes(key) || typeof detail.locator !== 'string')
|
|
896
|
+
if (typeof key !== 'string' || !(CHAT_LOCATOR_KEYS.includes(key) || isStepKey(key)) || typeof detail.locator !== 'string')
|
|
895
897
|
return;
|
|
896
898
|
const str = (v) => (typeof v === 'string' && v ? v : undefined);
|
|
897
899
|
const html = str(detail.html);
|
|
898
900
|
const picture = str(detail.picture);
|
|
899
901
|
const url = str(detail.url);
|
|
902
|
+
const piece = str(detail.piece);
|
|
903
|
+
const around = str(detail.around);
|
|
900
904
|
void this.locatorFailures
|
|
901
905
|
.record({
|
|
902
906
|
key: key,
|
|
907
|
+
...(str(detail.name) ? { name: str(detail.name) } : {}),
|
|
903
908
|
locator: detail.locator,
|
|
904
909
|
at: new Date().toISOString(),
|
|
905
910
|
why: str(detail.why) ?? '',
|
|
@@ -907,6 +912,7 @@ let OperatorService = class OperatorService {
|
|
|
907
912
|
...(html ? { html } : {}),
|
|
908
913
|
...(picture ? { picture } : {}),
|
|
909
914
|
...(url ? { url } : {}),
|
|
915
|
+
...(piece ? { piece, ...(around ? { around } : {}) } : {}),
|
|
910
916
|
})
|
|
911
917
|
.catch(() => undefined);
|
|
912
918
|
}
|
|
@@ -918,30 +924,59 @@ let OperatorService = class OperatorService {
|
|
|
918
924
|
async listLocatorFailures() {
|
|
919
925
|
const cfg = await this.settings.load();
|
|
920
926
|
const inForce = resolveChatLocators(cfg.copilot.chatLocators).locators;
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
+
// A step's (2026-11-17): changed when its locator is, or it is switched off, made not required, or gone.
|
|
928
|
+
const steps = new Map(cfg.copilot.extraSteps.map((s) => [stepKey(s.id), s]));
|
|
929
|
+
return (await this.locatorFailures.list()).map(({ html, picture: _picture, piece: _piece, around: _around, ...f }) => {
|
|
930
|
+
const step = isStepKey(f.key) ? steps.get(f.key) : undefined;
|
|
931
|
+
return {
|
|
932
|
+
...f,
|
|
933
|
+
...(step?.name ? { name: step.name } : {}),
|
|
934
|
+
html: !!html && existsSync(html),
|
|
935
|
+
changed: isStepKey(f.key) ? !step || step.off || step.locator !== f.locator || (f.stopped && !step.must) : inForce[f.key] !== f.locator,
|
|
936
|
+
prompt: isStepKey(f.key) ? stepPrompt(step ?? { name: f.name ?? '', action: 'click' }, f.locator) : locatorPrompt(f.key, f.locator),
|
|
937
|
+
};
|
|
938
|
+
});
|
|
927
939
|
}
|
|
928
940
|
/** The page's HTML kept with a failure, to download: only a file in the bot's runs folder. */
|
|
929
941
|
async locatorFailureHtml(key) {
|
|
930
942
|
const f = await this.locatorFailures.get(key);
|
|
931
943
|
if (!f?.html)
|
|
932
944
|
throw new Error(`No HTML is kept for the "${key}" locator.`);
|
|
945
|
+
const content = await this.keptFailureFile(key, f.html, 'HTML');
|
|
946
|
+
const stamp = f.at.replace(/[-:]/g, '').replace('T', '-').slice(0, 15);
|
|
947
|
+
// A step's key holds a colon, which a Windows file name cannot.
|
|
948
|
+
return { fileName: `copilot-page-${key.replace(/[^\w-]/g, '-')}-${stamp}.html`, content };
|
|
949
|
+
}
|
|
950
|
+
/**
|
|
951
|
+
* The one file for a chatbot (operator, 2026-11-18: "everything in one file; the user takes it and sends it to the
|
|
952
|
+
* chat, and that is all"): what to do, the goal, what failed, the old locator, the piece of the page where the element
|
|
953
|
+
* most likely is, the whole page, and how to find it by hand when it is in neither. See `session/chatbotFile.ts`.
|
|
954
|
+
* Made from what is kept, also for a failure kept before the piece was (then without it).
|
|
955
|
+
*/
|
|
956
|
+
async locatorFailureChatbotFile(key, lang) {
|
|
957
|
+
const f = await this.locatorFailures.get(key);
|
|
958
|
+
if (!f)
|
|
959
|
+
throw new Error(`No failure is kept for the "${key}" locator.`);
|
|
960
|
+
const page = f.html ? await this.keptFailureFile(key, f.html, 'HTML').catch(() => '') : '';
|
|
961
|
+
const piece = f.piece ? await this.keptFailureFile(key, f.piece, 'piece of HTML').catch(() => '') : '';
|
|
962
|
+
const cfg = await this.settings.load();
|
|
963
|
+
const step = isStepKey(f.key) ? cfg.copilot.extraSteps.find((s) => stepKey(s.id) === f.key) : undefined;
|
|
964
|
+
const content = chatbotFile({ failure: f, step, piece, page, ...(lang ? { lang } : {}) });
|
|
965
|
+
const stamp = f.at.replace(/[-:]/g, '').replace('T', '-').slice(0, 15);
|
|
966
|
+
return { fileName: `for-chatbot-${key.replace(/[^\w-]/g, '-')}-${stamp}.txt`, content };
|
|
967
|
+
}
|
|
968
|
+
/** A file kept with a failure, read: only one in the bot's runs folder. */
|
|
969
|
+
async keptFailureFile(key, path, what) {
|
|
933
970
|
const cfg = await this.settings.load();
|
|
934
971
|
const runs = resolve(cfg.resolved.runsDir);
|
|
935
|
-
const file = resolve(
|
|
972
|
+
const file = resolve(path);
|
|
936
973
|
const inside = relative(runs, file);
|
|
937
974
|
if (!inside || inside.startsWith('..') || isAbsolute(inside)) {
|
|
938
|
-
throw new Error(`The
|
|
975
|
+
throw new Error(`The ${what} kept for the "${key}" locator is not in the bot's runs folder.`);
|
|
939
976
|
}
|
|
940
|
-
|
|
941
|
-
throw new Error(`The
|
|
977
|
+
return await readFileText(file, 'utf8').catch(() => {
|
|
978
|
+
throw new Error(`The ${what} kept for the "${key}" locator is gone (${file}).`);
|
|
942
979
|
});
|
|
943
|
-
const stamp = f.at.replace(/[-:]/g, '').replace('T', '-').slice(0, 15);
|
|
944
|
-
return { fileName: `copilot-page-${key}-${stamp}.html`, content };
|
|
945
980
|
}
|
|
946
981
|
async startFailureReport(id) {
|
|
947
982
|
await this.init();
|
|
@@ -3293,6 +3328,8 @@ let OperatorService = class OperatorService {
|
|
|
3293
3328
|
transport = createTransport({
|
|
3294
3329
|
// The box to write in by Settings' locator (2026-11-17): the sign-in ends when it shows; one that finds nothing is kept.
|
|
3295
3330
|
...(cfg.copilot.chatLocators ? { chatLocators: cfg.copilot.chatLocators } : {}),
|
|
3331
|
+
builtInSteps: cfg.copilot.builtInSteps,
|
|
3332
|
+
extraSteps: cfg.copilot.extraSteps,
|
|
3296
3333
|
onEvent: (event, detail) => {
|
|
3297
3334
|
if (event === 'locator-missing' && detail)
|
|
3298
3335
|
this.recordLocatorFailure(detail);
|
|
@@ -3436,7 +3473,11 @@ let OperatorService = class OperatorService {
|
|
|
3436
3473
|
await transport.open();
|
|
3437
3474
|
let results;
|
|
3438
3475
|
try {
|
|
3439
|
-
|
|
3476
|
+
// A step of the operator's own that is not there stops the opening, as at work; it is said, and the check goes on.
|
|
3477
|
+
await transport.ensureSignedIn().catch((e) => {
|
|
3478
|
+
if (!(e instanceof LocatorMissing) || !isStepKey(e.key))
|
|
3479
|
+
throw e;
|
|
3480
|
+
});
|
|
3440
3481
|
results = await transport.checkLocators();
|
|
3441
3482
|
}
|
|
3442
3483
|
catch (e) {
|
package/dist/src/cli.js
CHANGED
|
@@ -130,6 +130,7 @@ program
|
|
|
130
130
|
const saved = await settingsOf(installLayout()).load().catch(() => null);
|
|
131
131
|
const transport = new CopilotTransport({
|
|
132
132
|
...(saved?.copilot.chatLocators ? { chatLocators: saved.copilot.chatLocators } : {}),
|
|
133
|
+
...(saved ? { builtInSteps: saved.copilot.builtInSteps, extraSteps: saved.copilot.extraSteps } : {}),
|
|
133
134
|
profileDir: opts.profile,
|
|
134
135
|
transportDir: join(opts.profile, '_transport'),
|
|
135
136
|
chatUrl: opts.url,
|
|
@@ -193,6 +194,7 @@ program
|
|
|
193
194
|
const saved = await settingsOf(installLayout()).load().catch(() => null);
|
|
194
195
|
const transport = new CopilotTransport({
|
|
195
196
|
...(saved?.copilot.chatLocators ? { chatLocators: saved.copilot.chatLocators } : {}),
|
|
197
|
+
...(saved ? { builtInSteps: saved.copilot.builtInSteps, extraSteps: saved.copilot.extraSteps } : {}),
|
|
196
198
|
profileDir: opts.profile,
|
|
197
199
|
transportDir: join(opts.profile, '_transport'),
|
|
198
200
|
chatUrl: opts.url,
|
|
@@ -398,6 +400,7 @@ program
|
|
|
398
400
|
const transport = new CopilotTransport({
|
|
399
401
|
...(saved?.copilot.pickerLocators ? { pickerLocators: saved.copilot.pickerLocators } : {}),
|
|
400
402
|
...(saved?.copilot.chatLocators ? { chatLocators: saved.copilot.chatLocators } : {}),
|
|
403
|
+
...(saved ? { builtInSteps: saved.copilot.builtInSteps, extraSteps: saved.copilot.extraSteps } : {}),
|
|
401
404
|
profileDir: opts.profile,
|
|
402
405
|
transportDir: join(installLayout().runsDir, '_models'),
|
|
403
406
|
chatUrl: opts.url,
|
package/dist/src/config/live.js
CHANGED
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
* - from the next message (`next`): what a message is built on when it starts — the models, plan mode, the shell and
|
|
13
13
|
* folder a step runs in by default, the project and its folders, the skills, the contract's stop word, the mode a
|
|
14
14
|
* start takes, and the lead's number of subtasks, which its assignment states;
|
|
15
|
-
* - when the chat window opens again (`window`): the chat's address, its browser and the waits
|
|
16
|
-
*
|
|
15
|
+
* - when the chat window opens again (`window`): the chat's address, its browser and the waits the window was opened
|
|
16
|
+
* with; it is kept open between messages. Its locators and the steps on the way to the chat are taken at once
|
|
17
|
+
* (2026-11-17): the window open is handed them (`takeSettings`).
|
|
17
18
|
*
|
|
18
19
|
* A step that is running, and a card already put to the operator, go on as they began. The locked policy, when there is
|
|
19
20
|
* one, is in what was saved (`loadConfigObject`), so it is taken with the rest and still wins.
|
|
@@ -29,6 +30,8 @@ const NOW = {
|
|
|
29
30
|
limits: '*',
|
|
30
31
|
pacing: '*',
|
|
31
32
|
report: '*',
|
|
33
|
+
// The locators and the steps on the way to the chat (2026-11-17): handed to the window open, at once (`takeSettings`).
|
|
34
|
+
copilot: ['pickerLocators', 'chatLocators', 'pickerSteps', 'builtInSteps', 'extraSteps'],
|
|
32
35
|
};
|
|
33
36
|
/** Of a section taken whole, what a message is told when it starts: the lead's number of subtasks is its assignment's. */
|
|
34
37
|
const NOT_NOW = {
|
|
@@ -36,7 +39,7 @@ const NOT_NOW = {
|
|
|
36
39
|
};
|
|
37
40
|
/** What the chat window was opened with. */
|
|
38
41
|
const WINDOW = {
|
|
39
|
-
copilot: ['url', 'profileDir', 'channel', 'headless', 'replyTimeoutSec', 'signInTimeoutSec', 'humanWaitSec', 'keepFailurePage'
|
|
42
|
+
copilot: ['url', 'profileDir', 'channel', 'headless', 'replyTimeoutSec', 'signInTimeoutSec', 'humanWaitSec', 'keepFailurePage'],
|
|
40
43
|
};
|
|
41
44
|
/** The sections a run compares; the rest (where the bot keeps its records) is read when the bot starts. */
|
|
42
45
|
const SECTIONS = ['copilot', 'task', 'execution', 'report', 'project', 'skills', 'pacing', 'limits'];
|
|
@@ -187,6 +187,29 @@ export const RunConfigSchema = z.object({
|
|
|
187
187
|
* a failed choice keeps the menu (models-select-failed.*).
|
|
188
188
|
*/
|
|
189
189
|
pickerSteps: z.boolean().default(false),
|
|
190
|
+
/**
|
|
191
|
+
* The steps on the way to the chat (operator, 2026-11-17: "what happens if we want to add or remove a step?"),
|
|
192
|
+
* see `transport/chatSteps.ts`: the bot's own that can be done without, each on unless switched off; and the
|
|
193
|
+
* operator's own, in their order, each "if this is on the page, do this" when the chat opens or before each message.
|
|
194
|
+
* Taken at once by the window open (`config/live.ts`).
|
|
195
|
+
*/
|
|
196
|
+
builtInSteps: z
|
|
197
|
+
.object({ popups: z.boolean().default(true), feedbackPanel: z.boolean().default(true), nameChat: z.boolean().default(true) })
|
|
198
|
+
.prefault({}),
|
|
199
|
+
extraSteps: z
|
|
200
|
+
.array(z.object({
|
|
201
|
+
id: z.string().regex(/^[\w-]{1,40}$/),
|
|
202
|
+
name: z.string().max(200).default(''),
|
|
203
|
+
when: z.enum(['open', 'message']).default('message'),
|
|
204
|
+
locator: z.string().max(4000).default(''),
|
|
205
|
+
action: z.enum(['click', 'press', 'appear', 'gone']).default('click'),
|
|
206
|
+
key: z.string().max(60).optional(),
|
|
207
|
+
must: z.boolean().default(false),
|
|
208
|
+
waitSec: z.number().min(0).max(600).default(2),
|
|
209
|
+
off: z.boolean().default(false),
|
|
210
|
+
}))
|
|
211
|
+
.max(100)
|
|
212
|
+
.default([]),
|
|
190
213
|
})
|
|
191
214
|
.prefault({}),
|
|
192
215
|
/** Level 1: the base prompt about how the runner works. Shipped with the project; editable in the UI. */
|
|
@@ -45,7 +45,7 @@ import { scriptsNote } from '../exec/scriptKinds.js';
|
|
|
45
45
|
import { collectPolicyManifest, describePolicyManifest } from '../exec/policyManifest.js';
|
|
46
46
|
import { assessIsolation, readIsolationSignals } from '../exec/isolation.js';
|
|
47
47
|
import { confinementRefusal, isWithin, sessionRoots } from '../exec/confinement.js';
|
|
48
|
-
import { writeReport } from '../exec/reportFile.js';
|
|
48
|
+
import { stripAnsi, writeReport } from '../exec/reportFile.js';
|
|
49
49
|
import { gapFrom, Pacer } from '../util/pacing.js';
|
|
50
50
|
import { RunLog } from '../log/runLog.js';
|
|
51
51
|
import { composeOpening, operatorNotesSection, readOnlyNote } from '../session/compose.js';
|
|
@@ -456,13 +456,22 @@ export function speakFor(transport, sessionId, opts = {}) {
|
|
|
456
456
|
if (opts.alone)
|
|
457
457
|
speaker.alone = true;
|
|
458
458
|
}
|
|
459
|
+
/** The settings a window open takes at once (`takeSettings`): its locators and the steps on the way to the chat. */
|
|
460
|
+
const WINDOW_NOW = new Set(['copilot.pickerLocators', 'copilot.chatLocators', 'copilot.pickerSteps', 'copilot.builtInSteps', 'copilot.extraSteps']);
|
|
459
461
|
/** The model menu's locators and its step pictures, as Settings have them (2026-10-24), for every window that picks a model. */
|
|
460
462
|
/** The locators Settings hold for the Copilot window: the model menu's, and the chat page's own (the box to write in, 2026-11-17). */
|
|
461
463
|
export function pickerOptions(cfg) {
|
|
464
|
+
// The steps on the way to the chat (2026-11-17): only what differs from the defaults, as the locators. Left out, a
|
|
465
|
+
// window takes the defaults (`takeSettings` too: a step deleted or switched back on goes with the next one).
|
|
466
|
+
const builtIn = cfg.copilot.builtInSteps;
|
|
467
|
+
const switchedOff = !!builtIn && Object.values(builtIn).some((on) => on === false);
|
|
468
|
+
const own = cfg.copilot.extraSteps ?? [];
|
|
462
469
|
return {
|
|
463
470
|
...(cfg.copilot.pickerLocators ? { pickerLocators: cfg.copilot.pickerLocators } : {}),
|
|
464
471
|
...(cfg.copilot.chatLocators ? { chatLocators: cfg.copilot.chatLocators } : {}),
|
|
465
472
|
...(cfg.copilot.pickerSteps ? { modelStepShots: true } : {}),
|
|
473
|
+
...(switchedOff ? { builtInSteps: builtIn } : {}),
|
|
474
|
+
...(own.length > 0 ? { extraSteps: own } : {}),
|
|
466
475
|
};
|
|
467
476
|
}
|
|
468
477
|
export async function openBrowser(cfg, bus, transportDir, sessionId,
|
|
@@ -502,7 +511,13 @@ signal) {
|
|
|
502
511
|
'chat-returned': `Back on this conversation${detail?.signedIn ? ', after the sign-in' : ''}${detail?.by === 'name' ? ', found by its name in the sidebar' : ''}. The work goes on there.`,
|
|
503
512
|
'chat-lost': 'The conversation could not be opened again, by its address or by its name. Nothing was sent, and nothing went into another chat.',
|
|
504
513
|
// A locator of the chat that found nothing (2026-11-17): which, and where Settings has it; the API keeps it for the red field.
|
|
505
|
-
'locator-missing':
|
|
514
|
+
'locator-missing': String(detail?.key ?? '').startsWith('step:')
|
|
515
|
+
? `Your step "${String(detail?.name || detail?.locator || '')}" (${String(detail?.locator ?? '')}) ${String(detail?.why ?? '')}. ${detail?.stopped === false ? 'The work goes on without it. ' : ''}Settings → "Steps to the chat" shows it in red, with the page's HTML for a chatbot to find the right one in.`
|
|
516
|
+
: `Not found on Copilot's page: the "${String(detail?.key ?? '')}" locator (${String(detail?.locator ?? '')}) found nothing ${String(detail?.why ?? '')}. ${detail?.stopped === false ? 'The work goes on without it. ' : ''}Settings → "The chat's locators" shows it in red, with the page's HTML for a chatbot to find the right one in.`,
|
|
517
|
+
// The steps on the way to the chat (2026-11-17).
|
|
518
|
+
'chat-step-not-used': `A step of yours in Settings is not taken: ${String(detail?.problem ?? '')}`,
|
|
519
|
+
'chat-name-off': "The conversation is not named in Copilot's sidebar: that step is switched off in Settings → \"Steps to the chat\".",
|
|
520
|
+
'chat-step': `Your step "${String(detail?.name ?? '')}": ${String(detail?.did ?? '')}`,
|
|
506
521
|
// Copilot showed another of its pages, its home page, instead of the chat (2026-11-17): the chat opened from it.
|
|
507
522
|
'chat-page-elsewhere': `Copilot showed its page ${String(detail?.found ?? '')} instead of the chat; opening the chat ${detail?.by === 'link' ? "by the page's own link to it" : `at ${String(detail?.to ?? '')}`}.`,
|
|
508
523
|
};
|
|
@@ -1297,7 +1312,9 @@ export async function runTask(transport, session, task, deps) {
|
|
|
1297
1312
|
const photographed = session.kind === 'chat' && !session.vcs?.enabled;
|
|
1298
1313
|
let chatCheckpoint = photographed ? task.checkpoint : undefined;
|
|
1299
1314
|
const chatDir = photographed ? session.projectDir?.trim() ?? '' : '';
|
|
1300
|
-
const finish = async (status,
|
|
1315
|
+
const finish = async (status, reasonAsIs, summary, finalReply) => {
|
|
1316
|
+
// An error's text as a terminal would colour it (Playwright's: [2m … [22m) is said without the colours.
|
|
1317
|
+
let reason = reasonAsIs === undefined ? undefined : stripAnsi(reasonAsIs);
|
|
1301
1318
|
// How it ended as reported; the runner's own checks below can still change it, and the final word is written at the end.
|
|
1302
1319
|
await record(`ENDING: ${status.toUpperCase()}`, [summary ?? '', reason ? `Reason: ${reason}` : ''].filter(Boolean).join('\n\n') || '(no details)');
|
|
1303
1320
|
// The net under the plan's own checks: whatever the task left running is stopped and named.
|
|
@@ -1713,6 +1730,9 @@ export async function runTask(transport, session, task, deps) {
|
|
|
1713
1730
|
*/
|
|
1714
1731
|
let policyRevision = 1;
|
|
1715
1732
|
const tookSettings = async (change) => {
|
|
1733
|
+
// The locators and the steps on the way to the chat, fixed in Settings: the window open looks by them from now on.
|
|
1734
|
+
if (change.now.some((name) => WINDOW_NOW.has(name)))
|
|
1735
|
+
transport.takeSettings(pickerOptions(cfg));
|
|
1716
1736
|
pacer.retune({ enabled: cfg.pacing.enabled, settleMs: cfg.pacing.settleMs, maxMessagesPerHour: cfg.pacing.maxMessagesPerHour, gapMs: gapFrom(cfg.pacing) });
|
|
1717
1737
|
const later = [...change.next, ...change.window];
|
|
1718
1738
|
sink.event('settings-changed', change, `Settings saved while this message runs: ${change.now.join(', ')} in force from now${later.length ? `; ${later.join(', ')} from the next message, or the next time the chat window opens` : ''}`);
|
|
@@ -3653,6 +3673,8 @@ export async function runSession(sessionId, deps) {
|
|
|
3653
3673
|
if (borrowed) {
|
|
3654
3674
|
speakFor(borrowed, session.id, { alone: !!deps.chatWindow });
|
|
3655
3675
|
bus.publish({ sessionId, type: 'browser-reused', level: 'info', message: deps.chatWindow ? 'using the browser window the last message left open' : 'using the browser window that is already open' });
|
|
3676
|
+
// The window the last message left open, told what Settings say now: a locator fixed there since is looked by.
|
|
3677
|
+
borrowed.takeSettings(pickerOptions(cfg));
|
|
3656
3678
|
if (deps.chatWindow) {
|
|
3657
3679
|
await borrowed.clearNotice().catch(() => undefined);
|
|
3658
3680
|
await borrowed.ensureSignedIn(undefined, { signal: deps.signal });
|
|
@@ -206,20 +206,12 @@ export const SYSTEM_GUIDE = [
|
|
|
206
206
|
doesBg: 'На всяка страница, когато локатор на чата не е намерил нищо (2026-11-17): отваря Settings → „Локатори на чата“ на полето на този локатор, в червено, с курсора в него. Провал, спрял работата, го отваря веднъж сам.',
|
|
207
207
|
},
|
|
208
208
|
{
|
|
209
|
-
key: 'chatloc.
|
|
209
|
+
key: 'chatloc.file',
|
|
210
210
|
kind: 'link',
|
|
211
|
-
en: 'Download the
|
|
212
|
-
bg: 'Изтегли
|
|
213
|
-
doesEn: '
|
|
214
|
-
doesBg: '
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
key: 'chatloc.prompt',
|
|
218
|
-
kind: 'button',
|
|
219
|
-
en: 'Copy for a chatbot',
|
|
220
|
-
bg: 'Копирай за чатбот',
|
|
221
|
-
doesEn: 'Copies the text that asks a chatbot, given the HTML file, for the locator of this element: what it is, the locator that stopped finding it, and what a good locator uses.',
|
|
222
|
-
doesBg: 'Копира текста, който пита чатбот, получил HTML файла, за локатора на този елемент: какъв е, локаторът, който е спрял да го намира, и какво ползва добрият локатор.',
|
|
211
|
+
en: 'Download the file for a chatbot',
|
|
212
|
+
bg: 'Изтегли файл за чатбота',
|
|
213
|
+
doesEn: 'One file with all a chatbot needs to give the right locator (2026-11-18): what to do and why, what failed and when, the old locator, the part of the page where the element most likely is (around an element near it that was found), the whole page without scripts, styles and conversation names, and how the chatbot walks you through finding it in Edge (F12) when it is in neither. Attach it to Copilot or any other chatbot and send it, with nothing else to write; the chatbot speaks the interface\'s language.',
|
|
214
|
+
doesBg: 'Един файл с всичко, което е нужно на чатбот, за да даде правилния локатор (2026-11-18): какво да направи и защо, какво се е провалило и кога, старият локатор, частта от страницата, където елементът най-вероятно е (около близък елемент, който е намерен), цялата страница без скриптове, стилове и имена на разговори, и как чатботът да ви преведе през търсенето в Edge (F12), ако го няма в нито една от тях. Прикачете го в Copilot или друг чатбот и го пратете, без да пишете нищо друго; чатботът говори на езика на интерфейса.',
|
|
223
215
|
},
|
|
224
216
|
{
|
|
225
217
|
key: 'chatloc.dismiss',
|
|
@@ -2586,6 +2578,30 @@ export const SYSTEM_GUIDE = [
|
|
|
2586
2578
|
doesEn: 'How the bot finds the messages it sent in the conversation, to know one arrived; empty is the default, [id^="user-message-"].',
|
|
2587
2579
|
doesBg: 'Как ботът намира изпратените от него съобщения в разговора, за да разбере, че са пристигнали; празно е стойността по подразбиране, [id^="user-message-"].',
|
|
2588
2580
|
},
|
|
2581
|
+
{
|
|
2582
|
+
key: 'chatloc.uploadInput',
|
|
2583
|
+
kind: 'field',
|
|
2584
|
+
en: 'The box\'s file input',
|
|
2585
|
+
bg: 'Полето за файл на кутията',
|
|
2586
|
+
doesEn: 'How the bot finds the hidden file input of the box, through which it attaches a file (a message too long for text goes as one); empty is the default.',
|
|
2587
|
+
doesBg: 'Как ботът намира скритото поле за файл на кутията, през което прикачва файл (твърде дълго съобщение отива като файл); празно е стойността по подразбиране.',
|
|
2588
|
+
},
|
|
2589
|
+
{
|
|
2590
|
+
key: 'chatloc.attachment',
|
|
2591
|
+
kind: 'field',
|
|
2592
|
+
en: 'The attached file in the box',
|
|
2593
|
+
bg: 'Прикаченият файл в кутията',
|
|
2594
|
+
doesEn: 'How the bot sees that the file is attached; {$file_name} is where the file\'s name goes, {$file_stem} the name without its extension; empty is the default, which finds the old and the new look.',
|
|
2595
|
+
doesBg: 'Как ботът вижда, че файлът е прикачен; {$file_name} е мястото на името на файла, {$file_stem} е името без разширението; празно е стойността по подразбиране, която намира стария и новия вид.',
|
|
2596
|
+
},
|
|
2597
|
+
{
|
|
2598
|
+
key: 'chatloc.attachmentUploaded',
|
|
2599
|
+
kind: 'field',
|
|
2600
|
+
en: 'The attached file, uploaded',
|
|
2601
|
+
bg: 'Прикаченият файл, качен',
|
|
2602
|
+
doesEn: 'How the bot sees that the attached file has finished uploading, before it sends; empty is the default.',
|
|
2603
|
+
doesBg: 'Как ботът вижда, че прикаченият файл е качен докрай, преди да изпрати; празно е стойността по подразбиране.',
|
|
2604
|
+
},
|
|
2589
2605
|
{
|
|
2590
2606
|
key: 'chatloc.turn',
|
|
2591
2607
|
kind: 'field',
|
|
@@ -2660,6 +2676,197 @@ export const SYSTEM_GUIDE = [
|
|
|
2660
2676
|
},
|
|
2661
2677
|
],
|
|
2662
2678
|
},
|
|
2679
|
+
{
|
|
2680
|
+
headingKey: 'steps.title',
|
|
2681
|
+
en: 'Steps to the chat',
|
|
2682
|
+
bg: 'Стъпки до чата',
|
|
2683
|
+
controls: [
|
|
2684
|
+
{
|
|
2685
|
+
key: 'steps.builtInTitle',
|
|
2686
|
+
kind: 'note',
|
|
2687
|
+
en: 'The bot\'s own steps',
|
|
2688
|
+
bg: 'Стъпките на бота',
|
|
2689
|
+
doesEn: 'The bot\'s own steps on Copilot\'s page that can be done without, each with a tick box.',
|
|
2690
|
+
doesBg: 'Собствените стъпки на бота в страницата на Copilot, без които може, всяка с отметка.',
|
|
2691
|
+
},
|
|
2692
|
+
{
|
|
2693
|
+
key: 'steps.popups',
|
|
2694
|
+
kind: 'checkbox',
|
|
2695
|
+
en: 'Close first-run dialogs and banners',
|
|
2696
|
+
bg: 'Затваряй прозорците и банерите при първо пускане',
|
|
2697
|
+
doesEn: 'On (the default): Edge\'s and the page\'s first-run dialogs and banners are closed with the button that declines, before each message and when the chat opens. Off: left as they are.',
|
|
2698
|
+
doesBg: 'Включено (по подразбиране): прозорците и банерите при първо пускане на Edge и на страницата се затварят с бутона, който отказва, преди всяко съобщение и при отваряне на чата. Изключено: остават.',
|
|
2699
|
+
},
|
|
2700
|
+
{
|
|
2701
|
+
key: 'steps.feedbackPanel',
|
|
2702
|
+
kind: 'checkbox',
|
|
2703
|
+
en: 'Close Office\'s feedback panel',
|
|
2704
|
+
bg: 'Затваряй панела за обратна връзка на Office',
|
|
2705
|
+
doesEn: 'On (the default): Office\'s feedback panel is closed before each message when it is open. Off: left open.',
|
|
2706
|
+
doesBg: 'Включено (по подразбиране): панелът за обратна връзка на Office се затваря преди всяко съобщение, когато е отворен. Изключено: остава отворен.',
|
|
2707
|
+
},
|
|
2708
|
+
{
|
|
2709
|
+
key: 'steps.nameChat',
|
|
2710
|
+
kind: 'checkbox',
|
|
2711
|
+
en: 'Name the conversation in the sidebar',
|
|
2712
|
+
bg: 'Кръщавай разговора в страничната лента',
|
|
2713
|
+
doesEn: 'On (the default): a new conversation is renamed in Copilot\'s sidebar after its first answer. Off: it keeps Copilot\'s title and is found by its address only.',
|
|
2714
|
+
doesBg: 'Включено (по подразбиране): новият разговор се преименува в страничната лента на Copilot след първия отговор. Изключено: остава със заглавието от Copilot и се намира само по адреса си.',
|
|
2715
|
+
},
|
|
2716
|
+
{
|
|
2717
|
+
key: 'steps.ownTitle',
|
|
2718
|
+
kind: 'note',
|
|
2719
|
+
en: 'Your steps',
|
|
2720
|
+
bg: 'Твоите стъпки',
|
|
2721
|
+
doesEn: 'The steps of your own, in their order: each "if this is on the page, do this".',
|
|
2722
|
+
doesBg: 'Твоите стъпки, в реда им: всяка „ако това е на страницата, направи това“.',
|
|
2723
|
+
},
|
|
2724
|
+
{
|
|
2725
|
+
key: 'steps.add',
|
|
2726
|
+
kind: 'button',
|
|
2727
|
+
en: '+ Add a step',
|
|
2728
|
+
bg: '+ Добави стъпка',
|
|
2729
|
+
doesEn: 'Adds a step of your own at the end of the list, switched on, before each message, "Click it"; its name field gets the cursor.',
|
|
2730
|
+
doesBg: 'Добавя твоя стъпка в края на списъка, включена, преди всяко съобщение, „Кликни го“; курсорът отива в полето за име.',
|
|
2731
|
+
},
|
|
2732
|
+
{
|
|
2733
|
+
key: 'steps.on',
|
|
2734
|
+
kind: 'checkbox',
|
|
2735
|
+
en: 'On',
|
|
2736
|
+
bg: 'Включена',
|
|
2737
|
+
doesEn: 'Whether the bot takes the step; off, it is kept and passed over.',
|
|
2738
|
+
doesBg: 'Дали ботът прави стъпката; изключена, остава и се пропуска.',
|
|
2739
|
+
},
|
|
2740
|
+
{
|
|
2741
|
+
key: 'steps.name',
|
|
2742
|
+
kind: 'field',
|
|
2743
|
+
en: 'Name',
|
|
2744
|
+
bg: 'Име',
|
|
2745
|
+
doesEn: 'The step\'s name in your words, shown in the bot\'s messages and given to a chatbot with the page\'s HTML.',
|
|
2746
|
+
doesBg: 'Името на стъпката с твои думи, показва се в съобщенията на бота и се дава на чатбот с HTML-а на страницата.',
|
|
2747
|
+
},
|
|
2748
|
+
{
|
|
2749
|
+
key: 'steps.when',
|
|
2750
|
+
kind: 'select',
|
|
2751
|
+
en: 'When',
|
|
2752
|
+
bg: 'Кога',
|
|
2753
|
+
doesEn: 'When the step is taken: "When the chat opens" or "Before each message".',
|
|
2754
|
+
doesBg: 'Кога се прави стъпката: „При отваряне на чата“ или „Преди всяко съобщение“.',
|
|
2755
|
+
},
|
|
2756
|
+
{
|
|
2757
|
+
key: 'steps.whenOpen',
|
|
2758
|
+
kind: 'select',
|
|
2759
|
+
en: 'When the chat opens',
|
|
2760
|
+
bg: 'При отваряне на чата',
|
|
2761
|
+
doesEn: 'In "When": a new chat, a conversation opened again, after a sign-in.',
|
|
2762
|
+
doesBg: 'В „Кога“: нов чат, разговор, отворен отново, след вход.',
|
|
2763
|
+
},
|
|
2764
|
+
{
|
|
2765
|
+
key: 'steps.whenMessage',
|
|
2766
|
+
kind: 'select',
|
|
2767
|
+
en: 'Before each message',
|
|
2768
|
+
bg: 'Преди всяко съобщение',
|
|
2769
|
+
doesEn: 'In "When": just before the bot writes each message in the box.',
|
|
2770
|
+
doesBg: 'В „Кога“: точно преди ботът да напише всяко съобщение в кутията.',
|
|
2771
|
+
},
|
|
2772
|
+
{
|
|
2773
|
+
key: 'steps.locator',
|
|
2774
|
+
kind: 'field',
|
|
2775
|
+
en: 'Locator',
|
|
2776
|
+
bg: 'Локатор',
|
|
2777
|
+
doesEn: 'What the step looks for on the page (CSS, XPath or Playwright\'s own); only what is visible counts. In red when a required step found nothing, with the page\'s HTML.',
|
|
2778
|
+
doesBg: 'Какво търси стъпката на страницата (CSS, XPath или формата на Playwright); брои се само видимото. В червено, когато задължителна стъпка не е намерила нищо, с HTML-а на страницата.',
|
|
2779
|
+
},
|
|
2780
|
+
{
|
|
2781
|
+
key: 'steps.action',
|
|
2782
|
+
kind: 'select',
|
|
2783
|
+
en: 'Action',
|
|
2784
|
+
bg: 'Действие',
|
|
2785
|
+
doesEn: 'What is done when the locator finds something: "Click it", "Press a key", "Wait for it to show", "Wait for it to go".',
|
|
2786
|
+
doesBg: 'Какво се прави, когато локаторът намери нещо: „Кликни го“, „Натисни клавиш“, „Изчакай да се появи“, „Изчакай да изчезне“.',
|
|
2787
|
+
},
|
|
2788
|
+
{
|
|
2789
|
+
key: 'steps.action.click',
|
|
2790
|
+
kind: 'select',
|
|
2791
|
+
en: 'Click it',
|
|
2792
|
+
bg: 'Кликни го',
|
|
2793
|
+
doesEn: 'In "Action": the element found is clicked.',
|
|
2794
|
+
doesBg: 'В „Действие“: намереният елемент се кликва.',
|
|
2795
|
+
},
|
|
2796
|
+
{
|
|
2797
|
+
key: 'steps.action.press',
|
|
2798
|
+
kind: 'select',
|
|
2799
|
+
en: 'Press a key',
|
|
2800
|
+
bg: 'Натисни клавиш',
|
|
2801
|
+
doesEn: 'In "Action": the key in "Key" is pressed when the element is there.',
|
|
2802
|
+
doesBg: 'В „Действие“: натиска се клавишът от „Клавиш“, когато елементът е там.',
|
|
2803
|
+
},
|
|
2804
|
+
{
|
|
2805
|
+
key: 'steps.action.appear',
|
|
2806
|
+
kind: 'select',
|
|
2807
|
+
en: 'Wait for it to show',
|
|
2808
|
+
bg: 'Изчакай да се появи',
|
|
2809
|
+
doesEn: 'In "Action": the bot only waits for the element to show.',
|
|
2810
|
+
doesBg: 'В „Действие“: ботът само изчаква елементът да се появи.',
|
|
2811
|
+
},
|
|
2812
|
+
{
|
|
2813
|
+
key: 'steps.action.gone',
|
|
2814
|
+
kind: 'select',
|
|
2815
|
+
en: 'Wait for it to go',
|
|
2816
|
+
bg: 'Изчакай да изчезне',
|
|
2817
|
+
doesEn: 'In "Action": when the element is there, the bot waits for it to go (a spinner, a banner).',
|
|
2818
|
+
doesBg: 'В „Действие“: когато елементът е там, ботът чака да изчезне (индикатор, банер).',
|
|
2819
|
+
},
|
|
2820
|
+
{
|
|
2821
|
+
key: 'steps.key',
|
|
2822
|
+
kind: 'field',
|
|
2823
|
+
en: 'Key',
|
|
2824
|
+
bg: 'Клавиш',
|
|
2825
|
+
doesEn: 'With "Press a key": the key, as Playwright names it (Escape, Enter, Tab…).',
|
|
2826
|
+
doesBg: 'При „Натисни клавиш“: клавишът, както го нарича Playwright (Escape, Enter, Tab…).',
|
|
2827
|
+
},
|
|
2828
|
+
{
|
|
2829
|
+
key: 'steps.must',
|
|
2830
|
+
kind: 'checkbox',
|
|
2831
|
+
en: 'Must be there',
|
|
2832
|
+
bg: 'Задължителна',
|
|
2833
|
+
doesEn: 'On: a step that finds nothing in its seconds stops the work and is shown in red. Off: it is passed over.',
|
|
2834
|
+
doesBg: 'Включено: стъпка, която не намери нищо в секундите си, спира работата и се показва в червено. Изключено: пропуска се.',
|
|
2835
|
+
},
|
|
2836
|
+
{
|
|
2837
|
+
key: 'steps.waitSec',
|
|
2838
|
+
kind: 'field',
|
|
2839
|
+
en: 'Wait up to',
|
|
2840
|
+
bg: 'Чакай до',
|
|
2841
|
+
doesEn: 'How many seconds the step waits for its element to show (or to go); 0 only looks.',
|
|
2842
|
+
doesBg: 'Колко секунди стъпката чака елементът да се появи (или да изчезне); 0 само поглежда.',
|
|
2843
|
+
},
|
|
2844
|
+
{
|
|
2845
|
+
key: 'steps.up',
|
|
2846
|
+
kind: 'button',
|
|
2847
|
+
en: 'Move up',
|
|
2848
|
+
bg: 'Нагоре',
|
|
2849
|
+
doesEn: 'Moves the step one place up: the steps are taken in their order.',
|
|
2850
|
+
doesBg: 'Мести стъпката едно място нагоре: стъпките се правят в реда си.',
|
|
2851
|
+
},
|
|
2852
|
+
{
|
|
2853
|
+
key: 'steps.down',
|
|
2854
|
+
kind: 'button',
|
|
2855
|
+
en: 'Move down',
|
|
2856
|
+
bg: 'Надолу',
|
|
2857
|
+
doesEn: 'Moves the step one place down.',
|
|
2858
|
+
doesBg: 'Мести стъпката едно място надолу.',
|
|
2859
|
+
},
|
|
2860
|
+
{
|
|
2861
|
+
key: 'steps.remove',
|
|
2862
|
+
kind: 'button',
|
|
2863
|
+
en: 'Delete',
|
|
2864
|
+
bg: 'Изтрий',
|
|
2865
|
+
doesEn: 'Deletes the step, after asking. To keep it for later, untick "On" instead.',
|
|
2866
|
+
doesBg: 'Изтрива стъпката, след като попита. За да я запазиш за по-късно, махни отметката „Включена“.',
|
|
2867
|
+
},
|
|
2868
|
+
],
|
|
2869
|
+
},
|
|
2663
2870
|
{
|
|
2664
2871
|
headingKey: 'loc.title',
|
|
2665
2872
|
en: "The model menu's locators",
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/** A text without a terminal's colour codes (Playwright's errors carry them: [2m … [22m). */
|
|
2
|
+
const ANSI = new RegExp(`${String.fromCharCode(27)}\\[[0-9;?]*[ -/]*[@-~]`, 'g');
|
|
3
|
+
const stripAnsi = (text) => text.replace(ANSI, '');
|
|
1
4
|
const WORDS = {
|
|
2
5
|
en: {
|
|
3
6
|
done: 'The task is done',
|
|
@@ -148,7 +151,7 @@ const WORDS = {
|
|
|
148
151
|
const RIGHT_TO_LEFT = new Set(['ar']);
|
|
149
152
|
/** A reason as a line: its first sentence or so, since the whole of it is in the chat. */
|
|
150
153
|
function brief(text, max = 220) {
|
|
151
|
-
const one = (text ?? '').replace(/\s+/g, ' ').trim();
|
|
154
|
+
const one = stripAnsi(text ?? '').replace(/\s+/g, ' ').trim();
|
|
152
155
|
return one.length > max ? `${one.slice(0, max - 1).trimEnd()}…` : one;
|
|
153
156
|
}
|
|
154
157
|
/** The card for a run of the chat that has ended: how its message(s) ended, and that the window stays open. */
|