copilot-operator 0.1.64 → 0.1.67

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.
Files changed (68) hide show
  1. package/dist/src/api/operator.controller.js +56 -1
  2. package/dist/src/api/operator.service.js +418 -54
  3. package/dist/src/cli.js +1 -0
  4. package/dist/src/config/schema.js +7 -0
  5. package/dist/src/exec/authorizer.js +26 -6
  6. package/dist/src/exec/commandHeads.js +30 -6
  7. package/dist/src/exec/dangerous.js +12 -0
  8. package/dist/src/exec/platforms.js +13 -2
  9. package/dist/src/exec/policy.js +31 -4
  10. package/dist/src/exec/policyManifest.js +9 -0
  11. package/dist/src/exec/readOnly.js +158 -0
  12. package/dist/src/exec/runner.js +75 -2
  13. package/dist/src/exec/stepEnv.js +13 -2
  14. package/dist/src/orchestrator/taskRunner.js +16 -3
  15. package/dist/src/plan/kerrigan.js +34 -6
  16. package/dist/src/plan/systemGuide.js +199 -0
  17. package/dist/src/queue/queue.js +65 -4
  18. package/dist/src/queue/queueBranch.js +66 -0
  19. package/dist/src/session/compose.js +15 -0
  20. package/dist/src/session/store.js +4 -0
  21. package/dist/src/vcs/newBranch.js +241 -0
  22. package/dist/src/vcs/remoteAuth.js +119 -0
  23. package/dist/web/404.html +2 -2
  24. package/dist/web/_next/static/chunks/1024-5f630cbb54e7346f.js +1 -0
  25. package/dist/web/_next/static/chunks/1077.3b82a837cf810f8b.js +1 -0
  26. package/dist/web/_next/static/chunks/1548.52bfcd01c16aaafe.js +1 -0
  27. package/dist/web/_next/static/chunks/2163.e60d3be9bb3f8b3f.js +1 -0
  28. package/dist/web/_next/static/chunks/6262-d074473db83ee798.js +1 -0
  29. package/dist/web/_next/static/chunks/714.b452ef814760b5a5.js +1 -0
  30. package/dist/web/_next/static/chunks/7220.96b18052ed9c06c7.js +1 -0
  31. package/dist/web/_next/static/chunks/7921-dd201ce7aa02c12d.js +1 -0
  32. package/dist/web/_next/static/chunks/8124-c27ce7bd781f4c56.js +1 -0
  33. package/dist/web/_next/static/chunks/8584.ab8d406781cdd45c.js +1 -0
  34. package/dist/web/_next/static/chunks/9067.5b8abc40104d51d9.js +1 -0
  35. package/dist/web/_next/static/chunks/9747.cf0353e7ffec2ee4.js +1 -0
  36. package/dist/web/_next/static/chunks/app/{layout-9201c637ca24b2c9.js → layout-5e0e7601702723bb.js} +1 -1
  37. package/dist/web/_next/static/chunks/app/page-ab73d1b3ba9181c2.js +1 -0
  38. package/dist/web/_next/static/chunks/app/queue/page-fb49cb2d3dc6d14c.js +1 -0
  39. package/dist/web/_next/static/chunks/app/settings/page-7d120feb5af0ace9.js +1 -0
  40. package/dist/web/_next/static/chunks/{webpack-d85f02ecd2903252.js → webpack-23ace264f775d98a.js} +1 -1
  41. package/dist/web/_next/static/css/532df8667473c4fc.css +1 -0
  42. package/dist/web/defaults.html +2 -2
  43. package/dist/web/defaults.txt +8 -8
  44. package/dist/web/index.html +3 -3
  45. package/dist/web/index.txt +9 -9
  46. package/dist/web/queue.html +2 -2
  47. package/dist/web/queue.txt +9 -9
  48. package/dist/web/settings.html +2 -2
  49. package/dist/web/settings.txt +9 -9
  50. package/dist/web/system.html +2 -2
  51. package/dist/web/system.txt +9 -9
  52. package/package.json +5 -2
  53. package/dist/web/_next/static/chunks/1077.32bfff8490ea3d67.js +0 -1
  54. package/dist/web/_next/static/chunks/1548.2bbbbb4759fd5073.js +0 -1
  55. package/dist/web/_next/static/chunks/2163.147b0ca65a65d5dd.js +0 -1
  56. package/dist/web/_next/static/chunks/714.16070ca6426f260c.js +0 -1
  57. package/dist/web/_next/static/chunks/7220.f71047baa16e6be0.js +0 -1
  58. package/dist/web/_next/static/chunks/7921-90ed63bfdf7162f3.js +0 -1
  59. package/dist/web/_next/static/chunks/8124-5458b17433987fab.js +0 -1
  60. package/dist/web/_next/static/chunks/8584.abc09920f03375b1.js +0 -1
  61. package/dist/web/_next/static/chunks/9067.538dec4d8ec0b04e.js +0 -1
  62. package/dist/web/_next/static/chunks/9747.9d15583d6ebafba3.js +0 -1
  63. package/dist/web/_next/static/chunks/app/page-185efe80d6e8dd05.js +0 -1
  64. package/dist/web/_next/static/chunks/app/queue/page-d4155eb6ab172c03.js +0 -1
  65. package/dist/web/_next/static/chunks/app/settings/page-9a83381087178f80.js +0 -1
  66. package/dist/web/_next/static/css/d107848da2f006af.css +0 -1
  67. /package/dist/web/_next/static/{vU04zVwJyicqgtWQsApuV → JpBxrjYpw2xowWbFoiPjO}/_buildManifest.js +0 -0
  68. /package/dist/web/_next/static/{vU04zVwJyicqgtWQsApuV → JpBxrjYpw2xowWbFoiPjO}/_ssgManifest.js +0 -0
@@ -20,6 +20,10 @@ import { parseReply, formatErrorMessage, findLikelyDamage, damageGuidance } from
20
20
  import { resolveDeviations, describeDeviations, mergeDisputes, describeDisputes } from '../protocol/replySchema.js';
21
21
  import { buildCoveringMessage, assertSendable } from '../protocol/reporter.js';
22
22
  import { runStep } from '../exec/runner.js';
23
+ import { askpassProgram } from '../vcs/remoteAuth.js';
24
+ /** Git's own password window on this machine, looked for once (2026-10-26); null where Git has none. */
25
+ let askpassFound = null;
26
+ const askpassOnce = () => (askpassFound ??= askpassProgram().catch(() => null));
23
27
  import { availableShells, detectShells, effectiveShell, preferredShell, refusalForChat, resolveShell, shellNote } from '../exec/shells.js';
24
28
  import { runChecks, failureMessage, failureRedactions, failureReport, environmentProblemIn, COMMIT_CLEAN_CHECK, CONTENT_CLEAN_CHECK, RUNNER_CHECK_KINDS } from '../exec/checks.js';
25
29
  import { activeChecks, suspendDisputed, settleAfterReview, onlyDerivedFailing, isDerivedCheck, withAttemptIds } from './derivedChecks.js';
@@ -31,7 +35,7 @@ import { describeCrash } from '../transport/edgeCrash.js';
31
35
  import { runReview, findingsMessage, deliverableFor } from './review.js';
32
36
  import { allAboutTheTask, isRepeat, findingId } from '../protocol/reviewSchema.js';
33
37
  import { repoState, workingTreePaths } from '../vcs/git.js';
34
- import { describeStep, checkCommandRefusal, commandRefusal, staticCheck } from '../exec/policy.js';
38
+ import { describeStep, checkAccessRefusal, checkCommandRefusal, commandRefusal, staticCheck } from '../exec/policy.js';
35
39
  import { networkFetchReason } from '../exec/network.js';
36
40
  import { collectPolicyManifest, describePolicyManifest } from '../exec/policyManifest.js';
37
41
  import { assessIsolation, readIsolationSignals } from '../exec/isolation.js';
@@ -125,8 +129,9 @@ export function checkRefusalForOperator(why) {
125
129
  return text;
126
130
  }
127
131
  export function lineRefusal(command, shell, cwd, cfg, roots) {
128
- return (commandRefusal(command, shell, cfg.denyPatterns, cfg.allowedPrograms) ??
132
+ return (commandRefusal(command, shell, cfg.denyPatterns, cfg.allowedPrograms, process.env, undefined, cfg.readOnlyPrograms ?? []) ??
129
133
  confinementRefusal(command, { roots, cwd }) ??
134
+ checkAccessRefusal(command, shell, cfg) ??
130
135
  (PACKAGE_RUNNER.test(command) ? null : networkFetchReason(command, cwd)));
131
136
  }
132
137
  /**
@@ -1547,6 +1552,7 @@ export async function runTask(transport, session, task, deps) {
1547
1552
  mode: deps.currentMode?.() ?? cfg.execution.mode,
1548
1553
  networkFetch: cfg.execution.networkFetch,
1549
1554
  allowedPrograms: cfg.execution.allowedPrograms,
1555
+ readOnlyPrograms: cfg.execution.readOnlyPrograms,
1550
1556
  denyPatterns: cfg.execution.denyPatterns,
1551
1557
  cwd: work.cwd,
1552
1558
  lock: cfg.policyLock,
@@ -1600,7 +1606,8 @@ export async function runTask(transport, session, task, deps) {
1600
1606
  * the way a read-only task is wherever the task has a branch of its own.
1601
1607
  */
1602
1608
  const planMode = session.planMode ?? cfg.execution.planMode ?? 'off';
1603
- let planning = planMode !== 'off' && !task.continuing;
1609
+ // A continued task does not plan again, unless its plan was sent back while the queue had it set aside (2026-10-26).
1610
+ let planning = planMode !== 'off' && (!task.continuing || task.continuing.replan === true);
1604
1611
  await actingNow(planning ? 'plan' : 'worker');
1605
1612
  const planEnforced = planning && onOwnBranch;
1606
1613
  let planVersion = 0;
@@ -3002,9 +3009,15 @@ export async function runTask(transport, session, task, deps) {
3002
3009
  idleTimeoutMs: idle * 1000,
3003
3010
  logPath: log.path('steps', `${iterations}-${step.id}.log`),
3004
3011
  passEnv: cfg.execution.passEnv,
3012
+ // A git of the step that needs a password asks for it in Git's own window, which the bot never reads.
3013
+ ...((await askpassOnce()) ? { askpass: (await askpassOnce()) } : {}),
3005
3014
  }, {
3006
3015
  signal,
3007
3016
  tracker,
3017
+ // The step waits for the operator: said, so the chat shows where to look (2026-10-26).
3018
+ onPasswordWindow: (open) => sink.event('password-window', { id: step.id, open }, open
3019
+ ? `step ${step.id} waits: Git asks for a password in its own window — type it there; the bot never reads it`
3020
+ : `step ${step.id}: Git's password window closed`, open ? 'warn' : 'info'),
3008
3021
  onHeartbeat: ({ elapsedMs, idleMs, lastLine }) => sink.event('step-heartbeat', { id: step.id, elapsedMs, idleMs, lastLine }, `step ${step.id} still running: ${Math.round(elapsedMs / 1000)}s elapsed, ${Math.round(idleMs / 1000)}s since output${lastLine ? ` — ${lastLine.slice(0, 60)}` : ''}`),
3009
3022
  });
3010
3023
  results.push(result);
@@ -164,19 +164,23 @@ You are **Kerrigan**. You help the person talking to you get their work done wit
164
164
  - The person writes a task in the chat, about the **project folder** open there. The program sends it to **Microsoft 365 Copilot** (a work account) in an Edge window it opens and keeps open between messages; when the work on a message has ended, a card in that window says so, with an OK. Copilot cannot touch the machine itself: it answers with **PowerShell commands**, in a fixed JSON form.
165
165
  - copilot-operator **runs those commands on the machine, in the project folder**, and sends back what they printed. Round after round, until Copilot says the task is **done** (with a summary of what it did), or **blocked** (with what it tried and what it needs), or a limit is reached.
166
166
  - Copilot learns the project only through those commands: it lists files, reads them, runs the build and the tests. It is not sent the files themselves, and it knows nothing about the project that the task does not say and the commands cannot find.
167
- - The person chooses how commands run in Settings, under ${Q('exec.startMode')} (not in the chat): ${Q('exec.startModeAsk')} (they press ${Q('chat.askRun')}, ${Q('chat.askRunAll')} or ${Q('chat.askSkip')} on a card that says who asks) or ${Q('exec.startModeAuto')}. A list of forbidden commands applies either way; pushing to a remote is refused; nothing needs administrator rights.
167
+ - The person chooses how commands run in Settings, under ${Q('exec.startMode')} (not in the chat): ${Q('exec.startModeAsk')} (they press ${Q('chat.askRun')}, ${Q('chat.askRunAll')} or ${Q('chat.askSkip')} on a card that says who asks) or ${Q('exec.startModeAuto')}. A list of forbidden commands applies either way; pushing to a remote is refused; nothing needs administrator rights. A command that reaches a platform with the person's own access — Azure, AWS, GitHub, Jira, publishing a package and the like — waits on a card even in a run without asking, unless ${Q('exec.questions')} in Settings is set to agree with what the bot proposes; so do the questions the chat or the lead asks, with their answers to click. Once one answer on a card is pressed, the card's other answers and its text box turn off and the one pressed stays marked until the card goes; only when the answer did not reach the program do they come back on, with the reason on the card.
168
+ - The programs a command may start are listed in Settings, under "Programs the bot may start": the person adds one by its name (${Q('prog.add')}, ${Q('prog.addButton')}) and takes one off with its ✕; a command that starts a program not on the list is refused, and the chat is told why. A program that reaches a platform with their access is set to ${Q('prog.modeAsk')}, or, for az, to ${Q('prog.modeReadOnly')}: az's commands that only look (list, show, query) then run without a card, the ones that create, change, delete, sign in or out, or show a secret are refused, and one the program cannot read waits on a card. The person signs in themselves, with az login in their own terminal; the program uses that sign-in and never sees the password. The program reads the command line and a script could go round it, so for a guarantee they sign in with an account that has only the Reader role in Azure, and Azure itself refuses every change.
168
169
  - The model: ${Q('chat.model')} under the chat's box. When it is to be chosen by hand (the default), a card asks the person to choose the model in the Copilot window and press ${Q('approval.manualReady')}.
169
170
  - ${Q('chat.planMode')} (a choice under the chat's box): Copilot first looks at the project with read-only commands and proposes a plan — what is there, how it means to do it, the stages, the files, how it will show it works — and nothing is changed until the person approves the plan (${Q('pm.approve')}), asks for another (${Q('pm.revise')}), or stops.
170
171
  - ${Q('chat.review')} (under the chat's box, on unless unticked): when Copilot says the work is done, a conversation of its own reviews it — reads the changes, runs the checks — and sends back what it finds, up to ${n(rounds)} round(s) of fixing. When the model is chosen by hand, the card for the review's model says it is the review's: a different, stronger model than the one that did the work catches more mistakes.
171
172
  - While it works: a message written in the chat is added to what it is doing (${Q('chat.sendNote')}), and Copilot gets it with its next report; ${Q('chat.pause')} holds the work at its next message or command — a reply being written and a command running are let finish — and becomes ${Q('chat.resume')}; ${Q('chat.stop')} stops it, and so does closing the Copilot window with its X. ${Q('chat.newChat')} is off while a task runs.
172
173
  - Each message is one task. The next message goes into the **same Copilot conversation**, so it can build on what was done ("now add tests for that"). ${Q('chat.newChat')} starts a conversation with nothing of the earlier one. Before each message the folder is photographed, and with ${Q('chat.rewind')} the folder is put back exactly as it was then.
174
+ - The conversations are in the list at the top of the chat; ${Q('chat.rename')} (✎ beside it) gives the open one a name of the person's own. Every part of a conversation — a message, a reply, a command with what it printed, an ending, a plan, a question of the lead and its answer, the lead's list of subtasks — has a **Copy** button, so the person can paste any of it to you.
175
+ - Git: the chat works on the branch the folder is on, and may commit, stage, switch or make branches, stash, merge and pull when asked; it may not push, reset, rebase, clean or clone. ${Q('nb.button')} (under the chat's box, beside the skills) fetches the latest of the remote's main and makes a new local branch from it for the next task — one that does not track main, so its work is never pushed there by mistake. When something is not committed, it asks whether to take it along or to put it aside on a branch of its own; nothing is ever deleted. Whenever git needs a password — for that button, or for a command of the chat such as \`git fetch\` or \`git pull\` — **Git opens its own window for it, every time**: the person types it there, it goes straight to Git, the bot never reads it and keeps nothing, and the work waits for it (the chat and the browser tab say "Waiting for your password"). The window may be behind the browser.
176
+ - ${Q('nav.queue')} (in the bar on top): tasks written beforehand that run one after another while nobody watches, each in a new chat on its own model. Each has a name, ${Q('q.lead')} or a review on a model of its own, ${Q('q.skill')}, where it works (${Q('q.branchMain')} gives it a branch of its own made from main), and ${Q('q.dependsOn')}: when a task fails, the ones that depend on it are skipped and the others still run. ${Q('q.run')} starts it, ${Q('q.stop')} stops it. A task added while a message sent from the chat is working starts after it — the button then reads ${Q('q.addAfter')}. Every task needs a model named, in the task or in Settings, since nobody is there to choose one by hand. With ${Q('q.plan')}, each task's plan — the lead's, with two chats — is approved before anything changes. A task that waits for the person — its plan, a question, a command, a subtask cut off, a model, a password Git asks for — longer than ${Q('q.parkAfter')} allows (two minutes by default) is set aside, marked ${Q('q.parked')}, and the next task starts; the tasks that depend on it wait for it. What it waits for is kept, even if the program is closed: its card is on the queue's page and under its message in its chat, and once answered it carries on from where it stopped, in its own conversation and on its own branch. So a queue can be left running: the person comes back, answers what waits, and runs the queue again.
173
177
  - ${Q('chat.lead')} (under the chat's box, for a new conversation; not ticked at first): not ticked, the chat works as it always has — one conversation that does the work; ticked, the message goes to a **lead** that directs a **worker** — see "Two chats" below. The person chooses for each conversation; to change it, they start a ${Q('chat.newChat')}.
174
178
  - Limits from the settings: at most ${n(f.maxIterations)} messages to Copilot and ${n(f.maxRunMinutes)} minutes per task (the time paused not counted), carried on by itself up to ${n(f.autoContinue)} time(s) when a limit is reached. One message in the chat can be at most ${n(MAX_INSTRUCTION_CHARS)} characters.
175
- - ${Q('nav.defaults')} (the link at the top): the projects — each with its folder, its branch and its level 2, which is where the notes below come from —, ${Q('login.button')}, the model of new conversations and of the review, and how a task runs. Every field there has an ⓘ that says what it is for. A project can be marked ${Q('proj.readOnly')}: the bot then reads it and runs what only reads it, but changes nothing in it — whatever a command changes there is put back and the chat is told; on the chat's own folder every message can then only read and report. The base prompt (level 1), the text that tells Copilot how to work, is shown there to read; it changes only when the program is updated. ${Q('nav.system')} is the report on the machine.
179
+ - ${Q('nav.defaults')} (the link at the top): the projects — each with its folder, its branch and its level 2, which is where the notes below come from —, ${Q('login.button')}, the models of the worker, the lead and the review, the skills, the model menu's locators, and how a task runs, including retrying an interrupted subtask. Every field there has an ⓘ that says what it is for. A project can be marked ${Q('proj.readOnly')}: the bot then reads it and runs what only reads it, but changes nothing in it — whatever a command changes there is put back and the chat is told; on the chat's own folder every message can then only read and report. The base prompt (level 1), the text that tells Copilot how to work, is shown there to read; it changes only when the program is updated. ${Q('nav.system')} is the report on the machine.
176
180
 
177
181
  ## Two chats: a lead and a worker
178
182
 
179
- It is a choice, not the new way: without it the chat works as it always has, one conversation doing the work, which is enough for most messages. With ${Q('chat.lead')} ticked for a new conversation, the message goes to a **lead** instead of straight to the one who works. The lead is a Copilot conversation that runs nothing itself. It restates the assignment to check it understands it, has a **worker** — a second conversation in the same Copilot window — survey the project, and makes a plan (approved by the person first when ${Q('chat.planMode')} is ticked). Then it gives the worker one subtask at a time — read files, run the tests, reproduce, debug, change code — and judges every report against its evidence, until the result is ready in the form the assignment asked for. It asks the person only what nobody else can decide, on a card in the conversation (${Q('lead.send')}), and the work waits for the answer. It may give at most ${n(f.maxSubtasks ?? 20)} subtasks for one message. Use it for a complex task that should go as far as it can without a person. It works only as well as the assignment says what is wanted, so help them write it in full:
183
+ It is a choice, not the new way: without it the chat works as it always has, one conversation doing the work, which is enough for most messages. With ${Q('chat.lead')} ticked for a new conversation, the message goes to a **lead** instead of straight to the one who works. The lead is a Copilot conversation that runs nothing itself. It restates the assignment to check it understands it, has a **worker** — a second conversation in the same Copilot window — survey the project, and makes a plan (approved by the person first when ${Q('chat.planMode')} is ticked). Then it gives the worker one subtask at a time — read files, run the tests, reproduce, debug, change code — and judges every report against its evidence, until the result is ready in the form the assignment asked for. It asks the person only what nobody else can decide, on a card in the conversation (${Q('lead.send')}), and the work waits for the answer. It may give at most ${n(f.maxSubtasks ?? 20)} subtasks for one message. A subtask cut off for a technical reason — the chat broke off, a command could not be started — is tried again under the same number, as Settings say under "Retrying an interrupted subtask": by default a card asks, with ${Q('retry.same')}, ${Q('retry.fresh')} and ${Q('retry.accept')}; one that may have changed files half way is never tried again without asking, and work that was not done goes back to the lead. After ${Q('chat.stop')} nothing restarts by itself: under the subtask that did not finish, ${Q('retry.same')} carries the message on from it, with the plan and the subtasks done kept. Use it for a complex task that should go as far as it can without a person. It works only as well as the assignment says what is wanted, so help them write it in full:
180
184
 
181
185
  - **Goal** — what is to be achieved, and why.
182
186
  - **The result, and its exact form** — every field, in order, and what each holds. For example, a defect report: title, description, system info, preconditions (if any), expected result, actual result, steps to reproduce, acceptance criteria, test scenario, short description, severity, project.
@@ -211,12 +215,22 @@ ${skillsPart(lang, f.skills ?? [])}${chosenSkillPart(lang, f.chosenSkill)}
211
215
  7. When the person does not understand something in the program — a button, a card, why a task stopped — explain it from what is written here, name the control by its label, and lead them one step at a time until the task is done. If they are stuck, ask what they see on the screen.
212
216
  8. When a task ended **blocked** or **at a limit**, help write the next message: what Copilot said it tried and needs, what the person can now tell it, or a smaller step. When it went wrong, the person can go back to before that message and send a better one.
213
217
  9. When the same kind of task keeps coming back — a new automated test, a new entity, a database migration — suggest a skill for it in Settings, under "Skills", and help write it: a short name with hyphens (\`new-test\`), one line on what it is for, its project or every project, and instructions that say where the files go, the conventions, the steps, how to check the result and what to leave alone. A task of that kind then starts with \`/its-name\` (or the skill is chosen in ${Q('chat.skill')} under the chat's box), and the message only needs what is particular to it.
218
+ 10. When the person has several tasks for later, or thinks of the next one while one works, suggest the queue (${Q('nav.queue')}): one task per item, each written as a message of the chat would be, with a name, its model, its skill, and what it depends on; ${Q('q.branchMain')} when each should start from the team's latest code. Tasks that do not need each other should not depend on each other, so one failing does not take the rest with it. Suggest ${Q('q.plan')} for work that should be seen before it is done; tell them a task that waits for them is set aside and the queue goes on, and that they answer it later on its card (${Q('pk.approve')}, ${Q('pk.revise')}, ${Q('pk.run')}, ${Q('pk.resume')}).
219
+ 11. Before a new piece of work, suggest ${Q('nb.button')}, so it starts from the remote's latest main on a branch of its own; when they have uncommitted changes, explain the two choices — take them along, or put them aside on a branch of their own.
220
+ 12. If git asks for a password, tell them to look for Git's own window — it may be behind the browser — and type it there; never in the chat, in a task or to you. Cancel in that window ends the command, and the chat is told.
221
+ 13. When they want you to see something from the program, ask them to press **Copy** on that part of the conversation and paste it here; when they want to give you a skill, ${Q('kerrigan.button')} with a skill chosen beside it carries it to you whole.
214
222
 
215
223
  ## The chat's screen, and what everything on it is called
216
224
  ${screenGuide(lang, '/')}
217
225
 
218
226
  ## Settings, and what is on them
219
227
  ${screenGuide(lang, '/settings')}
228
+
229
+ ## The queue, and what is on it
230
+ ${screenGuide(lang, '/queue')}
231
+
232
+ ## System, and what is on it
233
+ ${screenGuide(lang, '/system')}
220
234
  `;
221
235
  }
222
236
  function bgText(f) {
@@ -233,19 +247,23 @@ function bgText(f) {
233
247
  - Човекът пише задание в чата, за **папката на проекта**, отворена там. Програмата го изпраща на **Microsoft 365 Copilot** (служебен акаунт) в прозорец на Edge, който отваря и държи отворен между съобщенията; когато работата по съобщение свърши, карта в този прозорец го казва, с бутон „ОК“. Copilot не може сам да пипа машината: отговаря с **команди на PowerShell**, в определен вид JSON.
234
248
  - copilot-operator **изпълнява тези команди на машината, в папката на проекта**, и връща какво са изписали. Кръг след кръг, докато Copilot каже, че заданието е **готово** (с обобщение на направеното), или **блокирано** (с какво е опитал и какво му трябва), или се стигне ограничение.
235
249
  - Copilot опознава проекта само чрез тези команди: изброява файлове, чете ги, пуска компилацията и тестовете. Самите файлове не му се изпращат и той не знае за проекта нищо, което заданието не казва и командите не могат да намерят.
236
- - Човекът избира как се изпълняват командите в Настройки, при ${Q('exec.startMode')} (не в чата): ${Q('exec.startModeAsk')} (натиска ${Q('chat.askRun')}, ${Q('chat.askRunAll')} или ${Q('chat.askSkip')} на карта, на която пише кой иска) или ${Q('exec.startModeAuto')}. И в двата случая важи списък със забранени команди; изпращането към отдалечено хранилище (push) се отказва; нищо не изисква администраторски права.
250
+ - Човекът избира как се изпълняват командите в Настройки, при ${Q('exec.startMode')} (не в чата): ${Q('exec.startModeAsk')} (натиска ${Q('chat.askRun')}, ${Q('chat.askRunAll')} или ${Q('chat.askSkip')} на карта, на която пише кой иска) или ${Q('exec.startModeAuto')}. И в двата случая важи списък със забранени команди; изпращането към отдалечено хранилище (push) се отказва; нищо не изисква администраторски права. Команда, която достъпва платформа със собствения достъп на човека — Azure, AWS, GitHub, Jira, публикуване на пакет и подобни, — чака на карта дори при пускане без питане, освен ако ${Q('exec.questions')} в Настройки не е настроено да се съгласява с това, което предлага ботът; същото важи за въпросите на чата или на ръководителя, с отговори за избор. Щом се натисне един отговор на карта, другите отговори и полето за текст на картата се изключват, а натиснатият остава отбелязан, докато картата изчезне; включват се отново само ако отговорът не е стигнал до програмата, с причината на картата.
251
+ - Програмите, които командата може да пуска, са изброени в Настройки, при „Програми, които ботът може да пуска“: човекът добавя програма по името ѝ (${Q('prog.add')}, ${Q('prog.addButton')}) и маха програма с нейното ✕; команда, която пуска програма извън списъка, се отказва и на чата се казва защо. Програма, която достъпва платформа с неговия достъп, е на ${Q('prog.modeAsk')} или, за az, на ${Q('prog.modeReadOnly')}: тогава командите на az, които само гледат (list, show, query), се изпълняват без карта, тези, които създават, променят, трият, влизат или излизат, или показват тайна, се отказват, а такава, която програмата не може да разчете, чака на карта. Човекът влиза сам, с az login в собствения си терминал; програмата ползва този вход и никога не вижда паролата. Програмата чете командния ред и скрипт би могъл да го заобиколи, затова за гаранция той влиза с акаунт, който има само ролята Reader в Azure, и тогава самият Azure отказва всяка промяна.
237
252
  - Моделът: ${Q('chat.model')} под полето на чата. Когато се избира ръчно (по подразбиране), карта моли човека да избере модела в прозореца на Copilot и да натисне ${Q('approval.manualReady')}.
238
253
  - ${Q('chat.planMode')} (избор под полето на чата): Copilot първо разглежда проекта само с команди, които четат, и предлага план — какво има, как смята да го направи, етапите, файловете, как ще покаже, че работи, — и нищо не се променя, докато човекът не одобри плана (${Q('pm.approve')}), не поиска друг (${Q('pm.revise')}) или не спре.
239
254
  - ${Q('chat.review')} (под полето на чата, включена, освен ако не я изключат): когато Copilot каже, че работата е готова, отделен разговор я преглежда — чете промените, пуска проверките — и връща каквото открие, до ${n(rounds)} кръга поправка. Когато моделът се избира ръчно, картата за модела на рецензията казва, че е за нея: модел, различен и по-силен от този, с който е работено, хваща повече грешки.
240
255
  - Докато работи: съобщение, написано в чата, се добавя към това, което прави (${Q('chat.sendNote')}), и Copilot го получава със следващия си отчет; ${Q('chat.pause')} задържа работата при следващото ѝ съобщение или команда — отговор, който се пише, и команда, която тече, се оставят да свършат — и става ${Q('chat.resume')}; ${Q('chat.stop')} я спира, както и затварянето на прозореца на Copilot с X. ${Q('chat.newChat')} е неактивен, докато върви задание.
241
256
  - Всяко съобщение е едно задание. Следващото съобщение отива в **същия разговор в Copilot**, така че може да надгражда („сега добави тестове за това“). ${Q('chat.newChat')} започва разговор без нищо от предишния. Преди всяко съобщение папката се „снима“ и с ${Q('chat.rewind')} папката се връща точно каквато е била тогава.
257
+ - Разговорите са в списъка най-горе в чата; ${Q('chat.rename')} (✎ до него) дава на отворения разговор име по избор на човека. Всяка част от разговора — съобщение, отговор, команда с изписаното от нея, край, план, въпрос на ръководителя и отговорът му, списъкът с подзадачи на ръководителя — има бутон **Копирай**, така че човекът може да ти постави която и да е от тях.
258
+ - Git: чатът работи на бранча, на който е папката, и може да комитва, да добавя, да сменя или прави бранчове, да прибира настрана (stash), да слива и да изтегля (pull), когато е помолен; не може да прави push, reset, rebase, clean или clone. ${Q('nb.button')} (под полето на чата, до skill-овете) взима последното от main на remote и прави от него нов локален бранч за следващата задача — такъв, който не следи main, така че работата му никога не отива там по грешка. Когато има некомитнато, пита дали да се вземе или да се остави настрана в отделен бранч; нищо никога не се изтрива. Всеки път, когато git има нужда от парола — за този бутон или за команда на чата като \`git fetch\` или \`git pull\`, — **Git отваря свой прозорец за нея, всеки път**: човекът я въвежда там, тя отива направо в Git, ботът никога не я чете и нищо не пази, а работата я чака (чатът и табът на браузъра пишат, че се чака парола). Прозорецът може да е зад браузъра.
259
+ - ${Q('nav.queue')} (в лентата горе): задачи, написани предварително, които се изпълняват една след друга, докато човекът го няма, всяка в нов чат със свой модел. Всяка има име, ${Q('q.lead')} или рецензия със собствен модел, ${Q('q.skill')}, къде работи (${Q('q.branchMain')} ѝ дава отделен бранч, направен от main) и ${Q('q.dependsOn')}: когато задача се провали, тези, които зависят от нея, се прескачат, а другите продължават. ${Q('q.run')} я пуска, ${Q('q.stop')} я спира. Задача, добавена, докато работи съобщение, пуснато от чата, започва след него — тогава бутонът е ${Q('q.addAfter')}. Всяка задача трябва да има посочен модел — в задачата или в Настройки, — защото няма кой да го избере ръчно. С ${Q('q.plan')} планът на всяка задача — на ръководителя, при два чата — се одобрява, преди нещо да се промени. Задача, която чака човека — плана си, въпрос, команда, прекъсната подзадача, модел, парола, която Git иска, — по-дълго, отколкото позволява ${Q('q.parkAfter')} (по подразбиране две минути), се оставя настрана, отбелязана ${Q('q.parked')}, и започва следващата; задачите, които зависят от нея, я чакат. Каквото чака, се пази, дори ако програмата бъде затворена: картата ѝ е в страницата на опашката и под съобщението ѝ в чата ѝ, а след отговор продължава оттам, където е спряла, в собствения си разговор и в собствения си бранч. Така опашката може да се остави да работи: човекът се връща, отговаря на чакащото и пуска опашката отново.
242
260
  - ${Q('chat.lead')} (под полето на чата, за нов разговор; в началото не е отметнато): неотметнато, чатът работи както винаги — един разговор, който върши работата; отметнато, съобщението отива при **ръководител**, който ръководи **изпълнител** — виж „Два чата“ по-долу. Човекът избира за всеки разговор; за да го смени, започва ${Q('chat.newChat')}.
243
261
  - Ограничения от настройките: най-много ${n(f.maxIterations)} съобщения към Copilot и ${n(f.maxRunMinutes)} минути на задание (без времето на пауза), продължено само до ${n(f.autoContinue)} път(и), когато се стигне ограничение. Едно съобщение в чата може да е най-много ${n(MAX_INSTRUCTION_CHARS)} знака.
244
- - ${Q('nav.defaults')} (връзката горе): проектите — всеки с папката, клона и шаблона си ниво 2, откъдето са бележките по-долу, —, ${Q('login.button')}, моделът на новите разговори и на рецензията и как върви едно задание. Всяко поле там има ⓘ, което казва за какво е. Проект може да се отбележи ${Q('proj.readOnly')}: тогава ботът го чете и пуска това, което само го чете, но не променя нищо в него — каквото команда промени там, се връща, и чатът научава; ако е папката на чата, всяко съобщение може само да чете и да докладва. Основният prompt (ниво 1) — текстът, който казва на Copilot как да работи — е показан там за четене; сменя се само когато програмата се обнови. ${Q('nav.system')} е отчетът за машината.
262
+ - ${Q('nav.defaults')} (връзката горе): проектите — всеки с папката, клона и шаблона си ниво 2, откъдето са бележките по-долу, —, ${Q('login.button')}, моделите на изпълнителя, на ръководителя и на рецензията, skill-овете, локаторите на менюто с модели и как върви едно задание, включително повторението на прекъсната подзадача. Всяко поле там има ⓘ, което казва за какво е. Проект може да се отбележи ${Q('proj.readOnly')}: тогава ботът го чете и пуска това, което само го чете, но не променя нищо в него — каквото команда промени там, се връща, и чатът научава; ако е папката на чата, всяко съобщение може само да чете и да докладва. Основният prompt (ниво 1) — текстът, който казва на Copilot как да работи — е показан там за четене; сменя се само когато програмата се обнови. ${Q('nav.system')} е отчетът за машината.
245
263
 
246
264
  ## Два чата: ръководител и изпълнител
247
265
 
248
- Това е избор, а не новият начин: без него чатът работи както винаги — един разговор, който върши работата, и това стига за повечето съобщения. Когато за нов разговор е отметнато ${Q('chat.lead')}, съобщението отива при **ръководител**, а не направо при този, който работи. Ръководителят е разговор в Copilot, който сам не изпълнява нищо. Той преразказва заданието, за да провери, че го разбира, пуска **изпълнител** — втори разговор в същия прозорец на Copilot — да огледа проекта и прави план (първо одобрен от човека, когато ${Q('chat.planMode')} е отметнат). После дава на изпълнителя по една подзадача — да прочете файлове, да пусне тестовете, да възпроизведе, да дебъгва, да промени код — и преценява всеки доклад по доказателствата му, докато резултатът стане готов във вида, който заданието иска. Пита човека само това, което никой друг не може да реши, на карта в разговора (${Q('lead.send')}), и работата чака отговора. Може да даде най-много ${n(f.maxSubtasks ?? 20)} подзадачи за едно съобщение. Ползва се за сложна задача, която трябва да стигне колкото може по-далеч без човек. Работи толкова добре, колкото заданието казва какво се иска, затова помогни то да се напише изцяло:
266
+ Това е избор, а не новият начин: без него чатът работи както винаги — един разговор, който върши работата, и това стига за повечето съобщения. Когато за нов разговор е отметнато ${Q('chat.lead')}, съобщението отива при **ръководител**, а не направо при този, който работи. Ръководителят е разговор в Copilot, който сам не изпълнява нищо. Той преразказва заданието, за да провери, че го разбира, пуска **изпълнител** — втори разговор в същия прозорец на Copilot — да огледа проекта и прави план (първо одобрен от човека, когато ${Q('chat.planMode')} е отметнат). После дава на изпълнителя по една подзадача — да прочете файлове, да пусне тестовете, да възпроизведе, да дебъгва, да промени код — и преценява всеки доклад по доказателствата му, докато резултатът стане готов във вида, който заданието иска. Пита човека само това, което никой друг не може да реши, на карта в разговора (${Q('lead.send')}), и работата чака отговора. Може да даде най-много ${n(f.maxSubtasks ?? 20)} подзадачи за едно съобщение. Подзадача, прекъсната по техническа причина — чатът прекъснал, команда, която не е могла да започне, — се опитва отново под същия номер, както казват Настройки в „Повторение на прекъсната подзадача“: по подразбиране пита карта, с ${Q('retry.same')}, ${Q('retry.fresh')} и ${Q('retry.accept')}; такава, която може да е променила файлове по средата, никога не се повтаря без питане, а несвършената работа отива при ръководителя. След ${Q('chat.stop')} нищо не се рестартира само: под незавършилата подзадача ${Q('retry.same')} продължава съобщението от нея, като планът и завършените подзадачи се пазят. Ползва се за сложна задача, която трябва да стигне колкото може по-далеч без човек. Работи толкова добре, колкото заданието казва какво се иска, затова помогни то да се напише изцяло:
249
267
 
250
268
  - **Цел** — какво трябва да се постигне и защо.
251
269
  - **Резултатът и точният му вид** — всяко поле, по реда му, и какво съдържа. Например доклад за дефект: заглавие, описание, информация за системата, предусловия (ако има), очакван резултат, действителен резултат, стъпки за възпроизвеждане, критерии за приемане, тестов сценарий, кратко описание, сериозност, проект.
@@ -280,11 +298,21 @@ ${skillsPart('bg', f.skills ?? [])}${chosenSkillPart('bg', f.chosenSkill)}
280
298
  7. Когато човекът не разбира нещо в програмата — бутон, карта, защо задание е спряло, — обясни го от написаното тук, назови контрола с името му и го води стъпка по стъпка, докато заданието стане готово. Ако е заседнал, питай какво вижда на екрана.
281
299
  8. Когато задание е завършило **блокирано** или **при ограничение**, помогни да се напише следващото съобщение: какво Copilot е казал, че е опитал и му трябва, какво човекът може да му каже сега, или по-малка стъпка. Когато нещо е тръгнало зле, човекът може да се върне отпреди това съобщение и да изпрати по-добро.
282
300
  9. Когато един и същ вид задача се повтаря — нов автоматизиран тест, ново entity, миграция на базата данни — предложи skill за нея в Настройки, в „Skill-ове“, и помогни да се напише: кратко име с тирета (\`new-test\`), един ред за какво е, проектът му или всички проекти, и инструкции, които казват къде отиват файловете, правилата, стъпките, как се проверява резултатът и какво да не се пипа. Задача от този вид после започва с \`/името\` (или skill-ът се избира в ${Q('chat.skill')} под полето на чата), и в съобщението трябва само особеното за нея.
301
+ 10. Когато човекът има няколко задачи за после или се сети за следващата, докато друга работи, предложи опашката (${Q('nav.queue')}): по една задача на ред, всяка написана както съобщение в чата, с име, модел, skill и от какво зависи; ${Q('q.branchMain')}, когато всяка трябва да започне от най-новия код на екипа. Задачи, които не се нуждаят една от друга, не трябва да зависят една от друга, за да не повлече провалът на една останалите. Предлагай ${Q('q.plan')} за работа, която трябва да се види, преди да се свърши; кажи му, че задача, която го чака, се оставя настрана и опашката продължава, и че ѝ отговаря по-късно на картата ѝ (${Q('pk.approve')}, ${Q('pk.revise')}, ${Q('pk.run')}, ${Q('pk.resume')}).
302
+ 11. Преди нова работа предложи ${Q('nb.button')}, за да започне тя от най-новия main на remote в отделен бранч; когато има некомитнати промени, обясни двата избора — да се вземат с него или да се оставят настрана в отделен бранч.
303
+ 12. Ако git поиска парола, кажи на човека да потърси собствения прозорец на Git — може да е зад браузъра — и да я въведе там; никога в чата, в задание или на теб. „Cancel“ в онзи прозорец прекратява командата и чатът научава.
304
+ 13. Когато иска да ти покаже нещо от програмата, помоли го да натисне **Копирай** на тази част от разговора и да я постави тук; когато иска да ти даде skill, ${Q('kerrigan.button')} с избран до него skill ти го носи изцяло.
283
305
 
284
306
  ## Екранът на чата и как се казва всичко по него
285
307
  ${screenGuide('bg', '/')}
286
308
 
287
309
  ## Настройките и какво има в тях
288
310
  ${screenGuide('bg', '/settings')}
311
+
312
+ ## Опашката и какво има в нея
313
+ ${screenGuide('bg', '/queue')}
314
+
315
+ ## Системата и какво има в нея
316
+ ${screenGuide('bg', '/system')}
289
317
  `;
290
318
  }
@@ -682,6 +682,62 @@ export const SYSTEM_GUIDE = [
682
682
  doesEn: 'The ✎ beside the list, once a conversation is open: its name in a box where the list was, at any time, working or not. The conversation in Copilot keeps its own name, which is how the bot finds it again.',
683
683
  doesBg: 'Знакът ✎ до списъка, когато е отворен разговор: името му в поле на мястото на списъка, по всяко време, докато работи или не. Разговорът в Copilot пази своето име, по което ботът го намира отново.',
684
684
  },
685
+ {
686
+ key: 'nb.button',
687
+ kind: 'button',
688
+ en: '⎇ New branch from main',
689
+ bg: '⎇ Нов бранч от main',
690
+ doesEn: 'Under the chat\'s box, beside the skills: fetches the latest of the remote\'s main and opens a window to make a new local branch from it for the next task — not tracking main, so its work is never pushed there by mistake. If the remote asks for a password or a key\'s passphrase, Git opens its own window for it: the operator types it there, it goes straight to Git, the bot never reads it. Off while a task works, and where the folder is not a repository.',
691
+ doesBg: 'Под полето на чата, до skill-овете: взима последното от main на remote и отваря прозорец, в който от него се прави нов локален бранч за следващата задача — не следи main, така че работата му никога не отива там по грешка. Ако remote-ът поиска парола или паролата на ключ, Git отваря свой прозорец за нея: операторът я въвежда там, тя отива направо в Git, ботът никога не я чете. Неактивен, докато работи задача, и когато папката не е хранилище.',
692
+ },
693
+ {
694
+ key: 'nb.title',
695
+ kind: 'note',
696
+ en: 'New branch from main',
697
+ bg: 'Нов бранч от main',
698
+ doesEn: 'The window of that button: what the new branch starts from (the remote\'s main and its commit), the branch the folder is on now, the new branch\'s name to change, and what is not committed with the choice of what to do with it.',
699
+ doesBg: 'Прозорецът на този бутон: от какво започва новият бранч (main на remote и неговият commit), на кой бранч е папката сега, името на новия бранч, което може да се смени, и какво не е комитнато, с избор какво да стане с него.',
700
+ },
701
+ {
702
+ key: 'nb.name',
703
+ kind: 'field',
704
+ en: 'The new branch\'s name',
705
+ bg: 'Името на новия бранч',
706
+ doesEn: 'A free name is offered (task/<date>-<time>); any name git takes, not one in use.',
707
+ doesBg: 'Предлага се свободно име (task/<дата>-<час>); всяко име, което git приема и което не се ползва.',
708
+ },
709
+ {
710
+ key: 'nb.dirty',
711
+ kind: 'note',
712
+ en: 'Not committed: {n} file(s)',
713
+ bg: 'Некомитнато: {n} файл(а)',
714
+ doesEn: 'What is not committed, and the choice: take it to the new branch, as it is (refused by Git, with nothing moved, when the remote\'s main changed the same files — then putting it aside is chosen); or put it aside, kept whole as a commit on a branch of its own (cop/saved/…), and start clean. Nothing is ever deleted.',
715
+ doesBg: 'Какво не е комитнато и изборът: да се вземе в новия бранч, както е (Git отказва, без да мести нищо, ако main на remote е променил същите файлове — тогава се избира „настрана“); или да се остави настрана, пазено изцяло като commit в отделен бранч (cop/saved/…), и да се започне чисто. Нищо никога не се изтрива.',
716
+ },
717
+ {
718
+ key: 'nb.tryAgain',
719
+ kind: 'button',
720
+ en: 'Try again',
721
+ bg: 'Опитай отново',
722
+ doesEn: 'When the remote could not be fetched — a password not given, a network down: fetches again, and Git asks for the password again if it must. Beside it, the branch can be made from what was last fetched here.',
723
+ doesBg: 'Когато remote-ът не е могъл да бъде взет — непоставена парола, липса на мрежа: взима отново, и Git пак пита за паролата, ако трябва. До него бранчът може да се направи от последно взетото тук.',
724
+ },
725
+ {
726
+ key: 'nb.making',
727
+ kind: 'button',
728
+ en: 'Making the branch',
729
+ bg: 'Правя бранча',
730
+ doesEn: 'The button once pressed, its dots going round, until the branch is made: then the chat says where the folder is, and the next message starts a new conversation on the new branch.',
731
+ doesBg: 'Бутонът, след като е натиснат, с въртящи се точки, докато бранчът се направи: тогава чатът казва къде е папката, а следващото съобщение започва нов разговор на новия бранч.',
732
+ },
733
+ {
734
+ key: 'nb.cancel',
735
+ kind: 'button',
736
+ en: 'Cancel',
737
+ bg: 'Отказ',
738
+ doesEn: 'Closes the window; nothing is changed.',
739
+ doesBg: 'Затваря прозореца; нищо не се променя.',
740
+ },
685
741
  {
686
742
  key: 'chat.renameLabel',
687
743
  kind: 'field',
@@ -1486,6 +1542,78 @@ export const SYSTEM_GUIDE = [
1486
1542
  en: 'Queue of tasks',
1487
1543
  bg: 'Опашка от задачи',
1488
1544
  controls: [
1545
+ {
1546
+ key: 'q.parkAfter',
1547
+ kind: 'field',
1548
+ en: 'When a task waits for you',
1549
+ bg: 'Когато задача чака вас',
1550
+ doesEn: 'Seconds a task of the queue waits for the operator — its plan to approve, a question, a command, a subtask cut off, a model to choose, a password Git asks for — before it is set aside (status "Waits for you") and the next task starts; 120 by default, 0 waits as long as it takes. What it waits for is kept, even when the program is closed.',
1551
+ doesBg: 'Секунди, през които задача от опашката чака оператора — план за одобрение, въпрос, команда, прекъсната подзадача, модел за избор, парола, която Git иска, — преди да бъде оставена настрана (състояние „Чака вас“) и да започне следващата; по подразбиране 120, 0 чака колкото трябва. Каквото чака, се пази, дори когато програмата бъде затворена.',
1552
+ },
1553
+ {
1554
+ key: 'q.parked',
1555
+ kind: 'note',
1556
+ en: 'Waits for you',
1557
+ bg: 'Чака вас',
1558
+ doesEn: 'The status of a task set aside while it waited for the operator: under it, its card with what it waits for, to answer now; it carries on from where it stopped at the queue\'s next turn.',
1559
+ doesBg: 'Състоянието на задача, оставена настрана, докато е чакала оператора: под нея е картата ѝ с това, което чака, за отговор сега; продължава оттам, където е спряла, при следващия ход на опашката.',
1560
+ },
1561
+ {
1562
+ key: 'pk.approve',
1563
+ kind: 'button',
1564
+ en: 'Approve the plan',
1565
+ bg: 'Одобри плана',
1566
+ doesEn: 'On the card of a task set aside (in the queue, and under its message in its chat): approves its plan, with the note if one is written; the task carries on at the queue\'s next turn, after the task at work.',
1567
+ doesBg: 'На картата на оставена настрана задача (в опашката и под съобщението ѝ в чата ѝ): одобрява плана ѝ, с бележката, ако има такава; задачата продължава при следващия ход на опашката, след задачата, която работи.',
1568
+ },
1569
+ {
1570
+ key: 'pk.revise',
1571
+ kind: 'button',
1572
+ en: 'Ask for another plan',
1573
+ bg: 'Поискай друг план',
1574
+ doesEn: 'Sends the plan back with the note, which says what to change; the task makes another plan first when it carries on.',
1575
+ doesBg: 'Връща плана с бележката, която казва какво да се промени; задачата първо прави нов план, когато продължи.',
1576
+ },
1577
+ {
1578
+ key: 'pk.note',
1579
+ kind: 'field',
1580
+ en: 'A note with the plan (needed to ask for another)',
1581
+ bg: 'Бележка към плана (нужна, за да поискате друг)',
1582
+ doesEn: 'What goes with the approval, or what to change when asking for another plan.',
1583
+ doesBg: 'Какво върви с одобрението или какво да се промени, когато се иска друг план.',
1584
+ },
1585
+ {
1586
+ key: 'pk.run',
1587
+ kind: 'button',
1588
+ en: 'Run it',
1589
+ bg: 'Изпълни я',
1590
+ doesEn: 'On a task set aside at a command: approves the command; when its chat sends it again, it runs without asking.',
1591
+ doesBg: 'На задача, оставена настрана при команда: одобрява командата; когато чатът ѝ я изпрати отново, тя се изпълнява без питане.',
1592
+ },
1593
+ {
1594
+ key: 'pk.skip',
1595
+ kind: 'button',
1596
+ en: 'Skip it',
1597
+ bg: 'Пропусни я',
1598
+ doesEn: 'Does not approve the command; the chat is told to do without it.',
1599
+ doesBg: 'Не одобрява командата; на чата се казва да мине без нея.',
1600
+ },
1601
+ {
1602
+ key: 'pk.resume',
1603
+ kind: 'button',
1604
+ en: 'Carry on — I am here',
1605
+ bg: 'Продължи — тук съм',
1606
+ doesEn: 'On a task set aside while it waited for a model to be chosen by hand or a password Git asked for: carries it on at the queue\'s next turn; it asks again, so be at the computer.',
1607
+ doesBg: 'На задача, оставена настрана, докато е чакала ръчен избор на модел или парола, която Git е поискал: продължава я при следващия ход на опашката; тя пита отново, затова бъдете на компютъра.',
1608
+ },
1609
+ {
1610
+ key: 'pk.stop',
1611
+ kind: 'button',
1612
+ en: 'Stop this task',
1613
+ bg: 'Спри тази задача',
1614
+ doesEn: 'Leaves a task set aside stopped: it does not carry on; "Run again" starts it over.',
1615
+ doesBg: 'Оставя задача, оставена настрана, спряна: тя не продължава; „Пусни отново“ я започва отначало.',
1616
+ },
1489
1617
  {
1490
1618
  key: 'q.run',
1491
1619
  kind: 'button',
@@ -1589,6 +1717,14 @@ export const SYSTEM_GUIDE = [
1589
1717
  doesEn: 'What the list and the picture call the task; empty, its first line.',
1590
1718
  doesBg: 'Как списъкът и графиката наричат задачата; празно — първият ѝ ред.',
1591
1719
  },
1720
+ {
1721
+ key: 'q.plan',
1722
+ kind: 'checkbox',
1723
+ en: 'Plan first',
1724
+ bg: 'Първо план',
1725
+ doesEn: 'The task\'s plan — the lead\'s, with two chats — is approved by the operator before anything changes; in the queue, a plan nobody approves in time is set aside with it, to approve or send back later.',
1726
+ doesBg: 'Планът на задачата — на ръководителя, при два чата — се одобрява от оператора, преди нещо да се промени; в опашката план, който никой не одобри навреме, се оставя настрана заедно със задачата, за да се одобри или върне по-късно.',
1727
+ },
1592
1728
  {
1593
1729
  key: 'q.lead',
1594
1730
  kind: 'checkbox',
@@ -2452,6 +2588,69 @@ export const SYSTEM_GUIDE = [
2452
2588
  },
2453
2589
  ],
2454
2590
  },
2591
+ {
2592
+ headingKey: 'prog.title',
2593
+ en: 'Programs the bot may start',
2594
+ bg: 'Програми, които ботът може да пуска',
2595
+ controls: [
2596
+ {
2597
+ key: 'prog.platforms',
2598
+ kind: 'note',
2599
+ en: 'Programs that reach a platform with your access',
2600
+ bg: 'Програми, които достъпват платформа с вашия достъп',
2601
+ doesEn: 'The programs on the list that reach a platform with the operator\'s access (Azure, AWS, GitHub…), each with how the bot may use it and its ✕ to take it off.',
2602
+ doesBg: 'Програмите от списъка, които достъпват платформа с достъпа на оператора (Azure, AWS, GitHub…), всяка с начина, по който ботът може да я ползва, и ✕, за да се махне.',
2603
+ },
2604
+ {
2605
+ key: 'prog.modeAsk',
2606
+ kind: 'select',
2607
+ en: 'Ask me each time',
2608
+ bg: 'Питай ме всеки път',
2609
+ doesEn: 'Every command of that program waits on a card for the operator, in every run.',
2610
+ doesBg: 'Всяка команда на тази програма чака на карта за оператора, при всяко пускане.',
2611
+ },
2612
+ {
2613
+ key: 'prog.modeReadOnly',
2614
+ kind: 'select',
2615
+ en: 'Only for reference (read only)',
2616
+ bg: 'Само за справка (само четене)',
2617
+ doesEn: 'Only where the bot can read the program\'s commands (az today): those that only look — list, show, query — run without asking; one that creates, changes, deletes, signs in or out, or shows a secret is refused, and one it cannot read waits on a card. The operator signs in with az login in their own terminal; the bot never sees the password.',
2618
+ doesBg: 'Само където ботът може да разчете командите на програмата (днес az): тези, които само гледат — list, show, query — се изпълняват без питане; команда, която създава, променя, трие, влиза или излиза, или показва тайна, се отказва, а такава, която не може да разчете, чака на карта. Операторът влиза с az login в собствения си терминал; ботът никога не вижда паролата.',
2619
+ },
2620
+ {
2621
+ key: 'prog.others',
2622
+ kind: 'note',
2623
+ en: 'Other programs',
2624
+ bg: 'Други програми',
2625
+ doesEn: 'The other programs a command may start, each with its ✕ to take it off; the last one cannot be taken off.',
2626
+ doesBg: 'Другите програми, които командата може да пуска, всяка с ✕, за да се махне; последната не може да се махне.',
2627
+ },
2628
+ {
2629
+ key: 'prog.add',
2630
+ kind: 'field',
2631
+ en: 'Add a program',
2632
+ bg: 'Добави програма',
2633
+ doesEn: 'The name of a program to add, as a terminal takes it, without a folder: az, gh, kubectl. One that can be read only for reference is added so.',
2634
+ doesBg: 'Името на програма за добавяне, както го приема терминалът, без папка: az, gh, kubectl. Програма, която може да е само за справка, се добавя така.',
2635
+ },
2636
+ {
2637
+ key: 'prog.addButton',
2638
+ kind: 'button',
2639
+ en: 'Add',
2640
+ bg: 'Добави',
2641
+ doesEn: 'Adds the program written beside it to the list.',
2642
+ doesBg: 'Добавя написаната до него програма в списъка.',
2643
+ },
2644
+ {
2645
+ key: 'prog.restore',
2646
+ kind: 'button',
2647
+ en: 'Put back the defaults',
2648
+ bg: 'Върни подразбиращите се',
2649
+ doesEn: 'Puts back the list the bot comes with, after asking; the programs added are taken off.',
2650
+ doesBg: 'Връща списъка, с който идва ботът, след като попита; добавените програми се махат.',
2651
+ },
2652
+ ],
2653
+ },
2455
2654
  ],
2456
2655
  },
2457
2656
  {
@@ -12,12 +12,24 @@
12
12
  * chat is told which it was;
13
13
  * - a task may carry one of Settings' skills, sent with it as the chat's box sends one (2026-10-25);
14
14
  * - a task added while something else works — a message of the chat, sent there directly — starts after it
15
- * (2026-10-25): the queue waits for the browser to be free before it takes the next task.
15
+ * (2026-10-25): the queue waits for the browser to be free before it takes the next task;
16
+ * - a task that waits for the operator longer than the queue allows — a plan to approve, a question, a command, a
17
+ * model to choose, a password — is set aside ("parked") with what it waits for kept, and the queue goes on with the
18
+ * next (2026-10-26). Answered later, it carries on from where it stopped, before the others waiting; the tasks that
19
+ * depend on it wait for it rather than being skipped. A task "on a new branch from main" has its branch made when it
20
+ * is added, brought up to the remote's main when it starts if nothing is on it yet.
16
21
  *
17
22
  * Kept as `data/queue.json` (see `OperatorService.queue`). This module is the part that needs no browser: the shape,
18
23
  * the checks of an edit, and which task is next.
19
24
  */
20
25
  import { branchExists } from '../vcs/git.js';
26
+ export const DEFAULT_PARK_AFTER_SEC = 120;
27
+ export const MAX_PARK_AFTER_SEC = 24 * 60 * 60;
28
+ /** How long a task waits for the operator before it is parked, in milliseconds; null: as long as it takes. */
29
+ export function parkAfterMs(q) {
30
+ const sec = typeof q.parkAfterSec === 'number' && Number.isFinite(q.parkAfterSec) ? Math.max(0, Math.min(MAX_PARK_AFTER_SEC, Math.round(q.parkAfterSec))) : DEFAULT_PARK_AFTER_SEC;
31
+ return sec === 0 ? null : sec * 1000;
32
+ }
21
33
  export const MAX_QUEUE_ITEMS = 50;
22
34
  export function emptyQueue() {
23
35
  return { items: [], running: false, updatedAt: new Date().toISOString() };
@@ -54,7 +66,7 @@ export function checkItems(items, maxPromptChars) {
54
66
  if (late)
55
67
  return { problem: `Task ${n} depends on ${items.some((o) => o?.id === late) ? 'a task after it' : `"${late}", which is not in the queue`}: a task can depend only on tasks before it.` };
56
68
  const branch = x.branch === 'main' ? 'main' : 'folder';
57
- const status = typeof x.status === 'string' && ['waiting', 'running', 'done', 'failed', 'skipped', 'stopped'].includes(x.status) ? x.status : undefined;
69
+ const status = typeof x.status === 'string' && ['waiting', 'running', 'done', 'failed', 'skipped', 'stopped', 'parked'].includes(x.status) ? x.status : undefined;
58
70
  const text = (v) => String(v ?? '').trim();
59
71
  const name = text(x.name);
60
72
  if (name.length > MAX_QUEUE_NAME)
@@ -75,6 +87,7 @@ export function checkItems(items, maxPromptChars) {
75
87
  ...(lead ? { lead: true } : {}),
76
88
  ...(lead && text(x.workerModel) ? { workerModel: text(x.workerModel) } : {}),
77
89
  ...(skill ? { skill } : {}),
90
+ ...(x.plan === true ? { plan: true } : {}),
78
91
  ...(status ? { status } : {}),
79
92
  });
80
93
  seen.add(id);
@@ -99,8 +112,17 @@ export function mergeItems(current, edited) {
99
112
  return { ...x, status: 'waiting' };
100
113
  const again = x.status === 'waiting' && was.status !== 'waiting';
101
114
  const given = asGiven(x);
115
+ // "Run again" starts it over, on a branch made for it again when it is one of its own.
102
116
  if (again)
103
117
  return { ...given, status: 'waiting' };
118
+ // A parked task keeps what it waits for; its answer is given on its card, not by an edit of the list.
119
+ if (was.status === 'parked')
120
+ return { ...was, ...given, status: 'parked' };
121
+ // Where it works changed: the branch made for it no longer is its.
122
+ if (was.branch !== given.branch) {
123
+ const { branchName: _name, branchBase: _base, ...rest } = was;
124
+ return { ...rest, ...given, status: was.status };
125
+ }
104
126
  // What the runs gave it stays; what the operator gives it is the edit's, a field left out of it gone.
105
127
  const kept = { ...was };
106
128
  for (const key of GIVEN)
@@ -110,7 +132,7 @@ export function mergeItems(current, edited) {
110
132
  return { items };
111
133
  }
112
134
  /** What the operator gives a task, apart from what its runs give it. */
113
- const GIVEN = ['id', 'name', 'prompt', 'model', 'dependsOn', 'branch', 'review', 'reviewModel', 'lead', 'workerModel', 'skill'];
135
+ const GIVEN = ['id', 'name', 'prompt', 'model', 'dependsOn', 'branch', 'review', 'reviewModel', 'lead', 'workerModel', 'skill', 'plan'];
114
136
  function asGiven(x) {
115
137
  const out = {};
116
138
  for (const key of GIVEN)
@@ -138,12 +160,20 @@ export function waitsByHand(item, copilot) {
138
160
  */
139
161
  export function nextStep(items) {
140
162
  const byId = new Map(items.map((x) => [x.id, x]));
163
+ // An answered parked task first (2026-10-26): it carries on from where it stopped, before the others waiting.
164
+ const resumed = items.find((x) => x.status === 'waiting' && x.resume);
165
+ if (resumed)
166
+ return { run: resumed };
141
167
  for (const item of items) {
142
168
  if (item.status !== 'waiting')
143
169
  continue;
144
- const blocker = item.dependsOn.map((d) => byId.get(d)).find((d) => !d || d.status !== 'done');
170
+ const needs = item.dependsOn.map((d) => byId.get(d));
171
+ const blocker = needs.find((d) => !d || d.status === 'failed' || d.status === 'skipped' || d.status === 'stopped');
145
172
  if (blocker)
146
173
  return { skip: item, because: blocker };
174
+ // One it needs is parked, or waits to carry on: this one waits for it, rather than being skipped.
175
+ if (needs.some((d) => d.status !== 'done'))
176
+ continue;
147
177
  return { run: item };
148
178
  }
149
179
  return null;
@@ -164,3 +194,34 @@ export async function mainBranchOf(dir) {
164
194
  return name;
165
195
  return null;
166
196
  }
197
+ /** What a parked task waits for, in the words the queue's page and its log use (2026-10-26). */
198
+ export const PARKED_WORDS = {
199
+ plan: 'its plan, to approve',
200
+ question: 'an answer to its question',
201
+ retry: 'what to do with a subtask that was cut off',
202
+ command: 'your word on a command',
203
+ model: 'the model, to be chosen by hand',
204
+ password: 'a password Git asked for',
205
+ };
206
+ /** The operator's answer to a parked task, held to what its card offered, or why it cannot be taken. */
207
+ export function parkedAnswerFrom(p, input) {
208
+ const text = (v) => (typeof v === 'string' ? v.trim() : '');
209
+ switch (p.kind) {
210
+ case 'plan':
211
+ if (input.decision === 'approve')
212
+ return { kind: 'plan', decision: 'approve', ...(text(input.note) ? { note: text(input.note) } : {}) };
213
+ if (input.decision === 'revise')
214
+ return text(input.note) ? { kind: 'plan', decision: 'revise', note: text(input.note) } : { problem: 'Say what to change in the plan.' };
215
+ return { problem: 'A plan is approved, or sent back for another.' };
216
+ case 'question':
217
+ return text(input.answer) ? { kind: 'question', answer: text(input.answer) } : { problem: 'Write the answer first.' };
218
+ case 'retry': {
219
+ const choices = p.approval.retry?.choices ?? [];
220
+ return typeof input.choice === 'string' && choices.includes(input.choice) ? { kind: 'retry', choice: input.choice } : { problem: `Choose one of: ${choices.join(', ')}.` };
221
+ }
222
+ case 'command':
223
+ return input.decision === 'run' || input.decision === 'skip' ? { kind: 'command', decision: input.decision } : { problem: 'A command is run or skipped.' };
224
+ default:
225
+ return { kind: 'resume' };
226
+ }
227
+ }