copilot-operator 0.1.42 → 0.1.44

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 +185 -0
  2. package/dist/src/api/operator.service.js +421 -3
  3. package/dist/src/api/server.js +16 -0
  4. package/dist/src/cli.js +12 -0
  5. package/dist/src/config/schema.js +10 -0
  6. package/dist/src/orchestrator/taskRunner.js +109 -38
  7. package/dist/src/plan/brief.js +57 -20
  8. package/dist/src/plan/changes.js +217 -0
  9. package/dist/src/plan/schema.js +1 -1
  10. package/dist/src/plan/systemGuide.js +733 -12
  11. package/dist/src/session/compose.js +15 -1
  12. package/dist/src/session/model.js +1 -1
  13. package/dist/src/session/store.js +60 -0
  14. package/dist/src/session/workspace.js +71 -0
  15. package/dist/src/vcs/taskVcs.js +110 -1
  16. package/dist/web/404.html +2 -2
  17. package/dist/web/_next/static/BX8Nw248DTY9xAfUu2pOH/_buildManifest.js +1 -0
  18. package/dist/web/_next/static/chunks/499-751e0be9d4f86e2d.js +1 -0
  19. package/dist/web/_next/static/chunks/549-1fe42544e4b72942.js +1 -0
  20. package/dist/web/_next/static/chunks/699-9d031f8c145a0465.js +1 -0
  21. package/dist/web/_next/static/chunks/867-0f0f8c3bd37be31e.js +1 -0
  22. package/dist/web/_next/static/chunks/897-5a34109533c3da50.js +1 -0
  23. package/dist/web/_next/static/chunks/app/defaults/page-56134fbb8cc7554f.js +1 -0
  24. package/dist/web/_next/static/chunks/app/history/{page-47973539ceff81d6.js → page-0bb537407fed5944.js} +1 -1
  25. package/dist/web/_next/static/chunks/app/import/{page-999d6cd958989723.js → page-8ef75fc08638e75f.js} +1 -1
  26. package/dist/web/_next/static/chunks/app/layout-12f138ee04d33c1e.js +1 -0
  27. package/dist/web/_next/static/chunks/app/page-09c6e2d42098f8d4.js +1 -0
  28. package/dist/web/_next/static/chunks/app/{page-e557d58476ae6383.js → sessions/page-28376d2e4a9b4738.js} +1 -1
  29. package/dist/web/_next/static/chunks/app/sessions/view/page-afc235a9171535d8.js +1 -0
  30. package/dist/web/_next/static/css/{0e55721108c300f2.css → eaec9cc6fe8aceb7.css} +1 -1
  31. package/dist/web/appearance.html +2 -2
  32. package/dist/web/appearance.txt +25 -28
  33. package/dist/web/defaults.html +2 -2
  34. package/dist/web/defaults.txt +25 -28
  35. package/dist/web/history.html +2 -2
  36. package/dist/web/history.txt +25 -28
  37. package/dist/web/import.html +2 -2
  38. package/dist/web/import.txt +25 -28
  39. package/dist/web/index.html +2 -2
  40. package/dist/web/index.txt +25 -28
  41. package/dist/web/level1.html +2 -2
  42. package/dist/web/level1.txt +25 -28
  43. package/dist/web/presets.html +3 -3
  44. package/dist/web/presets.txt +25 -28
  45. package/dist/web/sessions/view.html +2 -2
  46. package/dist/web/sessions/view.txt +25 -28
  47. package/dist/web/sessions.html +16 -0
  48. package/dist/web/sessions.txt +26 -0
  49. package/dist/web/system.html +2 -2
  50. package/dist/web/system.txt +25 -28
  51. package/package.json +5 -2
  52. package/dist/web/_next/static/chunks/204-db82ca47ff211e21.js +0 -1
  53. package/dist/web/_next/static/chunks/499-39b2c00bda3656f0.js +0 -1
  54. package/dist/web/_next/static/chunks/549-348b0a1404407e5a.js +0 -1
  55. package/dist/web/_next/static/chunks/867-7d86a692260006f1.js +0 -1
  56. package/dist/web/_next/static/chunks/app/defaults/page-a25c40436fc312db.js +0 -1
  57. package/dist/web/_next/static/chunks/app/layout-6ee612d25e78b246.js +0 -1
  58. package/dist/web/_next/static/chunks/app/sessions/view/page-872d8b9fe8eedbbf.js +0 -1
  59. package/dist/web/_next/static/lDmqS7pWU_B_Ac5idPvdS/_buildManifest.js +0 -1
  60. /package/dist/web/_next/static/{lDmqS7pWU_B_Ac5idPvdS → BX8Nw248DTY9xAfUu2pOH}/_ssgManifest.js +0 -0
@@ -188,6 +188,16 @@ let OperatorController = class OperatorController {
188
188
  * A body with `title`, `prompt` or `level2` edits the task on the way: the attempt that
189
189
  * already ran keeps the text it ran with, and the next one uses the new text.
190
190
  */
191
+ /** A note to the chat about this task: sent with its next message, at once while it runs. */
192
+ addTaskNote(id, taskId, body = {}) {
193
+ if (typeof body?.text !== 'string' || !body.text.trim())
194
+ throw new BadRequestException('text is required');
195
+ return this.ops.addTaskNote(id, taskId, body.text).catch(fail);
196
+ }
197
+ /** The operator accepts a task as done that did not end so. */
198
+ acceptTask(id, taskId, body = {}) {
199
+ return this.ops.acceptTask(id, taskId, typeof body?.note === 'string' ? body.note : undefined).catch(fail);
200
+ }
191
201
  /** A task that stopped at the runner's limit carries on in its own conversation and branch. */
192
202
  continueTask(id, taskId, body = {}) {
193
203
  // The operator's new prompt, when one is given: see `TaskContinuation.instruction`.
@@ -216,6 +226,19 @@ let OperatorController = class OperatorController {
216
226
  restore(id, taskId) {
217
227
  return this.ops.restore(id, taskId).catch(fail);
218
228
  }
229
+ /** What undoing this task would do, both ways: only this task, or back to before it. */
230
+ undoPreview(id, taskId) {
231
+ return this.ops.undoPreview(id, taskId).catch(fail);
232
+ }
233
+ /** Does it: `this` takes the task's work out (queued again); `back` goes back to before it (it and the later ones queued). */
234
+ async undoTask(id, taskId, body) {
235
+ if (body?.how !== 'this' && body?.how !== 'back')
236
+ throw new BadRequestException('how must be "this" or "back"');
237
+ const r = await this.ops.undoTask(id, taskId, body.how).catch(fail);
238
+ if (!r.ok)
239
+ throw new BadRequestException(r.problem);
240
+ return r;
241
+ }
219
242
  /** What starting the run again from this task would re-queue, and do to the code. */
220
243
  restartPlan(id, taskId) {
221
244
  return this.ops.restartPlan(id, taskId).catch(fail);
@@ -501,6 +524,55 @@ let OperatorController = class OperatorController {
501
524
  resetContext(kind, lang) {
502
525
  return this.ops.resetContext(asContextKind(kind), lang ?? 'en');
503
526
  }
527
+ /** The project folder the workbench has open, its files on disk, and one of them. Read-only. */
528
+ workspace() {
529
+ return this.ops.workspace().catch(fail);
530
+ }
531
+ workspaceFiles() {
532
+ return this.ops.workspaceFiles().catch(fail);
533
+ }
534
+ workspaceFile(path) {
535
+ if (!path)
536
+ throw new BadRequestException('path is required');
537
+ return this.ops.workspaceFile(path).catch(fail);
538
+ }
539
+ /** The chat's conversations, newest first. */
540
+ chatThreads() {
541
+ return this.ops.chatThreads().catch(fail);
542
+ }
543
+ /** A message in the chat: a task of its conversation (made in the open folder if there is none), or a note while it works. */
544
+ chatSend(body = {}) {
545
+ if (typeof body?.text !== 'string' || !body.text.trim())
546
+ throw new BadRequestException('text is required');
547
+ return this.ops.chatSend({ text: body.text, ...(typeof body.threadId === 'string' && body.threadId ? { threadId: body.threadId } : {}) }).catch(fail);
548
+ }
549
+ /** One folder of the session's repository at its branch (or the task's commit): read-only, for the workbench. */
550
+ repoTree(id, path, task) {
551
+ return this.ops.repoTree(id, path ?? '', task?.trim() || undefined).catch(fail);
552
+ }
553
+ /** One file of it, as text. */
554
+ repoFile(id, path, task) {
555
+ if (!path)
556
+ throw new BadRequestException('path is required');
557
+ return this.ops.repoFile(id, path, task?.trim() || undefined).catch(fail);
558
+ }
559
+ /** The commits on the session's line, each with the task that made it. */
560
+ repoLog(id) {
561
+ return this.ops.repoLog(id).catch(fail);
562
+ }
563
+ /** What happened in these sessions, for Kerrigan, with the operator's note and the form of her answer. */
564
+ kerriganReport(body = {}) {
565
+ const ids = (v) => (Array.isArray(v) ? v.filter((x) => typeof x === 'string') : []);
566
+ return this.ops.kerriganReport({ sessionIds: ids(body?.sessionIds), taskIds: ids(body?.taskIds), note: typeof body?.note === 'string' ? body.note : undefined }).catch(fail);
567
+ }
568
+ /** Kerrigan's changes to existing work, read against it as it is now; nothing is changed. */
569
+ checkChanges(body = {}) {
570
+ return this.ops.checkChanges(typeof body?.text === 'string' ? body.text : '').catch(fail);
571
+ }
572
+ /** Applies them one by one, stopping at the first refused; nothing is started. */
573
+ applyChanges(body = {}) {
574
+ return this.ops.applyChanges(typeof body?.text === 'string' ? body.text : '').catch(fail);
575
+ }
504
576
  /** Checks a pasted plan without importing anything, and says what it would duplicate. */
505
577
  checkPlan(body) {
506
578
  return this.ops.checkPlan(body?.text ?? '').catch(fail);
@@ -807,6 +879,24 @@ __decorate([
807
879
  __metadata("design:paramtypes", [String, String]),
808
880
  __metadata("design:returntype", Promise)
809
881
  ], OperatorController.prototype, "deleteTask", null);
882
+ __decorate([
883
+ Post('sessions/:id/tasks/:taskId/notes'),
884
+ __param(0, Param('id')),
885
+ __param(1, Param('taskId')),
886
+ __param(2, Body()),
887
+ __metadata("design:type", Function),
888
+ __metadata("design:paramtypes", [String, String, Object]),
889
+ __metadata("design:returntype", Promise)
890
+ ], OperatorController.prototype, "addTaskNote", null);
891
+ __decorate([
892
+ Post('sessions/:id/tasks/:taskId/accept'),
893
+ __param(0, Param('id')),
894
+ __param(1, Param('taskId')),
895
+ __param(2, Body()),
896
+ __metadata("design:type", Function),
897
+ __metadata("design:paramtypes", [String, String, Object]),
898
+ __metadata("design:returntype", Promise)
899
+ ], OperatorController.prototype, "acceptTask", null);
810
900
  __decorate([
811
901
  Post('sessions/:id/tasks/:taskId/continue'),
812
902
  __param(0, Param('id')),
@@ -858,6 +948,23 @@ __decorate([
858
948
  __metadata("design:paramtypes", [String, String]),
859
949
  __metadata("design:returntype", Promise)
860
950
  ], OperatorController.prototype, "restore", null);
951
+ __decorate([
952
+ Get('sessions/:id/tasks/:taskId/undo'),
953
+ __param(0, Param('id')),
954
+ __param(1, Param('taskId')),
955
+ __metadata("design:type", Function),
956
+ __metadata("design:paramtypes", [String, String]),
957
+ __metadata("design:returntype", Promise)
958
+ ], OperatorController.prototype, "undoPreview", null);
959
+ __decorate([
960
+ Post('sessions/:id/tasks/:taskId/undo'),
961
+ __param(0, Param('id')),
962
+ __param(1, Param('taskId')),
963
+ __param(2, Body()),
964
+ __metadata("design:type", Function),
965
+ __metadata("design:paramtypes", [String, String, Object]),
966
+ __metadata("design:returntype", Promise)
967
+ ], OperatorController.prototype, "undoTask", null);
861
968
  __decorate([
862
969
  Get('sessions/:id/tasks/:taskId/restart'),
863
970
  __param(0, Param('id')),
@@ -1111,6 +1218,84 @@ __decorate([
1111
1218
  __metadata("design:paramtypes", [String, String]),
1112
1219
  __metadata("design:returntype", Promise)
1113
1220
  ], OperatorController.prototype, "resetContext", null);
1221
+ __decorate([
1222
+ Get('workspace'),
1223
+ __metadata("design:type", Function),
1224
+ __metadata("design:paramtypes", []),
1225
+ __metadata("design:returntype", Promise)
1226
+ ], OperatorController.prototype, "workspace", null);
1227
+ __decorate([
1228
+ Get('workspace/files'),
1229
+ __metadata("design:type", Function),
1230
+ __metadata("design:paramtypes", []),
1231
+ __metadata("design:returntype", Promise)
1232
+ ], OperatorController.prototype, "workspaceFiles", null);
1233
+ __decorate([
1234
+ Get('workspace/file'),
1235
+ __param(0, Query('path')),
1236
+ __metadata("design:type", Function),
1237
+ __metadata("design:paramtypes", [String]),
1238
+ __metadata("design:returntype", Promise)
1239
+ ], OperatorController.prototype, "workspaceFile", null);
1240
+ __decorate([
1241
+ Get('chat/threads'),
1242
+ __metadata("design:type", Function),
1243
+ __metadata("design:paramtypes", []),
1244
+ __metadata("design:returntype", Promise)
1245
+ ], OperatorController.prototype, "chatThreads", null);
1246
+ __decorate([
1247
+ Post('chat'),
1248
+ __param(0, Body()),
1249
+ __metadata("design:type", Function),
1250
+ __metadata("design:paramtypes", [Object]),
1251
+ __metadata("design:returntype", Promise)
1252
+ ], OperatorController.prototype, "chatSend", null);
1253
+ __decorate([
1254
+ Get('sessions/:id/repo/tree'),
1255
+ __param(0, Param('id')),
1256
+ __param(1, Query('path')),
1257
+ __param(2, Query('task')),
1258
+ __metadata("design:type", Function),
1259
+ __metadata("design:paramtypes", [String, String, String]),
1260
+ __metadata("design:returntype", Promise)
1261
+ ], OperatorController.prototype, "repoTree", null);
1262
+ __decorate([
1263
+ Get('sessions/:id/repo/file'),
1264
+ __param(0, Param('id')),
1265
+ __param(1, Query('path')),
1266
+ __param(2, Query('task')),
1267
+ __metadata("design:type", Function),
1268
+ __metadata("design:paramtypes", [String, String, String]),
1269
+ __metadata("design:returntype", Promise)
1270
+ ], OperatorController.prototype, "repoFile", null);
1271
+ __decorate([
1272
+ Get('sessions/:id/repo/log'),
1273
+ __param(0, Param('id')),
1274
+ __metadata("design:type", Function),
1275
+ __metadata("design:paramtypes", [String]),
1276
+ __metadata("design:returntype", Promise)
1277
+ ], OperatorController.prototype, "repoLog", null);
1278
+ __decorate([
1279
+ Post('kerrigan/report'),
1280
+ __param(0, Body()),
1281
+ __metadata("design:type", Function),
1282
+ __metadata("design:paramtypes", [Object]),
1283
+ __metadata("design:returntype", Promise)
1284
+ ], OperatorController.prototype, "kerriganReport", null);
1285
+ __decorate([
1286
+ Post('changes/check'),
1287
+ __param(0, Body()),
1288
+ __metadata("design:type", Function),
1289
+ __metadata("design:paramtypes", [Object]),
1290
+ __metadata("design:returntype", Promise)
1291
+ ], OperatorController.prototype, "checkChanges", null);
1292
+ __decorate([
1293
+ Post('changes/apply'),
1294
+ __param(0, Body()),
1295
+ __metadata("design:type", Function),
1296
+ __metadata("design:paramtypes", [Object]),
1297
+ __metadata("design:returntype", Promise)
1298
+ ], OperatorController.prototype, "applyChanges", null);
1114
1299
  __decorate([
1115
1300
  Post('plan/check'),
1116
1301
  __param(0, Body()),