copilot-operator 0.1.41 → 0.1.43
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.
- package/dist/src/api/operator.controller.js +159 -6
- package/dist/src/api/operator.service.js +417 -10
- package/dist/src/api/server.js +16 -0
- package/dist/src/cli.js +12 -0
- package/dist/src/config/schema.js +17 -0
- package/dist/src/orchestrator/planMode.js +102 -0
- package/dist/src/orchestrator/review.js +8 -4
- package/dist/src/orchestrator/taskRunner.js +246 -40
- package/dist/src/plan/brief.js +69 -20
- package/dist/src/plan/changes.js +217 -0
- package/dist/src/plan/importPlan.js +2 -0
- package/dist/src/plan/schema.js +11 -1
- package/dist/src/plan/systemGuide.js +790 -14
- package/dist/src/protocol/parser.js +26 -2
- package/dist/src/protocol/replySchema.js +28 -4
- package/dist/src/session/compose.js +76 -7
- package/dist/src/session/exports.js +1 -0
- package/dist/src/session/model.js +38 -0
- package/dist/src/session/store.js +90 -3
- package/dist/src/vcs/startChoice.js +80 -8
- package/dist/src/vcs/taskVcs.js +126 -8
- package/dist/web/404.html +2 -2
- package/dist/web/_next/static/WmzBz4QN36pcz4PL_cfEW/_buildManifest.js +1 -0
- package/dist/web/_next/static/chunks/499-751e0be9d4f86e2d.js +1 -0
- package/dist/web/_next/static/chunks/549-2415dd26f4e53d07.js +1 -0
- package/dist/web/_next/static/chunks/699-9d031f8c145a0465.js +1 -0
- package/dist/web/_next/static/chunks/867-aea30f560bc18eaf.js +1 -0
- package/dist/web/_next/static/chunks/897-5a34109533c3da50.js +1 -0
- package/dist/web/_next/static/chunks/app/defaults/page-56134fbb8cc7554f.js +1 -0
- package/dist/web/_next/static/chunks/app/history/page-0bb537407fed5944.js +1 -0
- package/dist/web/_next/static/chunks/app/import/{page-999d6cd958989723.js → page-8ef75fc08638e75f.js} +1 -1
- package/dist/web/_next/static/chunks/app/layout-dc602b727480a653.js +1 -0
- package/dist/web/_next/static/chunks/app/page-d73a8ff300862cd8.js +1 -0
- package/dist/web/_next/static/chunks/app/{page-e557d58476ae6383.js → sessions/page-28376d2e4a9b4738.js} +1 -1
- package/dist/web/_next/static/chunks/app/sessions/view/page-afc235a9171535d8.js +1 -0
- package/dist/web/_next/static/css/{cea7913ba416dbb7.css → 72c85e4322c21223.css} +1 -1
- package/dist/web/appearance.html +2 -2
- package/dist/web/appearance.txt +25 -28
- package/dist/web/defaults.html +2 -2
- package/dist/web/defaults.txt +25 -28
- package/dist/web/history.html +2 -2
- package/dist/web/history.txt +25 -28
- package/dist/web/import.html +2 -2
- package/dist/web/import.txt +25 -28
- package/dist/web/index.html +2 -2
- package/dist/web/index.txt +25 -28
- package/dist/web/level1.html +2 -2
- package/dist/web/level1.txt +25 -28
- package/dist/web/presets.html +3 -3
- package/dist/web/presets.txt +25 -28
- package/dist/web/sessions/view.html +2 -2
- package/dist/web/sessions/view.txt +25 -28
- package/dist/web/sessions.html +16 -0
- package/dist/web/sessions.txt +26 -0
- package/dist/web/system.html +2 -2
- package/dist/web/system.txt +25 -28
- package/package.json +161 -158
- package/dist/web/_next/static/-htN5GTSrd3W3f5j_QC2y/_buildManifest.js +0 -1
- package/dist/web/_next/static/chunks/499-28e118e33ce07935.js +0 -1
- package/dist/web/_next/static/chunks/549-f295c8429e83b25b.js +0 -1
- package/dist/web/_next/static/chunks/584-578be94a0786334b.js +0 -1
- package/dist/web/_next/static/chunks/867-8dc5bbb092ca2c5c.js +0 -1
- package/dist/web/_next/static/chunks/app/defaults/page-879158e9e550eea7.js +0 -1
- package/dist/web/_next/static/chunks/app/history/page-9f69ccde726c9be2.js +0 -1
- package/dist/web/_next/static/chunks/app/layout-73f28bc065a46ed3.js +0 -1
- package/dist/web/_next/static/chunks/app/sessions/view/page-0485ee7f781156ec.js +0 -1
- /package/dist/web/_next/static/{-htN5GTSrd3W3f5j_QC2y → WmzBz4QN36pcz4PL_cfEW}/_ssgManifest.js +0 -0
|
@@ -69,12 +69,14 @@ function startsFrom(raw) {
|
|
|
69
69
|
const x = c;
|
|
70
70
|
const branch = typeof x.branch === 'string' ? x.branch : '';
|
|
71
71
|
const onBranch = x.onBranch === true ? { onBranch: true } : {};
|
|
72
|
+
// Another start for a session that has run: see `StartChoice.rechoose`.
|
|
73
|
+
const rechoose = x.rechoose === true ? { rechoose: true } : {};
|
|
72
74
|
if (x.from === 'previous-session')
|
|
73
|
-
out[id] = { from: 'previous-session' };
|
|
75
|
+
out[id] = { from: 'previous-session', ...rechoose };
|
|
74
76
|
else if (x.from === 'local' && branch)
|
|
75
|
-
out[id] = { from: 'local', branch, ...onBranch };
|
|
77
|
+
out[id] = { from: 'local', branch, ...onBranch, ...rechoose };
|
|
76
78
|
else if (x.from === 'remote' && branch && typeof x.remote === 'string' && x.remote)
|
|
77
|
-
out[id] = { from: 'remote', remote: x.remote, branch, ...onBranch };
|
|
79
|
+
out[id] = { from: 'remote', remote: x.remote, branch, ...onBranch, ...rechoose };
|
|
78
80
|
}
|
|
79
81
|
return Object.keys(out).length > 0 ? out : undefined;
|
|
80
82
|
}
|
|
@@ -186,9 +188,21 @@ let OperatorController = class OperatorController {
|
|
|
186
188
|
* A body with `title`, `prompt` or `level2` edits the task on the way: the attempt that
|
|
187
189
|
* already ran keeps the text it ran with, and the next one uses the new text.
|
|
188
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
|
+
}
|
|
189
201
|
/** A task that stopped at the runner's limit carries on in its own conversation and branch. */
|
|
190
|
-
continueTask(id, taskId) {
|
|
191
|
-
|
|
202
|
+
continueTask(id, taskId, body = {}) {
|
|
203
|
+
// The operator's new prompt, when one is given: see `TaskContinuation.instruction`.
|
|
204
|
+
const instruction = typeof body?.instruction === 'string' ? body.instruction : undefined;
|
|
205
|
+
return this.ops.continueTask(id, taskId, instruction).catch(fail);
|
|
192
206
|
}
|
|
193
207
|
rerunTask(id, taskId, body) {
|
|
194
208
|
const { buildOnFinished, ...patch } = body ?? {};
|
|
@@ -212,6 +226,19 @@ let OperatorController = class OperatorController {
|
|
|
212
226
|
restore(id, taskId) {
|
|
213
227
|
return this.ops.restore(id, taskId).catch(fail);
|
|
214
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
|
+
}
|
|
215
242
|
/** What starting the run again from this task would re-queue, and do to the code. */
|
|
216
243
|
restartPlan(id, taskId) {
|
|
217
244
|
return this.ops.restartPlan(id, taskId).catch(fail);
|
|
@@ -497,6 +524,33 @@ let OperatorController = class OperatorController {
|
|
|
497
524
|
resetContext(kind, lang) {
|
|
498
525
|
return this.ops.resetContext(asContextKind(kind), lang ?? 'en');
|
|
499
526
|
}
|
|
527
|
+
/** One folder of the session's repository at its branch (or the task's commit): read-only, for the workbench. */
|
|
528
|
+
repoTree(id, path, task) {
|
|
529
|
+
return this.ops.repoTree(id, path ?? '', task?.trim() || undefined).catch(fail);
|
|
530
|
+
}
|
|
531
|
+
/** One file of it, as text. */
|
|
532
|
+
repoFile(id, path, task) {
|
|
533
|
+
if (!path)
|
|
534
|
+
throw new BadRequestException('path is required');
|
|
535
|
+
return this.ops.repoFile(id, path, task?.trim() || undefined).catch(fail);
|
|
536
|
+
}
|
|
537
|
+
/** The commits on the session's line, each with the task that made it. */
|
|
538
|
+
repoLog(id) {
|
|
539
|
+
return this.ops.repoLog(id).catch(fail);
|
|
540
|
+
}
|
|
541
|
+
/** What happened in these sessions, for Kerrigan, with the operator's note and the form of her answer. */
|
|
542
|
+
kerriganReport(body = {}) {
|
|
543
|
+
const ids = (v) => (Array.isArray(v) ? v.filter((x) => typeof x === 'string') : []);
|
|
544
|
+
return this.ops.kerriganReport({ sessionIds: ids(body?.sessionIds), taskIds: ids(body?.taskIds), note: typeof body?.note === 'string' ? body.note : undefined }).catch(fail);
|
|
545
|
+
}
|
|
546
|
+
/** Kerrigan's changes to existing work, read against it as it is now; nothing is changed. */
|
|
547
|
+
checkChanges(body = {}) {
|
|
548
|
+
return this.ops.checkChanges(typeof body?.text === 'string' ? body.text : '').catch(fail);
|
|
549
|
+
}
|
|
550
|
+
/** Applies them one by one, stopping at the first refused; nothing is started. */
|
|
551
|
+
applyChanges(body = {}) {
|
|
552
|
+
return this.ops.applyChanges(typeof body?.text === 'string' ? body.text : '').catch(fail);
|
|
553
|
+
}
|
|
500
554
|
/** Checks a pasted plan without importing anything, and says what it would duplicate. */
|
|
501
555
|
checkPlan(body) {
|
|
502
556
|
return this.ops.checkPlan(body?.text ?? '').catch(fail);
|
|
@@ -537,6 +591,15 @@ let OperatorController = class OperatorController {
|
|
|
537
591
|
}
|
|
538
592
|
return this.ops.decide(id, body.action);
|
|
539
593
|
}
|
|
594
|
+
/** A plan waiting for approval (plan mode): approve it, with a note or not; ask for another; or stop the task. */
|
|
595
|
+
decidePlan(id, body) {
|
|
596
|
+
if (!['approve', 'revise', 'stop'].includes(body?.action ?? ''))
|
|
597
|
+
throw new BadRequestException('action must be approve, revise or stop');
|
|
598
|
+
const result = this.ops.decidePlan(id, body.action, typeof body?.note === 'string' ? body.note : undefined);
|
|
599
|
+
if (!result.ok)
|
|
600
|
+
throw new BadRequestException(result.problem);
|
|
601
|
+
return result;
|
|
602
|
+
}
|
|
540
603
|
/** Turns asking on or off in the middle of a run. */
|
|
541
604
|
setMode(id, body) {
|
|
542
605
|
if (body?.mode !== 'confirm' && body?.mode !== 'unattended') {
|
|
@@ -794,12 +857,31 @@ __decorate([
|
|
|
794
857
|
__metadata("design:paramtypes", [String, String]),
|
|
795
858
|
__metadata("design:returntype", Promise)
|
|
796
859
|
], OperatorController.prototype, "deleteTask", null);
|
|
860
|
+
__decorate([
|
|
861
|
+
Post('sessions/:id/tasks/:taskId/notes'),
|
|
862
|
+
__param(0, Param('id')),
|
|
863
|
+
__param(1, Param('taskId')),
|
|
864
|
+
__param(2, Body()),
|
|
865
|
+
__metadata("design:type", Function),
|
|
866
|
+
__metadata("design:paramtypes", [String, String, Object]),
|
|
867
|
+
__metadata("design:returntype", Promise)
|
|
868
|
+
], OperatorController.prototype, "addTaskNote", null);
|
|
869
|
+
__decorate([
|
|
870
|
+
Post('sessions/:id/tasks/:taskId/accept'),
|
|
871
|
+
__param(0, Param('id')),
|
|
872
|
+
__param(1, Param('taskId')),
|
|
873
|
+
__param(2, Body()),
|
|
874
|
+
__metadata("design:type", Function),
|
|
875
|
+
__metadata("design:paramtypes", [String, String, Object]),
|
|
876
|
+
__metadata("design:returntype", Promise)
|
|
877
|
+
], OperatorController.prototype, "acceptTask", null);
|
|
797
878
|
__decorate([
|
|
798
879
|
Post('sessions/:id/tasks/:taskId/continue'),
|
|
799
880
|
__param(0, Param('id')),
|
|
800
881
|
__param(1, Param('taskId')),
|
|
882
|
+
__param(2, Body()),
|
|
801
883
|
__metadata("design:type", Function),
|
|
802
|
-
__metadata("design:paramtypes", [String, String]),
|
|
884
|
+
__metadata("design:paramtypes", [String, String, Object]),
|
|
803
885
|
__metadata("design:returntype", Promise)
|
|
804
886
|
], OperatorController.prototype, "continueTask", null);
|
|
805
887
|
__decorate([
|
|
@@ -844,6 +926,23 @@ __decorate([
|
|
|
844
926
|
__metadata("design:paramtypes", [String, String]),
|
|
845
927
|
__metadata("design:returntype", Promise)
|
|
846
928
|
], OperatorController.prototype, "restore", null);
|
|
929
|
+
__decorate([
|
|
930
|
+
Get('sessions/:id/tasks/:taskId/undo'),
|
|
931
|
+
__param(0, Param('id')),
|
|
932
|
+
__param(1, Param('taskId')),
|
|
933
|
+
__metadata("design:type", Function),
|
|
934
|
+
__metadata("design:paramtypes", [String, String]),
|
|
935
|
+
__metadata("design:returntype", Promise)
|
|
936
|
+
], OperatorController.prototype, "undoPreview", null);
|
|
937
|
+
__decorate([
|
|
938
|
+
Post('sessions/:id/tasks/:taskId/undo'),
|
|
939
|
+
__param(0, Param('id')),
|
|
940
|
+
__param(1, Param('taskId')),
|
|
941
|
+
__param(2, Body()),
|
|
942
|
+
__metadata("design:type", Function),
|
|
943
|
+
__metadata("design:paramtypes", [String, String, Object]),
|
|
944
|
+
__metadata("design:returntype", Promise)
|
|
945
|
+
], OperatorController.prototype, "undoTask", null);
|
|
847
946
|
__decorate([
|
|
848
947
|
Get('sessions/:id/tasks/:taskId/restart'),
|
|
849
948
|
__param(0, Param('id')),
|
|
@@ -1097,6 +1196,52 @@ __decorate([
|
|
|
1097
1196
|
__metadata("design:paramtypes", [String, String]),
|
|
1098
1197
|
__metadata("design:returntype", Promise)
|
|
1099
1198
|
], OperatorController.prototype, "resetContext", null);
|
|
1199
|
+
__decorate([
|
|
1200
|
+
Get('sessions/:id/repo/tree'),
|
|
1201
|
+
__param(0, Param('id')),
|
|
1202
|
+
__param(1, Query('path')),
|
|
1203
|
+
__param(2, Query('task')),
|
|
1204
|
+
__metadata("design:type", Function),
|
|
1205
|
+
__metadata("design:paramtypes", [String, String, String]),
|
|
1206
|
+
__metadata("design:returntype", Promise)
|
|
1207
|
+
], OperatorController.prototype, "repoTree", null);
|
|
1208
|
+
__decorate([
|
|
1209
|
+
Get('sessions/:id/repo/file'),
|
|
1210
|
+
__param(0, Param('id')),
|
|
1211
|
+
__param(1, Query('path')),
|
|
1212
|
+
__param(2, Query('task')),
|
|
1213
|
+
__metadata("design:type", Function),
|
|
1214
|
+
__metadata("design:paramtypes", [String, String, String]),
|
|
1215
|
+
__metadata("design:returntype", Promise)
|
|
1216
|
+
], OperatorController.prototype, "repoFile", null);
|
|
1217
|
+
__decorate([
|
|
1218
|
+
Get('sessions/:id/repo/log'),
|
|
1219
|
+
__param(0, Param('id')),
|
|
1220
|
+
__metadata("design:type", Function),
|
|
1221
|
+
__metadata("design:paramtypes", [String]),
|
|
1222
|
+
__metadata("design:returntype", Promise)
|
|
1223
|
+
], OperatorController.prototype, "repoLog", null);
|
|
1224
|
+
__decorate([
|
|
1225
|
+
Post('kerrigan/report'),
|
|
1226
|
+
__param(0, Body()),
|
|
1227
|
+
__metadata("design:type", Function),
|
|
1228
|
+
__metadata("design:paramtypes", [Object]),
|
|
1229
|
+
__metadata("design:returntype", Promise)
|
|
1230
|
+
], OperatorController.prototype, "kerriganReport", null);
|
|
1231
|
+
__decorate([
|
|
1232
|
+
Post('changes/check'),
|
|
1233
|
+
__param(0, Body()),
|
|
1234
|
+
__metadata("design:type", Function),
|
|
1235
|
+
__metadata("design:paramtypes", [Object]),
|
|
1236
|
+
__metadata("design:returntype", Promise)
|
|
1237
|
+
], OperatorController.prototype, "checkChanges", null);
|
|
1238
|
+
__decorate([
|
|
1239
|
+
Post('changes/apply'),
|
|
1240
|
+
__param(0, Body()),
|
|
1241
|
+
__metadata("design:type", Function),
|
|
1242
|
+
__metadata("design:paramtypes", [Object]),
|
|
1243
|
+
__metadata("design:returntype", Promise)
|
|
1244
|
+
], OperatorController.prototype, "applyChanges", null);
|
|
1100
1245
|
__decorate([
|
|
1101
1246
|
Post('plan/check'),
|
|
1102
1247
|
__param(0, Body()),
|
|
@@ -1140,6 +1285,14 @@ __decorate([
|
|
|
1140
1285
|
__metadata("design:paramtypes", [String, Object]),
|
|
1141
1286
|
__metadata("design:returntype", Object)
|
|
1142
1287
|
], OperatorController.prototype, "decide", null);
|
|
1288
|
+
__decorate([
|
|
1289
|
+
Post('approvals/:id/plan'),
|
|
1290
|
+
__param(0, Param('id')),
|
|
1291
|
+
__param(1, Body()),
|
|
1292
|
+
__metadata("design:type", Function),
|
|
1293
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
1294
|
+
__metadata("design:returntype", Object)
|
|
1295
|
+
], OperatorController.prototype, "decidePlan", null);
|
|
1143
1296
|
__decorate([
|
|
1144
1297
|
Post('sessions/:id/mode'),
|
|
1145
1298
|
__param(0, Param('id')),
|