copilot-operator 0.1.88 → 0.1.92
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 +66 -3
- package/dist/src/api/operator.service.js +156 -0
- package/dist/src/api/server.js +5 -1
- package/dist/src/cli.js +9 -0
- package/dist/src/config/live.js +6 -3
- package/dist/src/config/schema.js +35 -0
- package/dist/src/orchestrator/taskRunner.js +33 -4
- package/dist/src/plan/systemGuide.js +373 -0
- package/dist/src/session/chatNotice.js +4 -1
- package/dist/src/session/events.js +5 -1
- package/dist/src/session/locatorFailures.js +56 -0
- package/dist/src/transport/chatSteps.js +74 -0
- package/dist/src/transport/copilotTransport.js +514 -76
- package/dist/src/transport/keptWindow.js +7 -0
- package/dist/src/transport/locators.js +174 -5
- package/dist/src/transport/pageHtml.js +62 -0
- package/dist/web/404.html +2 -2
- package/dist/web/_next/static/chunks/{1077.26ca37faa3726fff.js → 1077.922b5f1492f6e0dd.js} +1 -1
- package/dist/web/_next/static/chunks/{1548.f5790cd11a91309f.js → 1548.4a09f12e23d369ec.js} +1 -1
- package/dist/web/_next/static/chunks/{2163.aa9d9b82fcde6caa.js → 2163.14e7879a45ae9748.js} +1 -1
- package/dist/web/_next/static/chunks/{714.b7dbce98ba0b59a8.js → 714.2daeede6dd07ee60.js} +1 -1
- package/dist/web/_next/static/chunks/{7220.0ca53eefec5d01ea.js → 7220.260579c8dbfa2c30.js} +1 -1
- package/dist/web/_next/static/chunks/7921-1de1f08d23145c0d.js +1 -0
- package/dist/web/_next/static/chunks/{8584.9f3b058a8f67d3d7.js → 8584.01e3a7f9f14f0b4f.js} +1 -1
- package/dist/web/_next/static/chunks/{9067.107f6164157e0aa1.js → 9067.75d4fdcf47f62fd1.js} +1 -1
- package/dist/web/_next/static/chunks/{9747.984a86f70f9cd973.js → 9747.f1bdfbefaba61f8b.js} +1 -1
- package/dist/web/_next/static/chunks/app/layout-f5681fae8247797b.js +1 -0
- package/dist/web/_next/static/chunks/app/queue/{page-317151444eda8115.js → page-7909ba7c9e3d4c2d.js} +1 -1
- package/dist/web/_next/static/chunks/app/settings/page-7d343eecdd9c7500.js +1 -0
- package/dist/web/_next/static/chunks/{webpack-c015bbeb103c0856.js → webpack-abd1f09115b96456.js} +1 -1
- package/dist/web/_next/static/css/{0c5d6d5914aa3824.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 +3 -2
- package/dist/web/_next/static/chunks/7921-8f6503aba840928a.js +0 -1
- package/dist/web/_next/static/chunks/app/layout-127e5af1ebf21876.js +0 -1
- package/dist/web/_next/static/chunks/app/settings/page-95069cb94d79e909.js +0 -1
- /package/dist/web/_next/static/{hLBBsG7Kn4vd0p_J-47BJ → n7rfXOWgaCFmATod4Q6hp}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{hLBBsG7Kn4vd0p_J-47BJ → n7rfXOWgaCFmATod4Q6hp}/_ssgManifest.js +0 -0
|
@@ -192,6 +192,45 @@ export const SYSTEM_GUIDE = [
|
|
|
192
192
|
},
|
|
193
193
|
],
|
|
194
194
|
},
|
|
195
|
+
{
|
|
196
|
+
headingKey: 'chatloc.failTitle',
|
|
197
|
+
en: 'The bot could not find "{name}" on Copilot\'s page; the work stopped',
|
|
198
|
+
bg: 'Ботът не намери „{name}“ в страницата на Copilot; работата спря',
|
|
199
|
+
controls: [
|
|
200
|
+
{
|
|
201
|
+
key: 'chatloc.fix',
|
|
202
|
+
kind: 'link',
|
|
203
|
+
en: 'Fix in Settings',
|
|
204
|
+
bg: 'Поправи в Settings',
|
|
205
|
+
doesEn: 'On every page, when a locator of the chat found nothing (2026-11-17): opens Settings → "The chat\'s locators" at that locator\'s field, in red, the cursor in it. A failure that stopped the work opens it once by itself.',
|
|
206
|
+
doesBg: 'На всяка страница, когато локатор на чата не е намерил нищо (2026-11-17): отваря Settings → „Локатори на чата“ на полето на този локатор, в червено, с курсора в него. Провал, спрял работата, го отваря веднъж сам.',
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
key: 'chatloc.html',
|
|
210
|
+
kind: 'link',
|
|
211
|
+
en: 'Download the HTML',
|
|
212
|
+
bg: 'Изтегли HTML',
|
|
213
|
+
doesEn: 'The page\'s HTML at the moment the locator found nothing, scripts, styles and the sidebar\'s conversation names taken out: the file to give a chatbot with "Copy for a chatbot", which answers with the right locator.',
|
|
214
|
+
doesBg: 'HTML-ът на страницата в момента, в който локаторът не е намерил нищо, без скриптове, стилове и имената на разговорите от страничната лента: файлът, който се дава на чатбот заедно с „Копирай за чатбот“, и той отговаря с правилния локатор.',
|
|
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 файла, за локатора на този елемент: какъв е, локаторът, който е спрял да го намира, и какво ползва добрият локатор.',
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
key: 'chatloc.dismiss',
|
|
226
|
+
kind: 'button',
|
|
227
|
+
en: 'Close',
|
|
228
|
+
bg: 'Затвори',
|
|
229
|
+
doesEn: 'Closes the notice of this locator, on every page and in Settings; changing the locator in Settings takes it away too.',
|
|
230
|
+
doesBg: 'Затваря съобщението за този локатор, на всяка страница и в Settings; смяната на локатора в Settings също го маха.',
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
},
|
|
195
234
|
{
|
|
196
235
|
headingKey: 'approval.waitingHere',
|
|
197
236
|
en: 'A step is waiting for your decision',
|
|
@@ -2502,6 +2541,340 @@ export const SYSTEM_GUIDE = [
|
|
|
2502
2541
|
},
|
|
2503
2542
|
],
|
|
2504
2543
|
},
|
|
2544
|
+
{
|
|
2545
|
+
headingKey: 'chatloc.title',
|
|
2546
|
+
en: "The chat's locators",
|
|
2547
|
+
bg: 'Локатори на чата',
|
|
2548
|
+
controls: [
|
|
2549
|
+
{
|
|
2550
|
+
key: 'chatloc.check',
|
|
2551
|
+
kind: 'button',
|
|
2552
|
+
en: 'Check the locators',
|
|
2553
|
+
bg: 'Провери локаторите',
|
|
2554
|
+
doesEn: 'Opens the Copilot window, as reading the models does, and looks for each locator: the box and Send, the sidebar, the newest conversation (opened by its address) and its "More" menu (opened and closed again). It only reads; nothing is sent or renamed. Under each field: found, not found (then in red, with the page\'s HTML), or not on the page then and why.',
|
|
2555
|
+
doesBg: 'Отваря прозореца на Copilot, както при четенето на моделите, и търси всеки локатор: полето и Send, страничната лента, най-новия разговор (отворен по адреса му) и менюто му „More“ (отворено и затворено отново). Само чете; нищо не се изпраща и не се преименува. Под всяко поле: намерен, ненамерен (тогава в червено, с HTML-а на страницата) или не беше на страницата тогава и защо.',
|
|
2556
|
+
},
|
|
2557
|
+
{
|
|
2558
|
+
key: 'chatloc.composer',
|
|
2559
|
+
kind: 'field',
|
|
2560
|
+
en: 'Box to write in',
|
|
2561
|
+
bg: 'Поле за писане',
|
|
2562
|
+
doesEn: 'How the bot finds the box it writes its messages in (2026-11-17): a CSS selector, or an XPath starting with /; empty is the default, which finds the box of before November 2026 and the one of 17 November 2026. A locator of an element around the box works too. When a start is refused as "not the Microsoft 365 Copilot chat" and its picture shows the chat, this is the one to change. The next Copilot window takes it.',
|
|
2563
|
+
doesBg: 'Как ботът намира полето, в което пише съобщенията си (2026-11-17): CSS селектор или XPath, започващ с /; празно е стойността по подразбиране, която намира полето отпреди ноември 2026 и това от 17 ноември 2026. Става и локатор на елемент около полето. Когато стартът е отказан с „not the Microsoft 365 Copilot chat“, а снимката му показва чата, сменя се този. Важи от следващия прозорец на Copilot.',
|
|
2564
|
+
},
|
|
2565
|
+
{
|
|
2566
|
+
key: 'chatloc.howTitle',
|
|
2567
|
+
kind: 'disclosure',
|
|
2568
|
+
en: 'How to find the right locator',
|
|
2569
|
+
bg: 'Как да намерите правилния локатор',
|
|
2570
|
+
doesEn: 'Opens the steps: download the page\'s HTML, give it to a chatbot with the text "Copy for a chatbot", put the locator it answers in the field in red; or by hand, with Inspect and Ctrl+F.',
|
|
2571
|
+
doesBg: 'Отваря стъпките: изтеглете HTML-а на страницата, дайте го на чатбот с текста от „Копирай за чатбот“, сложете локатора, който върне, в полето в червено; или на ръка, с Inspect и Ctrl+F.',
|
|
2572
|
+
},
|
|
2573
|
+
{
|
|
2574
|
+
key: 'chatloc.send',
|
|
2575
|
+
kind: 'field',
|
|
2576
|
+
en: 'Send button',
|
|
2577
|
+
bg: 'Бутон Send',
|
|
2578
|
+
doesEn: 'How the bot finds the button that sends the message; empty is the default, the button named "Send" in the box\'s wrapper.',
|
|
2579
|
+
doesBg: 'Как ботът намира бутона, който изпраща съобщението; празно е стойността по подразбиране — бутонът с име „Send“ в обвивката на полето.',
|
|
2580
|
+
},
|
|
2581
|
+
{
|
|
2582
|
+
key: 'chatloc.userMessage',
|
|
2583
|
+
kind: 'field',
|
|
2584
|
+
en: 'Your message in the conversation',
|
|
2585
|
+
bg: 'Вашето съобщение в разговора',
|
|
2586
|
+
doesEn: 'How the bot finds the messages it sent in the conversation, to know one arrived; empty is the default, [id^="user-message-"].',
|
|
2587
|
+
doesBg: 'Как ботът намира изпратените от него съобщения в разговора, за да разбере, че са пристигнали; празно е стойността по подразбиране, [id^="user-message-"].',
|
|
2588
|
+
},
|
|
2589
|
+
{
|
|
2590
|
+
key: 'chatloc.uploadInput',
|
|
2591
|
+
kind: 'field',
|
|
2592
|
+
en: 'The box\'s file input',
|
|
2593
|
+
bg: 'Полето за файл на кутията',
|
|
2594
|
+
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.',
|
|
2595
|
+
doesBg: 'Как ботът намира скритото поле за файл на кутията, през което прикачва файл (твърде дълго съобщение отива като файл); празно е стойността по подразбиране.',
|
|
2596
|
+
},
|
|
2597
|
+
{
|
|
2598
|
+
key: 'chatloc.attachment',
|
|
2599
|
+
kind: 'field',
|
|
2600
|
+
en: 'The attached file in the box',
|
|
2601
|
+
bg: 'Прикаченият файл в кутията',
|
|
2602
|
+
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.',
|
|
2603
|
+
doesBg: 'Как ботът вижда, че файлът е прикачен; {$file_name} е мястото на името на файла, {$file_stem} е името без разширението; празно е стойността по подразбиране, която намира стария и новия вид.',
|
|
2604
|
+
},
|
|
2605
|
+
{
|
|
2606
|
+
key: 'chatloc.attachmentUploaded',
|
|
2607
|
+
kind: 'field',
|
|
2608
|
+
en: 'The attached file, uploaded',
|
|
2609
|
+
bg: 'Прикаченият файл, качен',
|
|
2610
|
+
doesEn: 'How the bot sees that the attached file has finished uploading, before it sends; empty is the default.',
|
|
2611
|
+
doesBg: 'Как ботът вижда, че прикаченият файл е качен докрай, преди да изпрати; празно е стойността по подразбиране.',
|
|
2612
|
+
},
|
|
2613
|
+
{
|
|
2614
|
+
key: 'chatloc.turn',
|
|
2615
|
+
kind: 'field',
|
|
2616
|
+
en: 'Messages of the conversation',
|
|
2617
|
+
bg: 'Съобщенията в разговора',
|
|
2618
|
+
doesEn: 'How the bot finds each message of the conversation, to count them; empty is the default.',
|
|
2619
|
+
doesBg: 'Как ботът намира всяко съобщение в разговора, за да ги брои; празно е стойността по подразбиране.',
|
|
2620
|
+
},
|
|
2621
|
+
{
|
|
2622
|
+
key: 'chatloc.answer',
|
|
2623
|
+
kind: 'field',
|
|
2624
|
+
en: 'Copilot\'s answer',
|
|
2625
|
+
bg: 'Отговорът на Copilot',
|
|
2626
|
+
doesEn: 'How the bot finds each of Copilot\'s answers, with its toolbar; empty is the default.',
|
|
2627
|
+
doesBg: 'Как ботът намира всеки отговор на Copilot, с лентата му; празно е стойността по подразбиране.',
|
|
2628
|
+
},
|
|
2629
|
+
{
|
|
2630
|
+
key: 'chatloc.copy',
|
|
2631
|
+
kind: 'field',
|
|
2632
|
+
en: 'Copy button of the answer',
|
|
2633
|
+
bg: 'Бутон Copy на отговора',
|
|
2634
|
+
doesEn: 'How the bot finds the Copy button inside the answer, through which it takes the answer; empty is the default.',
|
|
2635
|
+
doesBg: 'Как ботът намира бутона Copy в отговора, през който взема отговора; празно е стойността по подразбиране.',
|
|
2636
|
+
},
|
|
2637
|
+
{
|
|
2638
|
+
key: 'chatloc.stop',
|
|
2639
|
+
kind: 'field',
|
|
2640
|
+
en: 'Stop button',
|
|
2641
|
+
bg: 'Бутон Stop',
|
|
2642
|
+
doesEn: 'How the bot finds the button shown while Copilot is still writing; empty is the default.',
|
|
2643
|
+
doesBg: 'Как ботът намира бутона, който се вижда, докато Copilot още пише; празно е стойността по подразбиране.',
|
|
2644
|
+
},
|
|
2645
|
+
{
|
|
2646
|
+
key: 'chatloc.conversationLink',
|
|
2647
|
+
kind: 'field',
|
|
2648
|
+
en: 'A conversation in the sidebar',
|
|
2649
|
+
bg: 'Разговор в страничната лента',
|
|
2650
|
+
doesEn: 'How the bot finds a conversation\'s link in the sidebar, to name it or open it again by its name; empty is the default.',
|
|
2651
|
+
doesBg: 'Как ботът намира връзката към разговор в страничната лента, за да го кръсти или отвори отново по името му; празно е стойността по подразбиране.',
|
|
2652
|
+
},
|
|
2653
|
+
{
|
|
2654
|
+
key: 'chatloc.chatMore',
|
|
2655
|
+
kind: 'field',
|
|
2656
|
+
en: '"More" button of a conversation',
|
|
2657
|
+
bg: 'Бутон „More“ на разговор',
|
|
2658
|
+
doesEn: 'How the bot finds a conversation\'s "More" button in the sidebar; {$chat_id} is where the conversation\'s id goes; empty is the default.',
|
|
2659
|
+
doesBg: 'Как ботът намира бутона „More“ на разговор в страничната лента; {$chat_id} е мястото на id-то на разговора; празно е стойността по подразбиране.',
|
|
2660
|
+
},
|
|
2661
|
+
{
|
|
2662
|
+
key: 'chatloc.renameItem',
|
|
2663
|
+
kind: 'field',
|
|
2664
|
+
en: '"Rename" in that menu',
|
|
2665
|
+
bg: '„Rename“ в това меню',
|
|
2666
|
+
doesEn: 'How the bot finds "Rename" in a conversation\'s menu; empty is the default.',
|
|
2667
|
+
doesBg: 'Как ботът намира „Rename“ в менюто на разговор; празно е стойността по подразбиране.',
|
|
2668
|
+
},
|
|
2669
|
+
{
|
|
2670
|
+
key: 'chatloc.renameInput',
|
|
2671
|
+
kind: 'field',
|
|
2672
|
+
en: 'The name field of the rename dialog',
|
|
2673
|
+
bg: 'Полето за име в прозореца за преименуване',
|
|
2674
|
+
doesEn: 'How the bot finds the field the new name is written in; empty is the default.',
|
|
2675
|
+
doesBg: 'Как ботът намира полето, в което се пише новото име; празно е стойността по подразбиране.',
|
|
2676
|
+
},
|
|
2677
|
+
{
|
|
2678
|
+
key: 'chatloc.renameSave',
|
|
2679
|
+
kind: 'field',
|
|
2680
|
+
en: '"Save" of the rename dialog',
|
|
2681
|
+
bg: '„Save“ в прозореца за преименуване',
|
|
2682
|
+
doesEn: 'How the bot finds the button that saves the new name; empty is the default.',
|
|
2683
|
+
doesBg: 'Как ботът намира бутона, който записва новото име; празно е стойността по подразбиране.',
|
|
2684
|
+
},
|
|
2685
|
+
],
|
|
2686
|
+
},
|
|
2687
|
+
{
|
|
2688
|
+
headingKey: 'steps.title',
|
|
2689
|
+
en: 'Steps to the chat',
|
|
2690
|
+
bg: 'Стъпки до чата',
|
|
2691
|
+
controls: [
|
|
2692
|
+
{
|
|
2693
|
+
key: 'steps.builtInTitle',
|
|
2694
|
+
kind: 'note',
|
|
2695
|
+
en: 'The bot\'s own steps',
|
|
2696
|
+
bg: 'Стъпките на бота',
|
|
2697
|
+
doesEn: 'The bot\'s own steps on Copilot\'s page that can be done without, each with a tick box.',
|
|
2698
|
+
doesBg: 'Собствените стъпки на бота в страницата на Copilot, без които може, всяка с отметка.',
|
|
2699
|
+
},
|
|
2700
|
+
{
|
|
2701
|
+
key: 'steps.popups',
|
|
2702
|
+
kind: 'checkbox',
|
|
2703
|
+
en: 'Close first-run dialogs and banners',
|
|
2704
|
+
bg: 'Затваряй прозорците и банерите при първо пускане',
|
|
2705
|
+
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.',
|
|
2706
|
+
doesBg: 'Включено (по подразбиране): прозорците и банерите при първо пускане на Edge и на страницата се затварят с бутона, който отказва, преди всяко съобщение и при отваряне на чата. Изключено: остават.',
|
|
2707
|
+
},
|
|
2708
|
+
{
|
|
2709
|
+
key: 'steps.feedbackPanel',
|
|
2710
|
+
kind: 'checkbox',
|
|
2711
|
+
en: 'Close Office\'s feedback panel',
|
|
2712
|
+
bg: 'Затваряй панела за обратна връзка на Office',
|
|
2713
|
+
doesEn: 'On (the default): Office\'s feedback panel is closed before each message when it is open. Off: left open.',
|
|
2714
|
+
doesBg: 'Включено (по подразбиране): панелът за обратна връзка на Office се затваря преди всяко съобщение, когато е отворен. Изключено: остава отворен.',
|
|
2715
|
+
},
|
|
2716
|
+
{
|
|
2717
|
+
key: 'steps.nameChat',
|
|
2718
|
+
kind: 'checkbox',
|
|
2719
|
+
en: 'Name the conversation in the sidebar',
|
|
2720
|
+
bg: 'Кръщавай разговора в страничната лента',
|
|
2721
|
+
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.',
|
|
2722
|
+
doesBg: 'Включено (по подразбиране): новият разговор се преименува в страничната лента на Copilot след първия отговор. Изключено: остава със заглавието от Copilot и се намира само по адреса си.',
|
|
2723
|
+
},
|
|
2724
|
+
{
|
|
2725
|
+
key: 'steps.ownTitle',
|
|
2726
|
+
kind: 'note',
|
|
2727
|
+
en: 'Your steps',
|
|
2728
|
+
bg: 'Твоите стъпки',
|
|
2729
|
+
doesEn: 'The steps of your own, in their order: each "if this is on the page, do this".',
|
|
2730
|
+
doesBg: 'Твоите стъпки, в реда им: всяка „ако това е на страницата, направи това“.',
|
|
2731
|
+
},
|
|
2732
|
+
{
|
|
2733
|
+
key: 'steps.add',
|
|
2734
|
+
kind: 'button',
|
|
2735
|
+
en: '+ Add a step',
|
|
2736
|
+
bg: '+ Добави стъпка',
|
|
2737
|
+
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.',
|
|
2738
|
+
doesBg: 'Добавя твоя стъпка в края на списъка, включена, преди всяко съобщение, „Кликни го“; курсорът отива в полето за име.',
|
|
2739
|
+
},
|
|
2740
|
+
{
|
|
2741
|
+
key: 'steps.on',
|
|
2742
|
+
kind: 'checkbox',
|
|
2743
|
+
en: 'On',
|
|
2744
|
+
bg: 'Включена',
|
|
2745
|
+
doesEn: 'Whether the bot takes the step; off, it is kept and passed over.',
|
|
2746
|
+
doesBg: 'Дали ботът прави стъпката; изключена, остава и се пропуска.',
|
|
2747
|
+
},
|
|
2748
|
+
{
|
|
2749
|
+
key: 'steps.name',
|
|
2750
|
+
kind: 'field',
|
|
2751
|
+
en: 'Name',
|
|
2752
|
+
bg: 'Име',
|
|
2753
|
+
doesEn: 'The step\'s name in your words, shown in the bot\'s messages and given to a chatbot with the page\'s HTML.',
|
|
2754
|
+
doesBg: 'Името на стъпката с твои думи, показва се в съобщенията на бота и се дава на чатбот с HTML-а на страницата.',
|
|
2755
|
+
},
|
|
2756
|
+
{
|
|
2757
|
+
key: 'steps.when',
|
|
2758
|
+
kind: 'select',
|
|
2759
|
+
en: 'When',
|
|
2760
|
+
bg: 'Кога',
|
|
2761
|
+
doesEn: 'When the step is taken: "When the chat opens" or "Before each message".',
|
|
2762
|
+
doesBg: 'Кога се прави стъпката: „При отваряне на чата“ или „Преди всяко съобщение“.',
|
|
2763
|
+
},
|
|
2764
|
+
{
|
|
2765
|
+
key: 'steps.whenOpen',
|
|
2766
|
+
kind: 'select',
|
|
2767
|
+
en: 'When the chat opens',
|
|
2768
|
+
bg: 'При отваряне на чата',
|
|
2769
|
+
doesEn: 'In "When": a new chat, a conversation opened again, after a sign-in.',
|
|
2770
|
+
doesBg: 'В „Кога“: нов чат, разговор, отворен отново, след вход.',
|
|
2771
|
+
},
|
|
2772
|
+
{
|
|
2773
|
+
key: 'steps.whenMessage',
|
|
2774
|
+
kind: 'select',
|
|
2775
|
+
en: 'Before each message',
|
|
2776
|
+
bg: 'Преди всяко съобщение',
|
|
2777
|
+
doesEn: 'In "When": just before the bot writes each message in the box.',
|
|
2778
|
+
doesBg: 'В „Кога“: точно преди ботът да напише всяко съобщение в кутията.',
|
|
2779
|
+
},
|
|
2780
|
+
{
|
|
2781
|
+
key: 'steps.locator',
|
|
2782
|
+
kind: 'field',
|
|
2783
|
+
en: 'Locator',
|
|
2784
|
+
bg: 'Локатор',
|
|
2785
|
+
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.',
|
|
2786
|
+
doesBg: 'Какво търси стъпката на страницата (CSS, XPath или формата на Playwright); брои се само видимото. В червено, когато задължителна стъпка не е намерила нищо, с HTML-а на страницата.',
|
|
2787
|
+
},
|
|
2788
|
+
{
|
|
2789
|
+
key: 'steps.action',
|
|
2790
|
+
kind: 'select',
|
|
2791
|
+
en: 'Action',
|
|
2792
|
+
bg: 'Действие',
|
|
2793
|
+
doesEn: 'What is done when the locator finds something: "Click it", "Press a key", "Wait for it to show", "Wait for it to go".',
|
|
2794
|
+
doesBg: 'Какво се прави, когато локаторът намери нещо: „Кликни го“, „Натисни клавиш“, „Изчакай да се появи“, „Изчакай да изчезне“.',
|
|
2795
|
+
},
|
|
2796
|
+
{
|
|
2797
|
+
key: 'steps.action.click',
|
|
2798
|
+
kind: 'select',
|
|
2799
|
+
en: 'Click it',
|
|
2800
|
+
bg: 'Кликни го',
|
|
2801
|
+
doesEn: 'In "Action": the element found is clicked.',
|
|
2802
|
+
doesBg: 'В „Действие“: намереният елемент се кликва.',
|
|
2803
|
+
},
|
|
2804
|
+
{
|
|
2805
|
+
key: 'steps.action.press',
|
|
2806
|
+
kind: 'select',
|
|
2807
|
+
en: 'Press a key',
|
|
2808
|
+
bg: 'Натисни клавиш',
|
|
2809
|
+
doesEn: 'In "Action": the key in "Key" is pressed when the element is there.',
|
|
2810
|
+
doesBg: 'В „Действие“: натиска се клавишът от „Клавиш“, когато елементът е там.',
|
|
2811
|
+
},
|
|
2812
|
+
{
|
|
2813
|
+
key: 'steps.action.appear',
|
|
2814
|
+
kind: 'select',
|
|
2815
|
+
en: 'Wait for it to show',
|
|
2816
|
+
bg: 'Изчакай да се появи',
|
|
2817
|
+
doesEn: 'In "Action": the bot only waits for the element to show.',
|
|
2818
|
+
doesBg: 'В „Действие“: ботът само изчаква елементът да се появи.',
|
|
2819
|
+
},
|
|
2820
|
+
{
|
|
2821
|
+
key: 'steps.action.gone',
|
|
2822
|
+
kind: 'select',
|
|
2823
|
+
en: 'Wait for it to go',
|
|
2824
|
+
bg: 'Изчакай да изчезне',
|
|
2825
|
+
doesEn: 'In "Action": when the element is there, the bot waits for it to go (a spinner, a banner).',
|
|
2826
|
+
doesBg: 'В „Действие“: когато елементът е там, ботът чака да изчезне (индикатор, банер).',
|
|
2827
|
+
},
|
|
2828
|
+
{
|
|
2829
|
+
key: 'steps.key',
|
|
2830
|
+
kind: 'field',
|
|
2831
|
+
en: 'Key',
|
|
2832
|
+
bg: 'Клавиш',
|
|
2833
|
+
doesEn: 'With "Press a key": the key, as Playwright names it (Escape, Enter, Tab…).',
|
|
2834
|
+
doesBg: 'При „Натисни клавиш“: клавишът, както го нарича Playwright (Escape, Enter, Tab…).',
|
|
2835
|
+
},
|
|
2836
|
+
{
|
|
2837
|
+
key: 'steps.must',
|
|
2838
|
+
kind: 'checkbox',
|
|
2839
|
+
en: 'Must be there',
|
|
2840
|
+
bg: 'Задължителна',
|
|
2841
|
+
doesEn: 'On: a step that finds nothing in its seconds stops the work and is shown in red. Off: it is passed over.',
|
|
2842
|
+
doesBg: 'Включено: стъпка, която не намери нищо в секундите си, спира работата и се показва в червено. Изключено: пропуска се.',
|
|
2843
|
+
},
|
|
2844
|
+
{
|
|
2845
|
+
key: 'steps.waitSec',
|
|
2846
|
+
kind: 'field',
|
|
2847
|
+
en: 'Wait up to',
|
|
2848
|
+
bg: 'Чакай до',
|
|
2849
|
+
doesEn: 'How many seconds the step waits for its element to show (or to go); 0 only looks.',
|
|
2850
|
+
doesBg: 'Колко секунди стъпката чака елементът да се появи (или да изчезне); 0 само поглежда.',
|
|
2851
|
+
},
|
|
2852
|
+
{
|
|
2853
|
+
key: 'steps.up',
|
|
2854
|
+
kind: 'button',
|
|
2855
|
+
en: 'Move up',
|
|
2856
|
+
bg: 'Нагоре',
|
|
2857
|
+
doesEn: 'Moves the step one place up: the steps are taken in their order.',
|
|
2858
|
+
doesBg: 'Мести стъпката едно място нагоре: стъпките се правят в реда си.',
|
|
2859
|
+
},
|
|
2860
|
+
{
|
|
2861
|
+
key: 'steps.down',
|
|
2862
|
+
kind: 'button',
|
|
2863
|
+
en: 'Move down',
|
|
2864
|
+
bg: 'Надолу',
|
|
2865
|
+
doesEn: 'Moves the step one place down.',
|
|
2866
|
+
doesBg: 'Мести стъпката едно място надолу.',
|
|
2867
|
+
},
|
|
2868
|
+
{
|
|
2869
|
+
key: 'steps.remove',
|
|
2870
|
+
kind: 'button',
|
|
2871
|
+
en: 'Delete',
|
|
2872
|
+
bg: 'Изтрий',
|
|
2873
|
+
doesEn: 'Deletes the step, after asking. To keep it for later, untick "On" instead.',
|
|
2874
|
+
doesBg: 'Изтрива стъпката, след като попита. За да я запазиш за по-късно, махни отметката „Включена“.',
|
|
2875
|
+
},
|
|
2876
|
+
],
|
|
2877
|
+
},
|
|
2505
2878
|
{
|
|
2506
2879
|
headingKey: 'loc.title',
|
|
2507
2880
|
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. */
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
* history so a page that opens mid-run can catch up.
|
|
7
7
|
*/
|
|
8
8
|
import { EventEmitter } from 'node:events';
|
|
9
|
+
/** A text without a terminal's colour codes (Playwright's errors carry them: [2m … [22m). */
|
|
10
|
+
const ANSI = new RegExp(`${String.fromCharCode(27)}\\[[0-9;?]*[ -/]*[@-~]`, 'g');
|
|
11
|
+
const stripAnsi = (text) => text.replace(ANSI, '');
|
|
9
12
|
const HISTORY_PER_SESSION = 500;
|
|
10
13
|
export class EventBus {
|
|
11
14
|
emitter = new EventEmitter();
|
|
@@ -14,7 +17,8 @@ export class EventBus {
|
|
|
14
17
|
this.emitter.setMaxListeners(100);
|
|
15
18
|
}
|
|
16
19
|
publish(event) {
|
|
17
|
-
|
|
20
|
+
// Playwright colours its errors for a terminal ([2m … [22m): what is said is said without (2026-11-17).
|
|
21
|
+
const full = { at: new Date().toISOString(), ...event, ...(typeof event.message === 'string' ? { message: stripAnsi(event.message) } : {}) };
|
|
18
22
|
const list = this.history.get(event.sessionId) ?? [];
|
|
19
23
|
list.push(full);
|
|
20
24
|
if (list.length > HISTORY_PER_SESSION)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The chat's locators that found nothing where the bot needed them (operator, 2026-11-17: "a mechanism that detects
|
|
3
|
+
* which locator exactly the bot failed on, so we can easily see which locator has to be updated"), the last time for
|
|
4
|
+
* each. Kept in the data folder, so a failure seen before a restart is still shown; read by the banner on every page
|
|
5
|
+
* and by Settings, where the locator's field is in red, until the locator is changed there or the operator closes it.
|
|
6
|
+
*/
|
|
7
|
+
import { readFile, rename, writeFile } from 'node:fs/promises';
|
|
8
|
+
import { CHAT_LOCATOR_KEYS } from '../transport/locators.js';
|
|
9
|
+
import { isStepKey } from '../transport/chatSteps.js';
|
|
10
|
+
const isKey = (k) => typeof k === 'string' && (CHAT_LOCATOR_KEYS.includes(k) || isStepKey(k));
|
|
11
|
+
export class LocatorFailures {
|
|
12
|
+
file;
|
|
13
|
+
/** One write at a time: two failures in the same second are both kept. */
|
|
14
|
+
queue = Promise.resolve();
|
|
15
|
+
constructor(file) {
|
|
16
|
+
this.file = file;
|
|
17
|
+
}
|
|
18
|
+
async list() {
|
|
19
|
+
try {
|
|
20
|
+
const raw = JSON.parse(await readFile(this.file, 'utf8'));
|
|
21
|
+
if (!Array.isArray(raw))
|
|
22
|
+
return [];
|
|
23
|
+
return raw.filter((f) => !!f && typeof f === 'object' && isKey(f.key) && typeof f.locator === 'string' && typeof f.at === 'string');
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async get(key) {
|
|
30
|
+
return (await this.list()).find((f) => f.key === key) ?? null;
|
|
31
|
+
}
|
|
32
|
+
/** Kept as the one for its locator: the newest replaces the one before. */
|
|
33
|
+
async record(failure) {
|
|
34
|
+
await this.change((all) => [failure, ...all.filter((f) => f.key !== failure.key)]);
|
|
35
|
+
}
|
|
36
|
+
/** Closed by the operator. True when there was one. */
|
|
37
|
+
async dismiss(key) {
|
|
38
|
+
let had = false;
|
|
39
|
+
await this.change((all) => {
|
|
40
|
+
had = all.some((f) => f.key === key);
|
|
41
|
+
return all.filter((f) => f.key !== key);
|
|
42
|
+
});
|
|
43
|
+
return had;
|
|
44
|
+
}
|
|
45
|
+
async change(edit) {
|
|
46
|
+
const run = async () => {
|
|
47
|
+
const next = edit(await this.list());
|
|
48
|
+
const tmp = `${this.file}.tmp`;
|
|
49
|
+
await writeFile(tmp, JSON.stringify(next, null, 2), 'utf8');
|
|
50
|
+
await rename(tmp, this.file);
|
|
51
|
+
};
|
|
52
|
+
const done = this.queue.then(run, run);
|
|
53
|
+
this.queue = done.catch(() => undefined);
|
|
54
|
+
await done;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The steps on the way to the chat, as the operator sets them (2026-11-17: "what happens if we want to add or remove a
|
|
3
|
+
* step? Some steps will drop out in future and new ones will appear to reach the chat"). The locators say where each of
|
|
4
|
+
* the bot's own steps clicks; these say which of those steps are taken at all, and what more is done:
|
|
5
|
+
*
|
|
6
|
+
* - the bot's own steps that can be done without — declining Edge's and the page's first-run dialogs, closing
|
|
7
|
+
* Office's feedback panel, naming the conversation in the sidebar — each switched off in Settings;
|
|
8
|
+
* - steps of the operator's own, in their order, each "if this is on the page, do this": when the chat opens (a new
|
|
9
|
+
* chat, a conversation opened again, after a sign-in) or before each message. Click it, press a key, wait for it to
|
|
10
|
+
* show, wait for it to go. One that "must be there" and is not, within its seconds, stops the work and is said like
|
|
11
|
+
* a locator that found nothing — in red in Settings, with the page's HTML for a chatbot; the others are passed over
|
|
12
|
+
* when they are not there.
|
|
13
|
+
*
|
|
14
|
+
* Only on Copilot's page, only what the locator finds: nothing is typed, nothing is downloaded, no program is started.
|
|
15
|
+
*/
|
|
16
|
+
import { locatorSyntaxProblem } from './locators.js';
|
|
17
|
+
export const STEP_WHEN = ['open', 'message'];
|
|
18
|
+
export const STEP_ACTIONS = ['click', 'press', 'appear', 'gone'];
|
|
19
|
+
/** The bot's own steps that can be switched off; all on by default, as before 2026-11-17. */
|
|
20
|
+
export const BUILT_IN_STEPS = ['popups', 'feedbackPanel', 'nameChat'];
|
|
21
|
+
export const DefaultBuiltInSteps = { popups: true, feedbackPanel: true, nameChat: true };
|
|
22
|
+
/** Where a step's failure is kept, and Settings finds its row by. */
|
|
23
|
+
export const stepKey = (id) => `step:${id}`;
|
|
24
|
+
export const isStepKey = (key) => /^step:[\w-]{1,40}$/.test(key);
|
|
25
|
+
/** A key Playwright can press: a name or one character, with Control/Shift/Alt/Meta in front. */
|
|
26
|
+
export function keyProblem(key) {
|
|
27
|
+
const k = (key ?? '').trim();
|
|
28
|
+
if (!k)
|
|
29
|
+
return 'no key is given to press';
|
|
30
|
+
const ok = /^(?:(?:Control|Shift|Alt|Meta)\+)*(?:[A-Za-z0-9]|F(?:[1-9]|1[0-2])|Escape|Enter|Tab|Space|Backspace|Delete|ArrowUp|ArrowDown|ArrowLeft|ArrowRight|Home|End|PageUp|PageDown)$/.test(k);
|
|
31
|
+
return ok ? null : `"${k}" is not a key it can press (Escape, Enter, Tab, Space, an arrow, F1–F12, one letter or digit, Control+… )`;
|
|
32
|
+
}
|
|
33
|
+
/** What keeps a step from being taken, said for the operator; null when it can be. */
|
|
34
|
+
export function stepProblem(step) {
|
|
35
|
+
if (!step.locator.trim())
|
|
36
|
+
return 'it has no locator';
|
|
37
|
+
const syntax = locatorSyntaxProblem(step.locator);
|
|
38
|
+
if (syntax)
|
|
39
|
+
return syntax;
|
|
40
|
+
if (step.action === 'press')
|
|
41
|
+
return keyProblem(step.key);
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
/** The steps taken, in their order: those switched on that can be taken; the rest said in `problems`. */
|
|
45
|
+
export function usableSteps(saved) {
|
|
46
|
+
const steps = [];
|
|
47
|
+
const problems = [];
|
|
48
|
+
for (const [i, step] of (saved ?? []).entries()) {
|
|
49
|
+
if (step.off)
|
|
50
|
+
continue;
|
|
51
|
+
const problem = stepProblem(step);
|
|
52
|
+
if (problem)
|
|
53
|
+
problems.push(`step ${i + 1} "${step.name || step.locator}" in Settings is not taken: ${problem}`);
|
|
54
|
+
else
|
|
55
|
+
steps.push(step);
|
|
56
|
+
}
|
|
57
|
+
return { steps, problems };
|
|
58
|
+
}
|
|
59
|
+
/** The text a chatbot is handed with the page's HTML for a step's element (as `locatorPrompt` for the chat's own). */
|
|
60
|
+
export function stepPrompt(step, failed) {
|
|
61
|
+
const what = step.action === 'click' ? 'the element the user clicks at this point'
|
|
62
|
+
: step.action === 'press' ? `the element whose presence means the key ${step.key ?? ''} is to be pressed`
|
|
63
|
+
: step.action === 'appear' ? 'the element that shows when the page is ready for this step'
|
|
64
|
+
: 'the element that shows while the page is not ready yet (a spinner, a banner, a dialog)';
|
|
65
|
+
return [
|
|
66
|
+
'The attached file is the HTML of the Microsoft 365 Copilot chat page in a browser (scripts, styles and the list of conversations taken out).',
|
|
67
|
+
`Find this element in it: ${what}. The user describes it as: "${step.name || '(no description)'}".`,
|
|
68
|
+
`This locator used to find it and now finds nothing: ${failed}`,
|
|
69
|
+
'Give me one locator that finds exactly this element, and only it: a CSS selector, or an XPath if CSS cannot say it.',
|
|
70
|
+
'Use what stays the same between versions of the page: id, role, aria-label, data-testid, data-test-id and other data-* attributes, the tag, the visible text.',
|
|
71
|
+
'Do not use class names made of random letters (like azFuQXgw or ___1x5usfw): they change with every new version of the page.',
|
|
72
|
+
'Answer with the locator on the first line, then one line on why it is that element.',
|
|
73
|
+
].join('\n');
|
|
74
|
+
}
|