copilot-operator 0.1.50 → 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 (97) hide show
  1. package/README.md +587 -574
  2. package/dist/src/api/operator.controller.js +119 -1023
  3. package/dist/src/api/operator.service.js +346 -2553
  4. package/dist/src/config/schema.js +13 -0
  5. package/dist/src/orchestrator/hold.js +49 -0
  6. package/dist/src/orchestrator/leadRunner.js +559 -0
  7. package/dist/src/orchestrator/taskRunner.js +211 -39
  8. package/dist/src/plan/kerrigan.js +232 -0
  9. package/dist/src/plan/systemGuide.js +758 -3757
  10. package/dist/src/protocol/leadSchema.js +156 -0
  11. package/dist/src/protocol/parser.js +1 -1
  12. package/dist/src/session/chatNotice.js +191 -0
  13. package/dist/src/session/checkpoint.js +19 -0
  14. package/dist/src/session/compose.js +1 -1
  15. package/dist/src/session/store.js +17 -126
  16. package/dist/src/session/workspace.js +52 -5
  17. package/dist/src/transport/chatTransport.js +1 -1
  18. package/dist/src/transport/copilotTransport.js +135 -1
  19. package/dist/web/404.html +13 -16
  20. package/dist/web/_next/static/_1zhoDsMOPAH2xW702E5A/_buildManifest.js +1 -0
  21. package/dist/web/_next/static/chunks/134-ddd50a7fbb536ec8.js +1 -0
  22. package/dist/web/_next/static/chunks/163.dbd7d36584d0bb37.js +1 -0
  23. package/dist/web/_next/static/chunks/220.35531b39410e1a9f.js +1 -0
  24. package/dist/web/_next/static/chunks/548.71ac96c94136659b.js +1 -0
  25. package/dist/web/_next/static/chunks/584.6df695c5b86a75aa.js +1 -0
  26. package/dist/web/_next/static/chunks/67.9ed79e2fbfb56f26.js +1 -0
  27. package/dist/web/_next/static/chunks/714.1e2338736a70b9c7.js +1 -0
  28. package/dist/web/_next/static/chunks/747.d2c1249d736dc03b.js +1 -0
  29. package/dist/web/_next/static/chunks/77.a200abef0f5b4a7f.js +1 -0
  30. package/dist/web/_next/static/chunks/808-bc7d7eac6d823291.js +1 -0
  31. package/dist/web/_next/static/chunks/921-dc5538cd779c6432.js +1 -0
  32. package/dist/web/_next/static/chunks/app/defaults/page-edd7534ca9ecf366.js +1 -0
  33. package/dist/web/_next/static/chunks/app/layout-8f99a164d76897a0.js +1 -0
  34. package/dist/web/_next/static/chunks/app/page-4bed816eda370d0c.js +1 -0
  35. package/dist/web/_next/static/chunks/app/system/page-1cf9e75e76da59ed.js +1 -0
  36. package/dist/web/_next/static/chunks/webpack-77147e31d2125631.js +1 -0
  37. package/dist/web/_next/static/css/3bea264adc472bc8.css +1 -0
  38. package/dist/web/defaults.html +13 -16
  39. package/dist/web/defaults.txt +22 -23
  40. package/dist/web/index.html +13 -16
  41. package/dist/web/index.txt +22 -23
  42. package/dist/web/system.html +13 -16
  43. package/dist/web/system.txt +22 -23
  44. package/package.json +5 -23
  45. package/prompts/lead1.md +116 -0
  46. package/dist/src/api/saveToDesktop.js +0 -157
  47. package/dist/src/plan/brief.js +0 -2003
  48. package/dist/src/plan/changes.js +0 -217
  49. package/dist/src/plan/script.js +0 -1014
  50. package/dist/src/session/debugExport.js +0 -165
  51. package/dist/src/session/exportRecord.js +0 -277
  52. package/dist/src/session/metrics.js +0 -95
  53. package/dist/src/vcs/prepareFromRemote.js +0 -288
  54. package/dist/src/vcs/remoteAuth.js +0 -117
  55. package/dist/src/vcs/startChoice.js +0 -367
  56. package/dist/src/vcs/syncCommand.js +0 -97
  57. package/dist/web/_next/static/chunks/197-f7c33a0114fc3db3.js +0 -1
  58. package/dist/web/_next/static/chunks/499-751e0be9d4f86e2d.js +0 -1
  59. package/dist/web/_next/static/chunks/534-56c68930a1a3c10f.js +0 -1
  60. package/dist/web/_next/static/chunks/549-c32dd718a1809d4d.js +0 -1
  61. package/dist/web/_next/static/chunks/699-9d031f8c145a0465.js +0 -1
  62. package/dist/web/_next/static/chunks/867-0e5d0d5472bf185f.js +0 -1
  63. package/dist/web/_next/static/chunks/app/appearance/page-a18019cdc395de3d.js +0 -1
  64. package/dist/web/_next/static/chunks/app/defaults/page-614be29d185a2947.js +0 -1
  65. package/dist/web/_next/static/chunks/app/history/page-95bab4c1b1ff9339.js +0 -1
  66. package/dist/web/_next/static/chunks/app/import/page-8ef75fc08638e75f.js +0 -1
  67. package/dist/web/_next/static/chunks/app/layout-a1314921eeba8ad5.js +0 -1
  68. package/dist/web/_next/static/chunks/app/level1/page-dd3ebf37d29dce4f.js +0 -1
  69. package/dist/web/_next/static/chunks/app/page-4d8f0851fe672925.js +0 -1
  70. package/dist/web/_next/static/chunks/app/presets/page-93ab518db67e52a2.js +0 -1
  71. package/dist/web/_next/static/chunks/app/sessions/page-28376d2e4a9b4738.js +0 -1
  72. package/dist/web/_next/static/chunks/app/sessions/view/page-adb64f8ba3d8c06e.js +0 -1
  73. package/dist/web/_next/static/chunks/app/system/page-227a259e383ca2a0.js +0 -1
  74. package/dist/web/_next/static/chunks/webpack-0f31b926d9a9c5a4.js +0 -1
  75. package/dist/web/_next/static/css/4335e4ce269ba1ea.css +0 -1
  76. package/dist/web/_next/static/z74_FBfnnXW5IJCHTgTH2/_buildManifest.js +0 -1
  77. package/dist/web/appearance.html +0 -16
  78. package/dist/web/appearance.txt +0 -26
  79. package/dist/web/history.html +0 -16
  80. package/dist/web/history.txt +0 -26
  81. package/dist/web/import.html +0 -16
  82. package/dist/web/import.txt +0 -26
  83. package/dist/web/level1.html +0 -16
  84. package/dist/web/level1.txt +0 -26
  85. package/dist/web/presets.html +0 -19
  86. package/dist/web/presets.txt +0 -26
  87. package/dist/web/sessions/view.html +0 -16
  88. package/dist/web/sessions/view.txt +0 -26
  89. package/dist/web/sessions.html +0 -16
  90. package/dist/web/sessions.txt +0 -26
  91. package/prompts/organisation.bg.md +0 -43
  92. package/prompts/organisation.en.md +0 -43
  93. package/prompts/persona.bg.md +0 -17
  94. package/prompts/persona.en.md +0 -17
  95. package/prompts/work.bg.md +0 -19
  96. package/prompts/work.en.md +0 -19
  97. /package/dist/web/_next/static/{z74_FBfnnXW5IJCHTgTH2 → _1zhoDsMOPAH2xW702E5A}/_ssgManifest.js +0 -0
@@ -15,12 +15,15 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
15
15
  *
16
16
  * Bound to localhost only (see main.ts). There is no authentication because there is no
17
17
  * network: this API runs on the operator's own machine and drives that machine's browser.
18
+ *
19
+ * What is here is what the chat and its workbench use, with Settings and Kerrigan (2026-10-20: the sessions, the task
20
+ * register and the plan from JSON were removed, and their routes with them).
18
21
  */
19
- import { Body, Controller, Delete, Get, Inject, Param, Post, Put, Query, Res, Sse, NotFoundException, BadRequestException } from '@nestjs/common';
20
- import { Observable } from 'rxjs';
22
+ import { Body, Controller, Get, Inject, Param, Post, Put, Query, Res, NotFoundException, BadRequestException, ConflictException } from '@nestjs/common';
21
23
  import { OperatorService } from './operator.service.js';
22
24
  import { SettingsUnusableError } from './settings.js';
23
25
  import { PolicyLockUnusableError } from '../config/lockedPolicy.js';
26
+ import { CHANGED_ON_DISK } from '../session/workspace.js';
24
27
  function fail(e) {
25
28
  // A settings file or a policy lock that cannot be used is not the request's fault, and every route
26
29
  // that reads the settings meets it, wrapped here or not: it is passed on as it is, for the server
@@ -48,38 +51,6 @@ function failText(res, e) {
48
51
  * nothing about names. The fix is the standard pair: an ASCII fallback for anything old, and
49
52
  * `filename*` with the real name percent-encoded for every current browser.
50
53
  */
51
- /** The three kinds, checked here so a path cannot name a file of its own choosing. */
52
- function asContextKind(kind) {
53
- if (kind !== 'organisation' && kind !== 'persona' && kind !== 'work') {
54
- throw new BadRequestException('kind must be organisation, persona or work');
55
- }
56
- return kind;
57
- }
58
- /**
59
- * The start window's choices as the service takes them: one per session id, each of a known shape, and
60
- * nothing else. A choice of any other shape is dropped, which leaves that session on its settings.
61
- */
62
- function startsFrom(raw) {
63
- if (!raw || typeof raw !== 'object' || Array.isArray(raw))
64
- return undefined;
65
- const out = {};
66
- for (const [id, c] of Object.entries(raw)) {
67
- if (!c || typeof c !== 'object')
68
- continue;
69
- const x = c;
70
- const branch = typeof x.branch === 'string' ? x.branch : '';
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 } : {};
74
- if (x.from === 'previous-session')
75
- out[id] = { from: 'previous-session', ...rechoose };
76
- else if (x.from === 'local' && branch)
77
- out[id] = { from: 'local', branch, ...onBranch, ...rechoose };
78
- else if (x.from === 'remote' && branch && typeof x.remote === 'string' && x.remote)
79
- out[id] = { from: 'remote', remote: x.remote, branch, ...onBranch, ...rechoose };
80
- }
81
- return Object.keys(out).length > 0 ? out : undefined;
82
- }
83
54
  function contentDisposition(fileName) {
84
55
  const ascii = fileName.replace(/[^\x20-\x7e]/g, '_').replace(/["\\]/g, '_');
85
56
  return `attachment; filename="${ascii}"; filename*=UTF-8''${encodeURIComponent(fileName)}`;
@@ -112,160 +83,31 @@ let OperatorController = class OperatorController {
112
83
  return { ok: true };
113
84
  }
114
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. */
115
87
  level1() {
116
88
  return this.ops.getLevel1();
117
89
  }
118
- async setLevel1(body) {
119
- if (typeof body?.content !== 'string' || body.content.trim().length < 100) {
120
- throw new BadRequestException('Level 1 must be a real contract, not a few words.');
121
- }
122
- await this.ops.setLevel1(body.content);
123
- return { ok: true };
124
- }
125
- resetLevel1() {
126
- return this.ops.resetLevel1();
127
- }
128
- // --- level 2 presets --------------------------------------------------------------------
129
- presets() {
130
- return this.ops.listPresets();
131
- }
132
- savePreset(name, body) {
133
- return this.ops.savePreset(name, body?.content ?? '').catch(fail);
134
- }
135
- async deletePreset(name) {
136
- await this.ops.deletePreset(name).catch(fail);
137
- return { ok: true };
138
- }
139
- // --- named personas (the import page's second box, saved under a name) -----------------
140
- personas() {
141
- return this.ops.listPersonas();
142
- }
143
- savePersona(name, body) {
144
- return this.ops.savePersona(name, body?.content ?? '').catch(fail);
90
+ // --- Kerrigan -------------------------------------------------------------------------------
91
+ /** Kerrigan, the persona to give another chat: what copilot-operator is and how a task is best written for it. */
92
+ kerrigan(lang) {
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);
145
96
  }
146
- async deletePersona(name) {
147
- await this.ops.deletePersona(name).catch(fail);
148
- return { ok: true };
149
- }
150
- // --- sessions ---------------------------------------------------------------------------
97
+ // --- the chat's conversations (sessions of kind `chat`) -------------------------------------
151
98
  sessions() {
152
99
  return this.ops.listSessions();
153
100
  }
154
- /** The sessions list in the operator's order: every session id, top to bottom. */
155
- reorderSessions(body) {
156
- return this.ops.reorderSessions(body?.ids).catch(fail);
157
- }
158
- createSession(body) {
159
- return this.ops.createSession(body?.name ?? '', body?.projectDir).catch(fail);
160
- }
161
101
  async session(id) {
162
102
  const s = await this.ops.getSession(id);
163
103
  if (!s)
164
104
  throw new NotFoundException();
165
105
  return s;
166
106
  }
167
- /** Name, model, queue behaviour, files, version control and the independent review. */
107
+ /** The conversation's model, chosen in the chat (and the rest of a session's settings). */
168
108
  updateSession(id, body) {
169
109
  return this.ops.updateSession(id, body).catch(fail);
170
110
  }
171
- async deleteSession(id) {
172
- await this.ops.deleteSession(id).catch(fail);
173
- return { ok: true };
174
- }
175
- addTask(id, body) {
176
- return this.ops.addTask(id, { title: body?.title ?? '', level2: body?.level2 ?? '', prompt: body?.prompt ?? '' }).catch(fail);
177
- }
178
- updateTask(id, taskId, body) {
179
- return this.ops.updateTask(id, taskId, body).catch(fail);
180
- }
181
- async deleteTask(id, taskId) {
182
- await this.ops.deleteTask(id, taskId).catch(fail);
183
- return { ok: true };
184
- }
185
- /**
186
- * Puts a finished task back in the queue, keeping the earlier attempt on the record.
187
- *
188
- * A body with `title`, `prompt` or `level2` edits the task on the way: the attempt that
189
- * already ran keeps the text it ran with, and the next one uses the new text.
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
- }
201
- /** A task that stopped at the runner's limit carries on in its own conversation and branch. */
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);
206
- }
207
- rerunTask(id, taskId, body) {
208
- const { buildOnFinished, ...patch } = body ?? {};
209
- return this.ops.rerunTask(id, taskId, patch, { buildOnFinished: buildOnFinished === true }).catch(fail);
210
- }
211
- /** How the task contradicts itself, with the ways out of each contradiction. Changes nothing. */
212
- contractCheck(id, taskId) {
213
- return this.ops.contractCheck(id, taskId).catch(fail);
214
- }
215
- /** Applies one chosen fix per contradiction (-1 = none) and queues the task; starts nothing. */
216
- applyContractFix(id, taskId, body) {
217
- if (body?.expect !== undefined && (!Array.isArray(body.expect) || body.expect.some((x) => typeof x !== 'string')))
218
- throw new BadRequestException('expect must be a list of the contradictions shown');
219
- return this.ops.applyContractFix(id, taskId, body?.choices ?? [], body?.expect).catch(fail);
220
- }
221
- /** What going back to before this task would do. Changes nothing. */
222
- restorePreview(id, taskId) {
223
- return this.ops.restorePreview(id, taskId).catch(fail);
224
- }
225
- /** Does it: a new branch at the commit that task started from, checked out. */
226
- restore(id, taskId) {
227
- return this.ops.restore(id, taskId).catch(fail);
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
- }
242
- /** What starting the run again from this task would re-queue, and do to the code. */
243
- restartPlan(id, taskId) {
244
- return this.ops.restartPlan(id, taskId).catch(fail);
245
- }
246
- /** Restores the code, queues this task and everything after it, and starts the run again. */
247
- restartFrom(id, taskId, body) {
248
- return this.ops.restartFrom(id, taskId, body ?? {}).catch(fail);
249
- }
250
- async taskLog(id, taskId, res, run) {
251
- const text = await this.ops.taskLog(id, taskId, run);
252
- if (text === null) {
253
- res.status(404).send('no log yet');
254
- return;
255
- }
256
- res.type('text/plain; charset=utf-8').send(text);
257
- }
258
- /**
259
- * The same log, saved to the Desktop and shown in Explorer, which is what the operator
260
- * actually wants it for. The GET above stays as it is: it is where this falls back to when
261
- * the machine refuses to write the file, or when there is no Desktop to write it to.
262
- */
263
- async saveTaskLog(id, taskId, run) {
264
- const saved = await this.ops.saveTaskLog(id, taskId, run).catch(fail);
265
- if (!saved)
266
- throw new NotFoundException('This task has not produced a log yet.');
267
- return saved;
268
- }
269
111
  /** The attempt as a story: what was sent, answered, run and how it ended. `run` picks an earlier attempt. */
270
112
  async taskStory(id, taskId, run) {
271
113
  const story = await this.ops.taskStory(id, taskId, run);
@@ -286,102 +128,6 @@ let OperatorController = class OperatorController {
286
128
  throw new BadRequestException('path is required');
287
129
  return this.ops.taskChangeFile(id, taskId, path, run?.trim() || undefined).catch(fail);
288
130
  }
289
- taskFiles(id, taskId, run) {
290
- return this.ops.taskFiles(id, taskId, run);
291
- }
292
- async taskFile(id, taskId, kind, name, res, run) {
293
- if (!['reports', 'artifacts', 'replies'].includes(kind)) {
294
- res.status(400).send('bad kind');
295
- return;
296
- }
297
- const text = await this.ops.taskFile(id, taskId, kind, name, run);
298
- if (text === null) {
299
- res.status(404).send('not found');
300
- return;
301
- }
302
- res.type('text/plain; charset=utf-8').send(text);
303
- }
304
- /** A task's own file, saved to the Desktop and shown in Explorer, exactly as its log is. */
305
- async saveTaskFile(id, taskId, kind, name, run) {
306
- if (!['reports', 'artifacts', 'replies'].includes(kind))
307
- throw new BadRequestException('kind must be reports, artifacts or replies');
308
- const saved = await this.ops.saveTaskFile(id, taskId, kind, name, run).catch(fail);
309
- if (!saved)
310
- throw new NotFoundException('That file is not there.');
311
- return saved;
312
- }
313
- /**
314
- * Downloads the record of selected tasks.
315
- *
316
- * `tasks` is a comma-separated list of task ids, or absent for every task that has run.
317
- * `variant` is `full` for the whole conversation, or `outcome` for the first and the last
318
- * message only, which is the expected-and-actual pair.
319
- */
320
- async exportTasks(id, res, tasks, variant) {
321
- const ids = (tasks ?? '').split(',').map((x) => x.trim()).filter(Boolean);
322
- const kind = variant === 'full' ? 'full' : 'outcome';
323
- try {
324
- const { fileName, content } = await this.ops.exportTasks(id, ids, kind);
325
- res.type('text/plain; charset=utf-8');
326
- res.setHeader('content-disposition', contentDisposition(fileName));
327
- res.send(content);
328
- }
329
- catch (e) {
330
- failText(res, e);
331
- }
332
- }
333
- /**
334
- * Everything that happened across several sessions, as one JSON file.
335
- *
336
- * `sessions` is a comma-separated list of ids; leaving it out means the sessions of the last
337
- * batch. Meant for handing to somebody — or something — that has to work out why a run went
338
- * the way it did.
339
- */
340
- async debugExport(res, sessions) {
341
- const ids = (sessions ?? '').split(',').map((x) => x.trim()).filter(Boolean);
342
- try {
343
- const { fileName, content } = await this.ops.debugExport(ids);
344
- res.type('application/json; charset=utf-8');
345
- res.setHeader('content-disposition', contentDisposition(fileName));
346
- res.send(content);
347
- }
348
- catch (e) {
349
- failText(res, e);
350
- }
351
- }
352
- /**
353
- * All three views of a set of tasks the operator ticked, as one file.
354
- *
355
- * A POST rather than a GET, which makes it the odd one out among the exports and is the right
356
- * odd one out: the others name a run, a session or a task and fit in a query string, while this
357
- * names every task that was chosen, and a register with sixty finished tasks in it would put a
358
- * selection past what a URL can carry. The browser saves the body with a download link made
359
- * from a blob, so nothing about the operator's side of it changes.
360
- */
361
- async exportBundle(res, body) {
362
- const pairs = (body?.tasks ?? [])
363
- .map((x) => ({
364
- sessionId: (x?.sessionId ?? '').trim(),
365
- taskId: (x?.taskId ?? '').trim(),
366
- // One attempt of the task rather than the task as it is now; see `exportBundle`.
367
- ...(Number.isInteger(x?.attempt) ? { attempt: x.attempt } : {}),
368
- }))
369
- .filter((x) => x.sessionId && x.taskId);
370
- try {
371
- const { fileName, content } = await this.ops.exportBundle(pairs);
372
- res.type('application/json; charset=utf-8');
373
- res.setHeader('content-disposition', contentDisposition(fileName));
374
- res.send(content);
375
- }
376
- catch (e) {
377
- failText(res, e);
378
- }
379
- }
380
- /**
381
- * One of the three JSON views of a task, a session or a run: `plan` (what was asked, in the
382
- * format that imports again), `domain` (what happened to the work) or `bot` (what the runner
383
- * did). Exactly one of `run`, `session` or `session`+`task` names the scope.
384
- */
385
131
  /** One task's whole exchange with Copilot, as a JSON file (see `taskExchange.ts`). */
386
132
  async taskExchange(id, taskId, res) {
387
133
  try {
@@ -394,36 +140,12 @@ let OperatorController = class OperatorController {
394
140
  failText(res, e);
395
141
  }
396
142
  }
397
- async exportView(kind, res, run, session, task) {
398
- if (kind !== 'plan' && kind !== 'domain' && kind !== 'bot') {
399
- res.status(400).send('kind must be plan, domain or bot');
400
- return;
401
- }
402
- try {
403
- const { fileName, content } = await this.ops.exportView(kind, { runId: run?.trim() || undefined, sessionId: session?.trim() || undefined, taskId: task?.trim() || undefined });
404
- res.type('application/json; charset=utf-8');
405
- res.setHeader('content-disposition', contentDisposition(fileName));
406
- res.send(content);
407
- }
408
- catch (e) {
409
- failText(res, e);
410
- }
143
+ events(id) {
144
+ return this.ops.recentEvents(id);
411
145
  }
412
146
  // --- run control ------------------------------------------------------------------------
413
147
  start(id, body) {
414
- return this.ops.start(id, body?.mode === 'unattended' ? 'unattended' : 'confirm', body?.name, startsFrom(body?.starts));
415
- }
416
- /**
417
- * The start window's question: where each of these sessions starts, and the branches of their
418
- * repositories as they are here (nothing fetched). See `vcs/startChoice.ts`.
419
- */
420
- startOptions(sessions) {
421
- return this.ops.startChoices((sessions ?? '').split(',').map((x) => x.trim()).filter(Boolean)).catch(fail);
422
- }
423
- /** Fetches branches of a remote for the start window — through Git's password window when it asks. */
424
- startFetch(body) {
425
- const branches = Array.isArray(body?.branches) ? body.branches.filter((b) => typeof b === 'string') : null;
426
- return this.ops.startFetch(body?.dir ?? '', body?.remote ?? '', branches).catch(fail);
148
+ return this.ops.start(id, body?.mode === 'unattended' ? 'unattended' : 'confirm');
427
149
  }
428
150
  /** Starts that did not get as far as a first task, newest first; `unanswered=1` only those no press was answered with. */
429
151
  startFailures(unanswered) {
@@ -456,87 +178,21 @@ let OperatorController = class OperatorController {
456
178
  stop(id) {
457
179
  return this.ops.stop(id);
458
180
  }
459
- // --- running several sessions in turn ------------------------------------------------------
460
- /** The batch in progress, or the last one that ran. Null when none ever has. */
461
- batch() {
462
- return this.ops.batchState();
463
- }
464
- /**
465
- * Runs the queued tasks of several sessions, one after another, in the order given.
466
- *
467
- * `onFailure` is about the sessions, not the tasks inside them: `stop` gives up on the rest
468
- * once a session fails, `continue` works through all of them.
469
- */
470
- /**
471
- * What this run would be called if nobody typed anything, so the page can show it first.
472
- *
473
- * The same answer `startBatch` would reach on its own, asked before the fact rather than after,
474
- * because a name the operator can see and correct is worth more than a name that appears in the
475
- * register once it is too late to argue with.
476
- */
477
- suggestRunName(sessions) {
478
- const ids = (sessions ?? '').split(',').map((x) => x.trim()).filter(Boolean);
479
- return this.ops.suggestRunName(ids).then((name) => ({ name }));
480
- }
481
- startBatch(body) {
482
- if (!Array.isArray(body?.sessionIds))
483
- throw new BadRequestException('sessionIds must be a list of session ids');
484
- if (body?.taskIds !== undefined && !Array.isArray(body.taskIds))
485
- throw new BadRequestException('taskIds must be a list of task ids');
486
- return this.ops
487
- .startBatch(body.sessionIds, body?.mode === 'unattended' ? 'unattended' : 'confirm', body?.onFailure === 'continue' ? 'continue' : 'stop',
488
- // Absent or empty means every session keeps the model it already has, which is not the
489
- // same as "no model": an empty string on a session means "leave the chat alone".
490
- body?.model,
491
- // The same for the review: absent means each session keeps whatever it is set to.
492
- body?.reviewModel, body?.name, body?.taskIds, startsFrom(body?.starts))
493
- .catch(fail);
494
- }
495
- stopBatch() {
496
- return this.ops.stopBatch();
497
- }
498
- /**
499
- * Holds the run after the task that is running finishes, rather than after its current step.
500
- *
501
- * The pair of them are one switch from the page's point of view, so they are one route each
502
- * rather than one route with a flag: a request that says what it wants cannot be misread.
503
- */
504
- pauseBatch() {
505
- return this.ops.pauseBatch();
506
- }
507
- resumeBatch() {
508
- return this.ops.resumeBatch();
509
- }
510
- // --- plans ---------------------------------------------------------------------------------
511
- /**
512
- * The text the operator pastes into a chat model to have a plan written.
513
- *
514
- * One text per language and nothing else to choose. It used to be assembled from answers
515
- * given on the import page — version control on or off, which folder — and those are now
516
- * questions the brief tells the model to ask, because the model is the one in the
517
- * conversation and the answers belong to a session rather than to the whole document.
518
- */
519
- async planBrief(lang) {
520
- return await this.ops.planBrief({ lang: lang ?? 'en' });
521
- }
522
- // --- the operator's own two texts for the plan persona -------------------------------
523
- /**
524
- * `organisation` is how the company works and where the projects are, which changes rarely;
525
- * `work` is what this group of tasks is about, which changes whenever the work does.
526
- */
527
- context(kind, lang) {
528
- return this.ops.getContext(asContextKind(kind), lang ?? 'en');
529
- }
530
- async setContext(kind, body) {
531
- if (typeof body?.content !== 'string')
532
- throw new BadRequestException('content must be text');
533
- await this.ops.setContext(asContextKind(kind), body.content);
534
- return { ok: true };
181
+ /** "Pause": the running work holds at its next message or command. */
182
+ pause(id) {
183
+ try {
184
+ return this.ops.pause(id);
185
+ }
186
+ catch (e) {
187
+ throw new BadRequestException(e.message);
188
+ }
535
189
  }
536
- resetContext(kind, lang) {
537
- return this.ops.resetContext(asContextKind(kind), lang ?? 'en');
190
+ /** "Continue": the paused work goes on. */
191
+ resume(id) {
192
+ return this.ops.resume(id);
538
193
  }
539
- /** The project folder the workbench has open, its files on disk, and one of them. Read-only. */
194
+ // --- the workspace and its chat ---------------------------------------------------------------
195
+ /** The project folder the workbench has open, its files on disk, and one of them. */
540
196
  workspace() {
541
197
  return this.ops.workspace().catch(fail);
542
198
  }
@@ -548,6 +204,24 @@ let OperatorController = class OperatorController {
548
204
  throw new BadRequestException('path is required');
549
205
  return this.ops.workspaceFile(path).catch(fail);
550
206
  }
207
+ /**
208
+ * The editor saving a file of the open folder. `base` is the version it was opened at; a file changed on disk since
209
+ * is refused with 409, so the page can offer to read it again or to save over it (by sending no `base`).
210
+ */
211
+ async saveWorkspaceFile(body = {}) {
212
+ if (typeof body?.path !== 'string' || !body.path)
213
+ throw new BadRequestException('path is required');
214
+ if (typeof body.text !== 'string')
215
+ throw new BadRequestException('text is required');
216
+ try {
217
+ return await this.ops.saveWorkspaceFile(body.path, body.text, typeof body.base === 'string' && body.base ? body.base : undefined);
218
+ }
219
+ catch (e) {
220
+ if (e.code === CHANGED_ON_DISK)
221
+ throw new ConflictException(e.message);
222
+ fail(e);
223
+ }
224
+ }
551
225
  /** The open folder's git: the changes, staged and not, and the branch's commits. Read-only. */
552
226
  workspaceGit() {
553
227
  return this.ops.workspaceGit().catch(fail);
@@ -581,6 +255,14 @@ let OperatorController = class OperatorController {
581
255
  ...(typeof body.threadId === 'string' && body.threadId ? { threadId: body.threadId } : {}),
582
256
  ...(typeof body.model === 'string' && body.model.trim() ? { model: body.model } : {}),
583
257
  ...(body.manualModel === true ? { manualModel: true } : {}),
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 } : {}),
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 } : {}),
584
266
  })
585
267
  .catch(fail);
586
268
  }
@@ -593,63 +275,6 @@ let OperatorController = class OperatorController {
593
275
  throw new BadRequestException(r.problem);
594
276
  return r;
595
277
  }
596
- /** One folder of the session's repository at its branch (or the task's commit): read-only, for the workbench. */
597
- repoTree(id, path, task) {
598
- return this.ops.repoTree(id, path ?? '', task?.trim() || undefined).catch(fail);
599
- }
600
- /** One file of it, as text. */
601
- repoFile(id, path, task) {
602
- if (!path)
603
- throw new BadRequestException('path is required');
604
- return this.ops.repoFile(id, path, task?.trim() || undefined).catch(fail);
605
- }
606
- /** The commits on the session's line, each with the task that made it. */
607
- repoLog(id) {
608
- return this.ops.repoLog(id).catch(fail);
609
- }
610
- /** What happened in these sessions, for Kerrigan, with the operator's note and the form of her answer. */
611
- kerriganReport(body = {}) {
612
- const ids = (v) => (Array.isArray(v) ? v.filter((x) => typeof x === 'string') : []);
613
- return this.ops.kerriganReport({ sessionIds: ids(body?.sessionIds), taskIds: ids(body?.taskIds), note: typeof body?.note === 'string' ? body.note : undefined }).catch(fail);
614
- }
615
- /** Kerrigan's changes to existing work, read against it as it is now; nothing is changed. */
616
- checkChanges(body = {}) {
617
- return this.ops.checkChanges(typeof body?.text === 'string' ? body.text : '').catch(fail);
618
- }
619
- /** Applies them one by one, stopping at the first refused; nothing is started. */
620
- applyChanges(body = {}) {
621
- return this.ops.applyChanges(typeof body?.text === 'string' ? body.text : '').catch(fail);
622
- }
623
- /** Checks a pasted plan without importing anything, and says what it would duplicate. */
624
- checkPlan(body) {
625
- return this.ops.checkPlan(body?.text ?? '').catch(fail);
626
- }
627
- /**
628
- * Creates the sessions and tasks a plan describes, and starts nothing.
629
- *
630
- * A plan that does not validate comes back as 200 with `ok: false` rather than as an error,
631
- * because the list of what is wrong is the useful part of that answer and the UI shows it
632
- * to the operator to hand back to the chat.
633
- */
634
- importPlan(body) {
635
- return this.ops.importPlan(body?.text ?? '').catch(fail);
636
- }
637
- events(id) {
638
- return this.ops.recentEvents(id);
639
- }
640
- /** Live events as server-sent events. The browser's EventSource reconnects on its own. */
641
- stream(id) {
642
- return new Observable((subscriber) => {
643
- for (const e of this.ops.recentEvents(id))
644
- subscriber.next({ data: JSON.stringify(e) });
645
- const off = this.ops.subscribe(id, (e) => subscriber.next({ data: JSON.stringify(e) }));
646
- const keepAlive = setInterval(() => subscriber.next({ data: JSON.stringify({ type: 'ping', at: new Date().toISOString() }) }), 25_000);
647
- return () => {
648
- off();
649
- clearInterval(keepAlive);
650
- };
651
- });
652
- }
653
278
  // --- approvals --------------------------------------------------------------------------
654
279
  approvals(session) {
655
280
  return this.ops.pendingApprovals(session);
@@ -660,6 +285,13 @@ let OperatorController = class OperatorController {
660
285
  }
661
286
  return this.ops.decide(id, body.action);
662
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
+ }
663
295
  /** A plan waiting for approval (plan mode): approve it, with a note or not; ask for another; or stop the task. */
664
296
  decidePlan(id, body) {
665
297
  if (!['approve', 'revise', 'stop'].includes(body?.action ?? ''))
@@ -669,13 +301,6 @@ let OperatorController = class OperatorController {
669
301
  throw new BadRequestException(result.problem);
670
302
  return result;
671
303
  }
672
- /** Turns asking on or off in the middle of a run. */
673
- setMode(id, body) {
674
- if (body?.mode !== 'confirm' && body?.mode !== 'unattended') {
675
- throw new BadRequestException('mode must be confirm or unattended');
676
- }
677
- return this.ops.setRunMode(id, body.mode);
678
- }
679
304
  /**
680
305
  * Is anything running? Answered from memory, so it is safe to ask from every page.
681
306
  */
@@ -683,87 +308,42 @@ let OperatorController = class OperatorController {
683
308
  return this.ops.activity();
684
309
  }
685
310
  // --- the project being worked on -----------------------------------------------------------
686
- /** The folder new sessions start pointed at, and whether it can carry version control. */
311
+ /** The folder the chat works in. */
687
312
  project() {
688
313
  return this.ops.project();
689
314
  }
690
315
  /** Stores it. A field left out is kept; an empty `rootDir` clears the default. */
691
316
  setProject(body) {
692
- return this.ops.setProject({ rootDir: body?.rootDir, name: body?.name, others: body?.others }).catch(fail);
693
- }
694
- /**
695
- * Whether a folder can be used for version control at all, asked before the choice is made.
696
- *
697
- * Separate from the session's own preflight because that one only speaks when version
698
- * control is already on, and the question here is whether it may be turned on.
699
- */
700
- /** The command that brings a project's branch back to its remote's main — shown, never run. */
701
- repoSync(dir) {
702
- return this.ops.syncPlan(dir ?? '').catch(fail);
703
- }
704
- /** "Prepare the folder from the remote main branch": what it would do (fetches, changes nothing else). */
705
- repoPreparePreview(body) {
706
- return this.ops.preparePreview(body?.dir ?? '', body?.fetch !== false).catch(fail);
707
- }
708
- /** …and doing it, if the folder is still what the preview showed. */
709
- repoPrepare(body) {
710
- return this.ops.prepareProject(body?.dir ?? '', body?.fingerprint ?? '', { savedBranch: body?.savedBranch, savedMainBranch: body?.savedMainBranch }).catch(fail);
711
- }
712
- repo(dir) {
713
- const problem = this.ops.repoProblem(dir ?? '');
714
- return problem ? { ok: false, problem } : { ok: true };
715
- }
716
- /** Can version control do its job in this session right now? */
717
- vcsStatus(id) {
718
- return this.ops.vcsStatus(id).catch(fail);
719
- }
720
- /** "Prepare version control for this run": one group per repository of the sessions given. */
721
- runVcs(ids, tasks) {
722
- const only = (tasks ?? '').split(',').map((t) => t.trim()).filter(Boolean);
723
- return this.ops.runVcs((ids ?? '').split(',').map((s) => s.trim()).filter(Boolean), only.length > 0 ? new Set(only) : undefined).catch(fail);
724
- }
725
- /** One action of that panel, for one repository. */
726
- runVcsPrepare(body) {
727
- const actions = ['review-inputs', 'snapshot-on-base', 'snapshot-here', 'use-current-branch', 'allow-snapshot'];
728
- if (!actions.includes(body?.action ?? ''))
729
- return Promise.resolve({ ok: false, problem: 'unknown action' });
730
- return this.ops.runVcsPrepare(body?.sessionIds ?? [], body?.repoDir ?? '', body.action, body?.choices ?? {}).catch(fail);
731
- }
732
- /** The operator's approval of the starting snapshot: one choice per file of the list they saw. */
733
- vcsSnapshot(id, body) {
734
- return this.ops.vcsSnapshot(id, body?.choices ?? {}).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);
735
322
  }
736
323
  // --- the model picker ---------------------------------------------------------------------
737
324
  /** The cached list. Returns null when the picker has never been read on this machine. */
738
325
  models() {
739
326
  return this.ops.models();
740
327
  }
741
- /**
742
- * Re-reads the picker from the live chat. Slow on purpose: it opens the browser with the
743
- * bot profile, so it cannot run while a session is running.
744
- */
745
328
  /** "Sign in" from Settings: opens the bot's Edge and waits for the operator to sign in. See `OperatorService.login`. */
746
329
  login(body) {
747
330
  return this.ops.login(body?.account).catch(fail);
748
331
  }
332
+ /**
333
+ * Re-reads the picker from the live chat. Slow on purpose: it opens the browser with the
334
+ * bot profile, so it cannot run while a session is running.
335
+ */
749
336
  refreshModels() {
750
337
  return this.ops.refreshModels().catch(fail);
751
338
  }
752
- /** The model new sessions start on. An empty name means "leave the chat alone". */
339
+ /** The model a new conversation starts on. An empty name means "leave the chat alone". */
753
340
  setDefaultModel(body) {
754
341
  return this.ops.setDefaultModel(body?.model ?? '').catch(fail);
755
342
  }
756
- /** The model a new session's independent review runs on. An empty name means "the session's own". */
343
+ /** The model of the independent review. An empty name means "the session's own". */
757
344
  setDefaultReviewModel(body) {
758
345
  return this.ops.setDefaultReviewModel(body?.model ?? '').catch(fail);
759
346
  }
760
- // --- the registry of every task -----------------------------------------------------------
761
- tasks() {
762
- return this.ops.taskRegistry();
763
- }
764
- metrics() {
765
- return this.ops.metrics();
766
- }
767
347
  // --- helpers for the UI -----------------------------------------------------------------
768
348
  /**
769
349
  * Opens the machine's own folder dialog. A POST because it has a visible effect: a window
@@ -805,80 +385,18 @@ __decorate([
805
385
  __metadata("design:returntype", Promise)
806
386
  ], OperatorController.prototype, "level1", null);
807
387
  __decorate([
808
- Put('level1'),
809
- __param(0, Body()),
810
- __metadata("design:type", Function),
811
- __metadata("design:paramtypes", [Object]),
812
- __metadata("design:returntype", Promise)
813
- ], OperatorController.prototype, "setLevel1", null);
814
- __decorate([
815
- Delete('level1'),
816
- __metadata("design:type", Function),
817
- __metadata("design:paramtypes", []),
818
- __metadata("design:returntype", Promise)
819
- ], OperatorController.prototype, "resetLevel1", null);
820
- __decorate([
821
- Get('presets'),
822
- __metadata("design:type", Function),
823
- __metadata("design:paramtypes", []),
824
- __metadata("design:returntype", Promise)
825
- ], OperatorController.prototype, "presets", null);
826
- __decorate([
827
- Put('presets/:name'),
828
- __param(0, Param('name')),
829
- __param(1, Body()),
830
- __metadata("design:type", Function),
831
- __metadata("design:paramtypes", [String, Object]),
832
- __metadata("design:returntype", Promise)
833
- ], OperatorController.prototype, "savePreset", null);
834
- __decorate([
835
- Delete('presets/:name'),
836
- __param(0, Param('name')),
837
- __metadata("design:type", Function),
838
- __metadata("design:paramtypes", [String]),
839
- __metadata("design:returntype", Promise)
840
- ], OperatorController.prototype, "deletePreset", null);
841
- __decorate([
842
- Get('personas'),
843
- __metadata("design:type", Function),
844
- __metadata("design:paramtypes", []),
845
- __metadata("design:returntype", Promise)
846
- ], OperatorController.prototype, "personas", null);
847
- __decorate([
848
- Put('personas/:name'),
849
- __param(0, Param('name')),
850
- __param(1, Body()),
851
- __metadata("design:type", Function),
852
- __metadata("design:paramtypes", [String, Object]),
853
- __metadata("design:returntype", Promise)
854
- ], OperatorController.prototype, "savePersona", null);
855
- __decorate([
856
- Delete('personas/:name'),
857
- __param(0, Param('name')),
388
+ Get('kerrigan'),
389
+ __param(0, Query('lang')),
858
390
  __metadata("design:type", Function),
859
391
  __metadata("design:paramtypes", [String]),
860
392
  __metadata("design:returntype", Promise)
861
- ], OperatorController.prototype, "deletePersona", null);
393
+ ], OperatorController.prototype, "kerrigan", null);
862
394
  __decorate([
863
395
  Get('sessions'),
864
396
  __metadata("design:type", Function),
865
397
  __metadata("design:paramtypes", []),
866
398
  __metadata("design:returntype", Promise)
867
399
  ], OperatorController.prototype, "sessions", null);
868
- __decorate([
869
- Put('sessions-order'),
870
- __param(0, Body()),
871
- __metadata("design:type", Function),
872
- __metadata("design:paramtypes", [Object]),
873
- __metadata("design:returntype", Promise)
874
- ], OperatorController.prototype, "reorderSessions", null);
875
- __decorate([
876
- Post('sessions'),
877
- __param(0, Body()),
878
- __metadata("design:type", Function),
879
- __metadata("design:paramtypes", [Object]),
880
- __metadata("design:returntype", Promise)
881
- ], OperatorController.prototype, "createSession", null);
882
400
  __decorate([
883
401
  Get('sessions/:id'),
884
402
  __param(0, Param('id')),
@@ -895,287 +413,57 @@ __decorate([
895
413
  __metadata("design:returntype", Promise)
896
414
  ], OperatorController.prototype, "updateSession", null);
897
415
  __decorate([
898
- Delete('sessions/:id'),
899
- __param(0, Param('id')),
900
- __metadata("design:type", Function),
901
- __metadata("design:paramtypes", [String]),
902
- __metadata("design:returntype", Promise)
903
- ], OperatorController.prototype, "deleteSession", null);
904
- __decorate([
905
- Post('sessions/:id/tasks'),
416
+ Get('sessions/:id/tasks/:taskId/story'),
906
417
  __param(0, Param('id')),
907
- __param(1, Body()),
418
+ __param(1, Param('taskId')),
419
+ __param(2, Query('run')),
908
420
  __metadata("design:type", Function),
909
- __metadata("design:paramtypes", [String, Object]),
421
+ __metadata("design:paramtypes", [String, String, String]),
910
422
  __metadata("design:returntype", Promise)
911
- ], OperatorController.prototype, "addTask", null);
423
+ ], OperatorController.prototype, "taskStory", null);
912
424
  __decorate([
913
- Put('sessions/:id/tasks/:taskId'),
425
+ Get('sessions/:id/tasks/:taskId/changes'),
914
426
  __param(0, Param('id')),
915
427
  __param(1, Param('taskId')),
916
- __param(2, Body()),
428
+ __param(2, Query('run')),
917
429
  __metadata("design:type", Function),
918
- __metadata("design:paramtypes", [String, String, Object]),
430
+ __metadata("design:paramtypes", [String, String, String]),
919
431
  __metadata("design:returntype", Promise)
920
- ], OperatorController.prototype, "updateTask", null);
432
+ ], OperatorController.prototype, "taskChanges", null);
921
433
  __decorate([
922
- Delete('sessions/:id/tasks/:taskId'),
434
+ Get('sessions/:id/tasks/:taskId/changes/file'),
923
435
  __param(0, Param('id')),
924
436
  __param(1, Param('taskId')),
437
+ __param(2, Query('path')),
438
+ __param(3, Query('run')),
925
439
  __metadata("design:type", Function),
926
- __metadata("design:paramtypes", [String, String]),
440
+ __metadata("design:paramtypes", [String, String, String, String]),
927
441
  __metadata("design:returntype", Promise)
928
- ], OperatorController.prototype, "deleteTask", null);
442
+ ], OperatorController.prototype, "taskChangeFile", null);
929
443
  __decorate([
930
- Post('sessions/:id/tasks/:taskId/notes'),
444
+ Get('sessions/:id/tasks/:taskId/exchange'),
931
445
  __param(0, Param('id')),
932
446
  __param(1, Param('taskId')),
933
- __param(2, Body()),
447
+ __param(2, Res()),
934
448
  __metadata("design:type", Function),
935
449
  __metadata("design:paramtypes", [String, String, Object]),
936
450
  __metadata("design:returntype", Promise)
937
- ], OperatorController.prototype, "addTaskNote", null);
451
+ ], OperatorController.prototype, "taskExchange", null);
938
452
  __decorate([
939
- Post('sessions/:id/tasks/:taskId/accept'),
453
+ Get('sessions/:id/events'),
940
454
  __param(0, Param('id')),
941
- __param(1, Param('taskId')),
942
- __param(2, Body()),
943
455
  __metadata("design:type", Function),
944
- __metadata("design:paramtypes", [String, String, Object]),
945
- __metadata("design:returntype", Promise)
946
- ], OperatorController.prototype, "acceptTask", null);
456
+ __metadata("design:paramtypes", [String]),
457
+ __metadata("design:returntype", Object)
458
+ ], OperatorController.prototype, "events", null);
947
459
  __decorate([
948
- Post('sessions/:id/tasks/:taskId/continue'),
949
- __param(0, Param('id')),
950
- __param(1, Param('taskId')),
951
- __param(2, Body()),
952
- __metadata("design:type", Function),
953
- __metadata("design:paramtypes", [String, String, Object]),
954
- __metadata("design:returntype", Promise)
955
- ], OperatorController.prototype, "continueTask", null);
956
- __decorate([
957
- Post('sessions/:id/tasks/:taskId/rerun'),
958
- __param(0, Param('id')),
959
- __param(1, Param('taskId')),
960
- __param(2, Body()),
961
- __metadata("design:type", Function),
962
- __metadata("design:paramtypes", [String, String, Object]),
963
- __metadata("design:returntype", Promise)
964
- ], OperatorController.prototype, "rerunTask", null);
965
- __decorate([
966
- Get('sessions/:id/tasks/:taskId/contract'),
967
- __param(0, Param('id')),
968
- __param(1, Param('taskId')),
969
- __metadata("design:type", Function),
970
- __metadata("design:paramtypes", [String, String]),
971
- __metadata("design:returntype", Promise)
972
- ], OperatorController.prototype, "contractCheck", null);
973
- __decorate([
974
- Post('sessions/:id/tasks/:taskId/contract-fix'),
975
- __param(0, Param('id')),
976
- __param(1, Param('taskId')),
977
- __param(2, Body()),
978
- __metadata("design:type", Function),
979
- __metadata("design:paramtypes", [String, String, Object]),
980
- __metadata("design:returntype", Promise)
981
- ], OperatorController.prototype, "applyContractFix", null);
982
- __decorate([
983
- Get('sessions/:id/tasks/:taskId/restore'),
984
- __param(0, Param('id')),
985
- __param(1, Param('taskId')),
986
- __metadata("design:type", Function),
987
- __metadata("design:paramtypes", [String, String]),
988
- __metadata("design:returntype", Promise)
989
- ], OperatorController.prototype, "restorePreview", null);
990
- __decorate([
991
- Post('sessions/:id/tasks/:taskId/restore'),
992
- __param(0, Param('id')),
993
- __param(1, Param('taskId')),
994
- __metadata("design:type", Function),
995
- __metadata("design:paramtypes", [String, String]),
996
- __metadata("design:returntype", Promise)
997
- ], OperatorController.prototype, "restore", null);
998
- __decorate([
999
- Get('sessions/:id/tasks/:taskId/undo'),
1000
- __param(0, Param('id')),
1001
- __param(1, Param('taskId')),
1002
- __metadata("design:type", Function),
1003
- __metadata("design:paramtypes", [String, String]),
1004
- __metadata("design:returntype", Promise)
1005
- ], OperatorController.prototype, "undoPreview", null);
1006
- __decorate([
1007
- Post('sessions/:id/tasks/:taskId/undo'),
1008
- __param(0, Param('id')),
1009
- __param(1, Param('taskId')),
1010
- __param(2, Body()),
1011
- __metadata("design:type", Function),
1012
- __metadata("design:paramtypes", [String, String, Object]),
1013
- __metadata("design:returntype", Promise)
1014
- ], OperatorController.prototype, "undoTask", null);
1015
- __decorate([
1016
- Get('sessions/:id/tasks/:taskId/restart'),
1017
- __param(0, Param('id')),
1018
- __param(1, Param('taskId')),
1019
- __metadata("design:type", Function),
1020
- __metadata("design:paramtypes", [String, String]),
1021
- __metadata("design:returntype", Promise)
1022
- ], OperatorController.prototype, "restartPlan", null);
1023
- __decorate([
1024
- Post('sessions/:id/tasks/:taskId/restart'),
1025
- __param(0, Param('id')),
1026
- __param(1, Param('taskId')),
1027
- __param(2, Body()),
1028
- __metadata("design:type", Function),
1029
- __metadata("design:paramtypes", [String, String, Object]),
1030
- __metadata("design:returntype", Promise)
1031
- ], OperatorController.prototype, "restartFrom", null);
1032
- __decorate([
1033
- Get('sessions/:id/tasks/:taskId/log'),
1034
- __param(0, Param('id')),
1035
- __param(1, Param('taskId')),
1036
- __param(2, Res()),
1037
- __param(3, Query('run')),
1038
- __metadata("design:type", Function),
1039
- __metadata("design:paramtypes", [String, String, Object, String]),
1040
- __metadata("design:returntype", Promise)
1041
- ], OperatorController.prototype, "taskLog", null);
1042
- __decorate([
1043
- Post('sessions/:id/tasks/:taskId/log'),
1044
- __param(0, Param('id')),
1045
- __param(1, Param('taskId')),
1046
- __param(2, Query('run')),
1047
- __metadata("design:type", Function),
1048
- __metadata("design:paramtypes", [String, String, String]),
1049
- __metadata("design:returntype", Promise)
1050
- ], OperatorController.prototype, "saveTaskLog", null);
1051
- __decorate([
1052
- Get('sessions/:id/tasks/:taskId/story'),
1053
- __param(0, Param('id')),
1054
- __param(1, Param('taskId')),
1055
- __param(2, Query('run')),
1056
- __metadata("design:type", Function),
1057
- __metadata("design:paramtypes", [String, String, String]),
1058
- __metadata("design:returntype", Promise)
1059
- ], OperatorController.prototype, "taskStory", null);
1060
- __decorate([
1061
- Get('sessions/:id/tasks/:taskId/changes'),
1062
- __param(0, Param('id')),
1063
- __param(1, Param('taskId')),
1064
- __param(2, Query('run')),
1065
- __metadata("design:type", Function),
1066
- __metadata("design:paramtypes", [String, String, String]),
1067
- __metadata("design:returntype", Promise)
1068
- ], OperatorController.prototype, "taskChanges", null);
1069
- __decorate([
1070
- Get('sessions/:id/tasks/:taskId/changes/file'),
1071
- __param(0, Param('id')),
1072
- __param(1, Param('taskId')),
1073
- __param(2, Query('path')),
1074
- __param(3, Query('run')),
1075
- __metadata("design:type", Function),
1076
- __metadata("design:paramtypes", [String, String, String, String]),
1077
- __metadata("design:returntype", Promise)
1078
- ], OperatorController.prototype, "taskChangeFile", null);
1079
- __decorate([
1080
- Get('sessions/:id/tasks/:taskId/files'),
1081
- __param(0, Param('id')),
1082
- __param(1, Param('taskId')),
1083
- __param(2, Query('run')),
1084
- __metadata("design:type", Function),
1085
- __metadata("design:paramtypes", [String, String, String]),
1086
- __metadata("design:returntype", Promise)
1087
- ], OperatorController.prototype, "taskFiles", null);
1088
- __decorate([
1089
- Get('sessions/:id/tasks/:taskId/files/:kind/:name'),
1090
- __param(0, Param('id')),
1091
- __param(1, Param('taskId')),
1092
- __param(2, Param('kind')),
1093
- __param(3, Param('name')),
1094
- __param(4, Res()),
1095
- __param(5, Query('run')),
1096
- __metadata("design:type", Function),
1097
- __metadata("design:paramtypes", [String, String, String, String, Object, String]),
1098
- __metadata("design:returntype", Promise)
1099
- ], OperatorController.prototype, "taskFile", null);
1100
- __decorate([
1101
- Post('sessions/:id/tasks/:taskId/files/:kind/:name'),
1102
- __param(0, Param('id')),
1103
- __param(1, Param('taskId')),
1104
- __param(2, Param('kind')),
1105
- __param(3, Param('name')),
1106
- __param(4, Query('run')),
1107
- __metadata("design:type", Function),
1108
- __metadata("design:paramtypes", [String, String, String, String, String]),
1109
- __metadata("design:returntype", Promise)
1110
- ], OperatorController.prototype, "saveTaskFile", null);
1111
- __decorate([
1112
- Get('sessions/:id/export'),
1113
- __param(0, Param('id')),
1114
- __param(1, Res()),
1115
- __param(2, Query('tasks')),
1116
- __param(3, Query('variant')),
1117
- __metadata("design:type", Function),
1118
- __metadata("design:paramtypes", [String, Object, String, String]),
1119
- __metadata("design:returntype", Promise)
1120
- ], OperatorController.prototype, "exportTasks", null);
1121
- __decorate([
1122
- Get('debug/export'),
1123
- __param(0, Res()),
1124
- __param(1, Query('sessions')),
1125
- __metadata("design:type", Function),
1126
- __metadata("design:paramtypes", [Object, String]),
1127
- __metadata("design:returntype", Promise)
1128
- ], OperatorController.prototype, "debugExport", null);
1129
- __decorate([
1130
- Post('export/bundle'),
1131
- __param(0, Res()),
1132
- __param(1, Body()),
1133
- __metadata("design:type", Function),
1134
- __metadata("design:paramtypes", [Object, Object]),
1135
- __metadata("design:returntype", Promise)
1136
- ], OperatorController.prototype, "exportBundle", null);
1137
- __decorate([
1138
- Get('sessions/:id/tasks/:taskId/exchange'),
1139
- __param(0, Param('id')),
1140
- __param(1, Param('taskId')),
1141
- __param(2, Res()),
1142
- __metadata("design:type", Function),
1143
- __metadata("design:paramtypes", [String, String, Object]),
1144
- __metadata("design:returntype", Promise)
1145
- ], OperatorController.prototype, "taskExchange", null);
1146
- __decorate([
1147
- Get('export/:kind'),
1148
- __param(0, Param('kind')),
1149
- __param(1, Res()),
1150
- __param(2, Query('run')),
1151
- __param(3, Query('session')),
1152
- __param(4, Query('task')),
1153
- __metadata("design:type", Function),
1154
- __metadata("design:paramtypes", [String, Object, String, String, String]),
1155
- __metadata("design:returntype", Promise)
1156
- ], OperatorController.prototype, "exportView", null);
1157
- __decorate([
1158
- Post('sessions/:id/start'),
460
+ Post('sessions/:id/start'),
1159
461
  __param(0, Param('id')),
1160
462
  __param(1, Body()),
1161
463
  __metadata("design:type", Function),
1162
464
  __metadata("design:paramtypes", [String, Object]),
1163
465
  __metadata("design:returntype", Promise)
1164
466
  ], OperatorController.prototype, "start", null);
1165
- __decorate([
1166
- Get('start/options'),
1167
- __param(0, Query('sessions')),
1168
- __metadata("design:type", Function),
1169
- __metadata("design:paramtypes", [String]),
1170
- __metadata("design:returntype", Promise)
1171
- ], OperatorController.prototype, "startOptions", null);
1172
- __decorate([
1173
- Post('start/fetch'),
1174
- __param(0, Body()),
1175
- __metadata("design:type", Function),
1176
- __metadata("design:paramtypes", [Object]),
1177
- __metadata("design:returntype", Promise)
1178
- ], OperatorController.prototype, "startFetch", null);
1179
467
  __decorate([
1180
468
  Get('start/failures'),
1181
469
  __param(0, Query('unanswered')),
@@ -1206,74 +494,19 @@ __decorate([
1206
494
  __metadata("design:returntype", Promise)
1207
495
  ], OperatorController.prototype, "stop", null);
1208
496
  __decorate([
1209
- Get('batch'),
1210
- __metadata("design:type", Function),
1211
- __metadata("design:paramtypes", []),
1212
- __metadata("design:returntype", Object)
1213
- ], OperatorController.prototype, "batch", null);
1214
- __decorate([
1215
- Get('batch/name'),
1216
- __param(0, Query('sessions')),
497
+ Post('sessions/:id/pause'),
498
+ __param(0, Param('id')),
1217
499
  __metadata("design:type", Function),
1218
500
  __metadata("design:paramtypes", [String]),
1219
- __metadata("design:returntype", Promise)
1220
- ], OperatorController.prototype, "suggestRunName", null);
1221
- __decorate([
1222
- Post('batch/start'),
1223
- __param(0, Body()),
1224
- __metadata("design:type", Function),
1225
- __metadata("design:paramtypes", [Object]),
1226
- __metadata("design:returntype", Promise)
1227
- ], OperatorController.prototype, "startBatch", null);
1228
- __decorate([
1229
- Post('batch/stop'),
1230
- __metadata("design:type", Function),
1231
- __metadata("design:paramtypes", []),
1232
- __metadata("design:returntype", Promise)
1233
- ], OperatorController.prototype, "stopBatch", null);
1234
- __decorate([
1235
- Post('batch/pause'),
1236
- __metadata("design:type", Function),
1237
- __metadata("design:paramtypes", []),
1238
- __metadata("design:returntype", Promise)
1239
- ], OperatorController.prototype, "pauseBatch", null);
1240
- __decorate([
1241
- Post('batch/resume'),
1242
- __metadata("design:type", Function),
1243
- __metadata("design:paramtypes", []),
1244
- __metadata("design:returntype", Promise)
1245
- ], OperatorController.prototype, "resumeBatch", null);
501
+ __metadata("design:returntype", Object)
502
+ ], OperatorController.prototype, "pause", null);
1246
503
  __decorate([
1247
- Get('plan/brief'),
1248
- __param(0, Query('lang')),
504
+ Post('sessions/:id/resume'),
505
+ __param(0, Param('id')),
1249
506
  __metadata("design:type", Function),
1250
507
  __metadata("design:paramtypes", [String]),
1251
- __metadata("design:returntype", Promise)
1252
- ], OperatorController.prototype, "planBrief", null);
1253
- __decorate([
1254
- Get('context/:kind'),
1255
- __param(0, Param('kind')),
1256
- __param(1, Query('lang')),
1257
- __metadata("design:type", Function),
1258
- __metadata("design:paramtypes", [String, String]),
1259
- __metadata("design:returntype", Promise)
1260
- ], OperatorController.prototype, "context", null);
1261
- __decorate([
1262
- Put('context/:kind'),
1263
- __param(0, Param('kind')),
1264
- __param(1, Body()),
1265
- __metadata("design:type", Function),
1266
- __metadata("design:paramtypes", [String, Object]),
1267
- __metadata("design:returntype", Promise)
1268
- ], OperatorController.prototype, "setContext", null);
1269
- __decorate([
1270
- Delete('context/:kind'),
1271
- __param(0, Param('kind')),
1272
- __param(1, Query('lang')),
1273
- __metadata("design:type", Function),
1274
- __metadata("design:paramtypes", [String, String]),
1275
- __metadata("design:returntype", Promise)
1276
- ], OperatorController.prototype, "resetContext", null);
508
+ __metadata("design:returntype", Object)
509
+ ], OperatorController.prototype, "resume", null);
1277
510
  __decorate([
1278
511
  Get('workspace'),
1279
512
  __metadata("design:type", Function),
@@ -1293,6 +526,13 @@ __decorate([
1293
526
  __metadata("design:paramtypes", [String]),
1294
527
  __metadata("design:returntype", Promise)
1295
528
  ], OperatorController.prototype, "workspaceFile", null);
529
+ __decorate([
530
+ Put('workspace/file'),
531
+ __param(0, Body()),
532
+ __metadata("design:type", Function),
533
+ __metadata("design:paramtypes", [Object]),
534
+ __metadata("design:returntype", Promise)
535
+ ], OperatorController.prototype, "saveWorkspaceFile", null);
1296
536
  __decorate([
1297
537
  Get('workspace/git'),
1298
538
  __metadata("design:type", Function),
@@ -1336,80 +576,6 @@ __decorate([
1336
576
  __metadata("design:paramtypes", [String, Object]),
1337
577
  __metadata("design:returntype", Promise)
1338
578
  ], OperatorController.prototype, "chatRewind", null);
1339
- __decorate([
1340
- Get('sessions/:id/repo/tree'),
1341
- __param(0, Param('id')),
1342
- __param(1, Query('path')),
1343
- __param(2, Query('task')),
1344
- __metadata("design:type", Function),
1345
- __metadata("design:paramtypes", [String, String, String]),
1346
- __metadata("design:returntype", Promise)
1347
- ], OperatorController.prototype, "repoTree", null);
1348
- __decorate([
1349
- Get('sessions/:id/repo/file'),
1350
- __param(0, Param('id')),
1351
- __param(1, Query('path')),
1352
- __param(2, Query('task')),
1353
- __metadata("design:type", Function),
1354
- __metadata("design:paramtypes", [String, String, String]),
1355
- __metadata("design:returntype", Promise)
1356
- ], OperatorController.prototype, "repoFile", null);
1357
- __decorate([
1358
- Get('sessions/:id/repo/log'),
1359
- __param(0, Param('id')),
1360
- __metadata("design:type", Function),
1361
- __metadata("design:paramtypes", [String]),
1362
- __metadata("design:returntype", Promise)
1363
- ], OperatorController.prototype, "repoLog", null);
1364
- __decorate([
1365
- Post('kerrigan/report'),
1366
- __param(0, Body()),
1367
- __metadata("design:type", Function),
1368
- __metadata("design:paramtypes", [Object]),
1369
- __metadata("design:returntype", Promise)
1370
- ], OperatorController.prototype, "kerriganReport", null);
1371
- __decorate([
1372
- Post('changes/check'),
1373
- __param(0, Body()),
1374
- __metadata("design:type", Function),
1375
- __metadata("design:paramtypes", [Object]),
1376
- __metadata("design:returntype", Promise)
1377
- ], OperatorController.prototype, "checkChanges", null);
1378
- __decorate([
1379
- Post('changes/apply'),
1380
- __param(0, Body()),
1381
- __metadata("design:type", Function),
1382
- __metadata("design:paramtypes", [Object]),
1383
- __metadata("design:returntype", Promise)
1384
- ], OperatorController.prototype, "applyChanges", null);
1385
- __decorate([
1386
- Post('plan/check'),
1387
- __param(0, Body()),
1388
- __metadata("design:type", Function),
1389
- __metadata("design:paramtypes", [Object]),
1390
- __metadata("design:returntype", Promise)
1391
- ], OperatorController.prototype, "checkPlan", null);
1392
- __decorate([
1393
- Post('plan/import'),
1394
- __param(0, Body()),
1395
- __metadata("design:type", Function),
1396
- __metadata("design:paramtypes", [Object]),
1397
- __metadata("design:returntype", Promise)
1398
- ], OperatorController.prototype, "importPlan", null);
1399
- __decorate([
1400
- Get('sessions/:id/events'),
1401
- __param(0, Param('id')),
1402
- __metadata("design:type", Function),
1403
- __metadata("design:paramtypes", [String]),
1404
- __metadata("design:returntype", Object)
1405
- ], OperatorController.prototype, "events", null);
1406
- __decorate([
1407
- Sse('sessions/:id/stream'),
1408
- __param(0, Param('id')),
1409
- __metadata("design:type", Function),
1410
- __metadata("design:paramtypes", [String]),
1411
- __metadata("design:returntype", Observable)
1412
- ], OperatorController.prototype, "stream", null);
1413
579
  __decorate([
1414
580
  Get('approvals'),
1415
581
  __param(0, Query('session')),
@@ -1426,21 +592,21 @@ __decorate([
1426
592
  __metadata("design:returntype", Object)
1427
593
  ], OperatorController.prototype, "decide", null);
1428
594
  __decorate([
1429
- Post('approvals/:id/plan'),
595
+ Post('approvals/:id/answer'),
1430
596
  __param(0, Param('id')),
1431
597
  __param(1, Body()),
1432
598
  __metadata("design:type", Function),
1433
599
  __metadata("design:paramtypes", [String, Object]),
1434
600
  __metadata("design:returntype", Object)
1435
- ], OperatorController.prototype, "decidePlan", null);
601
+ ], OperatorController.prototype, "answerQuestion", null);
1436
602
  __decorate([
1437
- Post('sessions/:id/mode'),
603
+ Post('approvals/:id/plan'),
1438
604
  __param(0, Param('id')),
1439
605
  __param(1, Body()),
1440
606
  __metadata("design:type", Function),
1441
607
  __metadata("design:paramtypes", [String, Object]),
1442
608
  __metadata("design:returntype", Object)
1443
- ], OperatorController.prototype, "setMode", null);
609
+ ], OperatorController.prototype, "decidePlan", null);
1444
610
  __decorate([
1445
611
  Get('activity'),
1446
612
  __metadata("design:type", Function),
@@ -1460,64 +626,6 @@ __decorate([
1460
626
  __metadata("design:paramtypes", [Object]),
1461
627
  __metadata("design:returntype", Promise)
1462
628
  ], OperatorController.prototype, "setProject", null);
1463
- __decorate([
1464
- Get('repo/sync'),
1465
- __param(0, Query('dir')),
1466
- __metadata("design:type", Function),
1467
- __metadata("design:paramtypes", [String]),
1468
- __metadata("design:returntype", Promise)
1469
- ], OperatorController.prototype, "repoSync", null);
1470
- __decorate([
1471
- Post('repo/prepare/preview'),
1472
- __param(0, Body()),
1473
- __metadata("design:type", Function),
1474
- __metadata("design:paramtypes", [Object]),
1475
- __metadata("design:returntype", Promise)
1476
- ], OperatorController.prototype, "repoPreparePreview", null);
1477
- __decorate([
1478
- Post('repo/prepare'),
1479
- __param(0, Body()),
1480
- __metadata("design:type", Function),
1481
- __metadata("design:paramtypes", [Object]),
1482
- __metadata("design:returntype", Promise)
1483
- ], OperatorController.prototype, "repoPrepare", null);
1484
- __decorate([
1485
- Get('repo'),
1486
- __param(0, Query('dir')),
1487
- __metadata("design:type", Function),
1488
- __metadata("design:paramtypes", [String]),
1489
- __metadata("design:returntype", Object)
1490
- ], OperatorController.prototype, "repo", null);
1491
- __decorate([
1492
- Get('sessions/:id/vcs'),
1493
- __param(0, Param('id')),
1494
- __metadata("design:type", Function),
1495
- __metadata("design:paramtypes", [String]),
1496
- __metadata("design:returntype", Promise)
1497
- ], OperatorController.prototype, "vcsStatus", null);
1498
- __decorate([
1499
- Get('batch/vcs'),
1500
- __param(0, Query('ids')),
1501
- __param(1, Query('tasks')),
1502
- __metadata("design:type", Function),
1503
- __metadata("design:paramtypes", [String, String]),
1504
- __metadata("design:returntype", Promise)
1505
- ], OperatorController.prototype, "runVcs", null);
1506
- __decorate([
1507
- Post('batch/vcs/prepare'),
1508
- __param(0, Body()),
1509
- __metadata("design:type", Function),
1510
- __metadata("design:paramtypes", [Object]),
1511
- __metadata("design:returntype", Promise)
1512
- ], OperatorController.prototype, "runVcsPrepare", null);
1513
- __decorate([
1514
- Post('sessions/:id/vcs/snapshot'),
1515
- __param(0, Param('id')),
1516
- __param(1, Body()),
1517
- __metadata("design:type", Function),
1518
- __metadata("design:paramtypes", [String, Object]),
1519
- __metadata("design:returntype", Promise)
1520
- ], OperatorController.prototype, "vcsSnapshot", null);
1521
629
  __decorate([
1522
630
  Get('models'),
1523
631
  __metadata("design:type", Function),
@@ -1551,18 +659,6 @@ __decorate([
1551
659
  __metadata("design:paramtypes", [Object]),
1552
660
  __metadata("design:returntype", Promise)
1553
661
  ], OperatorController.prototype, "setDefaultReviewModel", null);
1554
- __decorate([
1555
- Get('tasks'),
1556
- __metadata("design:type", Function),
1557
- __metadata("design:paramtypes", []),
1558
- __metadata("design:returntype", Promise)
1559
- ], OperatorController.prototype, "tasks", null);
1560
- __decorate([
1561
- Get('metrics'),
1562
- __metadata("design:type", Function),
1563
- __metadata("design:paramtypes", []),
1564
- __metadata("design:returntype", Promise)
1565
- ], OperatorController.prototype, "metrics", null);
1566
662
  __decorate([
1567
663
  Post('browse-folder'),
1568
664
  __param(0, Body()),