copilot-operator 0.1.51 → 0.1.52

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 (64) hide show
  1. package/README.md +8 -3
  2. package/dist/src/api/operator.controller.js +32 -81
  3. package/dist/src/api/operator.service.js +166 -109
  4. package/dist/src/config/schema.js +13 -0
  5. package/dist/src/orchestrator/leadRunner.js +559 -0
  6. package/dist/src/orchestrator/taskRunner.js +55 -17
  7. package/dist/src/plan/kerrigan.js +172 -47
  8. package/dist/src/plan/systemGuide.js +443 -506
  9. package/dist/src/protocol/leadSchema.js +156 -0
  10. package/dist/src/protocol/parser.js +1 -1
  11. package/dist/src/session/chatNotice.js +115 -0
  12. package/dist/src/session/checkpoint.js +19 -0
  13. package/dist/src/session/compose.js +1 -1
  14. package/dist/src/session/store.js +18 -72
  15. package/dist/src/transport/copilotTransport.js +2 -0
  16. package/dist/web/404.html +13 -18
  17. package/dist/web/_next/static/_1zhoDsMOPAH2xW702E5A/_buildManifest.js +1 -0
  18. package/dist/web/_next/static/chunks/163.dbd7d36584d0bb37.js +1 -0
  19. package/dist/web/_next/static/chunks/220.35531b39410e1a9f.js +1 -0
  20. package/dist/web/_next/static/chunks/548.71ac96c94136659b.js +1 -0
  21. package/dist/web/_next/static/chunks/584.6df695c5b86a75aa.js +1 -0
  22. package/dist/web/_next/static/chunks/67.9ed79e2fbfb56f26.js +1 -0
  23. package/dist/web/_next/static/chunks/714.1e2338736a70b9c7.js +1 -0
  24. package/dist/web/_next/static/chunks/747.d2c1249d736dc03b.js +1 -0
  25. package/dist/web/_next/static/chunks/77.a200abef0f5b4a7f.js +1 -0
  26. package/dist/web/_next/static/chunks/808-bc7d7eac6d823291.js +1 -0
  27. package/dist/web/_next/static/chunks/921-dc5538cd779c6432.js +1 -0
  28. package/dist/web/_next/static/chunks/app/defaults/page-edd7534ca9ecf366.js +1 -0
  29. package/dist/web/_next/static/chunks/app/layout-8f99a164d76897a0.js +1 -0
  30. package/dist/web/_next/static/chunks/app/page-4bed816eda370d0c.js +1 -0
  31. package/dist/web/_next/static/chunks/app/system/page-1cf9e75e76da59ed.js +1 -0
  32. package/dist/web/_next/static/chunks/webpack-77147e31d2125631.js +1 -0
  33. package/dist/web/_next/static/css/3bea264adc472bc8.css +1 -0
  34. package/dist/web/defaults.html +13 -18
  35. package/dist/web/defaults.txt +9 -9
  36. package/dist/web/index.html +13 -18
  37. package/dist/web/index.txt +9 -9
  38. package/dist/web/system.html +13 -18
  39. package/dist/web/system.txt +9 -9
  40. package/package.json +4 -5
  41. package/prompts/lead1.md +116 -0
  42. package/dist/src/vcs/prepareFromRemote.js +0 -288
  43. package/dist/src/vcs/remoteAuth.js +0 -117
  44. package/dist/src/vcs/syncCommand.js +0 -97
  45. package/dist/web/_next/static/chunks/190-70555f20dd0da19b.js +0 -1
  46. package/dist/web/_next/static/chunks/643-e85d221d57900ed7.js +0 -1
  47. package/dist/web/_next/static/chunks/867-869900ec999e6345.js +0 -1
  48. package/dist/web/_next/static/chunks/app/appearance/page-cdef33c421397cbe.js +0 -1
  49. package/dist/web/_next/static/chunks/app/defaults/page-e0a2b8f9a41a94c4.js +0 -1
  50. package/dist/web/_next/static/chunks/app/layout-b4fc21e26e1bad95.js +0 -1
  51. package/dist/web/_next/static/chunks/app/level1/page-31b74cae86d960d8.js +0 -1
  52. package/dist/web/_next/static/chunks/app/page-1075921d44db3e4d.js +0 -1
  53. package/dist/web/_next/static/chunks/app/presets/page-f8abdd83cdf468f7.js +0 -1
  54. package/dist/web/_next/static/chunks/app/system/page-2a270bb885885821.js +0 -1
  55. package/dist/web/_next/static/chunks/webpack-0f31b926d9a9c5a4.js +0 -1
  56. package/dist/web/_next/static/css/8b14cb3cf0051138.css +0 -1
  57. package/dist/web/_next/static/eqTUTH_SJtBgNgq8Zzy3n/_buildManifest.js +0 -1
  58. package/dist/web/appearance.html +0 -18
  59. package/dist/web/appearance.txt +0 -25
  60. package/dist/web/level1.html +0 -18
  61. package/dist/web/level1.txt +0 -25
  62. package/dist/web/presets.html +0 -21
  63. package/dist/web/presets.txt +0 -25
  64. /package/dist/web/_next/static/{eqTUTH_SJtBgNgq8Zzy3n → _1zhoDsMOPAH2xW702E5A}/_ssgManifest.js +0 -0
package/README.md CHANGED
@@ -412,9 +412,14 @@ Open a project folder, write what to change in the chat on the right, approve ea
412
412
  the conversation (or let them run without asking), and read the summary when it finishes. The
413
413
  files of the folder are on the left, with its git; a file opens in the editor, coloured by its
414
414
  language, and can be edited and saved. "Plan mode" under the chat's box asks Copilot for a plan
415
- first, shown in the conversation to approve. "Pause" holds the work at its next message or command
416
- and becomes "Continue". "Kerrigan" on the home screen hands out a persona to
417
- give another chat, which then helps you write tasks for this one (optional). See
415
+ first, shown in the conversation to approve; "Review" has a conversation of its own check the work
416
+ when Copilot says it is done. "Two chats" gives a complex task to a lead, which plans and directs,
417
+ and a worker, which runs the commands of each subtask and reports back — two conversations in the
418
+ same Copilot window, the lead asking you only what nobody else can decide. "Pause" holds the work at its next message or command and becomes
419
+ "Continue". The interface speaks nine languages (English, Bulgarian, German, Spanish, French,
420
+ Portuguese, Japanese, Korean, Arabic), chosen from "Language". "Kerrigan" on the home screen hands out a persona to
421
+ give another chat, which then helps you write tasks for this one (optional); she knows your projects,
422
+ with the level 2 you write for each in Settings. See
418
423
  [`docs/ui.md`](docs/ui.md); the Sessions page, the task register and plans from JSON were removed
419
424
  on 2026-10-20.
420
425
 
@@ -19,7 +19,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
19
19
  * What is here is what the chat and its workbench use, with Settings and Kerrigan (2026-10-20: the sessions, the task
20
20
  * register and the plan from JSON were removed, and their routes with them).
21
21
  */
22
- import { Body, Controller, Delete, Get, Inject, Param, Post, Put, Query, Res, NotFoundException, BadRequestException, ConflictException } from '@nestjs/common';
22
+ import { Body, Controller, Get, Inject, Param, Post, Put, Query, Res, NotFoundException, BadRequestException, ConflictException } from '@nestjs/common';
23
23
  import { OperatorService } from './operator.service.js';
24
24
  import { SettingsUnusableError } from './settings.js';
25
25
  import { PolicyLockUnusableError } from '../config/lockedPolicy.js';
@@ -83,34 +83,16 @@ let OperatorController = class OperatorController {
83
83
  return { ok: true };
84
84
  }
85
85
  // --- level 1 ----------------------------------------------------------------------------
86
+ /** The contract the bot gives Copilot, as it ships: shown in Settings to read, changed only by an update of the bot. */
86
87
  level1() {
87
88
  return this.ops.getLevel1();
88
89
  }
89
- async setLevel1(body) {
90
- if (typeof body?.content !== 'string' || body.content.trim().length < 100) {
91
- throw new BadRequestException('Level 1 must be a real contract, not a few words.');
92
- }
93
- await this.ops.setLevel1(body.content);
94
- return { ok: true };
95
- }
96
- resetLevel1() {
97
- return this.ops.resetLevel1();
98
- }
99
- // --- level 2 presets --------------------------------------------------------------------
100
- presets() {
101
- return this.ops.listPresets();
102
- }
103
- savePreset(name, body) {
104
- return this.ops.savePreset(name, body?.content ?? '').catch(fail);
105
- }
106
- async deletePreset(name) {
107
- await this.ops.deletePreset(name).catch(fail);
108
- return { ok: true };
109
- }
110
90
  // --- Kerrigan -------------------------------------------------------------------------------
111
91
  /** Kerrigan, the persona to give another chat: what copilot-operator is and how a task is best written for it. */
112
92
  kerrigan(lang) {
113
- return this.ops.kerrigan(lang === 'bg' ? 'bg' : 'en').catch(fail);
93
+ // Any language code of the interface: in one she is not written out in, the page fills in the controls' names.
94
+ const code = typeof lang === 'string' && /^[a-z]{2,3}$/.test(lang) ? lang : 'en';
95
+ return this.ops.kerrigan(code).catch(fail);
114
96
  }
115
97
  // --- the chat's conversations (sessions of kind `chat`) -------------------------------------
116
98
  sessions() {
@@ -273,8 +255,14 @@ let OperatorController = class OperatorController {
273
255
  ...(typeof body.threadId === 'string' && body.threadId ? { threadId: body.threadId } : {}),
274
256
  ...(typeof body.model === 'string' && body.model.trim() ? { model: body.model } : {}),
275
257
  ...(body.manualModel === true ? { manualModel: true } : {}),
276
- ...(body.lang === 'bg' || body.lang === 'en' ? { lang: body.lang } : {}),
258
+ // The page's language, any of the interface's (`web/lib/lang/languages.ts`): the window's card says it in it.
259
+ ...(typeof body.lang === 'string' && /^[a-z]{2,3}$/.test(body.lang) ? { lang: body.lang } : {}),
277
260
  ...(body.planMode === true ? { planMode: true } : {}),
261
+ ...(typeof body.review === 'boolean' ? { review: body.review } : {}),
262
+ // Two chats, for a new conversation: a lead that directs and a worker that carries out (2026-10-20).
263
+ ...(body.lead === true ? { lead: true } : {}),
264
+ ...(typeof body.workerModel === 'string' && body.workerModel.trim() ? { workerModel: body.workerModel } : {}),
265
+ ...(body.workerManualModel === true ? { workerManualModel: true } : {}),
278
266
  })
279
267
  .catch(fail);
280
268
  }
@@ -297,6 +285,13 @@ let OperatorController = class OperatorController {
297
285
  }
298
286
  return this.ops.decide(id, body.action);
299
287
  }
288
+ /** The lead's question (two chats): the operator's answer, as text. Stopping the task is `approvals/:id` with abort. */
289
+ answerQuestion(id, body) {
290
+ const result = this.ops.answerQuestion(id, typeof body?.text === 'string' ? body.text : '');
291
+ if (!result.ok)
292
+ throw new BadRequestException(result.problem);
293
+ return result;
294
+ }
300
295
  /** A plan waiting for approval (plan mode): approve it, with a note or not; ask for another; or stop the task. */
301
296
  decidePlan(id, body) {
302
297
  if (!['approve', 'revise', 'stop'].includes(body?.action ?? ''))
@@ -319,15 +314,11 @@ let OperatorController = class OperatorController {
319
314
  }
320
315
  /** Stores it. A field left out is kept; an empty `rootDir` clears the default. */
321
316
  setProject(body) {
322
- return this.ops.setProject({ rootDir: body?.rootDir, name: body?.name, others: body?.others }).catch(fail);
323
- }
324
- /** "Prepare the folder from the remote main branch": what it would do (fetches, changes nothing else). */
325
- repoPreparePreview(body) {
326
- return this.ops.preparePreview(body?.dir ?? '', body?.fetch !== false).catch(fail);
327
- }
328
- /** …and doing it, if the folder is still what the preview showed. */
329
- repoPrepare(body) {
330
- return this.ops.prepareProject(body?.dir ?? '', body?.fingerprint ?? '', { savedBranch: body?.savedBranch, savedMainBranch: body?.savedMainBranch }).catch(fail);
317
+ const text = (v) => (typeof v === 'string' ? v : undefined);
318
+ const others = Array.isArray(body?.others)
319
+ ? body.others.map((o) => ({ name: String(o?.name ?? ''), rootDir: String(o?.rootDir ?? ''), ...(typeof o?.level2 === 'string' ? { level2: o.level2 } : {}) }))
320
+ : undefined;
321
+ return this.ops.setProject({ rootDir: text(body?.rootDir), name: text(body?.name), level2: text(body?.level2), ...(others ? { others } : {}) }).catch(fail);
331
322
  }
332
323
  // --- the model picker ---------------------------------------------------------------------
333
324
  /** The cached list. Returns null when the picker has never been read on this machine. */
@@ -393,40 +384,6 @@ __decorate([
393
384
  __metadata("design:paramtypes", []),
394
385
  __metadata("design:returntype", Promise)
395
386
  ], OperatorController.prototype, "level1", null);
396
- __decorate([
397
- Put('level1'),
398
- __param(0, Body()),
399
- __metadata("design:type", Function),
400
- __metadata("design:paramtypes", [Object]),
401
- __metadata("design:returntype", Promise)
402
- ], OperatorController.prototype, "setLevel1", null);
403
- __decorate([
404
- Delete('level1'),
405
- __metadata("design:type", Function),
406
- __metadata("design:paramtypes", []),
407
- __metadata("design:returntype", Promise)
408
- ], OperatorController.prototype, "resetLevel1", null);
409
- __decorate([
410
- Get('presets'),
411
- __metadata("design:type", Function),
412
- __metadata("design:paramtypes", []),
413
- __metadata("design:returntype", Promise)
414
- ], OperatorController.prototype, "presets", null);
415
- __decorate([
416
- Put('presets/:name'),
417
- __param(0, Param('name')),
418
- __param(1, Body()),
419
- __metadata("design:type", Function),
420
- __metadata("design:paramtypes", [String, Object]),
421
- __metadata("design:returntype", Promise)
422
- ], OperatorController.prototype, "savePreset", null);
423
- __decorate([
424
- Delete('presets/:name'),
425
- __param(0, Param('name')),
426
- __metadata("design:type", Function),
427
- __metadata("design:paramtypes", [String]),
428
- __metadata("design:returntype", Promise)
429
- ], OperatorController.prototype, "deletePreset", null);
430
387
  __decorate([
431
388
  Get('kerrigan'),
432
389
  __param(0, Query('lang')),
@@ -634,6 +591,14 @@ __decorate([
634
591
  __metadata("design:paramtypes", [String, Object]),
635
592
  __metadata("design:returntype", Object)
636
593
  ], OperatorController.prototype, "decide", null);
594
+ __decorate([
595
+ Post('approvals/:id/answer'),
596
+ __param(0, Param('id')),
597
+ __param(1, Body()),
598
+ __metadata("design:type", Function),
599
+ __metadata("design:paramtypes", [String, Object]),
600
+ __metadata("design:returntype", Object)
601
+ ], OperatorController.prototype, "answerQuestion", null);
637
602
  __decorate([
638
603
  Post('approvals/:id/plan'),
639
604
  __param(0, Param('id')),
@@ -661,20 +626,6 @@ __decorate([
661
626
  __metadata("design:paramtypes", [Object]),
662
627
  __metadata("design:returntype", Promise)
663
628
  ], OperatorController.prototype, "setProject", null);
664
- __decorate([
665
- Post('repo/prepare/preview'),
666
- __param(0, Body()),
667
- __metadata("design:type", Function),
668
- __metadata("design:paramtypes", [Object]),
669
- __metadata("design:returntype", Promise)
670
- ], OperatorController.prototype, "repoPreparePreview", null);
671
- __decorate([
672
- Post('repo/prepare'),
673
- __param(0, Body()),
674
- __metadata("design:type", Function),
675
- __metadata("design:paramtypes", [Object]),
676
- __metadata("design:returntype", Promise)
677
- ], OperatorController.prototype, "repoPrepare", null);
678
629
  __decorate([
679
630
  Get('models'),
680
631
  __metadata("design:type", Function),