copilot-operator 0.1.52 → 0.1.54
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/README.md +23 -1
- package/dist/src/api/operator.controller.js +71 -2
- package/dist/src/api/operator.service.js +99 -7
- package/dist/src/config/schema.js +32 -0
- package/dist/src/exec/policy.js +11 -1
- package/dist/src/exec/scriptFiles.js +108 -2
- package/dist/src/orchestrator/leadRunner.js +50 -4
- package/dist/src/orchestrator/review.js +9 -3
- package/dist/src/orchestrator/taskRunner.js +55 -3
- package/dist/src/plan/kerrigan.js +35 -4
- package/dist/src/plan/systemGuide.js +234 -4
- package/dist/src/session/compose.js +16 -4
- package/dist/src/session/store.js +3 -0
- package/dist/src/session/workspace.js +22 -0
- package/dist/src/session/workspaceSearch.js +162 -0
- package/dist/src/util/pacing.js +33 -2
- package/dist/src/vcs/git.js +12 -2
- package/dist/src/vcs/referenceGuard.js +299 -0
- package/dist/web/404.html +3 -2
- package/dist/web/_next/static/{_1zhoDsMOPAH2xW702E5A → WuIGWiKKh_ESR3KwzsLZF}/_buildManifest.js +1 -1
- package/dist/web/_next/static/chunks/1017.ce926873b598fb89.js +1 -0
- package/dist/web/_next/static/chunks/1077.ae2fd686ef05572e.js +1 -0
- package/dist/web/_next/static/chunks/12.06a7f14bd6716249.js +1 -0
- package/dist/web/_next/static/chunks/1350.a5dc706c8110fd34.js +24 -0
- package/dist/web/_next/static/chunks/1548.bd558d3f2c8df4af.js +1 -0
- package/dist/web/_next/static/chunks/1706.db51b57351297898.js +309 -0
- package/dist/web/_next/static/chunks/1707.7d64ffc060c697a0.js +193 -0
- package/dist/web/_next/static/chunks/1880.87829ecb91209eda.js +24 -0
- package/dist/web/_next/static/chunks/20154aaa.28032c3aa5bcd84d.js +1 -0
- package/dist/web/_next/static/chunks/2037.d1bb5e37c7fe85ae.js +104 -0
- package/dist/web/_next/static/chunks/2163.b41334711ddcceff.js +1 -0
- package/dist/web/_next/static/chunks/2398d077.79ae940919b9695e.js +1 -0
- package/dist/web/_next/static/chunks/2435.9b433b38d34b4b2e.js +1 -0
- package/dist/web/_next/static/chunks/2506.bc8515842e225d2a.js +1 -0
- package/dist/web/_next/static/chunks/2529.c88688b437d71d68.js +41 -0
- package/dist/web/_next/static/chunks/2908.4e0e875d2d471932.js +1 -0
- package/dist/web/_next/static/chunks/3117.a4e1c3348e8bead9.js +1 -0
- package/dist/web/_next/static/chunks/3131-8ec8b632ebf0450d.js +1 -0
- package/dist/web/_next/static/chunks/3134-b6a7bc1f267c39aa.js +1 -0
- package/dist/web/_next/static/chunks/3233.1dcc2798f7f5efa0.js +149 -0
- package/dist/web/_next/static/chunks/344.41cc997c8c8deeed.js +115 -0
- package/dist/web/_next/static/chunks/3690.f691d3fcbd70073d.js +1 -0
- package/dist/web/_next/static/chunks/3804.593b14643e74a2a1.js +1 -0
- package/dist/web/_next/static/chunks/3816.9f5568918e35e4ef.js +77 -0
- package/dist/web/_next/static/chunks/3859.f56f3c6ac4b74cf1.js +94 -0
- package/dist/web/_next/static/chunks/3976.11b159e82e0aa974.js +1 -0
- package/dist/web/_next/static/chunks/3986.d47ed4855773e6dd.js +1 -0
- package/dist/web/_next/static/chunks/441.172f3f581f0030d1.js +226 -0
- package/dist/web/_next/static/chunks/442.2e236a6c5c413bd9.js +1 -0
- package/dist/web/_next/static/chunks/4459.d6df347eb58fccd7.js +1 -0
- package/dist/web/_next/static/chunks/4619.ae3628373decf74f.js +34 -0
- package/dist/web/_next/static/chunks/4623.d5711a8d967e49f4.js +1 -0
- package/dist/web/_next/static/chunks/4670.6b811cc3f67a851c.js +62 -0
- package/dist/web/_next/static/chunks/4812.0af1380aa478f6d3.js +93 -0
- package/dist/web/_next/static/chunks/4969.4f7aff472cf938bf.js +1 -0
- package/dist/web/_next/static/chunks/5790.fe114d1a18741d62.js +86 -0
- package/dist/web/_next/static/chunks/603.4055460889ea24d8.js +1 -0
- package/dist/web/_next/static/chunks/6072.b4b359b24b1738d4.js +286 -0
- package/dist/web/_next/static/chunks/6230.8645bbed143793da.js +1 -0
- package/dist/web/_next/static/chunks/6260.6b5b5c9713d7133f.js +1 -0
- package/dist/web/_next/static/chunks/63b9f8e2.218fd437b256a7e4.js +1 -0
- package/dist/web/_next/static/chunks/6421.3ace3aefc3e7350e.js +1 -0
- package/dist/web/_next/static/chunks/6542.963ec591b5c2bc5a.js +1 -0
- package/dist/web/_next/static/chunks/6885.8fb8eeb9e792b515.js +1 -0
- package/dist/web/_next/static/chunks/6891.dd910309748ad46b.js +1 -0
- package/dist/web/_next/static/chunks/714.cb77983f9be215c9.js +1 -0
- package/dist/web/_next/static/chunks/7220.072a60cd9d60220a.js +1 -0
- package/dist/web/_next/static/chunks/7307.39c27470a879fd0a.js +1 -0
- package/dist/web/_next/static/chunks/7333.04d0e45b223dadd4.js +32 -0
- package/dist/web/_next/static/chunks/7489.395193bf37b80884.js +1 -0
- package/dist/web/_next/static/chunks/7496.17282033df0e8794.js +148 -0
- package/dist/web/_next/static/chunks/7500-f90e2ae7061e351d.js +1 -0
- package/dist/web/_next/static/chunks/7507.9fd648884587a7f3.js +287 -0
- package/dist/web/_next/static/chunks/76.f9c2aea58a61692f.js +1 -0
- package/dist/web/_next/static/chunks/7664.bd6265e6e94e1ecd.js +79 -0
- package/dist/web/_next/static/chunks/7872.9b08a88b7289949f.js +64 -0
- package/dist/web/_next/static/chunks/7921-54dae769aa8bae96.js +1 -0
- package/dist/web/_next/static/chunks/795.710d39b80c9ae80c.js +1 -0
- package/dist/web/_next/static/chunks/8173.b82aa1855e641605.js +1 -0
- package/dist/web/_next/static/chunks/8216.b248ebe0af447347.js +8 -0
- package/dist/web/_next/static/chunks/82d3f3cb.23be11b749288234.js +62 -0
- package/dist/web/_next/static/chunks/8381.2d6783c030f8a913.js +27 -0
- package/dist/web/_next/static/chunks/85120a0e.ac16dccf0b8d73d3.js +66 -0
- package/dist/web/_next/static/chunks/8547.0a9997b67008c706.js +1 -0
- package/dist/web/_next/static/chunks/8584.9d5d6c09b0375015.js +1 -0
- package/dist/web/_next/static/chunks/8662.f2663643214caed1.js +38 -0
- package/dist/web/_next/static/chunks/8689.e564346c6e0d16be.js +1 -0
- package/dist/web/_next/static/chunks/9067.832c4761a991f2c2.js +1 -0
- package/dist/web/_next/static/chunks/9125.8589db5ba200cbf1.js +1 -0
- package/dist/web/_next/static/chunks/9202.8dcf7e6a85cc3d36.js +1 -0
- package/dist/web/_next/static/chunks/9249.916a423ac8a07e76.js +1 -0
- package/dist/web/_next/static/chunks/9313.e4f6405d96375c40.js +92 -0
- package/dist/web/_next/static/chunks/937.6d8406b06135134f.js +1 -0
- package/dist/web/_next/static/chunks/9418.1e8f8e14bb5fe3ae.js +217 -0
- package/dist/web/_next/static/chunks/9591.fabd60bd0d10341c.js +1 -0
- package/dist/web/_next/static/chunks/972.db753db904050e48.js +23 -0
- package/dist/web/_next/static/chunks/9747.c8d4ba56c9eef95f.js +1 -0
- package/dist/web/_next/static/chunks/9763.da9015d4a1b533b9.js +36 -0
- package/dist/web/_next/static/chunks/9884.8712c5ed7b044ff2.js +1 -0
- package/dist/web/_next/static/chunks/9891.91a2c59fd073fd48.js +74 -0
- package/dist/web/_next/static/chunks/9984.cdabea5a592e42a1.js +1 -0
- package/dist/web/_next/static/chunks/a9ddb983.8bbb677720017a57.js +122 -0
- package/dist/web/_next/static/chunks/app/_not-found/page-1264c0db9665169c.js +1 -0
- package/dist/web/_next/static/chunks/app/defaults/page-a1f90fe37e302928.js +1 -0
- package/dist/web/_next/static/chunks/app/layout-46efb208d7c88648.js +1 -0
- package/dist/web/_next/static/chunks/app/page-57787f15774d76b8.js +1 -0
- package/dist/web/_next/static/chunks/app/system/page-825f53f14d16033d.js +1 -0
- package/dist/web/_next/static/chunks/c7879cf7-fabe25011515220e.js +1 -0
- package/dist/web/_next/static/chunks/c7ea4e13.9b71b5f026a1d6d4.js +1 -0
- package/dist/web/_next/static/chunks/f99cb6a2.3f570aeba3860608.js +160 -0
- package/dist/web/_next/static/chunks/framework-a8bf4d38dd23845f.js +1 -0
- package/dist/web/_next/static/chunks/main-app-f747f0f5ddb4213b.js +1 -0
- package/dist/web/_next/static/chunks/main-d3bbfb91b54fbcc3.js +1 -0
- package/dist/web/_next/static/chunks/pages/_app-5b348989bba3d570.js +1 -0
- package/dist/web/_next/static/chunks/pages/_error-cf88c6d2cc5868d7.js +1 -0
- package/dist/web/_next/static/chunks/webpack-cb74fa884b8af278.js +1 -0
- package/dist/web/_next/static/css/d3398f485b2a9075.css +1 -0
- package/dist/web/defaults.html +3 -2
- package/dist/web/defaults.txt +16 -16
- package/dist/web/index.html +4 -2
- package/dist/web/index.txt +16 -16
- package/dist/web/system.html +3 -2
- package/dist/web/system.txt +16 -16
- package/package.json +8 -2
- package/prompts/level1.md +32 -12
- package/prompts/review1.md +287 -286
- package/dist/web/_next/static/chunks/12.f1f4d35b52633e8d.js +0 -1
- package/dist/web/_next/static/chunks/131-bae98f790a541679.js +0 -1
- package/dist/web/_next/static/chunks/134-ddd50a7fbb536ec8.js +0 -1
- package/dist/web/_next/static/chunks/163.dbd7d36584d0bb37.js +0 -1
- package/dist/web/_next/static/chunks/220.35531b39410e1a9f.js +0 -1
- package/dist/web/_next/static/chunks/489.158bbe303a595fba.js +0 -1
- package/dist/web/_next/static/chunks/548.71ac96c94136659b.js +0 -1
- package/dist/web/_next/static/chunks/584.6df695c5b86a75aa.js +0 -1
- package/dist/web/_next/static/chunks/67.9ed79e2fbfb56f26.js +0 -1
- package/dist/web/_next/static/chunks/714.1e2338736a70b9c7.js +0 -1
- package/dist/web/_next/static/chunks/747.d2c1249d736dc03b.js +0 -1
- package/dist/web/_next/static/chunks/77.a200abef0f5b4a7f.js +0 -1
- package/dist/web/_next/static/chunks/808-bc7d7eac6d823291.js +0 -1
- package/dist/web/_next/static/chunks/921-dc5538cd779c6432.js +0 -1
- package/dist/web/_next/static/chunks/app/_not-found/page-0d0d8e7e62efca12.js +0 -1
- package/dist/web/_next/static/chunks/app/defaults/page-edd7534ca9ecf366.js +0 -1
- package/dist/web/_next/static/chunks/app/layout-8f99a164d76897a0.js +0 -1
- package/dist/web/_next/static/chunks/app/page-4bed816eda370d0c.js +0 -1
- package/dist/web/_next/static/chunks/app/system/page-1cf9e75e76da59ed.js +0 -1
- package/dist/web/_next/static/chunks/c7879cf7-b5ab1053c1d9a2e7.js +0 -1
- package/dist/web/_next/static/chunks/framework-9ac6a346bd42cedd.js +0 -1
- package/dist/web/_next/static/chunks/main-6be4444e2d667e41.js +0 -1
- package/dist/web/_next/static/chunks/main-app-e3a5f713ba31557e.js +0 -1
- package/dist/web/_next/static/chunks/pages/_app-32d20d5a04949d29.js +0 -1
- package/dist/web/_next/static/chunks/pages/_error-abbab53f25ea29b0.js +0 -1
- package/dist/web/_next/static/chunks/webpack-77147e31d2125631.js +0 -1
- package/dist/web/_next/static/css/3bea264adc472bc8.css +0 -1
- /package/dist/web/_next/static/{_1zhoDsMOPAH2xW702E5A → WuIGWiKKh_ESR3KwzsLZF}/_ssgManifest.js +0 -0
|
@@ -325,8 +325,8 @@ export const SYSTEM_GUIDE = [
|
|
|
325
325
|
route: '/',
|
|
326
326
|
nameEn: 'Chat',
|
|
327
327
|
nameBg: 'Чат',
|
|
328
|
-
purposeEn: 'The home screen, laid out as an IDE: the open folder\'s files or its git on the left, the open files and diffs in the middle with Kerrigan when nothing is open, the terminal, the problems and the output of the chat\'s conversation below, and the chat on the right, which works in the open folder. The status bar says what runs; Ctrl+K finds anything.',
|
|
329
|
-
purposeBg: 'Началният екран, подреден като IDE: файловете или git на отворената папка отляво, отворените файлове и разлики в средата, с Кериган, когато нищо не е отворено, терминалът, проблемите и изходът на разговора в чата отдолу и чатът отдясно, който работи в отворената
|
|
328
|
+
purposeEn: 'The home screen, laid out as an IDE: the open folder\'s files or its git on the left, the open files and diffs in the middle with Kerrigan when nothing is open, the terminal, the problems and the output of the chat\'s conversation below, and the chat on the right, which works in the open folder — where they start: the three panels can be moved (the grip ⠿ in the head of each). The status bar says what runs; Ctrl+K finds anything.',
|
|
329
|
+
purposeBg: 'Началният екран, подреден като IDE: файловете или git на отворената папка отляво, отворените файлове и разлики в средата, с Кериган, когато нищо не е отворено, терминалът, проблемите и изходът на разговора в чата отдолу и чатът отдясно, който работи в отворената папка — така започват: трите панела могат да се местят (дръжката ⠿ в заглавието на всеки). Лентата най-долу казва какво върви; Ctrl+K намира всичко.',
|
|
330
330
|
sections: [
|
|
331
331
|
{
|
|
332
332
|
headingKey: null,
|
|
@@ -443,6 +443,14 @@ export const SYSTEM_GUIDE = [
|
|
|
443
443
|
doesEn: 'Shows the open folder\'s files beside it; a file opens in the editor.',
|
|
444
444
|
doesBg: 'Показва файловете на отворената папка до нея; файл се отваря в редактора.',
|
|
445
445
|
},
|
|
446
|
+
{
|
|
447
|
+
key: 'wb.search',
|
|
448
|
+
kind: 'button',
|
|
449
|
+
en: 'Search (Ctrl+Shift+F)',
|
|
450
|
+
bg: 'Търсене (Ctrl+Shift+F)',
|
|
451
|
+
doesEn: 'The magnifier in the column of icons (or Ctrl+Shift+F): the Search view, as in VS Code — the open folder\'s code searched as you type, the results by file.',
|
|
452
|
+
doesBg: 'Лупата в колоната с икони (или Ctrl+Shift+F): изгледът за търсене, както във VS Code — кодът на отворената папка се търси, докато пишете, резултатите по файлове.',
|
|
453
|
+
},
|
|
446
454
|
{
|
|
447
455
|
key: 'wb.viewCommits',
|
|
448
456
|
kind: 'button',
|
|
@@ -663,8 +671,8 @@ export const SYSTEM_GUIDE = [
|
|
|
663
671
|
kind: 'button',
|
|
664
672
|
en: 'Copy',
|
|
665
673
|
bg: 'Копирай',
|
|
666
|
-
doesEn: 'Under your message, under what the chat said, beside how it ended and
|
|
667
|
-
doesBg: 'Под твое съобщение, под казаното от чата, до
|
|
674
|
+
doesEn: 'Under your message, under what the chat said, beside how it ended, beside a command and at the top and foot of a plan: copies that text (a command with what it printed, a plan whole with its headings); it says "Copied" for a moment.',
|
|
675
|
+
doesBg: 'Под твое съобщение, под казаното от чата, до края, до команда и в началото и края на план: копира този текст (команда — заедно с изписаното от нея, план — целия, със заглавията му); за момент пише „Копирано“.',
|
|
668
676
|
},
|
|
669
677
|
{
|
|
670
678
|
key: 'chat.foldOpen',
|
|
@@ -762,6 +770,14 @@ export const SYSTEM_GUIDE = [
|
|
|
762
770
|
doesEn: 'While it works: stops it; the message in flight ends stopped and can be carried on. The Copilot window stays open for the next message.',
|
|
763
771
|
doesBg: 'Докато работи: спира го; текущото съобщение завършва спряно и може да продължи. Прозорецът на Copilot остава отворен за следващото съобщение.',
|
|
764
772
|
},
|
|
773
|
+
{
|
|
774
|
+
key: 'chat.skill',
|
|
775
|
+
kind: 'select',
|
|
776
|
+
en: 'Skill',
|
|
777
|
+
bg: 'Skill',
|
|
778
|
+
doesEn: 'Under the chat\'s box when Settings have skills for this folder: chooses one for the next message, and its instructions for that kind of task go with it. Starting the message with /its-name does the same.',
|
|
779
|
+
doesBg: 'Под полето на чата, когато в Настройки има skill-ове за тази папка: избира един за следващото съобщение и инструкциите му за този вид задача отиват с него. Същото става, ако съобщението започне с /името му.',
|
|
780
|
+
},
|
|
765
781
|
{
|
|
766
782
|
key: 'chat.planMode',
|
|
767
783
|
kind: 'checkbox',
|
|
@@ -890,6 +906,22 @@ export const SYSTEM_GUIDE = [
|
|
|
890
906
|
doesEn: 'Does not run it; the chat is told and goes on.',
|
|
891
907
|
doesBg: 'Не я изпълнява; чатът научава и продължава.',
|
|
892
908
|
},
|
|
909
|
+
{
|
|
910
|
+
key: 'nav.appearance',
|
|
911
|
+
kind: 'button',
|
|
912
|
+
en: 'Appearance',
|
|
913
|
+
bg: 'Изглед',
|
|
914
|
+
doesEn: 'In the bar on top, between Settings and System: the theme (System, Light, Dark), the text size with A− and A+, and the reading aids — night light, underlined links, less motion, more contrast, a thick focus outline, the system\'s cursor.',
|
|
915
|
+
doesBg: 'В лентата горе, между Настройки и Система: темата (Системна, Светла, Тъмна), размерът на текста с A− и A+, и помощните опции — нощна светлина, подчертани връзки, по-малко движение, повече контраст, дебел фокусен контур, курсорът на системата.',
|
|
916
|
+
},
|
|
917
|
+
{
|
|
918
|
+
key: 'wb.move',
|
|
919
|
+
kind: 'button',
|
|
920
|
+
en: 'Move {name}',
|
|
921
|
+
bg: 'Премести {name}',
|
|
922
|
+
doesEn: 'The grip ⠿ at the head of the explorer, of the editor and of the chat: drag it onto another panel and the two swap places — the chat where the editor was, for one — or click it and choose to the left, to the middle or to the right. The order is kept in this browser; "Put the panels back where they were" (Ctrl+K) undoes it.',
|
|
923
|
+
doesBg: 'Дръжката ⠿ в заглавието на изследователя, на редактора и на чата: хванете я и я пуснете върху друг панел — двата си разменят местата, например чатът отива там, където е бил редакторът; или щракнете и изберете наляво, в средата или надясно. Подредбата се помни в този браузър; „Върни панелите по местата им“ (Ctrl+K) я връща.',
|
|
924
|
+
},
|
|
893
925
|
{
|
|
894
926
|
key: 'wb.toggleChat',
|
|
895
927
|
kind: 'button',
|
|
@@ -1050,6 +1082,109 @@ export const SYSTEM_GUIDE = [
|
|
|
1050
1082
|
},
|
|
1051
1083
|
],
|
|
1052
1084
|
},
|
|
1085
|
+
{
|
|
1086
|
+
headingKey: 'search.title',
|
|
1087
|
+
en: 'Search',
|
|
1088
|
+
bg: 'Търсене',
|
|
1089
|
+
controls: [
|
|
1090
|
+
{
|
|
1091
|
+
key: 'search.input',
|
|
1092
|
+
kind: 'field',
|
|
1093
|
+
en: 'Search',
|
|
1094
|
+
bg: 'Търсене',
|
|
1095
|
+
doesEn: 'The text to find in the open folder\'s files, searched a moment after you stop typing (Enter searches at once). Files git ignores and files that are not text are left out; files not committed yet are searched.',
|
|
1096
|
+
doesBg: 'Текстът, който да се намери във файловете на отворената папка; търси се малко след като спрете да пишете (Enter търси веднага). Файловете, които git пренебрегва, и тези, които не са текст, се пропускат; още некомитнатите се търсят.',
|
|
1097
|
+
},
|
|
1098
|
+
{
|
|
1099
|
+
key: 'search.matchCase',
|
|
1100
|
+
kind: 'button',
|
|
1101
|
+
en: 'Match Case',
|
|
1102
|
+
bg: 'Главни и малки букви',
|
|
1103
|
+
doesEn: 'Aa inside the box: only matches with the same capitals.',
|
|
1104
|
+
doesBg: 'Aa в полето: само съвпадения със същите главни и малки букви.',
|
|
1105
|
+
},
|
|
1106
|
+
{
|
|
1107
|
+
key: 'search.wholeWord',
|
|
1108
|
+
kind: 'button',
|
|
1109
|
+
en: 'Match Whole Word',
|
|
1110
|
+
bg: 'Само цели думи',
|
|
1111
|
+
doesEn: 'ab inside the box: only whole words, not part of a longer one.',
|
|
1112
|
+
doesBg: 'ab в полето: само цели думи, не част от по-дълга.',
|
|
1113
|
+
},
|
|
1114
|
+
{
|
|
1115
|
+
key: 'search.regex',
|
|
1116
|
+
kind: 'button',
|
|
1117
|
+
en: 'Use Regular Expression',
|
|
1118
|
+
bg: 'Регулярен израз',
|
|
1119
|
+
doesEn: '.* inside the box: the text is a regular expression (PCRE); one that is not valid is said under the box.',
|
|
1120
|
+
doesBg: '.* в полето: текстът е регулярен израз (PCRE); невалиден се казва под полето.',
|
|
1121
|
+
},
|
|
1122
|
+
{
|
|
1123
|
+
key: 'search.details',
|
|
1124
|
+
kind: 'button',
|
|
1125
|
+
en: 'Toggle Search Details',
|
|
1126
|
+
bg: 'Покажи или скрий подробностите',
|
|
1127
|
+
doesEn: 'The … beside the box: shows the files to include and to exclude.',
|
|
1128
|
+
doesBg: 'Трите точки до полето: показва файловете за включване и изключване.',
|
|
1129
|
+
},
|
|
1130
|
+
{
|
|
1131
|
+
key: 'search.include',
|
|
1132
|
+
kind: 'field',
|
|
1133
|
+
en: 'files to include',
|
|
1134
|
+
bg: 'файлове за включване',
|
|
1135
|
+
doesEn: 'Globs, separated by commas: *.ts in any folder, src/** from the root, a folder by its name.',
|
|
1136
|
+
doesBg: 'Шаблони, разделени със запетаи: *.ts във всяка папка, src/** от корена, папка по името ѝ.',
|
|
1137
|
+
},
|
|
1138
|
+
{
|
|
1139
|
+
key: 'search.exclude',
|
|
1140
|
+
kind: 'field',
|
|
1141
|
+
en: 'files to exclude',
|
|
1142
|
+
bg: 'файлове за изключване',
|
|
1143
|
+
doesEn: 'Globs, as for the files to include, of files left out of the search.',
|
|
1144
|
+
doesBg: 'Шаблони, като за включване, на файлове, оставени извън търсенето.',
|
|
1145
|
+
},
|
|
1146
|
+
{
|
|
1147
|
+
key: 'search.refresh',
|
|
1148
|
+
kind: 'button',
|
|
1149
|
+
en: 'Refresh',
|
|
1150
|
+
bg: 'Опресни',
|
|
1151
|
+
doesEn: 'Searches again, for files changed since.',
|
|
1152
|
+
doesBg: 'Търси наново, за файлове, променени оттогава.',
|
|
1153
|
+
},
|
|
1154
|
+
{
|
|
1155
|
+
key: 'search.clear',
|
|
1156
|
+
kind: 'button',
|
|
1157
|
+
en: 'Clear Search Results',
|
|
1158
|
+
bg: 'Изчисти резултатите',
|
|
1159
|
+
doesEn: 'Empties the box and the results.',
|
|
1160
|
+
doesBg: 'Изпразва полето и резултатите.',
|
|
1161
|
+
},
|
|
1162
|
+
{
|
|
1163
|
+
key: 'search.collapse',
|
|
1164
|
+
kind: 'button',
|
|
1165
|
+
en: 'Collapse All',
|
|
1166
|
+
bg: 'Свий всички',
|
|
1167
|
+
doesEn: 'Folds every file of the results (pressed again: Expand All). A file\'s row folds or opens it; a line of it opens the file at that line, the match chosen.',
|
|
1168
|
+
doesBg: 'Свива всеки файл от резултатите (натиснато пак: Разгъни всички). Редът на файл го свива или разгъва; негов ред отваря файла на този ред, със съвпадението избрано.',
|
|
1169
|
+
},
|
|
1170
|
+
{
|
|
1171
|
+
key: 'quick.label',
|
|
1172
|
+
kind: 'field',
|
|
1173
|
+
en: 'Go to File',
|
|
1174
|
+
bg: 'Отиди на файл',
|
|
1175
|
+
doesEn: 'Ctrl+P: a box at the top of the screen that finds a file of the open folder by a few letters of its name, the letters marked; Enter opens it, and name:42 opens it at line 42. The files open in the editor come first.',
|
|
1176
|
+
doesBg: 'Ctrl+P: поле горе на екрана, което намира файл от отворената папка по няколко букви от името му, със съвпадащите букви отбелязани; Enter го отваря, а име:42 го отваря на ред 42. Отворените в редактора файлове са първи.',
|
|
1177
|
+
},
|
|
1178
|
+
{
|
|
1179
|
+
key: 'ed.viewPreview',
|
|
1180
|
+
kind: 'button',
|
|
1181
|
+
en: 'Preview',
|
|
1182
|
+
bg: 'Преглед',
|
|
1183
|
+
doesEn: 'On a Markdown file (with Code and Side by side, or Ctrl+Shift+V): the file as it reads — headings, lists, tables, code in colour, pictures of the folder, and ```mermaid blocks drawn as diagrams. It opens so by default; the choice is kept.',
|
|
1184
|
+
doesBg: 'На Markdown файл (с „Код“ и „Едно до друго“, или Ctrl+Shift+V): файлът, както изглежда — заглавия, списъци, таблици, оцветен код, картинки от папката и ```mermaid блокове, начертани като диаграми. По подразбиране се отваря така; изборът се помни.',
|
|
1185
|
+
},
|
|
1186
|
+
],
|
|
1187
|
+
},
|
|
1053
1188
|
{
|
|
1054
1189
|
headingKey: 'wb.panel',
|
|
1055
1190
|
en: 'Panel',
|
|
@@ -1285,6 +1420,14 @@ export const SYSTEM_GUIDE = [
|
|
|
1285
1420
|
doesEn: 'On another project: takes it out of the list (the folder stays where it is).',
|
|
1286
1421
|
doesBg: 'На друг проект: маха го от списъка (папката си остава на мястото).',
|
|
1287
1422
|
},
|
|
1423
|
+
{
|
|
1424
|
+
key: 'proj.readOnly',
|
|
1425
|
+
kind: 'checkbox',
|
|
1426
|
+
en: 'For reference only (no changes)',
|
|
1427
|
+
bg: 'Само за справка (без промени)',
|
|
1428
|
+
doesEn: 'Ticked, the bot reads the project and runs what only reads it, and changes nothing there: after every command whatever changed in it — files, branches, what is staged — is put back, and the chat is told. On the chat\'s own folder, every message can then only read and report.',
|
|
1429
|
+
doesBg: 'Отметнато, ботът чете проекта и пуска това, което само го чете, без да променя нищо там: след всяка команда всичко променено в него — файлове, клонове, подготвеното за commit — се връща, и чатът научава. Ако е папката на чата, всяко съобщение може само да чете и да докладва.',
|
|
1430
|
+
},
|
|
1288
1431
|
{
|
|
1289
1432
|
key: 'proj.level2',
|
|
1290
1433
|
kind: 'field',
|
|
@@ -1334,6 +1477,61 @@ export const SYSTEM_GUIDE = [
|
|
|
1334
1477
|
},
|
|
1335
1478
|
],
|
|
1336
1479
|
},
|
|
1480
|
+
{
|
|
1481
|
+
headingKey: 'skills.title',
|
|
1482
|
+
en: 'Skills',
|
|
1483
|
+
bg: 'Skill-ове',
|
|
1484
|
+
controls: [
|
|
1485
|
+
{
|
|
1486
|
+
key: 'skills.name',
|
|
1487
|
+
kind: 'field',
|
|
1488
|
+
en: 'Name',
|
|
1489
|
+
bg: 'Име',
|
|
1490
|
+
doesEn: 'What the skill is called by: lowercase with hyphens (new-test), typed after / at the start of a message.',
|
|
1491
|
+
doesBg: 'Как се извиква skill-ът: с малки букви и тирета (new-test), написано след / в началото на съобщение.',
|
|
1492
|
+
},
|
|
1493
|
+
{
|
|
1494
|
+
key: 'skills.description',
|
|
1495
|
+
kind: 'field',
|
|
1496
|
+
en: 'What it is for',
|
|
1497
|
+
bg: 'За какво е',
|
|
1498
|
+
doesEn: 'One line on which tasks it is for, shown in the chat\'s list.',
|
|
1499
|
+
doesBg: 'Един ред за кои задачи е, показан в списъка на чата.',
|
|
1500
|
+
},
|
|
1501
|
+
{
|
|
1502
|
+
key: 'skills.project',
|
|
1503
|
+
kind: 'select',
|
|
1504
|
+
en: 'Project',
|
|
1505
|
+
bg: 'Проект',
|
|
1506
|
+
doesEn: 'The project the skill is for, or every project.',
|
|
1507
|
+
doesBg: 'Проектът, за който е skill-ът, или всички проекти.',
|
|
1508
|
+
},
|
|
1509
|
+
{
|
|
1510
|
+
key: 'skills.text',
|
|
1511
|
+
kind: 'field',
|
|
1512
|
+
en: 'Instructions',
|
|
1513
|
+
bg: 'Инструкции',
|
|
1514
|
+
doesEn: 'What the chat should know and do for this kind of task — where files go, conventions, steps, how to check it — sent with the message.',
|
|
1515
|
+
doesBg: 'Какво трябва да знае и да прави чатът за този вид задача — къде отиват файловете, правилата, стъпките, как се проверява — изпраща се със съобщението.',
|
|
1516
|
+
},
|
|
1517
|
+
{
|
|
1518
|
+
key: 'skills.remove',
|
|
1519
|
+
kind: 'button',
|
|
1520
|
+
en: 'Remove',
|
|
1521
|
+
bg: 'Махни',
|
|
1522
|
+
doesEn: 'Takes the skill out of the list; messages already sent with it keep it.',
|
|
1523
|
+
doesBg: 'Маха skill-а от списъка; вече изпратените с него съобщения го запазват.',
|
|
1524
|
+
},
|
|
1525
|
+
{
|
|
1526
|
+
key: 'skills.add',
|
|
1527
|
+
kind: 'button',
|
|
1528
|
+
en: 'Add the skill',
|
|
1529
|
+
bg: 'Добави skill-а',
|
|
1530
|
+
doesEn: 'Adds the skill written in the fields above it.',
|
|
1531
|
+
doesBg: 'Добавя skill-а, написан в полетата над него.',
|
|
1532
|
+
},
|
|
1533
|
+
],
|
|
1534
|
+
},
|
|
1337
1535
|
{
|
|
1338
1536
|
headingKey: 'login.title',
|
|
1339
1537
|
en: 'Sign in to Copilot',
|
|
@@ -1504,6 +1702,38 @@ export const SYSTEM_GUIDE = [
|
|
|
1504
1702
|
doesEn: 'The most subtasks the lead of a conversation with two chats may give for one message.',
|
|
1505
1703
|
doesBg: 'Най-много подзадачи, които ръководителят в разговор с два чата може да даде за едно съобщение.',
|
|
1506
1704
|
},
|
|
1705
|
+
{
|
|
1706
|
+
key: 'exec.gap',
|
|
1707
|
+
kind: 'checkbox',
|
|
1708
|
+
en: 'Pause between messages',
|
|
1709
|
+
bg: 'Пауза между съобщенията',
|
|
1710
|
+
doesEn: 'Ticked, a message to Copilot waits until "At least" seconds have passed since the one before — to the lead or the worker, in any conversation; the log says how long it waits.',
|
|
1711
|
+
doesBg: 'Отметнато, съобщение към Copilot чака, докато от предишното минат „Най-малко“ секунди — към ръководителя или изпълнителя, във всеки разговор; дневникът казва колко чака.',
|
|
1712
|
+
},
|
|
1713
|
+
{
|
|
1714
|
+
key: 'exec.gapSec',
|
|
1715
|
+
kind: 'field',
|
|
1716
|
+
en: 'At least',
|
|
1717
|
+
bg: 'Най-малко',
|
|
1718
|
+
doesEn: 'Shown with the pause: its shortest time, in seconds (60: one a minute at most).',
|
|
1719
|
+
doesBg: 'Показва се с паузата: най-краткото ѝ време, в секунди (60: най-много по едно на минута).',
|
|
1720
|
+
},
|
|
1721
|
+
{
|
|
1722
|
+
key: 'exec.gapRandom',
|
|
1723
|
+
kind: 'checkbox',
|
|
1724
|
+
en: 'Random time',
|
|
1725
|
+
bg: 'Случайно време',
|
|
1726
|
+
doesEn: 'Shown with the pause: each pause drawn anew between "At least" and "At most" (60 to 90 seconds, say).',
|
|
1727
|
+
doesBg: 'Показва се с паузата: всяка пауза се избира наново между „Най-малко“ и „Най-много“ (например 60 до 90 секунди).',
|
|
1728
|
+
},
|
|
1729
|
+
{
|
|
1730
|
+
key: 'exec.gapMax',
|
|
1731
|
+
kind: 'field',
|
|
1732
|
+
en: 'At most',
|
|
1733
|
+
bg: 'Най-много',
|
|
1734
|
+
doesEn: 'Shown with a random time: the longest pause, in seconds.',
|
|
1735
|
+
doesBg: 'Показва се със случайното време: най-дългата пауза, в секунди.',
|
|
1736
|
+
},
|
|
1507
1737
|
{
|
|
1508
1738
|
key: 'exec.replyTimeout',
|
|
1509
1739
|
kind: 'field',
|
|
@@ -25,7 +25,7 @@ const TASK_HEADER = '## Task';
|
|
|
25
25
|
* and a note that is empty simply leaves nothing behind.
|
|
26
26
|
*/
|
|
27
27
|
function runnerBlock(input) {
|
|
28
|
-
const notes = [input.workDirNote, input.readOnlyNote, input.scopeNote, input.approachesNote, input.vcsNote, input.shellNote, input.planNote, input.operatorNotes].map((n) => (n ?? '').trim()).filter((n) => n.length > 0);
|
|
28
|
+
const notes = [input.workDirNote, input.readOnlyNote, input.referenceNote, input.scopeNote, input.approachesNote, input.vcsNote, input.shellNote, input.planNote, input.operatorNotes].map((n) => (n ?? '').trim()).filter((n) => n.length > 0);
|
|
29
29
|
return notes.length > 0 ? `${notes.join('\n\n')}\n\n` : '';
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
@@ -39,7 +39,7 @@ export function readOnlyNote(commits, artifacts = []) {
|
|
|
39
39
|
'This task must not change any file: it reads, runs and reports. The runner fails it if it',
|
|
40
40
|
'changed the working tree, whatever the summary says' +
|
|
41
41
|
(commits ? ", and commits the change on the task's branch so it is not lost." : '. Nothing is committed in this session, so a change would stay in the working tree.'),
|
|
42
|
-
'
|
|
42
|
+
'Scratch files may go in `.cop-tmp`, which is not part of the project; nothing in it is run.' +
|
|
43
43
|
(artifacts.length > 0 ? ` A report or other evidence goes under ${artifacts.join(', ')}: kept with the run, never committed, and the one place this task may write.` : ''),
|
|
44
44
|
"This rule wins over any instruction above — the project's or the persona's — to change code. If a review",
|
|
45
45
|
'finding asks you to change something, that is a finding about the task, not about the work: dispute it',
|
|
@@ -48,6 +48,18 @@ export function readOnlyNote(commits, artifacts = []) {
|
|
|
48
48
|
}
|
|
49
49
|
/** The note for a session that commits: see `readOnlyNote`. */
|
|
50
50
|
export const READ_ONLY_NOTE = readOnlyNote(true);
|
|
51
|
+
/**
|
|
52
|
+
* The operator's skill for this kind of task (2026-10-21), right before the task: how this kind of work is done in
|
|
53
|
+
* their projects — where things go, the conventions, the steps, how it is checked. Empty when there is none.
|
|
54
|
+
*/
|
|
55
|
+
export function skillBlock(skill) {
|
|
56
|
+
if (!skill || !skill.text.trim())
|
|
57
|
+
return '';
|
|
58
|
+
return (`\n\n## Skill: ${skill.name}\n\n` +
|
|
59
|
+
(skill.description.trim() ? `For: ${skill.description.trim()}\n\n` : '') +
|
|
60
|
+
`The operator's instructions for this kind of task. Follow them where they apply; they add to the contract above ` +
|
|
61
|
+
`and cannot change it.\n\n${skill.text.trim()}`);
|
|
62
|
+
}
|
|
51
63
|
function level2Block(level2) {
|
|
52
64
|
const body = level2.trim();
|
|
53
65
|
return body.length > 0
|
|
@@ -174,7 +186,7 @@ export function composeOpening(input) {
|
|
|
174
186
|
`\n\n${instructionSection(instruction.text)}`
|
|
175
187
|
: '';
|
|
176
188
|
if (!input.contractAlreadySent) {
|
|
177
|
-
const taskMessage = `${runnerBlock(input)}${level2Block(input.level2)}\n\n${taskBlock}${continuationLine}`;
|
|
189
|
+
const taskMessage = `${runnerBlock(input)}${level2Block(input.level2)}${skillBlock(input.skill)}\n\n${taskBlock}${continuationLine}`;
|
|
178
190
|
return {
|
|
179
191
|
messages: [input.level1.trim(), taskMessage],
|
|
180
192
|
firstMessage: `${input.level1.trim()}\n\n---\n\n${taskMessage}`,
|
|
@@ -183,6 +195,6 @@ export function composeOpening(input) {
|
|
|
183
195
|
const reminder = `New task in this same conversation. The level 1 contract you received at the start of ` +
|
|
184
196
|
`this conversation still applies unchanged: same format, same rules, same stop word, ` +
|
|
185
197
|
`and a full "summary" when you finish. Step numbering restarts at 1.`;
|
|
186
|
-
const taskMessage = `${reminder}\n\n${runnerBlock(input)}${level2Block(input.level2)}\n\n${taskBlock}${continuationLine}`;
|
|
198
|
+
const taskMessage = `${reminder}\n\n${runnerBlock(input)}${level2Block(input.level2)}${skillBlock(input.skill)}\n\n${taskBlock}${continuationLine}`;
|
|
187
199
|
return { messages: [taskMessage], firstMessage: taskMessage };
|
|
188
200
|
}
|
|
@@ -115,6 +115,8 @@ export const TASK_FIELD_ON_RERUN = {
|
|
|
115
115
|
// The lead's rounds belong to the attempt that made them (two chats, 2026-10-20); which lead a subtask serves, to the task.
|
|
116
116
|
lead: 'archived',
|
|
117
117
|
fromLead: 'kept',
|
|
118
|
+
// The kind of task it is: every attempt is sent with the same skill.
|
|
119
|
+
skill: 'kept',
|
|
118
120
|
interruption: 'cleared',
|
|
119
121
|
finalReply: 'cleared',
|
|
120
122
|
firstMessage: 'cleared',
|
|
@@ -386,6 +388,7 @@ export class SessionStore {
|
|
|
386
388
|
// Stored only when it limits something: absent means anywhere, as before scopes existed.
|
|
387
389
|
...((input.scope ?? []).filter((p) => p.trim()).length > 0 ? { scope: (input.scope ?? []).map((p) => p.trim()).filter(Boolean) } : {}),
|
|
388
390
|
...((input.outputs ?? []).filter((p) => p.trim()).length > 0 ? { outputs: (input.outputs ?? []).map((p) => p.trim()).filter(Boolean) } : {}),
|
|
391
|
+
...(input.skill ? { skill: { name: input.skill.name, description: input.skill.description, text: input.skill.text } } : {}),
|
|
389
392
|
};
|
|
390
393
|
await this.updateSession(sessionId, (s) => {
|
|
391
394
|
s.tasks.push(task);
|
|
@@ -82,6 +82,28 @@ export async function workspaceFile(dir, path, maxBytes = MAX_EDIT_BYTES) {
|
|
|
82
82
|
const binary = bytes.subarray(0, 8000).includes(0);
|
|
83
83
|
return { path: clean, text: binary ? null : bytes.toString('utf8').replace(/^\ufeff/, ''), binary, tooLarge: false, size: st.size, version: versionOf(bytes) };
|
|
84
84
|
}
|
|
85
|
+
/** The pictures a Markdown preview may show from the folder, by extension, with the type they are served as. */
|
|
86
|
+
const PICTURES = {
|
|
87
|
+
png: 'image/png', jpg: 'image/jpeg', jpeg: 'image/jpeg', gif: 'image/gif', webp: 'image/webp', bmp: 'image/bmp', ico: 'image/x-icon', svg: 'image/svg+xml', avif: 'image/avif',
|
|
88
|
+
};
|
|
89
|
+
const MAX_PICTURE_BYTES = 10 * 1024 * 1024;
|
|
90
|
+
/**
|
|
91
|
+
* A picture of the folder as its bytes (2026-10-21), for an image a Markdown preview shows: only pictures, only inside
|
|
92
|
+
* the folder, at most 10 MB. Anything else is refused, so this is not a way to read the folder's files whole.
|
|
93
|
+
*/
|
|
94
|
+
export async function workspaceRaw(dir, path) {
|
|
95
|
+
const { clean, full } = insideFolder(dir, path);
|
|
96
|
+
const ext = clean.split('.').pop()?.toLowerCase() ?? '';
|
|
97
|
+
const type = PICTURES[ext];
|
|
98
|
+
if (!type)
|
|
99
|
+
throw new Error(`${clean} is not a picture this view shows.`);
|
|
100
|
+
const st = await stat(full).catch(() => null);
|
|
101
|
+
if (!st?.isFile())
|
|
102
|
+
throw new Error(`There is no file ${clean} in the project folder.`);
|
|
103
|
+
if (st.size > MAX_PICTURE_BYTES)
|
|
104
|
+
throw new Error(`${clean} is larger than a preview shows.`);
|
|
105
|
+
return { bytes: await readFile(full), type };
|
|
106
|
+
}
|
|
85
107
|
/** Said when the file changed on disk after the editor read it; the page offers to read it again or to save anyway. */
|
|
86
108
|
export const CHANGED_ON_DISK = 'changed-on-disk';
|
|
87
109
|
/**
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Searching the open folder's code, as VS Code's Search view does (operator, 2026-10-21: "an option to search code in
|
|
3
|
+
* the files, designed and working as in VS Code, so most programmers find it easy").
|
|
4
|
+
*
|
|
5
|
+
* `git grep` does the reading: fast, it skips what .gitignore leaves out and files that are not text, it searches the
|
|
6
|
+
* files not committed yet as well (`--untracked`), and in a folder that is not a repository it reads the folder as it
|
|
7
|
+
* is (`--no-index`). It runs as a process of its own with a time limit, so a pattern that would take forever stops
|
|
8
|
+
* the search, not the bot. The options are VS Code's: match case, whole word, a regular expression (PCRE), and the
|
|
9
|
+
* files to include and to exclude as globs — `*.ts` in any folder, `src/**` from the root.
|
|
10
|
+
*
|
|
11
|
+
* What comes back is grouped by file, each line with where its matches are, for the page to mark them; long lines are
|
|
12
|
+
* cut around the first match. There is a ceiling on matches in all and in one file, said when it is reached.
|
|
13
|
+
*/
|
|
14
|
+
import { spawn } from 'node:child_process';
|
|
15
|
+
import { looksLikeRepo, SAFE_GIT } from '../vcs/git.js';
|
|
16
|
+
export const MAX_MATCHES = 2000;
|
|
17
|
+
const MAX_PER_FILE = 300;
|
|
18
|
+
const PREVIEW = 240;
|
|
19
|
+
const TIMEOUT_MS = 20_000;
|
|
20
|
+
/**
|
|
21
|
+
* A glob as VS Code takes one, as git's pathspecs: a bare `*.ts` is for every folder, one with a slash is from the
|
|
22
|
+
* root, and a name with no wildcard (`dist`, `src/api`) is that file or everything in that folder.
|
|
23
|
+
*/
|
|
24
|
+
function pathspecs(glob, exclude) {
|
|
25
|
+
const g = glob.trim().replace(/\\/g, '/').replace(/^\.\//, '').replace(/^\/+/, '').replace(/\/+$/, '');
|
|
26
|
+
if (!g)
|
|
27
|
+
return [];
|
|
28
|
+
const magic = exclude ? ':(exclude,glob)' : ':(glob)';
|
|
29
|
+
const base = g.includes('/') ? g : `**/${g}`;
|
|
30
|
+
return /[*?[]/.test(g) ? [`${magic}${base}`] : [`${magic}${base}`, `${magic}${base}/**`];
|
|
31
|
+
}
|
|
32
|
+
function globs(list) {
|
|
33
|
+
return (list ?? '')
|
|
34
|
+
.split(',')
|
|
35
|
+
.map((s) => s.trim())
|
|
36
|
+
.filter(Boolean);
|
|
37
|
+
}
|
|
38
|
+
/** Where the matches are in a line, for the page to mark: by the same rules as the search, as near as JavaScript can. */
|
|
39
|
+
export function rangesIn(text, query, opts) {
|
|
40
|
+
const out = [];
|
|
41
|
+
let re;
|
|
42
|
+
try {
|
|
43
|
+
const body = opts.regex ? query : query.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
44
|
+
re = new RegExp(opts.wholeWord ? `(?<![\\p{L}\\p{N}_])(?:${body})(?![\\p{L}\\p{N}_])` : body, `gu${opts.matchCase ? '' : 'i'}`);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return out;
|
|
48
|
+
}
|
|
49
|
+
for (const m of text.matchAll(re)) {
|
|
50
|
+
if (m[0].length === 0)
|
|
51
|
+
break;
|
|
52
|
+
out.push([m.index, m.index + m[0].length]);
|
|
53
|
+
if (out.length >= 50)
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
58
|
+
/** A line as the results show it: whole when short, else cut around its first match. */
|
|
59
|
+
function preview(line, ranges) {
|
|
60
|
+
if (line.length <= PREVIEW)
|
|
61
|
+
return { text: line, ranges };
|
|
62
|
+
const first = ranges[0]?.[0] ?? 0;
|
|
63
|
+
const start = Math.max(0, first - 60);
|
|
64
|
+
const end = Math.min(line.length, start + PREVIEW);
|
|
65
|
+
const lead = start > 0 ? '…' : '';
|
|
66
|
+
const shift = start - lead.length;
|
|
67
|
+
return {
|
|
68
|
+
text: `${lead}${line.slice(start, end)}${end < line.length ? '…' : ''}`,
|
|
69
|
+
ranges: ranges.filter(([a]) => a >= start && a < end).map(([a, b]) => [a - shift, Math.min(b, end) - shift]),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export async function searchWorkspace(dir, query, opts = {}) {
|
|
73
|
+
const started = Date.now();
|
|
74
|
+
if (!query)
|
|
75
|
+
return { files: [], total: 0, truncated: false, ms: 0 };
|
|
76
|
+
const repo = looksLikeRepo(dir);
|
|
77
|
+
const args = [
|
|
78
|
+
...SAFE_GIT,
|
|
79
|
+
'-c', 'core.quotepath=false',
|
|
80
|
+
'-c', 'grep.lineNumber=true',
|
|
81
|
+
'grep', '--no-color', '-I', '-n', '-z',
|
|
82
|
+
`--max-count=${MAX_PER_FILE}`,
|
|
83
|
+
...(repo ? ['--untracked'] : ['--no-index', '--exclude-standard']),
|
|
84
|
+
...(opts.matchCase ? [] : ['-i']),
|
|
85
|
+
...(opts.wholeWord ? ['-w'] : []),
|
|
86
|
+
opts.regex ? '-P' : '-F',
|
|
87
|
+
'-e', query,
|
|
88
|
+
'--',
|
|
89
|
+
...globs(opts.include).flatMap((g) => pathspecs(g, false)),
|
|
90
|
+
...globs(opts.exclude).flatMap((g) => pathspecs(g, true)),
|
|
91
|
+
];
|
|
92
|
+
return await new Promise((resolveSearch) => {
|
|
93
|
+
const child = spawn('git', args, { cwd: dir, windowsHide: true });
|
|
94
|
+
const files = new Map();
|
|
95
|
+
let total = 0;
|
|
96
|
+
let truncated = false;
|
|
97
|
+
let rest = '';
|
|
98
|
+
let errText = '';
|
|
99
|
+
let done = false;
|
|
100
|
+
const finish = (problem) => {
|
|
101
|
+
if (done)
|
|
102
|
+
return;
|
|
103
|
+
done = true;
|
|
104
|
+
clearTimeout(timer);
|
|
105
|
+
resolveSearch({ files: [...files.values()], total, truncated, ms: Date.now() - started, ...(problem ? { problem } : {}) });
|
|
106
|
+
};
|
|
107
|
+
const timer = setTimeout(() => {
|
|
108
|
+
truncated = true;
|
|
109
|
+
child.kill();
|
|
110
|
+
finish(total === 0 ? 'the search took too long and was stopped; narrow it down' : undefined);
|
|
111
|
+
}, TIMEOUT_MS);
|
|
112
|
+
const take = (line) => {
|
|
113
|
+
// path NUL line NUL text — or path NUL line:text, as the git version writes it.
|
|
114
|
+
const a = line.indexOf('\0');
|
|
115
|
+
if (a < 0)
|
|
116
|
+
return;
|
|
117
|
+
const path = line.slice(0, a);
|
|
118
|
+
const after = line.slice(a + 1);
|
|
119
|
+
const m = /^(\d+)[\0:]([\s\S]*)$/.exec(after);
|
|
120
|
+
if (!m)
|
|
121
|
+
return;
|
|
122
|
+
const text = m[2].replace(/\r$/, '');
|
|
123
|
+
const found = rangesIn(text, query, opts);
|
|
124
|
+
const shown = preview(text, found);
|
|
125
|
+
const file = files.get(path) ?? { path, matches: [] };
|
|
126
|
+
file.matches.push({ line: Number(m[1]), ...shown, ...(found[0] ? { column: found[0][0], length: found[0][1] - found[0][0] } : {}) });
|
|
127
|
+
files.set(path, file);
|
|
128
|
+
// Matches, as VS Code counts them: two on one line are two.
|
|
129
|
+
total += Math.max(1, found.length);
|
|
130
|
+
if (total >= MAX_MATCHES) {
|
|
131
|
+
truncated = true;
|
|
132
|
+
child.kill();
|
|
133
|
+
finish();
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
child.stdout.setEncoding('utf8');
|
|
137
|
+
child.stdout.on('data', (chunk) => {
|
|
138
|
+
if (done)
|
|
139
|
+
return;
|
|
140
|
+
rest += chunk;
|
|
141
|
+
let i;
|
|
142
|
+
while (!done && (i = rest.indexOf('\n')) >= 0) {
|
|
143
|
+
take(rest.slice(0, i));
|
|
144
|
+
rest = rest.slice(i + 1);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
child.stderr.setEncoding('utf8');
|
|
148
|
+
child.stderr.on('data', (chunk) => {
|
|
149
|
+
errText += chunk;
|
|
150
|
+
});
|
|
151
|
+
child.on('error', (e) => finish(`git could not be started: ${e.message}`));
|
|
152
|
+
child.on('close', (code) => {
|
|
153
|
+
if (rest)
|
|
154
|
+
take(rest);
|
|
155
|
+
// 1 is "nothing found"; anything above it is git saying the search itself is wrong — a pattern, a glob.
|
|
156
|
+
if (code !== null && code > 1 && total === 0)
|
|
157
|
+
finish(errText.split('\n').find((l) => l.trim())?.replace(/^fatal:\s*/, '') || `git grep ended with ${code}`);
|
|
158
|
+
else
|
|
159
|
+
finish();
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
}
|
package/dist/src/util/pacing.js
CHANGED
|
@@ -17,7 +17,24 @@
|
|
|
17
17
|
* against service-side throttling on long runs.
|
|
18
18
|
* - `backoffFor()` exponential backoff with jitter, so a failing step cannot turn into a
|
|
19
19
|
* tight retry loop.
|
|
20
|
+
* - the gap (operator, 2026-10-21) a pause the operator sets between two messages to Copilot, fixed or drawn
|
|
21
|
+
* anew each time between two bounds: kept by `throttleSend` across every pacer of the program, so the
|
|
22
|
+
* lead's message after the worker's waits as one after the lead's does.
|
|
20
23
|
*/
|
|
24
|
+
/** The settings' pause between messages, as `gapMs`; undefined when it is off. */
|
|
25
|
+
export function gapFrom(p) {
|
|
26
|
+
if (!p.gapEnabled)
|
|
27
|
+
return undefined;
|
|
28
|
+
const lo = Math.max(1, p.gapSec ?? 60) * 1000;
|
|
29
|
+
const hi = p.gapRandom ? Math.max(lo, Math.max(1, p.gapMaxSec ?? 90) * 1000) : lo;
|
|
30
|
+
return [lo, hi];
|
|
31
|
+
}
|
|
32
|
+
/** When the program last sent a message to Copilot: one window, one account, so one clock for every pacer. */
|
|
33
|
+
let lastSentAt = 0;
|
|
34
|
+
/** For the checks: as if nothing had been sent yet. */
|
|
35
|
+
export function forgetLastSend() {
|
|
36
|
+
lastSentAt = 0;
|
|
37
|
+
}
|
|
21
38
|
export const DEFAULT_PACING = {
|
|
22
39
|
enabled: true,
|
|
23
40
|
settleMs: 1_000,
|
|
@@ -57,6 +74,19 @@ export class Pacer {
|
|
|
57
74
|
* waited, so the caller can log a visible "throttled for N s".
|
|
58
75
|
*/
|
|
59
76
|
async throttleSend(signal) {
|
|
77
|
+
const stop = signal ?? this.profile.signal;
|
|
78
|
+
let gapWaited = 0;
|
|
79
|
+
// The operator's pause between two messages: from the last one the program sent, whichever pacer sent it.
|
|
80
|
+
if (this.profile.gapMs && lastSentAt > 0) {
|
|
81
|
+
const [lo, hi] = this.profile.gapMs;
|
|
82
|
+
const gap = lo + Math.round(this.rnd() * Math.max(0, hi - lo));
|
|
83
|
+
const wait = lastSentAt + gap - Date.now();
|
|
84
|
+
if (wait > 0) {
|
|
85
|
+
this.profile.onGap?.(wait);
|
|
86
|
+
await sleep(wait, stop);
|
|
87
|
+
gapWaited = wait;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
60
90
|
const hour = 3_600_000;
|
|
61
91
|
const now = Date.now();
|
|
62
92
|
while (this.sentAt.length && now - this.sentAt[0] > hour)
|
|
@@ -65,10 +95,11 @@ export class Pacer {
|
|
|
65
95
|
if (this.sentAt.length >= this.profile.maxMessagesPerHour) {
|
|
66
96
|
waited = this.sentAt[0] + hour - now;
|
|
67
97
|
if (waited > 0)
|
|
68
|
-
await sleep(waited,
|
|
98
|
+
await sleep(waited, stop);
|
|
69
99
|
}
|
|
70
100
|
this.sentAt.push(Date.now());
|
|
71
|
-
|
|
101
|
+
lastSentAt = Date.now();
|
|
102
|
+
return Math.max(waited, 0) + gapWaited;
|
|
72
103
|
}
|
|
73
104
|
/** Exponential backoff with jitter, for retries after a failure. */
|
|
74
105
|
backoffFor(attempt, baseMs = 2_000, capMs = 60_000) {
|