copilot-operator 0.1.48 → 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 (83) hide show
  1. package/README.md +582 -574
  2. package/dist/src/api/operator.controller.js +112 -926
  3. package/dist/src/api/operator.service.js +217 -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 +419 -3283
  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/session/workspaceGit.js +212 -0
  12. package/dist/src/transport/chatSession.js +28 -4
  13. package/dist/src/transport/chatTransport.js +1 -1
  14. package/dist/src/transport/copilotTransport.js +133 -1
  15. package/dist/web/404.html +5 -3
  16. package/dist/web/_next/static/chunks/134-ddd50a7fbb536ec8.js +1 -0
  17. package/dist/web/_next/static/chunks/190-70555f20dd0da19b.js +1 -0
  18. package/dist/web/_next/static/chunks/643-e85d221d57900ed7.js +1 -0
  19. package/dist/web/_next/static/chunks/867-869900ec999e6345.js +1 -0
  20. package/dist/web/_next/static/chunks/app/appearance/page-cdef33c421397cbe.js +1 -0
  21. package/dist/web/_next/static/chunks/app/defaults/page-e0a2b8f9a41a94c4.js +1 -0
  22. package/dist/web/_next/static/chunks/app/layout-b4fc21e26e1bad95.js +1 -0
  23. package/dist/web/_next/static/chunks/app/level1/page-31b74cae86d960d8.js +1 -0
  24. package/dist/web/_next/static/chunks/app/page-1075921d44db3e4d.js +1 -0
  25. package/dist/web/_next/static/chunks/app/presets/page-f8abdd83cdf468f7.js +1 -0
  26. package/dist/web/_next/static/chunks/app/system/page-2a270bb885885821.js +1 -0
  27. package/dist/web/_next/static/css/8b14cb3cf0051138.css +1 -0
  28. package/dist/web/_next/static/eqTUTH_SJtBgNgq8Zzy3n/_buildManifest.js +1 -0
  29. package/dist/web/appearance.html +5 -3
  30. package/dist/web/appearance.txt +22 -23
  31. package/dist/web/defaults.html +5 -3
  32. package/dist/web/defaults.txt +22 -23
  33. package/dist/web/index.html +5 -3
  34. package/dist/web/index.txt +22 -23
  35. package/dist/web/level1.html +5 -3
  36. package/dist/web/level1.txt +22 -23
  37. package/dist/web/presets.html +6 -4
  38. package/dist/web/presets.txt +22 -23
  39. package/dist/web/system.html +5 -3
  40. package/dist/web/system.txt +22 -23
  41. package/package.json +4 -20
  42. package/dist/src/api/saveToDesktop.js +0 -157
  43. package/dist/src/plan/brief.js +0 -2003
  44. package/dist/src/plan/changes.js +0 -217
  45. package/dist/src/plan/script.js +0 -1014
  46. package/dist/src/session/debugExport.js +0 -165
  47. package/dist/src/session/exportRecord.js +0 -277
  48. package/dist/src/session/metrics.js +0 -95
  49. package/dist/src/vcs/startChoice.js +0 -367
  50. package/dist/web/_next/static/chunks/197-f7c33a0114fc3db3.js +0 -1
  51. package/dist/web/_next/static/chunks/499-751e0be9d4f86e2d.js +0 -1
  52. package/dist/web/_next/static/chunks/549-a4473e9519a97026.js +0 -1
  53. package/dist/web/_next/static/chunks/699-9d031f8c145a0465.js +0 -1
  54. package/dist/web/_next/static/chunks/867-b159f25612da5cbc.js +0 -1
  55. package/dist/web/_next/static/chunks/897-5a34109533c3da50.js +0 -1
  56. package/dist/web/_next/static/chunks/app/appearance/page-a18019cdc395de3d.js +0 -1
  57. package/dist/web/_next/static/chunks/app/defaults/page-614be29d185a2947.js +0 -1
  58. package/dist/web/_next/static/chunks/app/history/page-0bb537407fed5944.js +0 -1
  59. package/dist/web/_next/static/chunks/app/import/page-8ef75fc08638e75f.js +0 -1
  60. package/dist/web/_next/static/chunks/app/layout-485ce9395cb17998.js +0 -1
  61. package/dist/web/_next/static/chunks/app/level1/page-dd3ebf37d29dce4f.js +0 -1
  62. package/dist/web/_next/static/chunks/app/page-3caf0b02046754a1.js +0 -1
  63. package/dist/web/_next/static/chunks/app/presets/page-93ab518db67e52a2.js +0 -1
  64. package/dist/web/_next/static/chunks/app/sessions/page-28376d2e4a9b4738.js +0 -1
  65. package/dist/web/_next/static/chunks/app/sessions/view/page-835d3533fdc63082.js +0 -1
  66. package/dist/web/_next/static/chunks/app/system/page-227a259e383ca2a0.js +0 -1
  67. package/dist/web/_next/static/css/ddb518572ea43e30.css +0 -1
  68. package/dist/web/_next/static/nLLy7-v8M5YRGIMtuTvMJ/_buildManifest.js +0 -1
  69. package/dist/web/history.html +0 -16
  70. package/dist/web/history.txt +0 -26
  71. package/dist/web/import.html +0 -16
  72. package/dist/web/import.txt +0 -26
  73. package/dist/web/sessions/view.html +0 -16
  74. package/dist/web/sessions/view.txt +0 -26
  75. package/dist/web/sessions.html +0 -16
  76. package/dist/web/sessions.txt +0 -26
  77. package/prompts/organisation.bg.md +0 -43
  78. package/prompts/organisation.en.md +0 -43
  79. package/prompts/persona.bg.md +0 -17
  80. package/prompts/persona.en.md +0 -17
  81. package/prompts/work.bg.md +0 -19
  82. package/prompts/work.en.md +0 -19
  83. /package/dist/web/_next/static/{nLLy7-v8M5YRGIMtuTvMJ → 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,43 @@ 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
+ }
243
+ /** The open folder's git: the changes, staged and not, and the branch's commits. Read-only. */
244
+ workspaceGit() {
245
+ return this.ops.workspaceGit().catch(fail);
246
+ }
247
+ workspaceCommit(sha) {
248
+ if (!sha)
249
+ throw new BadRequestException('sha is required');
250
+ return this.ops.workspaceCommit(sha).catch(fail);
251
+ }
252
+ /** A file of those lists, its two versions: `area` staged, changes or commit (with `commit`). */
253
+ workspaceGitFile(area, path, commit) {
254
+ if (!path)
255
+ throw new BadRequestException('path is required');
256
+ if (area !== 'staged' && area !== 'changes' && area !== 'commit')
257
+ throw new BadRequestException('area must be staged, changes or commit');
258
+ if (area === 'commit' && !commit)
259
+ throw new BadRequestException('commit is required');
260
+ return this.ops.workspaceGitFile(area, path, commit).catch(fail);
261
+ }
551
262
  /** The chat's conversations, newest first. */
552
263
  chatThreads() {
553
264
  return this.ops.chatThreads().catch(fail);
@@ -562,6 +273,8 @@ let OperatorController = class OperatorController {
562
273
  ...(typeof body.threadId === 'string' && body.threadId ? { threadId: body.threadId } : {}),
563
274
  ...(typeof body.model === 'string' && body.model.trim() ? { model: body.model } : {}),
564
275
  ...(body.manualModel === true ? { manualModel: true } : {}),
276
+ ...(body.lang === 'bg' || body.lang === 'en' ? { lang: body.lang } : {}),
277
+ ...(body.planMode === true ? { planMode: true } : {}),
565
278
  })
566
279
  .catch(fail);
567
280
  }
@@ -574,63 +287,6 @@ let OperatorController = class OperatorController {
574
287
  throw new BadRequestException(r.problem);
575
288
  return r;
576
289
  }
577
- /** One folder of the session's repository at its branch (or the task's commit): read-only, for the workbench. */
578
- repoTree(id, path, task) {
579
- return this.ops.repoTree(id, path ?? '', task?.trim() || undefined).catch(fail);
580
- }
581
- /** One file of it, as text. */
582
- repoFile(id, path, task) {
583
- if (!path)
584
- throw new BadRequestException('path is required');
585
- return this.ops.repoFile(id, path, task?.trim() || undefined).catch(fail);
586
- }
587
- /** The commits on the session's line, each with the task that made it. */
588
- repoLog(id) {
589
- return this.ops.repoLog(id).catch(fail);
590
- }
591
- /** What happened in these sessions, for Kerrigan, with the operator's note and the form of her answer. */
592
- kerriganReport(body = {}) {
593
- const ids = (v) => (Array.isArray(v) ? v.filter((x) => typeof x === 'string') : []);
594
- return this.ops.kerriganReport({ sessionIds: ids(body?.sessionIds), taskIds: ids(body?.taskIds), note: typeof body?.note === 'string' ? body.note : undefined }).catch(fail);
595
- }
596
- /** Kerrigan's changes to existing work, read against it as it is now; nothing is changed. */
597
- checkChanges(body = {}) {
598
- return this.ops.checkChanges(typeof body?.text === 'string' ? body.text : '').catch(fail);
599
- }
600
- /** Applies them one by one, stopping at the first refused; nothing is started. */
601
- applyChanges(body = {}) {
602
- return this.ops.applyChanges(typeof body?.text === 'string' ? body.text : '').catch(fail);
603
- }
604
- /** Checks a pasted plan without importing anything, and says what it would duplicate. */
605
- checkPlan(body) {
606
- return this.ops.checkPlan(body?.text ?? '').catch(fail);
607
- }
608
- /**
609
- * Creates the sessions and tasks a plan describes, and starts nothing.
610
- *
611
- * A plan that does not validate comes back as 200 with `ok: false` rather than as an error,
612
- * because the list of what is wrong is the useful part of that answer and the UI shows it
613
- * to the operator to hand back to the chat.
614
- */
615
- importPlan(body) {
616
- return this.ops.importPlan(body?.text ?? '').catch(fail);
617
- }
618
- events(id) {
619
- return this.ops.recentEvents(id);
620
- }
621
- /** Live events as server-sent events. The browser's EventSource reconnects on its own. */
622
- stream(id) {
623
- return new Observable((subscriber) => {
624
- for (const e of this.ops.recentEvents(id))
625
- subscriber.next({ data: JSON.stringify(e) });
626
- const off = this.ops.subscribe(id, (e) => subscriber.next({ data: JSON.stringify(e) }));
627
- const keepAlive = setInterval(() => subscriber.next({ data: JSON.stringify({ type: 'ping', at: new Date().toISOString() }) }), 25_000);
628
- return () => {
629
- off();
630
- clearInterval(keepAlive);
631
- };
632
- });
633
- }
634
290
  // --- approvals --------------------------------------------------------------------------
635
291
  approvals(session) {
636
292
  return this.ops.pendingApprovals(session);
@@ -650,13 +306,6 @@ let OperatorController = class OperatorController {
650
306
  throw new BadRequestException(result.problem);
651
307
  return result;
652
308
  }
653
- /** Turns asking on or off in the middle of a run. */
654
- setMode(id, body) {
655
- if (body?.mode !== 'confirm' && body?.mode !== 'unattended') {
656
- throw new BadRequestException('mode must be confirm or unattended');
657
- }
658
- return this.ops.setRunMode(id, body.mode);
659
- }
660
309
  /**
661
310
  * Is anything running? Answered from memory, so it is safe to ask from every page.
662
311
  */
@@ -664,7 +313,7 @@ let OperatorController = class OperatorController {
664
313
  return this.ops.activity();
665
314
  }
666
315
  // --- the project being worked on -----------------------------------------------------------
667
- /** The folder new sessions start pointed at, and whether it can carry version control. */
316
+ /** The folder the chat works in. */
668
317
  project() {
669
318
  return this.ops.project();
670
319
  }
@@ -672,16 +321,6 @@ let OperatorController = class OperatorController {
672
321
  setProject(body) {
673
322
  return this.ops.setProject({ rootDir: body?.rootDir, name: body?.name, others: body?.others }).catch(fail);
674
323
  }
675
- /**
676
- * Whether a folder can be used for version control at all, asked before the choice is made.
677
- *
678
- * Separate from the session's own preflight because that one only speaks when version
679
- * control is already on, and the question here is whether it may be turned on.
680
- */
681
- /** The command that brings a project's branch back to its remote's main — shown, never run. */
682
- repoSync(dir) {
683
- return this.ops.syncPlan(dir ?? '').catch(fail);
684
- }
685
324
  /** "Prepare the folder from the remote main branch": what it would do (fetches, changes nothing else). */
686
325
  repoPreparePreview(body) {
687
326
  return this.ops.preparePreview(body?.dir ?? '', body?.fetch !== false).catch(fail);
@@ -690,61 +329,30 @@ let OperatorController = class OperatorController {
690
329
  repoPrepare(body) {
691
330
  return this.ops.prepareProject(body?.dir ?? '', body?.fingerprint ?? '', { savedBranch: body?.savedBranch, savedMainBranch: body?.savedMainBranch }).catch(fail);
692
331
  }
693
- repo(dir) {
694
- const problem = this.ops.repoProblem(dir ?? '');
695
- return problem ? { ok: false, problem } : { ok: true };
696
- }
697
- /** Can version control do its job in this session right now? */
698
- vcsStatus(id) {
699
- return this.ops.vcsStatus(id).catch(fail);
700
- }
701
- /** "Prepare version control for this run": one group per repository of the sessions given. */
702
- runVcs(ids, tasks) {
703
- const only = (tasks ?? '').split(',').map((t) => t.trim()).filter(Boolean);
704
- return this.ops.runVcs((ids ?? '').split(',').map((s) => s.trim()).filter(Boolean), only.length > 0 ? new Set(only) : undefined).catch(fail);
705
- }
706
- /** One action of that panel, for one repository. */
707
- runVcsPrepare(body) {
708
- const actions = ['review-inputs', 'snapshot-on-base', 'snapshot-here', 'use-current-branch', 'allow-snapshot'];
709
- if (!actions.includes(body?.action ?? ''))
710
- return Promise.resolve({ ok: false, problem: 'unknown action' });
711
- return this.ops.runVcsPrepare(body?.sessionIds ?? [], body?.repoDir ?? '', body.action, body?.choices ?? {}).catch(fail);
712
- }
713
- /** The operator's approval of the starting snapshot: one choice per file of the list they saw. */
714
- vcsSnapshot(id, body) {
715
- return this.ops.vcsSnapshot(id, body?.choices ?? {}).catch(fail);
716
- }
717
332
  // --- the model picker ---------------------------------------------------------------------
718
333
  /** The cached list. Returns null when the picker has never been read on this machine. */
719
334
  models() {
720
335
  return this.ops.models();
721
336
  }
722
- /**
723
- * Re-reads the picker from the live chat. Slow on purpose: it opens the browser with the
724
- * bot profile, so it cannot run while a session is running.
725
- */
726
337
  /** "Sign in" from Settings: opens the bot's Edge and waits for the operator to sign in. See `OperatorService.login`. */
727
338
  login(body) {
728
339
  return this.ops.login(body?.account).catch(fail);
729
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
+ */
730
345
  refreshModels() {
731
346
  return this.ops.refreshModels().catch(fail);
732
347
  }
733
- /** 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". */
734
349
  setDefaultModel(body) {
735
350
  return this.ops.setDefaultModel(body?.model ?? '').catch(fail);
736
351
  }
737
- /** 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". */
738
353
  setDefaultReviewModel(body) {
739
354
  return this.ops.setDefaultReviewModel(body?.model ?? '').catch(fail);
740
355
  }
741
- // --- the registry of every task -----------------------------------------------------------
742
- tasks() {
743
- return this.ops.taskRegistry();
744
- }
745
- metrics() {
746
- return this.ops.metrics();
747
- }
748
356
  // --- helpers for the UI -----------------------------------------------------------------
749
357
  /**
750
358
  * Opens the machine's own folder dialog. A POST because it has a visible effect: a window
@@ -820,46 +428,18 @@ __decorate([
820
428
  __metadata("design:returntype", Promise)
821
429
  ], OperatorController.prototype, "deletePreset", null);
822
430
  __decorate([
823
- Get('personas'),
824
- __metadata("design:type", Function),
825
- __metadata("design:paramtypes", []),
826
- __metadata("design:returntype", Promise)
827
- ], OperatorController.prototype, "personas", null);
828
- __decorate([
829
- Put('personas/:name'),
830
- __param(0, Param('name')),
831
- __param(1, Body()),
832
- __metadata("design:type", Function),
833
- __metadata("design:paramtypes", [String, Object]),
834
- __metadata("design:returntype", Promise)
835
- ], OperatorController.prototype, "savePersona", null);
836
- __decorate([
837
- Delete('personas/:name'),
838
- __param(0, Param('name')),
431
+ Get('kerrigan'),
432
+ __param(0, Query('lang')),
839
433
  __metadata("design:type", Function),
840
434
  __metadata("design:paramtypes", [String]),
841
435
  __metadata("design:returntype", Promise)
842
- ], OperatorController.prototype, "deletePersona", null);
436
+ ], OperatorController.prototype, "kerrigan", null);
843
437
  __decorate([
844
438
  Get('sessions'),
845
439
  __metadata("design:type", Function),
846
440
  __metadata("design:paramtypes", []),
847
441
  __metadata("design:returntype", Promise)
848
442
  ], OperatorController.prototype, "sessions", null);
849
- __decorate([
850
- Put('sessions-order'),
851
- __param(0, Body()),
852
- __metadata("design:type", Function),
853
- __metadata("design:paramtypes", [Object]),
854
- __metadata("design:returntype", Promise)
855
- ], OperatorController.prototype, "reorderSessions", null);
856
- __decorate([
857
- Post('sessions'),
858
- __param(0, Body()),
859
- __metadata("design:type", Function),
860
- __metadata("design:paramtypes", [Object]),
861
- __metadata("design:returntype", Promise)
862
- ], OperatorController.prototype, "createSession", null);
863
443
  __decorate([
864
444
  Get('sessions/:id'),
865
445
  __param(0, Param('id')),
@@ -875,160 +455,6 @@ __decorate([
875
455
  __metadata("design:paramtypes", [String, Object]),
876
456
  __metadata("design:returntype", Promise)
877
457
  ], OperatorController.prototype, "updateSession", null);
878
- __decorate([
879
- Delete('sessions/:id'),
880
- __param(0, Param('id')),
881
- __metadata("design:type", Function),
882
- __metadata("design:paramtypes", [String]),
883
- __metadata("design:returntype", Promise)
884
- ], OperatorController.prototype, "deleteSession", null);
885
- __decorate([
886
- Post('sessions/:id/tasks'),
887
- __param(0, Param('id')),
888
- __param(1, Body()),
889
- __metadata("design:type", Function),
890
- __metadata("design:paramtypes", [String, Object]),
891
- __metadata("design:returntype", Promise)
892
- ], OperatorController.prototype, "addTask", null);
893
- __decorate([
894
- Put('sessions/:id/tasks/:taskId'),
895
- __param(0, Param('id')),
896
- __param(1, Param('taskId')),
897
- __param(2, Body()),
898
- __metadata("design:type", Function),
899
- __metadata("design:paramtypes", [String, String, Object]),
900
- __metadata("design:returntype", Promise)
901
- ], OperatorController.prototype, "updateTask", null);
902
- __decorate([
903
- Delete('sessions/:id/tasks/:taskId'),
904
- __param(0, Param('id')),
905
- __param(1, Param('taskId')),
906
- __metadata("design:type", Function),
907
- __metadata("design:paramtypes", [String, String]),
908
- __metadata("design:returntype", Promise)
909
- ], OperatorController.prototype, "deleteTask", null);
910
- __decorate([
911
- Post('sessions/:id/tasks/:taskId/notes'),
912
- __param(0, Param('id')),
913
- __param(1, Param('taskId')),
914
- __param(2, Body()),
915
- __metadata("design:type", Function),
916
- __metadata("design:paramtypes", [String, String, Object]),
917
- __metadata("design:returntype", Promise)
918
- ], OperatorController.prototype, "addTaskNote", null);
919
- __decorate([
920
- Post('sessions/:id/tasks/:taskId/accept'),
921
- __param(0, Param('id')),
922
- __param(1, Param('taskId')),
923
- __param(2, Body()),
924
- __metadata("design:type", Function),
925
- __metadata("design:paramtypes", [String, String, Object]),
926
- __metadata("design:returntype", Promise)
927
- ], OperatorController.prototype, "acceptTask", null);
928
- __decorate([
929
- Post('sessions/:id/tasks/:taskId/continue'),
930
- __param(0, Param('id')),
931
- __param(1, Param('taskId')),
932
- __param(2, Body()),
933
- __metadata("design:type", Function),
934
- __metadata("design:paramtypes", [String, String, Object]),
935
- __metadata("design:returntype", Promise)
936
- ], OperatorController.prototype, "continueTask", null);
937
- __decorate([
938
- Post('sessions/:id/tasks/:taskId/rerun'),
939
- __param(0, Param('id')),
940
- __param(1, Param('taskId')),
941
- __param(2, Body()),
942
- __metadata("design:type", Function),
943
- __metadata("design:paramtypes", [String, String, Object]),
944
- __metadata("design:returntype", Promise)
945
- ], OperatorController.prototype, "rerunTask", null);
946
- __decorate([
947
- Get('sessions/:id/tasks/:taskId/contract'),
948
- __param(0, Param('id')),
949
- __param(1, Param('taskId')),
950
- __metadata("design:type", Function),
951
- __metadata("design:paramtypes", [String, String]),
952
- __metadata("design:returntype", Promise)
953
- ], OperatorController.prototype, "contractCheck", null);
954
- __decorate([
955
- Post('sessions/:id/tasks/:taskId/contract-fix'),
956
- __param(0, Param('id')),
957
- __param(1, Param('taskId')),
958
- __param(2, Body()),
959
- __metadata("design:type", Function),
960
- __metadata("design:paramtypes", [String, String, Object]),
961
- __metadata("design:returntype", Promise)
962
- ], OperatorController.prototype, "applyContractFix", null);
963
- __decorate([
964
- Get('sessions/:id/tasks/:taskId/restore'),
965
- __param(0, Param('id')),
966
- __param(1, Param('taskId')),
967
- __metadata("design:type", Function),
968
- __metadata("design:paramtypes", [String, String]),
969
- __metadata("design:returntype", Promise)
970
- ], OperatorController.prototype, "restorePreview", null);
971
- __decorate([
972
- Post('sessions/:id/tasks/:taskId/restore'),
973
- __param(0, Param('id')),
974
- __param(1, Param('taskId')),
975
- __metadata("design:type", Function),
976
- __metadata("design:paramtypes", [String, String]),
977
- __metadata("design:returntype", Promise)
978
- ], OperatorController.prototype, "restore", null);
979
- __decorate([
980
- Get('sessions/:id/tasks/:taskId/undo'),
981
- __param(0, Param('id')),
982
- __param(1, Param('taskId')),
983
- __metadata("design:type", Function),
984
- __metadata("design:paramtypes", [String, String]),
985
- __metadata("design:returntype", Promise)
986
- ], OperatorController.prototype, "undoPreview", null);
987
- __decorate([
988
- Post('sessions/:id/tasks/:taskId/undo'),
989
- __param(0, Param('id')),
990
- __param(1, Param('taskId')),
991
- __param(2, Body()),
992
- __metadata("design:type", Function),
993
- __metadata("design:paramtypes", [String, String, Object]),
994
- __metadata("design:returntype", Promise)
995
- ], OperatorController.prototype, "undoTask", null);
996
- __decorate([
997
- Get('sessions/:id/tasks/:taskId/restart'),
998
- __param(0, Param('id')),
999
- __param(1, Param('taskId')),
1000
- __metadata("design:type", Function),
1001
- __metadata("design:paramtypes", [String, String]),
1002
- __metadata("design:returntype", Promise)
1003
- ], OperatorController.prototype, "restartPlan", null);
1004
- __decorate([
1005
- Post('sessions/:id/tasks/:taskId/restart'),
1006
- __param(0, Param('id')),
1007
- __param(1, Param('taskId')),
1008
- __param(2, Body()),
1009
- __metadata("design:type", Function),
1010
- __metadata("design:paramtypes", [String, String, Object]),
1011
- __metadata("design:returntype", Promise)
1012
- ], OperatorController.prototype, "restartFrom", null);
1013
- __decorate([
1014
- Get('sessions/:id/tasks/:taskId/log'),
1015
- __param(0, Param('id')),
1016
- __param(1, Param('taskId')),
1017
- __param(2, Res()),
1018
- __param(3, Query('run')),
1019
- __metadata("design:type", Function),
1020
- __metadata("design:paramtypes", [String, String, Object, String]),
1021
- __metadata("design:returntype", Promise)
1022
- ], OperatorController.prototype, "taskLog", null);
1023
- __decorate([
1024
- Post('sessions/:id/tasks/:taskId/log'),
1025
- __param(0, Param('id')),
1026
- __param(1, Param('taskId')),
1027
- __param(2, Query('run')),
1028
- __metadata("design:type", Function),
1029
- __metadata("design:paramtypes", [String, String, String]),
1030
- __metadata("design:returntype", Promise)
1031
- ], OperatorController.prototype, "saveTaskLog", null);
1032
458
  __decorate([
1033
459
  Get('sessions/:id/tasks/:taskId/story'),
1034
460
  __param(0, Param('id')),
@@ -1057,64 +483,6 @@ __decorate([
1057
483
  __metadata("design:paramtypes", [String, String, String, String]),
1058
484
  __metadata("design:returntype", Promise)
1059
485
  ], OperatorController.prototype, "taskChangeFile", null);
1060
- __decorate([
1061
- Get('sessions/:id/tasks/:taskId/files'),
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, "taskFiles", null);
1069
- __decorate([
1070
- Get('sessions/:id/tasks/:taskId/files/:kind/:name'),
1071
- __param(0, Param('id')),
1072
- __param(1, Param('taskId')),
1073
- __param(2, Param('kind')),
1074
- __param(3, Param('name')),
1075
- __param(4, Res()),
1076
- __param(5, Query('run')),
1077
- __metadata("design:type", Function),
1078
- __metadata("design:paramtypes", [String, String, String, String, Object, String]),
1079
- __metadata("design:returntype", Promise)
1080
- ], OperatorController.prototype, "taskFile", null);
1081
- __decorate([
1082
- Post('sessions/:id/tasks/:taskId/files/:kind/:name'),
1083
- __param(0, Param('id')),
1084
- __param(1, Param('taskId')),
1085
- __param(2, Param('kind')),
1086
- __param(3, Param('name')),
1087
- __param(4, Query('run')),
1088
- __metadata("design:type", Function),
1089
- __metadata("design:paramtypes", [String, String, String, String, String]),
1090
- __metadata("design:returntype", Promise)
1091
- ], OperatorController.prototype, "saveTaskFile", null);
1092
- __decorate([
1093
- Get('sessions/:id/export'),
1094
- __param(0, Param('id')),
1095
- __param(1, Res()),
1096
- __param(2, Query('tasks')),
1097
- __param(3, Query('variant')),
1098
- __metadata("design:type", Function),
1099
- __metadata("design:paramtypes", [String, Object, String, String]),
1100
- __metadata("design:returntype", Promise)
1101
- ], OperatorController.prototype, "exportTasks", null);
1102
- __decorate([
1103
- Get('debug/export'),
1104
- __param(0, Res()),
1105
- __param(1, Query('sessions')),
1106
- __metadata("design:type", Function),
1107
- __metadata("design:paramtypes", [Object, String]),
1108
- __metadata("design:returntype", Promise)
1109
- ], OperatorController.prototype, "debugExport", null);
1110
- __decorate([
1111
- Post('export/bundle'),
1112
- __param(0, Res()),
1113
- __param(1, Body()),
1114
- __metadata("design:type", Function),
1115
- __metadata("design:paramtypes", [Object, Object]),
1116
- __metadata("design:returntype", Promise)
1117
- ], OperatorController.prototype, "exportBundle", null);
1118
486
  __decorate([
1119
487
  Get('sessions/:id/tasks/:taskId/exchange'),
1120
488
  __param(0, Param('id')),
@@ -1125,16 +493,12 @@ __decorate([
1125
493
  __metadata("design:returntype", Promise)
1126
494
  ], OperatorController.prototype, "taskExchange", null);
1127
495
  __decorate([
1128
- Get('export/:kind'),
1129
- __param(0, Param('kind')),
1130
- __param(1, Res()),
1131
- __param(2, Query('run')),
1132
- __param(3, Query('session')),
1133
- __param(4, Query('task')),
496
+ Get('sessions/:id/events'),
497
+ __param(0, Param('id')),
1134
498
  __metadata("design:type", Function),
1135
- __metadata("design:paramtypes", [String, Object, String, String, String]),
1136
- __metadata("design:returntype", Promise)
1137
- ], OperatorController.prototype, "exportView", null);
499
+ __metadata("design:paramtypes", [String]),
500
+ __metadata("design:returntype", Object)
501
+ ], OperatorController.prototype, "events", null);
1138
502
  __decorate([
1139
503
  Post('sessions/:id/start'),
1140
504
  __param(0, Param('id')),
@@ -1143,20 +507,6 @@ __decorate([
1143
507
  __metadata("design:paramtypes", [String, Object]),
1144
508
  __metadata("design:returntype", Promise)
1145
509
  ], OperatorController.prototype, "start", null);
1146
- __decorate([
1147
- Get('start/options'),
1148
- __param(0, Query('sessions')),
1149
- __metadata("design:type", Function),
1150
- __metadata("design:paramtypes", [String]),
1151
- __metadata("design:returntype", Promise)
1152
- ], OperatorController.prototype, "startOptions", null);
1153
- __decorate([
1154
- Post('start/fetch'),
1155
- __param(0, Body()),
1156
- __metadata("design:type", Function),
1157
- __metadata("design:paramtypes", [Object]),
1158
- __metadata("design:returntype", Promise)
1159
- ], OperatorController.prototype, "startFetch", null);
1160
510
  __decorate([
1161
511
  Get('start/failures'),
1162
512
  __param(0, Query('unanswered')),
@@ -1187,74 +537,19 @@ __decorate([
1187
537
  __metadata("design:returntype", Promise)
1188
538
  ], OperatorController.prototype, "stop", null);
1189
539
  __decorate([
1190
- Get('batch'),
1191
- __metadata("design:type", Function),
1192
- __metadata("design:paramtypes", []),
1193
- __metadata("design:returntype", Object)
1194
- ], OperatorController.prototype, "batch", null);
1195
- __decorate([
1196
- Get('batch/name'),
1197
- __param(0, Query('sessions')),
540
+ Post('sessions/:id/pause'),
541
+ __param(0, Param('id')),
1198
542
  __metadata("design:type", Function),
1199
543
  __metadata("design:paramtypes", [String]),
1200
- __metadata("design:returntype", Promise)
1201
- ], OperatorController.prototype, "suggestRunName", null);
1202
- __decorate([
1203
- Post('batch/start'),
1204
- __param(0, Body()),
1205
- __metadata("design:type", Function),
1206
- __metadata("design:paramtypes", [Object]),
1207
- __metadata("design:returntype", Promise)
1208
- ], OperatorController.prototype, "startBatch", null);
1209
- __decorate([
1210
- Post('batch/stop'),
1211
- __metadata("design:type", Function),
1212
- __metadata("design:paramtypes", []),
1213
- __metadata("design:returntype", Promise)
1214
- ], OperatorController.prototype, "stopBatch", null);
1215
- __decorate([
1216
- Post('batch/pause'),
1217
- __metadata("design:type", Function),
1218
- __metadata("design:paramtypes", []),
1219
- __metadata("design:returntype", Promise)
1220
- ], OperatorController.prototype, "pauseBatch", null);
1221
- __decorate([
1222
- Post('batch/resume'),
1223
- __metadata("design:type", Function),
1224
- __metadata("design:paramtypes", []),
1225
- __metadata("design:returntype", Promise)
1226
- ], OperatorController.prototype, "resumeBatch", null);
544
+ __metadata("design:returntype", Object)
545
+ ], OperatorController.prototype, "pause", null);
1227
546
  __decorate([
1228
- Get('plan/brief'),
1229
- __param(0, Query('lang')),
547
+ Post('sessions/:id/resume'),
548
+ __param(0, Param('id')),
1230
549
  __metadata("design:type", Function),
1231
550
  __metadata("design:paramtypes", [String]),
1232
- __metadata("design:returntype", Promise)
1233
- ], OperatorController.prototype, "planBrief", null);
1234
- __decorate([
1235
- Get('context/:kind'),
1236
- __param(0, Param('kind')),
1237
- __param(1, Query('lang')),
1238
- __metadata("design:type", Function),
1239
- __metadata("design:paramtypes", [String, String]),
1240
- __metadata("design:returntype", Promise)
1241
- ], OperatorController.prototype, "context", null);
1242
- __decorate([
1243
- Put('context/:kind'),
1244
- __param(0, Param('kind')),
1245
- __param(1, Body()),
1246
- __metadata("design:type", Function),
1247
- __metadata("design:paramtypes", [String, Object]),
1248
- __metadata("design:returntype", Promise)
1249
- ], OperatorController.prototype, "setContext", null);
1250
- __decorate([
1251
- Delete('context/:kind'),
1252
- __param(0, Param('kind')),
1253
- __param(1, Query('lang')),
1254
- __metadata("design:type", Function),
1255
- __metadata("design:paramtypes", [String, String]),
1256
- __metadata("design:returntype", Promise)
1257
- ], OperatorController.prototype, "resetContext", null);
551
+ __metadata("design:returntype", Object)
552
+ ], OperatorController.prototype, "resume", null);
1258
553
  __decorate([
1259
554
  Get('workspace'),
1260
555
  __metadata("design:type", Function),
@@ -1275,100 +570,55 @@ __decorate([
1275
570
  __metadata("design:returntype", Promise)
1276
571
  ], OperatorController.prototype, "workspaceFile", null);
1277
572
  __decorate([
1278
- Get('chat/threads'),
1279
- __metadata("design:type", Function),
1280
- __metadata("design:paramtypes", []),
1281
- __metadata("design:returntype", Promise)
1282
- ], OperatorController.prototype, "chatThreads", null);
1283
- __decorate([
1284
- Post('chat'),
573
+ Put('workspace/file'),
1285
574
  __param(0, Body()),
1286
575
  __metadata("design:type", Function),
1287
576
  __metadata("design:paramtypes", [Object]),
1288
577
  __metadata("design:returntype", Promise)
1289
- ], OperatorController.prototype, "chatSend", null);
578
+ ], OperatorController.prototype, "saveWorkspaceFile", null);
1290
579
  __decorate([
1291
- Post('chat/:id/rewind'),
1292
- __param(0, Param('id')),
1293
- __param(1, Body()),
580
+ Get('workspace/git'),
1294
581
  __metadata("design:type", Function),
1295
- __metadata("design:paramtypes", [String, Object]),
582
+ __metadata("design:paramtypes", []),
1296
583
  __metadata("design:returntype", Promise)
1297
- ], OperatorController.prototype, "chatRewind", null);
584
+ ], OperatorController.prototype, "workspaceGit", null);
1298
585
  __decorate([
1299
- Get('sessions/:id/repo/tree'),
1300
- __param(0, Param('id')),
1301
- __param(1, Query('path')),
1302
- __param(2, Query('task')),
586
+ Get('workspace/git/commit'),
587
+ __param(0, Query('sha')),
1303
588
  __metadata("design:type", Function),
1304
- __metadata("design:paramtypes", [String, String, String]),
589
+ __metadata("design:paramtypes", [String]),
1305
590
  __metadata("design:returntype", Promise)
1306
- ], OperatorController.prototype, "repoTree", null);
591
+ ], OperatorController.prototype, "workspaceCommit", null);
1307
592
  __decorate([
1308
- Get('sessions/:id/repo/file'),
1309
- __param(0, Param('id')),
593
+ Get('workspace/git/file'),
594
+ __param(0, Query('area')),
1310
595
  __param(1, Query('path')),
1311
- __param(2, Query('task')),
596
+ __param(2, Query('commit')),
1312
597
  __metadata("design:type", Function),
1313
598
  __metadata("design:paramtypes", [String, String, String]),
1314
599
  __metadata("design:returntype", Promise)
1315
- ], OperatorController.prototype, "repoFile", null);
1316
- __decorate([
1317
- Get('sessions/:id/repo/log'),
1318
- __param(0, Param('id')),
1319
- __metadata("design:type", Function),
1320
- __metadata("design:paramtypes", [String]),
1321
- __metadata("design:returntype", Promise)
1322
- ], OperatorController.prototype, "repoLog", null);
1323
- __decorate([
1324
- Post('kerrigan/report'),
1325
- __param(0, Body()),
1326
- __metadata("design:type", Function),
1327
- __metadata("design:paramtypes", [Object]),
1328
- __metadata("design:returntype", Promise)
1329
- ], OperatorController.prototype, "kerriganReport", null);
600
+ ], OperatorController.prototype, "workspaceGitFile", null);
1330
601
  __decorate([
1331
- Post('changes/check'),
1332
- __param(0, Body()),
1333
- __metadata("design:type", Function),
1334
- __metadata("design:paramtypes", [Object]),
1335
- __metadata("design:returntype", Promise)
1336
- ], OperatorController.prototype, "checkChanges", null);
1337
- __decorate([
1338
- Post('changes/apply'),
1339
- __param(0, Body()),
1340
- __metadata("design:type", Function),
1341
- __metadata("design:paramtypes", [Object]),
1342
- __metadata("design:returntype", Promise)
1343
- ], OperatorController.prototype, "applyChanges", null);
1344
- __decorate([
1345
- Post('plan/check'),
1346
- __param(0, Body()),
602
+ Get('chat/threads'),
1347
603
  __metadata("design:type", Function),
1348
- __metadata("design:paramtypes", [Object]),
604
+ __metadata("design:paramtypes", []),
1349
605
  __metadata("design:returntype", Promise)
1350
- ], OperatorController.prototype, "checkPlan", null);
606
+ ], OperatorController.prototype, "chatThreads", null);
1351
607
  __decorate([
1352
- Post('plan/import'),
608
+ Post('chat'),
1353
609
  __param(0, Body()),
1354
610
  __metadata("design:type", Function),
1355
611
  __metadata("design:paramtypes", [Object]),
1356
612
  __metadata("design:returntype", Promise)
1357
- ], OperatorController.prototype, "importPlan", null);
1358
- __decorate([
1359
- Get('sessions/:id/events'),
1360
- __param(0, Param('id')),
1361
- __metadata("design:type", Function),
1362
- __metadata("design:paramtypes", [String]),
1363
- __metadata("design:returntype", Object)
1364
- ], OperatorController.prototype, "events", null);
613
+ ], OperatorController.prototype, "chatSend", null);
1365
614
  __decorate([
1366
- Sse('sessions/:id/stream'),
615
+ Post('chat/:id/rewind'),
1367
616
  __param(0, Param('id')),
617
+ __param(1, Body()),
1368
618
  __metadata("design:type", Function),
1369
- __metadata("design:paramtypes", [String]),
1370
- __metadata("design:returntype", Observable)
1371
- ], OperatorController.prototype, "stream", null);
619
+ __metadata("design:paramtypes", [String, Object]),
620
+ __metadata("design:returntype", Promise)
621
+ ], OperatorController.prototype, "chatRewind", null);
1372
622
  __decorate([
1373
623
  Get('approvals'),
1374
624
  __param(0, Query('session')),
@@ -1392,14 +642,6 @@ __decorate([
1392
642
  __metadata("design:paramtypes", [String, Object]),
1393
643
  __metadata("design:returntype", Object)
1394
644
  ], OperatorController.prototype, "decidePlan", null);
1395
- __decorate([
1396
- Post('sessions/:id/mode'),
1397
- __param(0, Param('id')),
1398
- __param(1, Body()),
1399
- __metadata("design:type", Function),
1400
- __metadata("design:paramtypes", [String, Object]),
1401
- __metadata("design:returntype", Object)
1402
- ], OperatorController.prototype, "setMode", null);
1403
645
  __decorate([
1404
646
  Get('activity'),
1405
647
  __metadata("design:type", Function),
@@ -1419,13 +661,6 @@ __decorate([
1419
661
  __metadata("design:paramtypes", [Object]),
1420
662
  __metadata("design:returntype", Promise)
1421
663
  ], OperatorController.prototype, "setProject", null);
1422
- __decorate([
1423
- Get('repo/sync'),
1424
- __param(0, Query('dir')),
1425
- __metadata("design:type", Function),
1426
- __metadata("design:paramtypes", [String]),
1427
- __metadata("design:returntype", Promise)
1428
- ], OperatorController.prototype, "repoSync", null);
1429
664
  __decorate([
1430
665
  Post('repo/prepare/preview'),
1431
666
  __param(0, Body()),
@@ -1440,43 +675,6 @@ __decorate([
1440
675
  __metadata("design:paramtypes", [Object]),
1441
676
  __metadata("design:returntype", Promise)
1442
677
  ], OperatorController.prototype, "repoPrepare", null);
1443
- __decorate([
1444
- Get('repo'),
1445
- __param(0, Query('dir')),
1446
- __metadata("design:type", Function),
1447
- __metadata("design:paramtypes", [String]),
1448
- __metadata("design:returntype", Object)
1449
- ], OperatorController.prototype, "repo", null);
1450
- __decorate([
1451
- Get('sessions/:id/vcs'),
1452
- __param(0, Param('id')),
1453
- __metadata("design:type", Function),
1454
- __metadata("design:paramtypes", [String]),
1455
- __metadata("design:returntype", Promise)
1456
- ], OperatorController.prototype, "vcsStatus", null);
1457
- __decorate([
1458
- Get('batch/vcs'),
1459
- __param(0, Query('ids')),
1460
- __param(1, Query('tasks')),
1461
- __metadata("design:type", Function),
1462
- __metadata("design:paramtypes", [String, String]),
1463
- __metadata("design:returntype", Promise)
1464
- ], OperatorController.prototype, "runVcs", null);
1465
- __decorate([
1466
- Post('batch/vcs/prepare'),
1467
- __param(0, Body()),
1468
- __metadata("design:type", Function),
1469
- __metadata("design:paramtypes", [Object]),
1470
- __metadata("design:returntype", Promise)
1471
- ], OperatorController.prototype, "runVcsPrepare", null);
1472
- __decorate([
1473
- Post('sessions/:id/vcs/snapshot'),
1474
- __param(0, Param('id')),
1475
- __param(1, Body()),
1476
- __metadata("design:type", Function),
1477
- __metadata("design:paramtypes", [String, Object]),
1478
- __metadata("design:returntype", Promise)
1479
- ], OperatorController.prototype, "vcsSnapshot", null);
1480
678
  __decorate([
1481
679
  Get('models'),
1482
680
  __metadata("design:type", Function),
@@ -1510,18 +708,6 @@ __decorate([
1510
708
  __metadata("design:paramtypes", [Object]),
1511
709
  __metadata("design:returntype", Promise)
1512
710
  ], OperatorController.prototype, "setDefaultReviewModel", null);
1513
- __decorate([
1514
- Get('tasks'),
1515
- __metadata("design:type", Function),
1516
- __metadata("design:paramtypes", []),
1517
- __metadata("design:returntype", Promise)
1518
- ], OperatorController.prototype, "tasks", null);
1519
- __decorate([
1520
- Get('metrics'),
1521
- __metadata("design:type", Function),
1522
- __metadata("design:paramtypes", []),
1523
- __metadata("design:returntype", Promise)
1524
- ], OperatorController.prototype, "metrics", null);
1525
711
  __decorate([
1526
712
  Post('browse-folder'),
1527
713
  __param(0, Body()),