copilot-operator 0.1.83 → 0.1.85
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 +90 -0
- package/dist/src/api/operator.service.js +270 -30
- package/dist/src/config/schema.js +17 -0
- package/dist/src/orchestrator/cardText.js +91 -0
- package/dist/src/orchestrator/kerriganRunner.js +912 -0
- package/dist/src/orchestrator/leadRunner.js +25 -16
- package/dist/src/orchestrator/planMode.js +6 -4
- package/dist/src/orchestrator/taskRunner.js +88 -16
- package/dist/src/plan/kerrigan.js +109 -4
- package/dist/src/plan/systemGuide.js +194 -2
- package/dist/src/protocol/kerriganSchema.js +175 -0
- package/dist/src/session/store.js +9 -0
- package/dist/src/transport/chatTransport.js +1 -1
- package/dist/src/transport/copilotTransport.js +150 -3
- package/dist/src/vcs/git.js +72 -2
- package/dist/src/vcs/operatorGit.js +409 -0
- package/dist/web/404.html +2 -2
- package/dist/web/_next/static/chunks/1077.06fe73b2c16f8f49.js +1 -0
- package/dist/web/_next/static/chunks/1548.b38c5d8d00ab2a72.js +1 -0
- package/dist/web/_next/static/chunks/{2163.2af0979126ae613a.js → 2163.ba933c9a506302ca.js} +1 -1
- package/dist/web/_next/static/chunks/714.575273a189d030fe.js +1 -0
- package/dist/web/_next/static/chunks/7220.988dfd28e00f407c.js +1 -0
- package/dist/web/_next/static/chunks/7921-65dd56d87144bd44.js +1 -0
- package/dist/web/_next/static/chunks/8124-1dba8babfcfbc6e2.js +1 -0
- package/dist/web/_next/static/chunks/8584.2221587201bc2fa2.js +1 -0
- package/dist/web/_next/static/chunks/9067.8d94a08830c3d1da.js +1 -0
- package/dist/web/_next/static/chunks/9747.8671194406acd839.js +1 -0
- package/dist/web/_next/static/chunks/app/layout-127e5af1ebf21876.js +1 -0
- package/dist/web/_next/static/chunks/app/page-76139370c7ca3715.js +1 -0
- package/dist/web/_next/static/chunks/app/settings/page-116da78c83f0c5c9.js +1 -0
- package/dist/web/_next/static/chunks/webpack-13ccb80d7b7094ca.js +1 -0
- package/dist/web/_next/static/css/6e2b8656501f0dd7.css +1 -0
- 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 +175 -173
- package/prompts/kerrigan1.md +169 -0
- package/prompts/lead1.md +4 -1
- package/prompts/level1.md +8 -1
- package/dist/web/_next/static/chunks/1077.e0136d293069ccb8.js +0 -1
- package/dist/web/_next/static/chunks/1548.5cc0c57b00c2e44f.js +0 -1
- package/dist/web/_next/static/chunks/714.410e2b61aa8c72b7.js +0 -1
- package/dist/web/_next/static/chunks/7220.2c4e5173a060769f.js +0 -1
- package/dist/web/_next/static/chunks/7921-3d21f385338afdf9.js +0 -1
- package/dist/web/_next/static/chunks/8124-1dc34be1646970a8.js +0 -1
- package/dist/web/_next/static/chunks/8584.61650a59d2bfa54d.js +0 -1
- package/dist/web/_next/static/chunks/9067.553056fc9b6cf80e.js +0 -1
- package/dist/web/_next/static/chunks/9747.d5826524bf4b714d.js +0 -1
- package/dist/web/_next/static/chunks/app/layout-b8a1e0075a48b025.js +0 -1
- package/dist/web/_next/static/chunks/app/page-13147b69cf336831.js +0 -1
- package/dist/web/_next/static/chunks/app/settings/page-e3909ef6c2d8e321.js +0 -1
- package/dist/web/_next/static/chunks/webpack-19a2d7161f23b21d.js +0 -1
- package/dist/web/_next/static/css/f152f27d6afce55c.css +0 -1
- /package/dist/web/_next/static/{aHzr4dVoCwf71514A9bWP → aCQe1FDhYTj4zGeI5ueVq}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{aHzr4dVoCwf71514A9bWP → aCQe1FDhYTj4zGeI5ueVq}/_ssgManifest.js +0 -0
|
@@ -480,8 +480,8 @@ export const SYSTEM_GUIDE = [
|
|
|
480
480
|
kind: 'button',
|
|
481
481
|
en: 'Git',
|
|
482
482
|
bg: 'Git',
|
|
483
|
-
doesEn: 'Shows the open folder\'s git: the branch, the staged changes and the changes, each file with its letter (M modified, A added, D deleted, R renamed, U untracked, ! in conflict) and its lines, and the branch\'s commits; a file opens its two versions side by side, a commit opens to its files. A file opens as a preview, as in VS Code: its tab\'s name in italics, and the next file opened with one click — from Git, the files, the search or Go to File — takes its place; a double click on the file opens it to stay, and a double click on the tab keeps it and shows the file among the folder\'s files ("Files").
|
|
484
|
-
doesBg: 'Показва git на отворената папка: клона, подготвените промени и промените — всеки файл с буквата си (M променен, A добавен, D изтрит, R преименуван, U непроследен, ! в конфликт) и редовете си — и комитите на клона; файл отваря двете си версии една до друга, комит се разгъва до файловете си. Файлът се отваря за преглед, както във VS Code: името на раздела му е в курсив, а следващият файл, отворен с едно щракване — от Git, от файловете, от търсенето или от „Отиди на файл“ —, заема мястото му; двоен клик върху файла го отваря да остане, а двоен клик върху раздела го задържа и показва файла сред файловете на папката („Файлове“).
|
|
483
|
+
doesEn: 'Shows the open folder\'s git: the branch, the staged changes and the changes, each file with its letter (M modified, A added, D deleted, R renamed, U untracked, ! in conflict) and its lines, and the branch\'s commits; a file opens its two versions side by side, a commit opens to its files. A file opens as a preview, as in VS Code: its tab\'s name in italics, and the next file opened with one click — from Git, the files, the search or Go to File — takes its place; a double click on the file opens it to stay, and a double click on the tab keeps it and shows the file among the folder\'s files ("Files"). At its top, the person\'s own commit and push (below); a file\'s "+" stages it and its "−" unstages it, and the same beside a list\'s heading takes the whole list. Two numbers on the button: above, the files not committed yet; below, every file changed on this branch, committed or not, against the branch "Compared with" names (a number that is 0 is not shown; the button\'s tooltip says both).',
|
|
484
|
+
doesBg: 'Показва git на отворената папка: клона, подготвените промени и промените — всеки файл с буквата си (M променен, A добавен, D изтрит, R преименуван, U непроследен, ! в конфликт) и редовете си — и комитите на клона; файл отваря двете си версии една до друга, комит се разгъва до файловете си. Файлът се отваря за преглед, както във VS Code: името на раздела му е в курсив, а следващият файл, отворен с едно щракване — от Git, от файловете, от търсенето или от „Отиди на файл“ —, заема мястото му; двоен клик върху файла го отваря да остане, а двоен клик върху раздела го задържа и показва файла сред файловете на папката („Файлове“). Най-горе — собственият комит и push на човека (по-долу); „+“ на файл го подготвя, „−“ го изважда от подготвените, а същото до заглавието на списък взима целия списък. Две числа върху бутона: горе — файловете, които още не са комитнати; долу — всички файлове, променени на този клон, комитнати или не, спрямо клона в „Сравнен с“ (число 0 не се показва; подсказката на бутона казва и двете).',
|
|
485
485
|
},
|
|
486
486
|
{
|
|
487
487
|
key: 'wb.refresh',
|
|
@@ -515,6 +515,118 @@ export const SYSTEM_GUIDE = [
|
|
|
515
515
|
doesEn: 'In "On this branch": the branch a pull request of this one would go into — the remote\'s default branch, or main, unless another is chosen; kept for the folder.',
|
|
516
516
|
doesBg: 'В „На този клон“: клонът, в който би влязъл pull request от този — подразбиращият се клон на отдалеченото хранилище или main, освен ако не е избран друг; запазва се за папката.',
|
|
517
517
|
},
|
|
518
|
+
{
|
|
519
|
+
key: 'git.commit',
|
|
520
|
+
kind: 'button',
|
|
521
|
+
en: 'Commit',
|
|
522
|
+
bg: 'Комитни',
|
|
523
|
+
doesEn: 'At the top of the git view, under the message box (Ctrl+Enter there does the same): commits the staged files with that message, under the person\'s own name for git — the person\'s own commit, not the chat\'s. It runs the project\'s hooks, as a terminal would, unless one of them is not the project\'s own (not committed, changed since its commit, or committed by the bot): then it names them and why, and the person chooses "Without hooks", "Run them anyway" (remembered while they stay as they are) or "Cancel". Every line git and the hooks print shows as it comes; when it does not go through, a sentence says why over git\'s own words — and when git has no name for the person, a form for it. Nothing is ever amended or forced.',
|
|
524
|
+
doesBg: 'Най-горе в изгледа git, под полето за съобщението (Ctrl+Enter там прави същото): комитва подготвените файлове с това съобщение, с името на човека в git — собственият комит на човека, не на чата. Пуска hook-овете на проекта, както би го направил терминал, освен ако някой от тях не е собствен на проекта (не е комитнат, променен е след комита си или е комитнат от бота): тогава ги назовава и казва защо, а човекът избира „Без hook-ове“, „Пусни ги все пак“ (запомня се, докато са такива) или „Откажи“. Всеки ред, който git и hook-овете отпечатват, се вижда, докато идва; когато не мине, едно изречение казва защо, над собствените думи на git — а когато git няма име за човека, има форма за него. Нищо никога не се поправя (amend) и не се налага насила.',
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
key: 'git.commitAll',
|
|
528
|
+
kind: 'button',
|
|
529
|
+
en: 'Commit all',
|
|
530
|
+
bg: 'Комитни всичко',
|
|
531
|
+
doesEn: 'The same button when nothing is staged: stages every changed and new file, then commits them with the message.',
|
|
532
|
+
doesBg: 'Същият бутон, когато нищо не е подготвено: подготвя всеки променен и нов файл, после ги комитва със съобщението.',
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
key: 'git.push',
|
|
536
|
+
kind: 'button',
|
|
537
|
+
en: 'Push ↑{n}',
|
|
538
|
+
bg: 'Push ↑{n}',
|
|
539
|
+
doesEn: 'Beside "Commit": sends the branch\'s commits to the branch it follows on the remote, with how many go. When the remote asks for a password, Git opens its own window for it (the view says so), which the bot never reads. Never forced: when the remote has commits the branch has not, it is refused and the view says to get them first. The project\'s pre-push hook (Git LFS\'s, for one) runs as for "Commit".',
|
|
540
|
+
doesBg: 'До „Комитни“: изпраща комитите на клона в клона, който той следва в отдалеченото хранилище, с това колко са. Когато отдалеченото хранилище иска парола, Git отваря свой прозорец за нея (изгледът го казва), който ботът никога не чете. Никога насила: когато отдалеченото хранилище има комити, които клонът няма, push-ът се отказва и изгледът казва първо да се вземат. Pre-push hook-ът на проекта (например на Git LFS) се пуска както при „Комитни“.',
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
key: 'git.publish',
|
|
544
|
+
kind: 'button',
|
|
545
|
+
en: 'Publish branch',
|
|
546
|
+
bg: 'Публикувай клона',
|
|
547
|
+
doesEn: 'Instead of "Push" for a branch the remote has not got yet: pushes it there under its own name, and the branch follows it from then on.',
|
|
548
|
+
doesBg: 'Вместо „Push“ за клон, който отдалеченото хранилище още няма: изпраща го там под собственото му име и оттам нататък клонът го следва.',
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
key: 'git.message',
|
|
552
|
+
kind: 'field',
|
|
553
|
+
en: 'Commit message',
|
|
554
|
+
bg: 'Съобщение на комита',
|
|
555
|
+
doesEn: 'The box over "Commit": the commit\'s message, as git will keep it; kept in this browser for the folder until it is committed.',
|
|
556
|
+
doesBg: 'Полето над „Комитни“: съобщението на комита, както git ще го запази; пази се в този браузър за папката, докато не бъде комитнато.',
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
key: 'git.op.output',
|
|
560
|
+
kind: 'disclosure',
|
|
561
|
+
en: 'What git said:',
|
|
562
|
+
bg: 'Какво каза git:',
|
|
563
|
+
doesEn: 'Under a commit or push: every line git and the project\'s hooks printed, as they came, with the command that ran and "Copy"; open by itself while it runs and when it did not go through. The ✕ ("Close") of the result puts it away.',
|
|
564
|
+
doesBg: 'Под комит или push: всеки ред, който git и hook-овете на проекта отпечатаха, докато идваше, с командата, която се изпълни, и „Копирай“; отваря се само, докато работи и когато не е минало. ✕ („Затвори“) на резултата го прибира.',
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
key: 'git.op.dismiss',
|
|
568
|
+
kind: 'button',
|
|
569
|
+
en: 'Close',
|
|
570
|
+
bg: 'Затвори',
|
|
571
|
+
doesEn: 'The ✕ of a commit\'s or push\'s result: puts it away; it does not come back after a reload.',
|
|
572
|
+
doesBg: '✕ на резултата от комит или push: прибира го; не се връща след презареждане.',
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
key: 'git.hooks.skip',
|
|
576
|
+
kind: 'button',
|
|
577
|
+
en: 'Without hooks',
|
|
578
|
+
bg: 'Без hook-ове',
|
|
579
|
+
doesEn: 'When the project\'s hooks are not its own, or one of them said no: the same commit or push again, with none of the project\'s hooks run.',
|
|
580
|
+
doesBg: 'Когато hook-овете на проекта не са негови собствени или някой от тях каза „не“: същият комит или push отново, без да се пуска нито един hook на проекта.',
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
key: 'git.hooks.trust',
|
|
584
|
+
kind: 'button',
|
|
585
|
+
en: 'Run them anyway',
|
|
586
|
+
bg: 'Пусни ги все пак',
|
|
587
|
+
doesEn: 'When the project\'s hooks are not its own, after looking at them: runs them, and does not ask again about them while each stays exactly as it is now.',
|
|
588
|
+
doesBg: 'Когато hook-овете на проекта не са негови собствени, след като са прегледани: пуска ги и не пита отново за тях, докато всеки остава точно такъв, какъвто е сега.',
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
key: 'git.hooks.open',
|
|
592
|
+
kind: 'button',
|
|
593
|
+
en: 'Open',
|
|
594
|
+
bg: 'Отвори',
|
|
595
|
+
doesEn: 'Beside each hook the view asks about: opens the file in the editor, to look at it first.',
|
|
596
|
+
doesBg: 'До всеки hook, за който изгледът пита: отваря файла в редактора, за да бъде прегледан първо.',
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
key: 'git.hooks.cancel',
|
|
600
|
+
kind: 'button',
|
|
601
|
+
en: 'Cancel',
|
|
602
|
+
bg: 'Откажи',
|
|
603
|
+
doesEn: 'When the project\'s hooks are not its own: nothing is committed or pushed, and nothing runs.',
|
|
604
|
+
doesBg: 'Когато hook-овете на проекта не са негови собствени: нищо не се комитва и не се изпраща, и нищо не се пуска.',
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
key: 'git.identity.name',
|
|
608
|
+
kind: 'field',
|
|
609
|
+
en: 'Name',
|
|
610
|
+
bg: 'Име',
|
|
611
|
+
doesEn: 'Shown when git has no name for the person: the name every commit of theirs carries; with "E-mail", saved in git\'s own settings — for this repository, or for all of theirs when the box under them is ticked.',
|
|
612
|
+
doesBg: 'Показва се, когато git няма име за човека: името, което носи всеки негов комит; заедно с „Имейл“ се запазва в собствените настройки на git — за това хранилище или за всичките му, когато е отметнато квадратчето под тях.',
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
key: 'git.identity.email',
|
|
616
|
+
kind: 'field',
|
|
617
|
+
en: 'E-mail',
|
|
618
|
+
bg: 'Имейл',
|
|
619
|
+
doesEn: 'With "Name": the e-mail address every commit of the person\'s carries.',
|
|
620
|
+
doesBg: 'Заедно с „Име“: имейл адресът, който носи всеки комит на човека.',
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
key: 'git.identity.save',
|
|
624
|
+
kind: 'button',
|
|
625
|
+
en: 'Save, and commit again',
|
|
626
|
+
bg: 'Запази и комитни отново',
|
|
627
|
+
doesEn: 'Saves the name and e-mail for git, and makes the same commit again.',
|
|
628
|
+
doesBg: 'Запазва името и имейла за git и прави същия комит отново.',
|
|
629
|
+
},
|
|
518
630
|
{
|
|
519
631
|
key: 'wb.appearance',
|
|
520
632
|
kind: 'button',
|
|
@@ -954,6 +1066,46 @@ export const SYSTEM_GUIDE = [
|
|
|
954
1066
|
doesEn: 'Two chats, for a new conversation: the message goes to a lead, which restates it, has a worker survey the project, plans, gives the worker one subtask at a time and judges each report, until the result is ready in the form asked for; the worker runs the commands. Both are conversations in the same Copilot window. A started conversation shows how it began. With it, there is no "Review": the lead judges the worker.',
|
|
955
1067
|
doesBg: 'Два чата, за нов разговор: съобщението отива при ръководител, който го преразказва, пуска изпълнител да огледа проекта, прави план, дава на изпълнителя по една подзадача и преценява всеки доклад, докато резултатът стане готов в поискания вид; изпълнителят пуска командите. И двата са разговори в един и същ прозорец на Copilot. Започнатият разговор показва как е започнал. С него няма „Рецензия“: ръководителят преценява изпълнителя.',
|
|
956
1068
|
},
|
|
1069
|
+
{
|
|
1070
|
+
key: 'chat.kerrigan',
|
|
1071
|
+
kind: 'checkbox',
|
|
1072
|
+
en: 'Kerrigan directs',
|
|
1073
|
+
bg: 'Кериган води',
|
|
1074
|
+
doesEn: 'Kerrigan directs, for a new conversation: the message goes to Kerrigan, who works in the person\'s place. She looks first in what Copilot reaches for them (mail, Teams chats, meeting transcripts, shared files) and has a chat look in the code; writes the messages for chats of their own, choosing plan mode, two chats, the review and the skill for each; answers their questions, plans and cut-off subtasks, or leaves a card to the person with why and what she would choose; judges each result and goes on — in the same chat or a new one — until the task is done, then reports. Commands still run as Settings say; platform access, scripts to run by hand, passwords, sign-ins and a model chosen by hand stay the person\'s. With it, "Plan mode", "Two chats" and "Review" are hers to choose and are not shown.',
|
|
1075
|
+
doesBg: 'Кериган води, за нов разговор: съобщението отива при Кериган, която работи вместо човека. Първо търси в това, до което Copilot стига за него (поща, чатове в Teams, записи на срещи, споделени файлове), и праща чат да погледне в кода; пише съобщенията за отделни чатове, като за всяко избира режим на план, два чата, рецензия и skill; отговаря на въпросите им, плановете и прекъснатите подзадачи или оставя карта на човека с причина и какво би избрала; преценява всеки резултат и продължава — в същия чат или в нов — докато задачата е готова, после дава отчет. Командите пак вървят, както казват Настройки; достъпът до платформи, скриптовете за ръчно пускане, паролите, входът и ръчно избраният модел остават на човека. С него „Режим на план“, „Два чата“ и „Рецензия“ са неин избор и не се показват.',
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
key: 'chat.kerriganModel',
|
|
1079
|
+
kind: 'note',
|
|
1080
|
+
en: 'Kerrigan\'s model',
|
|
1081
|
+
bg: 'Модел на Кериган',
|
|
1082
|
+
doesEn: 'With Kerrigan directing: beside the first model, which is hers; none chosen, Settings\' model for the lead.',
|
|
1083
|
+
doesBg: 'Когато Кериган води: до първия модел, който е неин; ако не е избран — моделът за ръководителя от Настройки.',
|
|
1084
|
+
},
|
|
1085
|
+
{
|
|
1086
|
+
key: 'chat.kerriganChatsModel',
|
|
1087
|
+
kind: 'select',
|
|
1088
|
+
en: 'Her chats\' model',
|
|
1089
|
+
bg: 'Модел на чатовете ѝ',
|
|
1090
|
+
doesEn: 'With Kerrigan directing: the model of the chats she sends her messages to; none chosen, Settings\' model for the worker, or by hand in the Copilot window — then each new chat of hers waits for the person to choose it.',
|
|
1091
|
+
doesBg: 'Когато Кериган води: моделът на чатовете, към които праща съобщенията си; ако не е избран — моделът за изпълнителя от Настройки, или ръчно в прозореца на Copilot — тогава всеки неин нов чат чака човека да го избере.',
|
|
1092
|
+
},
|
|
1093
|
+
{
|
|
1094
|
+
key: 'kz.openChat',
|
|
1095
|
+
kind: 'button',
|
|
1096
|
+
en: 'Open the chat',
|
|
1097
|
+
bg: 'Отвори чата',
|
|
1098
|
+
doesEn: 'Under a message Kerrigan sent: shows that chat as it works — its commands, its cards, its ending. The chats she directs are in the list too, under her conversation.',
|
|
1099
|
+
doesBg: 'Под съобщение, което Кериган е пратила: показва този чат, докато работи — командите, картите и края му. Чатовете, които тя води, са и в списъка, под нейния разговор.',
|
|
1100
|
+
},
|
|
1101
|
+
{
|
|
1102
|
+
key: 'kz.openHers',
|
|
1103
|
+
kind: 'button',
|
|
1104
|
+
en: 'Open Kerrigan\'s conversation',
|
|
1105
|
+
bg: 'Отвори разговора на Кериган',
|
|
1106
|
+
doesEn: 'At the top of a chat Kerrigan directs: back to her conversation, where her decisions and the cards waiting are.',
|
|
1107
|
+
doesBg: 'Най-горе в чат, който Кериган води: обратно към нейния разговор, където са решенията ѝ и чакащите карти.',
|
|
1108
|
+
},
|
|
957
1109
|
{
|
|
958
1110
|
key: 'chat.leadModel',
|
|
959
1111
|
kind: 'note',
|
|
@@ -2185,6 +2337,14 @@ export const SYSTEM_GUIDE = [
|
|
|
2185
2337
|
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.',
|
|
2186
2338
|
doesBg: 'Какво трябва да знае и да прави чатът за този вид задача — къде отиват файловете, правилата, стъпките, как се проверява — изпраща се със съобщението.',
|
|
2187
2339
|
},
|
|
2340
|
+
{
|
|
2341
|
+
key: 'skills.forKerrigan',
|
|
2342
|
+
kind: 'field',
|
|
2343
|
+
en: 'For Kerrigan',
|
|
2344
|
+
bg: 'За Кериган',
|
|
2345
|
+
doesEn: 'A few lines for Kerrigan: the skill\'s phases, the result it leads to and what it needs from the person. She is given it for every skill, even one not chosen; left empty, she is given its instructions whole.',
|
|
2346
|
+
doesBg: 'Няколко реда за Кериган: фазите на skill-а, резултатът, до който води, и какво му трябва от човека. Тя го получава за всеки skill, дори неизбран; ако е празно, получава целите му инструкции.',
|
|
2347
|
+
},
|
|
2188
2348
|
{
|
|
2189
2349
|
key: 'skills.remove',
|
|
2190
2350
|
kind: 'button',
|
|
@@ -2451,6 +2611,14 @@ export const SYSTEM_GUIDE = [
|
|
|
2451
2611
|
doesEn: 'The most subtasks the lead of a conversation with two chats may give for one message.',
|
|
2452
2612
|
doesBg: 'Най-много подзадачи, които ръководителят в разговор с два чата може да даде за едно съобщение.',
|
|
2453
2613
|
},
|
|
2614
|
+
{
|
|
2615
|
+
key: 'exec.maxKerriganSends',
|
|
2616
|
+
kind: 'field',
|
|
2617
|
+
en: 'Most messages Kerrigan may send',
|
|
2618
|
+
bg: 'Най-много съобщения от Кериган',
|
|
2619
|
+
doesEn: 'The most messages Kerrigan may send to chats for one message of the person\'s, in a conversation she directs (6 by default); when they run out she delivers what was done, with what is missing said.',
|
|
2620
|
+
doesBg: 'Най-много съобщения, които Кериган може да прати към чатове за едно съобщение на човека, в разговор, който тя води (по подразбиране 6); когато свършат, тя предава свършеното и казва какво липсва.',
|
|
2621
|
+
},
|
|
2454
2622
|
{
|
|
2455
2623
|
key: 'exec.gap',
|
|
2456
2624
|
kind: 'checkbox',
|
|
@@ -2635,6 +2803,30 @@ export const SYSTEM_GUIDE = [
|
|
|
2635
2803
|
doesEn: 'Such a command runs, and each question gets the answer the chat recommends — the first it gives; the conversation says so; chosen, it asks once to confirm.',
|
|
2636
2804
|
doesBg: 'Такава команда се изпълнява, а всеки въпрос получава препоръчания от чата отговор — първия, който дава; разговорът го казва; при избор пита веднъж за потвърждение.',
|
|
2637
2805
|
},
|
|
2806
|
+
{
|
|
2807
|
+
key: 'exec.kerriganResult',
|
|
2808
|
+
kind: 'select',
|
|
2809
|
+
en: 'What Kerrigan gets when a chat\'s message ends',
|
|
2810
|
+
bg: 'Какво получава Кериган, когато съобщение на чат свърши',
|
|
2811
|
+
doesEn: 'In a conversation Kerrigan directs: what she is given when a chat\'s work on her message ends. Her cards are always what "Copy all" gives.',
|
|
2812
|
+
doesBg: 'В разговор, който Кериган води: какво получава тя, когато работата на чат по нейно съобщение свърши. На картите винаги получава каквото дава „Копирай всичко“.',
|
|
2813
|
+
},
|
|
2814
|
+
{
|
|
2815
|
+
key: 'exec.kerriganResultCopy',
|
|
2816
|
+
kind: 'select',
|
|
2817
|
+
en: 'What “Copy” gives: the summary under its ending',
|
|
2818
|
+
bg: 'Каквото дава „Копирай“: обобщението под края',
|
|
2819
|
+
doesEn: 'The default: the chat\'s summary of what was done, tried and how it went, as the person would copy it to her.',
|
|
2820
|
+
doesBg: 'По подразбиране: обобщението на чата какво е направено, пробвано и как е минало, както човекът би ѝ го копирал.',
|
|
2821
|
+
},
|
|
2822
|
+
{
|
|
2823
|
+
key: 'exec.kerriganResultExchange',
|
|
2824
|
+
kind: 'select',
|
|
2825
|
+
en: 'That, and the whole exchange (JSON) attached',
|
|
2826
|
+
bg: 'Това и целият обмен (JSON), прикачен',
|
|
2827
|
+
doesEn: 'The summary, and the message\'s whole exchange attached as its "JSON" gives it — every message, reply and command with all it printed, secrets taken out.',
|
|
2828
|
+
doesBg: 'Обобщението и целият обмен на съобщението, прикачен, както го дава „JSON“ — всяко съобщение, отговор и команда с всичко изписано, с махнати тайни.',
|
|
2829
|
+
},
|
|
2638
2830
|
],
|
|
2639
2831
|
},
|
|
2640
2832
|
{
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kerrigan's contract, as a schema (operator, 2026-11-12: "I paste Kerrigan into a chat, give her the task, she gives me
|
|
3
|
+
* the prompt and tells me plan mode, two chats, the reviewer, which skill; I run the bot; when it asks me something I
|
|
4
|
+
* take the question to her and do what she says; at the end she reads the result and goes on with a new prompt, in a
|
|
5
|
+
* new chat or the same — automate that").
|
|
6
|
+
*
|
|
7
|
+
* The prose she is given is `prompts/kerrigan1.md`; this is the enforcement. She runs nothing: every reply is one
|
|
8
|
+
* decision — a message to a chat with its settings, the answer to a card of the chat's, a question for the operator,
|
|
9
|
+
* her report, or a stop — and anything that does not validate here is sent back with the reason, as a chat's reply in
|
|
10
|
+
* the wrong shape is. Lenient where nothing runs on it, as the lead's: prose that came as an object or a list is read
|
|
11
|
+
* as the text it means.
|
|
12
|
+
*/
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
import { findJsonCandidates, stripCitations, stripLineNumbers } from './parser.js';
|
|
15
|
+
import { proseOfValue } from './leadSchema.js';
|
|
16
|
+
import { MIN_SUMMARY_CHARS } from './replySchema.js';
|
|
17
|
+
const prose = z.preprocess((v) => (v === undefined || v === null ? undefined : proseOfValue(v)), z.string().optional());
|
|
18
|
+
const proseList = z.preprocess((v) => v === undefined || v === null
|
|
19
|
+
? []
|
|
20
|
+
: typeof v === 'string'
|
|
21
|
+
? v.split(/\r?\n/).map((l) => l.replace(/^\s*(?:\d+[.)]|[-*•])\s+/, '').trim()).filter(Boolean)
|
|
22
|
+
: Array.isArray(v)
|
|
23
|
+
? v.map((x) => proseOfValue(x)).filter((x) => x.trim() !== '')
|
|
24
|
+
: [proseOfValue(v)], z.array(z.string()));
|
|
25
|
+
/** A yes or no, as a chat may say it: true, "true", "yes", 1. */
|
|
26
|
+
const flag = z.preprocess((v) => {
|
|
27
|
+
if (typeof v === 'string')
|
|
28
|
+
return /^(true|yes|on|1)$/i.test(v.trim()) ? true : /^(false|no|off|0|)$/i.test(v.trim()) ? false : v;
|
|
29
|
+
if (typeof v === 'number')
|
|
30
|
+
return v !== 0;
|
|
31
|
+
return v;
|
|
32
|
+
}, z.boolean());
|
|
33
|
+
/** A number of an answer, as a chat may write it: 2, "2", "2." or "option 2". */
|
|
34
|
+
const number = z.preprocess((v) => {
|
|
35
|
+
if (typeof v === 'string') {
|
|
36
|
+
const m = /^\D*(\d+)/.exec(v.trim());
|
|
37
|
+
return m ? Number(m[1]) : v;
|
|
38
|
+
}
|
|
39
|
+
return v;
|
|
40
|
+
}, z.number().int().min(1).max(50));
|
|
41
|
+
export const RETRY_CHOICES = ['same', 'fresh', 'continue', 'restore', 'accept'];
|
|
42
|
+
export const KerriganReplySchema = z
|
|
43
|
+
.object({
|
|
44
|
+
/**
|
|
45
|
+
* `send` — a message to a chat (`prompt`), new or the one sent to last (`chat`), with its settings. `answer` — the card
|
|
46
|
+
* the runner put to her, answered: an option by its number (`option`), several (`options`), her own words (`text`),
|
|
47
|
+
* a plan approved or sent back (`decision`, `note`), or a subtask's retry (`choice`). `ask` — a question for the
|
|
48
|
+
* operator; to a card, leaving it to them (`why`, `suggestion`). `done` — her report (`report`). `blocked` — it
|
|
49
|
+
* cannot go on (`summary`, `needed`).
|
|
50
|
+
*/
|
|
51
|
+
status: z.enum(['send', 'answer', 'ask', 'done', 'blocked'], {
|
|
52
|
+
message: 'status is one of "send", "answer", "ask", "done", "blocked". "continue", "delegate", "plan" and "handoff" are the chats\' and the lead\'s: ' +
|
|
53
|
+
'what a chat is to do goes in a "send"; a card is answered with "answer"; a question for the person is "ask".',
|
|
54
|
+
}),
|
|
55
|
+
understanding: prose,
|
|
56
|
+
notes: prose,
|
|
57
|
+
/** Where she looked before she decided, as she names them. */
|
|
58
|
+
sources: proseList.default([]),
|
|
59
|
+
// send
|
|
60
|
+
chat: z.preprocess((v) => (typeof v === 'string' ? v.trim().toLowerCase() : v), z.enum(['new', 'same'], { message: 'chat is "new" or "same".' })).optional(),
|
|
61
|
+
title: prose,
|
|
62
|
+
prompt: prose,
|
|
63
|
+
planMode: flag.optional(),
|
|
64
|
+
twoChats: flag.optional(),
|
|
65
|
+
review: flag.optional(),
|
|
66
|
+
skill: z.preprocess((v) => (v === undefined || v === null ? undefined : String(v).trim().replace(/^\//, '')), z.string().optional()),
|
|
67
|
+
// answer
|
|
68
|
+
option: number.optional(),
|
|
69
|
+
options: z.preprocess((v) => (v === undefined || v === null ? undefined : Array.isArray(v) ? v : [v]), z.array(z.union([number, z.string()])).optional()),
|
|
70
|
+
text: prose,
|
|
71
|
+
decision: z.preprocess((v) => (typeof v === 'string' ? v.trim().toLowerCase() : v), z.enum(['approve', 'revise'], { message: 'decision is "approve" or "revise".' })).optional(),
|
|
72
|
+
note: prose,
|
|
73
|
+
choice: z.preprocess((v) => (typeof v === 'string' ? v.trim().toLowerCase() : v), z.enum(RETRY_CHOICES, { message: `choice is one of ${RETRY_CHOICES.map((c) => `"${c}"`).join(', ')}.` })).optional(),
|
|
74
|
+
// ask
|
|
75
|
+
question: prose,
|
|
76
|
+
why: prose,
|
|
77
|
+
multiple: flag.default(false),
|
|
78
|
+
suggestion: prose,
|
|
79
|
+
// done / blocked
|
|
80
|
+
report: prose,
|
|
81
|
+
evidence: proseList.default([]),
|
|
82
|
+
summary: prose,
|
|
83
|
+
needed: prose,
|
|
84
|
+
})
|
|
85
|
+
.refine((r) => r.status !== 'send' || (r.prompt ?? '').trim().length >= 20, {
|
|
86
|
+
message: 'status "send" requires a "prompt": the message for the chat, in full — what to do, what it is for, the result and its form, and how it is known to be done.',
|
|
87
|
+
path: ['prompt'],
|
|
88
|
+
})
|
|
89
|
+
.refine((r) => r.status !== 'send' || !!r.chat, {
|
|
90
|
+
message: 'status "send" requires "chat": "new" for a new conversation, "same" for the one you sent to last.',
|
|
91
|
+
path: ['chat'],
|
|
92
|
+
})
|
|
93
|
+
.refine((r) => r.status !== 'done' || (r.report ?? '').trim().length >= MIN_SUMMARY_CHARS, {
|
|
94
|
+
message: 'status "done" requires a "report" for the person: what was done, what shows it, and what is left, in full.',
|
|
95
|
+
path: ['report'],
|
|
96
|
+
})
|
|
97
|
+
.refine((r) => r.status !== 'blocked' || (r.summary ?? '').trim().length >= MIN_SUMMARY_CHARS, {
|
|
98
|
+
message: 'status "blocked" requires a "summary": what was done and found, with its evidence.',
|
|
99
|
+
path: ['summary'],
|
|
100
|
+
})
|
|
101
|
+
.refine((r) => r.status !== 'blocked' || (r.needed ?? '').trim().length > 0, {
|
|
102
|
+
message: 'status "blocked" requires "needed": what would let the work go on.',
|
|
103
|
+
path: ['needed'],
|
|
104
|
+
});
|
|
105
|
+
/** Her reply, found, validated and cleaned of citation markers. */
|
|
106
|
+
export function parseKerriganReply(markdown) {
|
|
107
|
+
const candidates = findJsonCandidates(markdown);
|
|
108
|
+
if (candidates.length === 0) {
|
|
109
|
+
return { ok: false, reason: 'no-json-block', detail: 'The reply contained no fenced ```json block and no JSON object at all.' };
|
|
110
|
+
}
|
|
111
|
+
const errors = [];
|
|
112
|
+
const paths = new Set();
|
|
113
|
+
for (const raw of candidates) {
|
|
114
|
+
for (const text of [raw, stripLineNumbers(raw)]) {
|
|
115
|
+
let value;
|
|
116
|
+
try {
|
|
117
|
+
value = JSON.parse(text);
|
|
118
|
+
}
|
|
119
|
+
catch (e) {
|
|
120
|
+
errors.push(`JSON.parse failed: ${e.message}`);
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
const result = KerriganReplySchema.safeParse(value);
|
|
124
|
+
if (!result.success) {
|
|
125
|
+
errors.push(result.error.issues.map((i) => `${i.path.join('.') || '(root)'}: ${i.message}`).join('; '));
|
|
126
|
+
for (const i of result.error.issues)
|
|
127
|
+
paths.add(i.path.join('.') || '(root)');
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
const r = result.data;
|
|
131
|
+
const clean = (s) => stripCitations(s)?.trim() || undefined;
|
|
132
|
+
return {
|
|
133
|
+
ok: true,
|
|
134
|
+
reply: {
|
|
135
|
+
...r,
|
|
136
|
+
understanding: clean(r.understanding),
|
|
137
|
+
notes: clean(r.notes),
|
|
138
|
+
prompt: clean(r.prompt),
|
|
139
|
+
title: clean(r.title),
|
|
140
|
+
text: clean(r.text),
|
|
141
|
+
note: clean(r.note),
|
|
142
|
+
question: clean(r.question),
|
|
143
|
+
why: clean(r.why),
|
|
144
|
+
suggestion: clean(r.suggestion),
|
|
145
|
+
report: clean(r.report),
|
|
146
|
+
summary: clean(r.summary),
|
|
147
|
+
needed: clean(r.needed),
|
|
148
|
+
},
|
|
149
|
+
json: text.trim(),
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return { ok: false, reason: 'invalid-json', detail: errors.slice(0, 4).join(' | '), ...(paths.size > 0 ? { paths: [...paths] } : {}) };
|
|
154
|
+
}
|
|
155
|
+
const EXAMPLE = [
|
|
156
|
+
'```json',
|
|
157
|
+
'{"status": "send", "notes": "what you decided and why", "sources": ["the mail from …, 3 Nov"], "chat": "new", "title": "Fix the login test", "prompt": "the message for the chat, in full", "planMode": true, "twoChats": false, "review": true, "skill": ""}',
|
|
158
|
+
'```',
|
|
159
|
+
'or {"status": "answer", "option": 1, "why": "…"} — or "options": [1, 3], or "text": "…"; for a plan {"status": "answer", "decision": "approve"} or "revise" with "note"; for a subtask {"status": "answer", "option": 1}',
|
|
160
|
+
'or {"status": "ask", "question": "…", "why": "…", "options": ["…", "…"]} — to a card: {"status": "ask", "why": "…", "suggestion": "…"}',
|
|
161
|
+
'or {"status": "done", "report": "what was done, what shows it, what is left", "evidence": ["…"]}',
|
|
162
|
+
'or {"status": "blocked", "summary": "what was done and found", "needed": "what would let it go on"}',
|
|
163
|
+
].join('\n');
|
|
164
|
+
/** The message that asks her for the same answer again, in the format. */
|
|
165
|
+
export function kerriganFormatErrorMessage(fail, attempt, maxAttempts) {
|
|
166
|
+
return [
|
|
167
|
+
`Your last reply did not match Kerrigan's format (format retry ${attempt} of ${maxAttempts}).`,
|
|
168
|
+
fail.reason === 'no-json-block' ? 'There was no fenced json code block in it.' : `The json block did not validate: ${fail.detail}`,
|
|
169
|
+
'Only the format is wrong: nothing from that reply was acted on. Send the same answer again, reformatted, as exactly one fenced code block tagged json. For example:',
|
|
170
|
+
EXAMPLE,
|
|
171
|
+
].join('\n');
|
|
172
|
+
}
|
|
173
|
+
/** A first reply without the assignment restated. */
|
|
174
|
+
export const KERRIGAN_UNDERSTANDING_FIRST = 'Before anything else, restate the person\'s assignment in "understanding": the goal, the result they want and its form, ' +
|
|
175
|
+
'the constraints, and how it will be known to be done. Send your reply again with it; nothing from the last one was acted on.';
|
|
@@ -120,6 +120,8 @@ export const TASK_FIELD_ON_RERUN = {
|
|
|
120
120
|
// The lead's rounds belong to the attempt that made them (two chats, 2026-10-20); which lead a subtask serves, to the task.
|
|
121
121
|
lead: 'archived',
|
|
122
122
|
fromLead: 'kept',
|
|
123
|
+
kerrigan: 'archived',
|
|
124
|
+
fromKerrigan: 'kept',
|
|
123
125
|
// The kind of task it is: every attempt is sent with the same skill.
|
|
124
126
|
skill: 'kept',
|
|
125
127
|
interruption: 'cleared',
|
|
@@ -225,6 +227,10 @@ export class SessionStore {
|
|
|
225
227
|
async getLead1() {
|
|
226
228
|
return { content: await readFile(join(dirname(this.defaultLevel1Path), 'lead1.md'), 'utf8') };
|
|
227
229
|
}
|
|
230
|
+
/** Kerrigan's contract (2026-11-12), when she directs a conversation herself: `prompts/kerrigan1.md`. */
|
|
231
|
+
async getKerrigan1() {
|
|
232
|
+
return { content: await readFile(join(dirname(this.defaultLevel1Path), 'kerrigan1.md'), 'utf8') };
|
|
233
|
+
}
|
|
228
234
|
// --- the model catalogue ----------------------------------------------------------------
|
|
229
235
|
/** What the chat's picker offered when it was last read, or null if it never was. */
|
|
230
236
|
async getModels() {
|
|
@@ -606,6 +612,8 @@ export class SessionStore {
|
|
|
606
612
|
accepted: t.accepted,
|
|
607
613
|
// Two chats: the lead's rounds and subtasks of this attempt (the next one counts its own from nothing).
|
|
608
614
|
lead: t.lead,
|
|
615
|
+
// Kerrigan's rounds of this attempt (2026-11-12), as the lead's.
|
|
616
|
+
kerrigan: t.kerrigan,
|
|
609
617
|
},
|
|
610
618
|
];
|
|
611
619
|
// An edit is applied only after the old attempt has been put beyond its reach.
|
|
@@ -644,6 +652,7 @@ export class SessionStore {
|
|
|
644
652
|
t.plan = undefined;
|
|
645
653
|
t.accepted = undefined;
|
|
646
654
|
t.lead = undefined;
|
|
655
|
+
t.kerrigan = undefined;
|
|
647
656
|
t.scopeReverted = undefined;
|
|
648
657
|
t.treeChanged = undefined;
|
|
649
658
|
t.inputsRestored = undefined;
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* running in this process — a check script — can call `setTransportFactory`.
|
|
21
21
|
*/
|
|
22
22
|
import { CopilotTransport } from './copilotTransport.js';
|
|
23
|
-
export { ReplyTimeoutError, isReplyTimeout, WindowClosed } from './copilotTransport.js';
|
|
23
|
+
export { ReplyTimeoutError, isReplyTimeout, WindowClosed, ChatLost } from './copilotTransport.js';
|
|
24
24
|
const realChat = (opts) => new CopilotTransport(opts);
|
|
25
25
|
let factory = realChat;
|
|
26
26
|
/** A chat for these options: the real Copilot window, unless a check has put a scripted one in. */
|