copilot-operator 0.1.50 → 0.1.51

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 (81) hide show
  1. package/README.md +582 -574
  2. package/dist/src/api/operator.controller.js +77 -932
  3. package/dist/src/api/operator.service.js +197 -2461
  4. package/dist/src/orchestrator/hold.js +49 -0
  5. package/dist/src/orchestrator/taskRunner.js +157 -23
  6. package/dist/src/plan/kerrigan.js +107 -0
  7. package/dist/src/plan/systemGuide.js +438 -3374
  8. package/dist/src/session/chatNotice.js +76 -0
  9. package/dist/src/session/store.js +2 -57
  10. package/dist/src/session/workspace.js +52 -5
  11. package/dist/src/transport/chatTransport.js +1 -1
  12. package/dist/src/transport/copilotTransport.js +133 -1
  13. package/dist/web/404.html +5 -3
  14. package/dist/web/_next/static/chunks/134-ddd50a7fbb536ec8.js +1 -0
  15. package/dist/web/_next/static/chunks/190-70555f20dd0da19b.js +1 -0
  16. package/dist/web/_next/static/chunks/643-e85d221d57900ed7.js +1 -0
  17. package/dist/web/_next/static/chunks/867-869900ec999e6345.js +1 -0
  18. package/dist/web/_next/static/chunks/app/appearance/page-cdef33c421397cbe.js +1 -0
  19. package/dist/web/_next/static/chunks/app/defaults/page-e0a2b8f9a41a94c4.js +1 -0
  20. package/dist/web/_next/static/chunks/app/layout-b4fc21e26e1bad95.js +1 -0
  21. package/dist/web/_next/static/chunks/app/level1/page-31b74cae86d960d8.js +1 -0
  22. package/dist/web/_next/static/chunks/app/page-1075921d44db3e4d.js +1 -0
  23. package/dist/web/_next/static/chunks/app/presets/page-f8abdd83cdf468f7.js +1 -0
  24. package/dist/web/_next/static/chunks/app/system/page-2a270bb885885821.js +1 -0
  25. package/dist/web/_next/static/css/8b14cb3cf0051138.css +1 -0
  26. package/dist/web/_next/static/eqTUTH_SJtBgNgq8Zzy3n/_buildManifest.js +1 -0
  27. package/dist/web/appearance.html +5 -3
  28. package/dist/web/appearance.txt +22 -23
  29. package/dist/web/defaults.html +5 -3
  30. package/dist/web/defaults.txt +22 -23
  31. package/dist/web/index.html +5 -3
  32. package/dist/web/index.txt +22 -23
  33. package/dist/web/level1.html +5 -3
  34. package/dist/web/level1.txt +22 -23
  35. package/dist/web/presets.html +6 -4
  36. package/dist/web/presets.txt +22 -23
  37. package/dist/web/system.html +5 -3
  38. package/dist/web/system.txt +22 -23
  39. package/package.json +3 -20
  40. package/dist/src/api/saveToDesktop.js +0 -157
  41. package/dist/src/plan/brief.js +0 -2003
  42. package/dist/src/plan/changes.js +0 -217
  43. package/dist/src/plan/script.js +0 -1014
  44. package/dist/src/session/debugExport.js +0 -165
  45. package/dist/src/session/exportRecord.js +0 -277
  46. package/dist/src/session/metrics.js +0 -95
  47. package/dist/src/vcs/startChoice.js +0 -367
  48. package/dist/web/_next/static/chunks/197-f7c33a0114fc3db3.js +0 -1
  49. package/dist/web/_next/static/chunks/499-751e0be9d4f86e2d.js +0 -1
  50. package/dist/web/_next/static/chunks/534-56c68930a1a3c10f.js +0 -1
  51. package/dist/web/_next/static/chunks/549-c32dd718a1809d4d.js +0 -1
  52. package/dist/web/_next/static/chunks/699-9d031f8c145a0465.js +0 -1
  53. package/dist/web/_next/static/chunks/867-0e5d0d5472bf185f.js +0 -1
  54. package/dist/web/_next/static/chunks/app/appearance/page-a18019cdc395de3d.js +0 -1
  55. package/dist/web/_next/static/chunks/app/defaults/page-614be29d185a2947.js +0 -1
  56. package/dist/web/_next/static/chunks/app/history/page-95bab4c1b1ff9339.js +0 -1
  57. package/dist/web/_next/static/chunks/app/import/page-8ef75fc08638e75f.js +0 -1
  58. package/dist/web/_next/static/chunks/app/layout-a1314921eeba8ad5.js +0 -1
  59. package/dist/web/_next/static/chunks/app/level1/page-dd3ebf37d29dce4f.js +0 -1
  60. package/dist/web/_next/static/chunks/app/page-4d8f0851fe672925.js +0 -1
  61. package/dist/web/_next/static/chunks/app/presets/page-93ab518db67e52a2.js +0 -1
  62. package/dist/web/_next/static/chunks/app/sessions/page-28376d2e4a9b4738.js +0 -1
  63. package/dist/web/_next/static/chunks/app/sessions/view/page-adb64f8ba3d8c06e.js +0 -1
  64. package/dist/web/_next/static/chunks/app/system/page-227a259e383ca2a0.js +0 -1
  65. package/dist/web/_next/static/css/4335e4ce269ba1ea.css +0 -1
  66. package/dist/web/_next/static/z74_FBfnnXW5IJCHTgTH2/_buildManifest.js +0 -1
  67. package/dist/web/history.html +0 -16
  68. package/dist/web/history.txt +0 -26
  69. package/dist/web/import.html +0 -16
  70. package/dist/web/import.txt +0 -26
  71. package/dist/web/sessions/view.html +0 -16
  72. package/dist/web/sessions/view.txt +0 -26
  73. package/dist/web/sessions.html +0 -16
  74. package/dist/web/sessions.txt +0 -26
  75. package/prompts/organisation.bg.md +0 -43
  76. package/prompts/organisation.en.md +0 -43
  77. package/prompts/persona.bg.md +0 -17
  78. package/prompts/persona.en.md +0 -17
  79. package/prompts/work.bg.md +0 -19
  80. package/prompts/work.en.md +0 -19
  81. /package/dist/web/_next/static/{z74_FBfnnXW5IJCHTgTH2 → eqTUTH_SJtBgNgq8Zzy3n}/_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, Delete, 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)}`;
@@ -136,136 +107,25 @@ let OperatorController = class OperatorController {
136
107
  await this.ops.deletePreset(name).catch(fail);
137
108
  return { ok: true };
138
109
  }
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);
110
+ // --- Kerrigan -------------------------------------------------------------------------------
111
+ /** Kerrigan, the persona to give another chat: what copilot-operator is and how a task is best written for it. */
112
+ kerrigan(lang) {
113
+ return this.ops.kerrigan(lang === 'bg' ? 'bg' : 'en').catch(fail);
145
114
  }
146
- async deletePersona(name) {
147
- await this.ops.deletePersona(name).catch(fail);
148
- return { ok: true };
149
- }
150
- // --- sessions ---------------------------------------------------------------------------
115
+ // --- the chat's conversations (sessions of kind `chat`) -------------------------------------
151
116
  sessions() {
152
117
  return this.ops.listSessions();
153
118
  }
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
119
  async session(id) {
162
120
  const s = await this.ops.getSession(id);
163
121
  if (!s)
164
122
  throw new NotFoundException();
165
123
  return s;
166
124
  }
167
- /** Name, model, queue behaviour, files, version control and the independent review. */
125
+ /** The conversation's model, chosen in the chat (and the rest of a session's settings). */
168
126
  updateSession(id, body) {
169
127
  return this.ops.updateSession(id, body).catch(fail);
170
128
  }
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
129
  /** The attempt as a story: what was sent, answered, run and how it ended. `run` picks an earlier attempt. */
270
130
  async taskStory(id, taskId, run) {
271
131
  const story = await this.ops.taskStory(id, taskId, run);
@@ -286,102 +146,6 @@ let OperatorController = class OperatorController {
286
146
  throw new BadRequestException('path is required');
287
147
  return this.ops.taskChangeFile(id, taskId, path, run?.trim() || undefined).catch(fail);
288
148
  }
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
149
  /** One task's whole exchange with Copilot, as a JSON file (see `taskExchange.ts`). */
386
150
  async taskExchange(id, taskId, res) {
387
151
  try {
@@ -394,36 +158,12 @@ let OperatorController = class OperatorController {
394
158
  failText(res, e);
395
159
  }
396
160
  }
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
- }
161
+ events(id) {
162
+ return this.ops.recentEvents(id);
411
163
  }
412
164
  // --- run control ------------------------------------------------------------------------
413
165
  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);
166
+ return this.ops.start(id, body?.mode === 'unattended' ? 'unattended' : 'confirm');
427
167
  }
428
168
  /** Starts that did not get as far as a first task, newest first; `unanswered=1` only those no press was answered with. */
429
169
  startFailures(unanswered) {
@@ -456,87 +196,21 @@ let OperatorController = class OperatorController {
456
196
  stop(id) {
457
197
  return this.ops.stop(id);
458
198
  }
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 };
199
+ /** "Pause": the running work holds at its next message or command. */
200
+ pause(id) {
201
+ try {
202
+ return this.ops.pause(id);
203
+ }
204
+ catch (e) {
205
+ throw new BadRequestException(e.message);
206
+ }
535
207
  }
536
- resetContext(kind, lang) {
537
- return this.ops.resetContext(asContextKind(kind), lang ?? 'en');
208
+ /** "Continue": the paused work goes on. */
209
+ resume(id) {
210
+ return this.ops.resume(id);
538
211
  }
539
- /** The project folder the workbench has open, its files on disk, and one of them. Read-only. */
212
+ // --- the workspace and its chat ---------------------------------------------------------------
213
+ /** The project folder the workbench has open, its files on disk, and one of them. */
540
214
  workspace() {
541
215
  return this.ops.workspace().catch(fail);
542
216
  }
@@ -548,6 +222,24 @@ let OperatorController = class OperatorController {
548
222
  throw new BadRequestException('path is required');
549
223
  return this.ops.workspaceFile(path).catch(fail);
550
224
  }
225
+ /**
226
+ * The editor saving a file of the open folder. `base` is the version it was opened at; a file changed on disk since
227
+ * is refused with 409, so the page can offer to read it again or to save over it (by sending no `base`).
228
+ */
229
+ async saveWorkspaceFile(body = {}) {
230
+ if (typeof body?.path !== 'string' || !body.path)
231
+ throw new BadRequestException('path is required');
232
+ if (typeof body.text !== 'string')
233
+ throw new BadRequestException('text is required');
234
+ try {
235
+ return await this.ops.saveWorkspaceFile(body.path, body.text, typeof body.base === 'string' && body.base ? body.base : undefined);
236
+ }
237
+ catch (e) {
238
+ if (e.code === CHANGED_ON_DISK)
239
+ throw new ConflictException(e.message);
240
+ fail(e);
241
+ }
242
+ }
551
243
  /** The open folder's git: the changes, staged and not, and the branch's commits. Read-only. */
552
244
  workspaceGit() {
553
245
  return this.ops.workspaceGit().catch(fail);
@@ -581,6 +273,8 @@ let OperatorController = class OperatorController {
581
273
  ...(typeof body.threadId === 'string' && body.threadId ? { threadId: body.threadId } : {}),
582
274
  ...(typeof body.model === 'string' && body.model.trim() ? { model: body.model } : {}),
583
275
  ...(body.manualModel === true ? { manualModel: true } : {}),
276
+ ...(body.lang === 'bg' || body.lang === 'en' ? { lang: body.lang } : {}),
277
+ ...(body.planMode === true ? { planMode: true } : {}),
584
278
  })
585
279
  .catch(fail);
586
280
  }
@@ -593,63 +287,6 @@ let OperatorController = class OperatorController {
593
287
  throw new BadRequestException(r.problem);
594
288
  return r;
595
289
  }
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
290
  // --- approvals --------------------------------------------------------------------------
654
291
  approvals(session) {
655
292
  return this.ops.pendingApprovals(session);
@@ -669,13 +306,6 @@ let OperatorController = class OperatorController {
669
306
  throw new BadRequestException(result.problem);
670
307
  return result;
671
308
  }
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
309
  /**
680
310
  * Is anything running? Answered from memory, so it is safe to ask from every page.
681
311
  */
@@ -683,7 +313,7 @@ let OperatorController = class OperatorController {
683
313
  return this.ops.activity();
684
314
  }
685
315
  // --- the project being worked on -----------------------------------------------------------
686
- /** The folder new sessions start pointed at, and whether it can carry version control. */
316
+ /** The folder the chat works in. */
687
317
  project() {
688
318
  return this.ops.project();
689
319
  }
@@ -691,16 +321,6 @@ let OperatorController = class OperatorController {
691
321
  setProject(body) {
692
322
  return this.ops.setProject({ rootDir: body?.rootDir, name: body?.name, others: body?.others }).catch(fail);
693
323
  }
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
324
  /** "Prepare the folder from the remote main branch": what it would do (fetches, changes nothing else). */
705
325
  repoPreparePreview(body) {
706
326
  return this.ops.preparePreview(body?.dir ?? '', body?.fetch !== false).catch(fail);
@@ -709,61 +329,30 @@ let OperatorController = class OperatorController {
709
329
  repoPrepare(body) {
710
330
  return this.ops.prepareProject(body?.dir ?? '', body?.fingerprint ?? '', { savedBranch: body?.savedBranch, savedMainBranch: body?.savedMainBranch }).catch(fail);
711
331
  }
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);
735
- }
736
332
  // --- the model picker ---------------------------------------------------------------------
737
333
  /** The cached list. Returns null when the picker has never been read on this machine. */
738
334
  models() {
739
335
  return this.ops.models();
740
336
  }
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
337
  /** "Sign in" from Settings: opens the bot's Edge and waits for the operator to sign in. See `OperatorService.login`. */
746
338
  login(body) {
747
339
  return this.ops.login(body?.account).catch(fail);
748
340
  }
341
+ /**
342
+ * Re-reads the picker from the live chat. Slow on purpose: it opens the browser with the
343
+ * bot profile, so it cannot run while a session is running.
344
+ */
749
345
  refreshModels() {
750
346
  return this.ops.refreshModels().catch(fail);
751
347
  }
752
- /** The model new sessions start on. An empty name means "leave the chat alone". */
348
+ /** The model a new conversation starts on. An empty name means "leave the chat alone". */
753
349
  setDefaultModel(body) {
754
350
  return this.ops.setDefaultModel(body?.model ?? '').catch(fail);
755
351
  }
756
- /** The model a new session's independent review runs on. An empty name means "the session's own". */
352
+ /** The model of the independent review. An empty name means "the session's own". */
757
353
  setDefaultReviewModel(body) {
758
354
  return this.ops.setDefaultReviewModel(body?.model ?? '').catch(fail);
759
355
  }
760
- // --- the registry of every task -----------------------------------------------------------
761
- tasks() {
762
- return this.ops.taskRegistry();
763
- }
764
- metrics() {
765
- return this.ops.metrics();
766
- }
767
356
  // --- helpers for the UI -----------------------------------------------------------------
768
357
  /**
769
358
  * Opens the machine's own folder dialog. A POST because it has a visible effect: a window
@@ -839,46 +428,18 @@ __decorate([
839
428
  __metadata("design:returntype", Promise)
840
429
  ], OperatorController.prototype, "deletePreset", null);
841
430
  __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')),
431
+ Get('kerrigan'),
432
+ __param(0, Query('lang')),
858
433
  __metadata("design:type", Function),
859
434
  __metadata("design:paramtypes", [String]),
860
435
  __metadata("design:returntype", Promise)
861
- ], OperatorController.prototype, "deletePersona", null);
436
+ ], OperatorController.prototype, "kerrigan", null);
862
437
  __decorate([
863
438
  Get('sessions'),
864
439
  __metadata("design:type", Function),
865
440
  __metadata("design:paramtypes", []),
866
441
  __metadata("design:returntype", Promise)
867
442
  ], 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
443
  __decorate([
883
444
  Get('sessions/:id'),
884
445
  __param(0, Param('id')),
@@ -894,160 +455,6 @@ __decorate([
894
455
  __metadata("design:paramtypes", [String, Object]),
895
456
  __metadata("design:returntype", Promise)
896
457
  ], OperatorController.prototype, "updateSession", null);
897
- __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'),
906
- __param(0, Param('id')),
907
- __param(1, Body()),
908
- __metadata("design:type", Function),
909
- __metadata("design:paramtypes", [String, Object]),
910
- __metadata("design:returntype", Promise)
911
- ], OperatorController.prototype, "addTask", null);
912
- __decorate([
913
- Put('sessions/:id/tasks/:taskId'),
914
- __param(0, Param('id')),
915
- __param(1, Param('taskId')),
916
- __param(2, Body()),
917
- __metadata("design:type", Function),
918
- __metadata("design:paramtypes", [String, String, Object]),
919
- __metadata("design:returntype", Promise)
920
- ], OperatorController.prototype, "updateTask", null);
921
- __decorate([
922
- Delete('sessions/:id/tasks/:taskId'),
923
- __param(0, Param('id')),
924
- __param(1, Param('taskId')),
925
- __metadata("design:type", Function),
926
- __metadata("design:paramtypes", [String, String]),
927
- __metadata("design:returntype", Promise)
928
- ], OperatorController.prototype, "deleteTask", null);
929
- __decorate([
930
- Post('sessions/:id/tasks/:taskId/notes'),
931
- __param(0, Param('id')),
932
- __param(1, Param('taskId')),
933
- __param(2, Body()),
934
- __metadata("design:type", Function),
935
- __metadata("design:paramtypes", [String, String, Object]),
936
- __metadata("design:returntype", Promise)
937
- ], OperatorController.prototype, "addTaskNote", null);
938
- __decorate([
939
- Post('sessions/:id/tasks/:taskId/accept'),
940
- __param(0, Param('id')),
941
- __param(1, Param('taskId')),
942
- __param(2, Body()),
943
- __metadata("design:type", Function),
944
- __metadata("design:paramtypes", [String, String, Object]),
945
- __metadata("design:returntype", Promise)
946
- ], OperatorController.prototype, "acceptTask", null);
947
- __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
458
  __decorate([
1052
459
  Get('sessions/:id/tasks/:taskId/story'),
1053
460
  __param(0, Param('id')),
@@ -1076,64 +483,6 @@ __decorate([
1076
483
  __metadata("design:paramtypes", [String, String, String, String]),
1077
484
  __metadata("design:returntype", Promise)
1078
485
  ], 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
486
  __decorate([
1138
487
  Get('sessions/:id/tasks/:taskId/exchange'),
1139
488
  __param(0, Param('id')),
@@ -1144,16 +493,12 @@ __decorate([
1144
493
  __metadata("design:returntype", Promise)
1145
494
  ], OperatorController.prototype, "taskExchange", null);
1146
495
  __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')),
496
+ Get('sessions/:id/events'),
497
+ __param(0, Param('id')),
1153
498
  __metadata("design:type", Function),
1154
- __metadata("design:paramtypes", [String, Object, String, String, String]),
1155
- __metadata("design:returntype", Promise)
1156
- ], OperatorController.prototype, "exportView", null);
499
+ __metadata("design:paramtypes", [String]),
500
+ __metadata("design:returntype", Object)
501
+ ], OperatorController.prototype, "events", null);
1157
502
  __decorate([
1158
503
  Post('sessions/:id/start'),
1159
504
  __param(0, Param('id')),
@@ -1162,20 +507,6 @@ __decorate([
1162
507
  __metadata("design:paramtypes", [String, Object]),
1163
508
  __metadata("design:returntype", Promise)
1164
509
  ], 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
510
  __decorate([
1180
511
  Get('start/failures'),
1181
512
  __param(0, Query('unanswered')),
@@ -1206,74 +537,19 @@ __decorate([
1206
537
  __metadata("design:returntype", Promise)
1207
538
  ], OperatorController.prototype, "stop", null);
1208
539
  __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')),
540
+ Post('sessions/:id/pause'),
541
+ __param(0, Param('id')),
1217
542
  __metadata("design:type", Function),
1218
543
  __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);
544
+ __metadata("design:returntype", Object)
545
+ ], OperatorController.prototype, "pause", null);
1246
546
  __decorate([
1247
- Get('plan/brief'),
1248
- __param(0, Query('lang')),
547
+ Post('sessions/:id/resume'),
548
+ __param(0, Param('id')),
1249
549
  __metadata("design:type", Function),
1250
550
  __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);
551
+ __metadata("design:returntype", Object)
552
+ ], OperatorController.prototype, "resume", null);
1277
553
  __decorate([
1278
554
  Get('workspace'),
1279
555
  __metadata("design:type", Function),
@@ -1293,6 +569,13 @@ __decorate([
1293
569
  __metadata("design:paramtypes", [String]),
1294
570
  __metadata("design:returntype", Promise)
1295
571
  ], OperatorController.prototype, "workspaceFile", null);
572
+ __decorate([
573
+ Put('workspace/file'),
574
+ __param(0, Body()),
575
+ __metadata("design:type", Function),
576
+ __metadata("design:paramtypes", [Object]),
577
+ __metadata("design:returntype", Promise)
578
+ ], OperatorController.prototype, "saveWorkspaceFile", null);
1296
579
  __decorate([
1297
580
  Get('workspace/git'),
1298
581
  __metadata("design:type", Function),
@@ -1336,80 +619,6 @@ __decorate([
1336
619
  __metadata("design:paramtypes", [String, Object]),
1337
620
  __metadata("design:returntype", Promise)
1338
621
  ], 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
622
  __decorate([
1414
623
  Get('approvals'),
1415
624
  __param(0, Query('session')),
@@ -1433,14 +642,6 @@ __decorate([
1433
642
  __metadata("design:paramtypes", [String, Object]),
1434
643
  __metadata("design:returntype", Object)
1435
644
  ], OperatorController.prototype, "decidePlan", null);
1436
- __decorate([
1437
- Post('sessions/:id/mode'),
1438
- __param(0, Param('id')),
1439
- __param(1, Body()),
1440
- __metadata("design:type", Function),
1441
- __metadata("design:paramtypes", [String, Object]),
1442
- __metadata("design:returntype", Object)
1443
- ], OperatorController.prototype, "setMode", null);
1444
645
  __decorate([
1445
646
  Get('activity'),
1446
647
  __metadata("design:type", Function),
@@ -1460,13 +661,6 @@ __decorate([
1460
661
  __metadata("design:paramtypes", [Object]),
1461
662
  __metadata("design:returntype", Promise)
1462
663
  ], 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
664
  __decorate([
1471
665
  Post('repo/prepare/preview'),
1472
666
  __param(0, Body()),
@@ -1481,43 +675,6 @@ __decorate([
1481
675
  __metadata("design:paramtypes", [Object]),
1482
676
  __metadata("design:returntype", Promise)
1483
677
  ], 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
678
  __decorate([
1522
679
  Get('models'),
1523
680
  __metadata("design:type", Function),
@@ -1551,18 +708,6 @@ __decorate([
1551
708
  __metadata("design:paramtypes", [Object]),
1552
709
  __metadata("design:returntype", Promise)
1553
710
  ], 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
711
  __decorate([
1567
712
  Post('browse-folder'),
1568
713
  __param(0, Body()),