copilot-operator 0.1.84 → 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.
Files changed (60) hide show
  1. package/dist/src/api/operator.controller.js +90 -0
  2. package/dist/src/api/operator.service.js +270 -30
  3. package/dist/src/config/schema.js +17 -0
  4. package/dist/src/orchestrator/cardText.js +91 -0
  5. package/dist/src/orchestrator/kerriganRunner.js +912 -0
  6. package/dist/src/orchestrator/leadRunner.js +22 -14
  7. package/dist/src/orchestrator/planMode.js +6 -4
  8. package/dist/src/orchestrator/taskRunner.js +42 -14
  9. package/dist/src/plan/kerrigan.js +109 -4
  10. package/dist/src/plan/systemGuide.js +194 -2
  11. package/dist/src/protocol/kerriganSchema.js +175 -0
  12. package/dist/src/session/store.js +9 -0
  13. package/dist/src/vcs/git.js +72 -2
  14. package/dist/src/vcs/operatorGit.js +409 -0
  15. package/dist/web/404.html +2 -2
  16. package/dist/web/_next/static/chunks/1077.06fe73b2c16f8f49.js +1 -0
  17. package/dist/web/_next/static/chunks/1548.b38c5d8d00ab2a72.js +1 -0
  18. package/dist/web/_next/static/chunks/{2163.2af0979126ae613a.js → 2163.ba933c9a506302ca.js} +1 -1
  19. package/dist/web/_next/static/chunks/714.575273a189d030fe.js +1 -0
  20. package/dist/web/_next/static/chunks/7220.988dfd28e00f407c.js +1 -0
  21. package/dist/web/_next/static/chunks/7921-65dd56d87144bd44.js +1 -0
  22. package/dist/web/_next/static/chunks/8124-1dba8babfcfbc6e2.js +1 -0
  23. package/dist/web/_next/static/chunks/8584.2221587201bc2fa2.js +1 -0
  24. package/dist/web/_next/static/chunks/9067.8d94a08830c3d1da.js +1 -0
  25. package/dist/web/_next/static/chunks/9747.8671194406acd839.js +1 -0
  26. package/dist/web/_next/static/chunks/app/layout-127e5af1ebf21876.js +1 -0
  27. package/dist/web/_next/static/chunks/app/page-76139370c7ca3715.js +1 -0
  28. package/dist/web/_next/static/chunks/app/settings/page-116da78c83f0c5c9.js +1 -0
  29. package/dist/web/_next/static/chunks/webpack-13ccb80d7b7094ca.js +1 -0
  30. package/dist/web/_next/static/css/6e2b8656501f0dd7.css +1 -0
  31. package/dist/web/defaults.html +2 -2
  32. package/dist/web/defaults.txt +8 -8
  33. package/dist/web/index.html +3 -3
  34. package/dist/web/index.txt +9 -9
  35. package/dist/web/queue.html +2 -2
  36. package/dist/web/queue.txt +9 -9
  37. package/dist/web/settings.html +2 -2
  38. package/dist/web/settings.txt +9 -9
  39. package/dist/web/system.html +2 -2
  40. package/dist/web/system.txt +9 -9
  41. package/package.json +175 -173
  42. package/prompts/kerrigan1.md +169 -0
  43. package/prompts/lead1.md +4 -1
  44. package/prompts/level1.md +8 -1
  45. package/dist/web/_next/static/chunks/1077.e0136d293069ccb8.js +0 -1
  46. package/dist/web/_next/static/chunks/1548.5cc0c57b00c2e44f.js +0 -1
  47. package/dist/web/_next/static/chunks/714.410e2b61aa8c72b7.js +0 -1
  48. package/dist/web/_next/static/chunks/7220.2c4e5173a060769f.js +0 -1
  49. package/dist/web/_next/static/chunks/7921-3d21f385338afdf9.js +0 -1
  50. package/dist/web/_next/static/chunks/8124-1dc34be1646970a8.js +0 -1
  51. package/dist/web/_next/static/chunks/8584.61650a59d2bfa54d.js +0 -1
  52. package/dist/web/_next/static/chunks/9067.553056fc9b6cf80e.js +0 -1
  53. package/dist/web/_next/static/chunks/9747.d5826524bf4b714d.js +0 -1
  54. package/dist/web/_next/static/chunks/app/layout-b8a1e0075a48b025.js +0 -1
  55. package/dist/web/_next/static/chunks/app/page-13147b69cf336831.js +0 -1
  56. package/dist/web/_next/static/chunks/app/settings/page-e3909ef6c2d8e321.js +0 -1
  57. package/dist/web/_next/static/chunks/webpack-19a2d7161f23b21d.js +0 -1
  58. package/dist/web/_next/static/css/f152f27d6afce55c.css +0 -1
  59. /package/dist/web/_next/static/{WU_J4Ke1d3xVfpW2acqqf → aCQe1FDhYTj4zGeI5ueVq}/_buildManifest.js +0 -0
  60. /package/dist/web/_next/static/{WU_J4Ke1d3xVfpW2acqqf → aCQe1FDhYTj4zGeI5ueVq}/_ssgManifest.js +0 -0
@@ -210,6 +210,12 @@ export const RunConfigSchema = z.object({
210
210
  * takes what the bot proposes — the command runs, the recommended answer is given — and says so in the chat.
211
211
  */
212
212
  questions: z.enum(['ask', 'agree']).default('ask'),
213
+ /**
214
+ * What Kerrigan is given when a chat's work on her message ends, in a conversation she directs (operator,
215
+ * 2026-11-12): `copy` — what "Copy" under its ending gives, its summary, as the operator copied it to her; `exchange`
216
+ * — that, and the whole exchange of the message (its "JSON") attached. Her cards are always what "Copy all" gives.
217
+ */
218
+ kerriganResult: z.enum(['copy', 'exchange']).default('copy'),
213
219
  /**
214
220
  * Plan mode, for every session that does not set its own (see `PlanMode` in session/model.ts): a
215
221
  * task's chat first looks at the project read-only and replies with a plan, and the work begins once
@@ -422,6 +428,12 @@ export const RunConfigSchema = z.object({
422
428
  description: z.string().default(''),
423
429
  text: z.string().default(''),
424
430
  projectDir: z.string().default(''),
431
+ /*
432
+ * For Kerrigan (operator, 2026-11-12: "Kerrigan knows every skill, even one not chosen: short, exact and clear, at
433
+ * least its phases and the result it leads to"): the phases, the result and what it needs from the person, in a
434
+ * few lines. Empty, she is given its instructions whole.
435
+ */
436
+ forKerrigan: z.string().default(''),
425
437
  }))
426
438
  .default([]),
427
439
  pacing: z
@@ -530,6 +542,11 @@ export const RunConfigSchema = z.object({
530
542
  * subtask is a task of the worker's, with the limits above; this bounds the whole. Settings → Execution.
531
543
  */
532
544
  maxSubtasks: z.number().int().min(1).max(100).default(20),
545
+ /*
546
+ * The most messages Kerrigan may send to chats for one message of the operator's, in a conversation she directs
547
+ * (2026-11-12). Each is a chat's message, with the limits above; this bounds the whole. Settings → limits.
548
+ */
549
+ maxKerriganSends: z.number().int().min(1).max(50).default(6),
533
550
  /*
534
551
  * A subtask of two chats that failed for a technical reason (operator's specification, 2026-10-25; see
535
552
  * `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
+ }