copilot-operator 0.1.84 → 0.1.88

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 (66) hide show
  1. package/dist/src/api/operator.controller.js +113 -0
  2. package/dist/src/api/operator.service.js +329 -32
  3. package/dist/src/config/schema.js +32 -0
  4. package/dist/src/orchestrator/cardText.js +91 -0
  5. package/dist/src/orchestrator/kerriganRunner.js +914 -0
  6. package/dist/src/orchestrator/leadRunner.js +25 -15
  7. package/dist/src/orchestrator/planMode.js +6 -4
  8. package/dist/src/orchestrator/taskRunner.js +93 -40
  9. package/dist/src/plan/kerrigan.js +109 -4
  10. package/dist/src/plan/systemGuide.js +227 -4
  11. package/dist/src/protocol/kerriganSchema.js +175 -0
  12. package/dist/src/session/compose.js +5 -1
  13. package/dist/src/session/store.js +9 -0
  14. package/dist/src/transport/chatTransport.js +6 -2
  15. package/dist/src/transport/copilotTransport.js +226 -11
  16. package/dist/src/transport/keptWindow.js +247 -0
  17. package/dist/src/transport/locators.js +14 -4
  18. package/dist/src/vcs/git.js +72 -2
  19. package/dist/src/vcs/operatorGit.js +409 -0
  20. package/dist/web/404.html +2 -2
  21. package/dist/web/_next/static/chunks/1077.26ca37faa3726fff.js +1 -0
  22. package/dist/web/_next/static/chunks/1548.f5790cd11a91309f.js +1 -0
  23. package/dist/web/_next/static/chunks/2163.aa9d9b82fcde6caa.js +1 -0
  24. package/dist/web/_next/static/chunks/714.b7dbce98ba0b59a8.js +1 -0
  25. package/dist/web/_next/static/chunks/7220.0ca53eefec5d01ea.js +1 -0
  26. package/dist/web/_next/static/chunks/7921-8f6503aba840928a.js +1 -0
  27. package/dist/web/_next/static/chunks/8124-1dba8babfcfbc6e2.js +1 -0
  28. package/dist/web/_next/static/chunks/8584.9f3b058a8f67d3d7.js +1 -0
  29. package/dist/web/_next/static/chunks/9067.107f6164157e0aa1.js +1 -0
  30. package/dist/web/_next/static/chunks/9747.984a86f70f9cd973.js +1 -0
  31. package/dist/web/_next/static/chunks/app/layout-127e5af1ebf21876.js +1 -0
  32. package/dist/web/_next/static/chunks/app/page-b71841852e6b9ff5.js +1 -0
  33. package/dist/web/_next/static/chunks/app/settings/page-95069cb94d79e909.js +1 -0
  34. package/dist/web/_next/static/chunks/webpack-c015bbeb103c0856.js +1 -0
  35. package/dist/web/_next/static/css/0c5d6d5914aa3824.css +1 -0
  36. package/dist/web/defaults.html +2 -2
  37. package/dist/web/defaults.txt +8 -8
  38. package/dist/web/index.html +3 -3
  39. package/dist/web/index.txt +9 -9
  40. package/dist/web/queue.html +2 -2
  41. package/dist/web/queue.txt +9 -9
  42. package/dist/web/settings.html +2 -2
  43. package/dist/web/settings.txt +9 -9
  44. package/dist/web/system.html +2 -2
  45. package/dist/web/system.txt +9 -9
  46. package/package.json +176 -173
  47. package/prompts/kerrigan1.md +169 -0
  48. package/prompts/lead1.md +4 -1
  49. package/prompts/level1.md +8 -1
  50. package/dist/web/_next/static/chunks/1077.e0136d293069ccb8.js +0 -1
  51. package/dist/web/_next/static/chunks/1548.5cc0c57b00c2e44f.js +0 -1
  52. package/dist/web/_next/static/chunks/2163.2af0979126ae613a.js +0 -1
  53. package/dist/web/_next/static/chunks/714.410e2b61aa8c72b7.js +0 -1
  54. package/dist/web/_next/static/chunks/7220.2c4e5173a060769f.js +0 -1
  55. package/dist/web/_next/static/chunks/7921-3d21f385338afdf9.js +0 -1
  56. package/dist/web/_next/static/chunks/8124-1dc34be1646970a8.js +0 -1
  57. package/dist/web/_next/static/chunks/8584.61650a59d2bfa54d.js +0 -1
  58. package/dist/web/_next/static/chunks/9067.553056fc9b6cf80e.js +0 -1
  59. package/dist/web/_next/static/chunks/9747.d5826524bf4b714d.js +0 -1
  60. package/dist/web/_next/static/chunks/app/layout-b8a1e0075a48b025.js +0 -1
  61. package/dist/web/_next/static/chunks/app/page-13147b69cf336831.js +0 -1
  62. package/dist/web/_next/static/chunks/app/settings/page-e3909ef6c2d8e321.js +0 -1
  63. package/dist/web/_next/static/chunks/webpack-19a2d7161f23b21d.js +0 -1
  64. package/dist/web/_next/static/css/f152f27d6afce55c.css +0 -1
  65. /package/dist/web/_next/static/{WU_J4Ke1d3xVfpW2acqqf → hLBBsG7Kn4vd0p_J-47BJ}/_buildManifest.js +0 -0
  66. /package/dist/web/_next/static/{WU_J4Ke1d3xVfpW2acqqf → hLBBsG7Kn4vd0p_J-47BJ}/_ssgManifest.js +0 -0
@@ -124,6 +124,12 @@ export const RunConfigSchema = z.object({
124
124
  * lead's conversation on whatever it is set to.
125
125
  */
126
126
  defaultLeadModel: z.string().default(''),
127
+ /**
128
+ * The model Kerrigan's own conversation starts on (operator, 2026-11-13: "add the section in Settings"). Empty, she
129
+ * starts on the lead's, else the worker's — as before she had one of her own. The chats she sends to are the
130
+ * worker's (and, with two chats, the lead's), not this.
131
+ */
132
+ defaultKerriganModel: z.string().default(''),
127
133
  /**
128
134
  * Choose the model by hand (operator's workaround, 2026-10-06): at the start of a run, and of a review's
129
135
  * conversation, the runner does not touch the picker; a card in the UI asks the operator to choose the
@@ -135,6 +141,8 @@ export const RunConfigSchema = z.object({
135
141
  /** The lead's and the review's models chosen by hand, each on its own (2026-10-23); absent, as `manualModel`. */
136
142
  leadManualModel: z.boolean().optional(),
137
143
  reviewManualModel: z.boolean().optional(),
144
+ /** Kerrigan's model chosen by hand (2026-11-13); absent, as the lead's (`leadManualModel`, then `manualModel`). */
145
+ kerriganManualModel: z.boolean().optional(),
138
146
  replyTimeoutSec: z.number().int().positive().default(900),
139
147
  signInTimeoutSec: z.number().int().positive().default(900),
140
148
  humanWaitSec: z.number().int().positive().default(900),
@@ -210,6 +218,12 @@ export const RunConfigSchema = z.object({
210
218
  * takes what the bot proposes — the command runs, the recommended answer is given — and says so in the chat.
211
219
  */
212
220
  questions: z.enum(['ask', 'agree']).default('ask'),
221
+ /**
222
+ * What Kerrigan is given when a chat's work on her message ends, in a conversation she directs (operator,
223
+ * 2026-11-12): `copy` — what "Copy" under its ending gives, its summary, as the operator copied it to her; `exchange`
224
+ * — that, and the whole exchange of the message (its "JSON") attached. Her cards are always what "Copy all" gives.
225
+ */
226
+ kerriganResult: z.enum(['copy', 'exchange']).default('copy'),
213
227
  /**
214
228
  * Plan mode, for every session that does not set its own (see `PlanMode` in session/model.ts): a
215
229
  * task's chat first looks at the project read-only and replies with a plan, and the work begins once
@@ -422,6 +436,12 @@ export const RunConfigSchema = z.object({
422
436
  description: z.string().default(''),
423
437
  text: z.string().default(''),
424
438
  projectDir: z.string().default(''),
439
+ /*
440
+ * For Kerrigan (operator, 2026-11-12: "Kerrigan knows every skill, even one not chosen: short, exact and clear, at
441
+ * least its phases and the result it leads to"): the phases, the result and what it needs from the person, in a
442
+ * few lines. Empty, she is given its instructions whole.
443
+ */
444
+ forKerrigan: z.string().default(''),
425
445
  }))
426
446
  .default([]),
427
447
  pacing: z
@@ -525,11 +545,23 @@ export const RunConfigSchema = z.object({
525
545
  * Zero turns it off.
526
546
  */
527
547
  autoContinue: z.number().int().min(0).max(20).default(3),
548
+ /*
549
+ * How many times the chat's Edge window, closed while a message is at work — its X pressed, by accident or not, or
550
+ * Edge ending — is opened again on its conversation for that message, and the work carried on there (operator,
551
+ * 2026-11-13; see `transport/keptWindow.ts`). Past it, the message stops and "Continue" carries it on. Zero: a
552
+ * window closed under the work stops the message, as before. Stop is the way to stop the work. Settings → limits.
553
+ */
554
+ reopenWindow: z.number().int().min(0).max(10).default(3),
528
555
  /*
529
556
  * The most subtasks the lead of a two-chat conversation may give its worker for one message (2026-10-20). Each
530
557
  * subtask is a task of the worker's, with the limits above; this bounds the whole. Settings → Execution.
531
558
  */
532
559
  maxSubtasks: z.number().int().min(1).max(100).default(20),
560
+ /*
561
+ * The most messages Kerrigan may send to chats for one message of the operator's, in a conversation she directs
562
+ * (2026-11-12). Each is a chat's message, with the limits above; this bounds the whole. Settings → limits.
563
+ */
564
+ maxKerriganSends: z.number().int().min(1).max(50).default(6),
533
565
  /*
534
566
  * A subtask of two chats that failed for a technical reason (operator's specification, 2026-10-25; see
535
567
  * `orchestrator/subtaskRetry.ts`): `ask` puts it to the operator on a card; `same` tries it again in the same
@@ -0,0 +1,91 @@
1
+ /** The English dictionary's words this needs (`web/lib/lang/en.ts`), by their keys; the check holds them equal. */
2
+ export const CARD_WORDS = {
3
+ 'lead.question': 'The lead asks you',
4
+ 'chat.question': 'The chat asks you',
5
+ 'chat.copyOne': 'The answers offered — press one on the card:',
6
+ 'chat.copyMany': 'The answers offered — more than one may be chosen: press each one you want on the card, then “{send}”:',
7
+ 'chat.copyWrite': 'Or write your own answer in “{answer}” and press “{send}”.',
8
+ 'chat.copyWriteMany': 'You can also write in “{answer}”, alone or with the ones chosen, and press “{send}”.',
9
+ 'lead.answer': 'Your answer',
10
+ 'lead.send': 'Send the answer',
11
+ 'chat.sendChosen': 'Send the choice',
12
+ 'chat.optionRecommended': 'Recommended by the chat',
13
+ 'chat.optionRuns': 'runs: {cmd}',
14
+ 'chat.copyOffered': 'The answers offered:',
15
+ 'pm.cardTitle': 'Plan for “{title}”, waiting for approval',
16
+ 'pm.cardWhy': 'Nothing has been changed yet. The work starts once you approve this plan.',
17
+ 'pm.existing': 'Already there',
18
+ 'pm.approach': 'Approach',
19
+ 'pm.steps': 'Steps',
20
+ 'pm.files': 'Files it expects to change',
21
+ 'pm.verification': 'How it will show the work is done',
22
+ 'pm.risks': 'Risks',
23
+ 'retry.title': 'Subtask {n} did not finish',
24
+ 'retry.attempt': 'Attempt {k} of {m}',
25
+ 'retry.catTransient': 'The chat broke off',
26
+ 'retry.catCommand': 'A command could not be run',
27
+ 'retry.catEvidence': 'The work was not done',
28
+ 'retry.catStopped': 'Stopped',
29
+ 'retry.catUnknown': 'Not known what changed',
30
+ 'retry.reason': 'Reason: {reason}',
31
+ 'retry.unknown': 'The subtask was interrupted after a possible change. Choose whether to continue from the current state or to restore the snapshot.',
32
+ 'retry.changed': 'Files changed so far: {files}',
33
+ 'retry.same': 'Try again',
34
+ 'retry.fresh': 'Try with a new worker',
35
+ 'retry.continue': 'Continue from the current state',
36
+ 'retry.restore': 'Restore the snapshot',
37
+ 'retry.accept': 'Accept as failed',
38
+ };
39
+ const t = (key, vars = {}) => CARD_WORDS[key].replace(/\{(\w+)\}/g, (m, k) => (k in vars ? String(vars[k]) : m));
40
+ const paragraphs = (parts) => parts.filter(Boolean).join('\n\n');
41
+ const FAILURE = {
42
+ TRANSIENT_CHAT_FAILURE: 'retry.catTransient',
43
+ COMMAND_INFRASTRUCTURE_FAILURE: 'retry.catCommand',
44
+ TASK_EVIDENCE_FAILURE: 'retry.catEvidence',
45
+ USER_STOPPED: 'retry.catStopped',
46
+ UNKNOWN_SIDE_EFFECT_STATE: 'retry.catUnknown',
47
+ };
48
+ const CHOICE = { same: 'retry.same', fresh: 'retry.fresh', continue: 'retry.continue', restore: 'retry.restore', accept: 'retry.accept' };
49
+ function planAsText(plan) {
50
+ const part = (heading, body) => (body.trim() ? [`## ${t(heading)}`, '', body.trim(), ''] : []);
51
+ return [
52
+ ...part('pm.existing', plan.existing),
53
+ ...part('pm.approach', plan.approach),
54
+ ...part('pm.steps', plan.steps.map((s, i) => `${i + 1}. ${s.trim()}`).join('\n')),
55
+ ...part('pm.files', plan.files.map((f) => `- \`${f}\``).join('\n')),
56
+ ...part('pm.verification', plan.verification),
57
+ ...part('pm.risks', plan.risks ?? ''),
58
+ ]
59
+ .join('\n')
60
+ .trim();
61
+ }
62
+ function questionCopy(q) {
63
+ const send = t(q.multiple ? 'chat.sendChosen' : 'lead.send');
64
+ const offered = q.options.map((o, i) => [`${i + 1}. ${o}${i === 0 ? ` (${t('chat.optionRecommended')})` : ''}`, ...(q.commands?.[i] ? [` ${t('chat.optionRuns', { cmd: q.commands[i] })}`] : [])].join('\n'));
65
+ const head = q.multiple ? t('chat.copyMany', { send }) : t('chat.copyOne');
66
+ return paragraphs([q.text, q.why ?? '', offered.length > 0 ? [head, ...offered].join('\n') : '', t(q.multiple ? 'chat.copyWriteMany' : 'chat.copyWrite', { answer: t('lead.answer'), send })]);
67
+ }
68
+ function retryCopy(r) {
69
+ return paragraphs([
70
+ `${t('retry.title', { n: r.n })}\n${r.title}`,
71
+ `${t('retry.attempt', { k: r.attempt, m: r.maxAttempts })} · ${t(FAILURE[r.category])}`,
72
+ r.reason ? t('retry.reason', { reason: r.reason }) : '',
73
+ r.sideEffects === 'unknown' ? t('retry.unknown') : '',
74
+ r.changed.length > 0 ? t('retry.changed', { files: r.changed.join(', ') }) : '',
75
+ [t('chat.copyOffered'), ...r.choices.map((c, i) => `${i + 1}. ${t(CHOICE[c])}`)].join('\n'),
76
+ ]);
77
+ }
78
+ /** "Copy all" of a card that comes to her: a question, a plan, a subtask cut off. Null for any other. */
79
+ export function cardCopyText(a) {
80
+ if (a.plan)
81
+ return paragraphs([t('pm.cardTitle', { title: a.plan.title }), t('pm.cardWhy'), planAsText(a.plan.plan)]);
82
+ if (a.question && !a.question.handoff)
83
+ return paragraphs([t((a.actor ?? 'lead') === 'lead' ? 'lead.question' : 'chat.question'), questionCopy(a.question)]);
84
+ if (a.retry)
85
+ return retryCopy(a.retry);
86
+ return null;
87
+ }
88
+ /** "Copy" beside a message's ending: its summary, and why when it did not end done (`Ending` in `cascade.tsx`). */
89
+ export function endingCopyText(task) {
90
+ return [task.summary, task.status !== 'done' ? task.reason : ''].filter(Boolean).join('\n\n');
91
+ }