copilot-operator 0.1.97 → 0.1.99

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 (82) hide show
  1. package/dist/src/api/folderPicker.js +22 -22
  2. package/dist/src/api/operator.controller.js +21 -9
  3. package/dist/src/api/operator.service.js +233 -39
  4. package/dist/src/config/exportHome.js +51 -9
  5. package/dist/src/config/home.js +27 -11
  6. package/dist/src/exec/authorizer.js +11 -4
  7. package/dist/src/exec/commandHeads.js +25 -0
  8. package/dist/src/exec/confinement.js +50 -4
  9. package/dist/src/exec/network.js +11 -1
  10. package/dist/src/exec/npmScripts.js +33 -0
  11. package/dist/src/exec/policy.js +70 -6
  12. package/dist/src/exec/processes.js +24 -5
  13. package/dist/src/exec/programs.js +21 -0
  14. package/dist/src/exec/reportFile.js +2 -1
  15. package/dist/src/exec/runner.js +31 -9
  16. package/dist/src/exec/scriptFiles.js +133 -6
  17. package/dist/src/orchestrator/handoff.js +3 -3
  18. package/dist/src/orchestrator/kerriganRunner.js +14 -6
  19. package/dist/src/orchestrator/leadRunner.js +43 -23
  20. package/dist/src/orchestrator/review.js +66 -10
  21. package/dist/src/orchestrator/taskRunner.js +73 -14
  22. package/dist/src/plan/kerrigan.js +253 -253
  23. package/dist/src/plan/schema.js +3 -13
  24. package/dist/src/plan/systemGuide.js +2 -2
  25. package/dist/src/protocol/kerriganSchema.js +5 -1
  26. package/dist/src/protocol/replySchema.js +2 -2
  27. package/dist/src/queue/queue.js +86 -0
  28. package/dist/src/session/compose.js +14 -10
  29. package/dist/src/session/locatorFailures.js +27 -6
  30. package/dist/src/session/model.js +19 -0
  31. package/dist/src/session/workspace.js +20 -5
  32. package/dist/src/transport/copilotTransport.js +82 -62
  33. package/dist/src/util/zip.js +147 -44
  34. package/dist/src/vcs/newBranch.js +20 -3
  35. package/dist/src/vcs/referenceGuard.js +9 -4
  36. package/dist/web/404.html +2 -2
  37. package/dist/web/_next/static/chunks/1077.a4fe6ae48f3d3ff9.js +1 -0
  38. package/dist/web/_next/static/chunks/1548.765d6eed5325bd01.js +1 -0
  39. package/dist/web/_next/static/chunks/2163.e8d6c85412d5d411.js +1 -0
  40. package/dist/web/_next/static/chunks/{8124-967df691ec1bfeeb.js → 6240-8ba644c53ffab87d.js} +1 -1
  41. package/dist/web/_next/static/chunks/714.f2dcd6b41b58d1a7.js +1 -0
  42. package/dist/web/_next/static/chunks/7220.652a8a339c1e7401.js +1 -0
  43. package/dist/web/_next/static/chunks/7921-9cf1ece94fc89bb3.js +1 -0
  44. package/dist/web/_next/static/chunks/{8584.3301b056c97be517.js → 8584.7c438425140f1d8d.js} +1 -1
  45. package/dist/web/_next/static/chunks/9067.8c4e6a64620a45d9.js +1 -0
  46. package/dist/web/_next/static/chunks/9747.43d25bdff8737d09.js +1 -0
  47. package/dist/web/_next/static/chunks/app/{layout-7943a4391ad2f88f.js → layout-97259931ed97e20d.js} +1 -1
  48. package/dist/web/_next/static/chunks/app/page-26e4ea30eb076e6b.js +1 -0
  49. package/dist/web/_next/static/chunks/app/queue/page-7228e045f8ea10c4.js +1 -0
  50. package/dist/web/_next/static/chunks/app/settings/page-c915d61553e1025b.js +1 -0
  51. package/dist/web/_next/static/chunks/app/system/page-4d24f44eb9077fb7.js +1 -0
  52. package/dist/web/_next/static/chunks/{webpack-710628d673fa4afb.js → webpack-31db88c3d5781520.js} +1 -1
  53. package/dist/web/_next/static/css/{523d11041085f836.css → 87999096d96266fd.css} +1 -1
  54. package/dist/web/defaults.html +2 -2
  55. package/dist/web/defaults.txt +26 -25
  56. package/dist/web/index.html +3 -3
  57. package/dist/web/index.txt +26 -25
  58. package/dist/web/queue.html +2 -2
  59. package/dist/web/queue.txt +26 -25
  60. package/dist/web/settings.html +2 -2
  61. package/dist/web/settings.txt +26 -25
  62. package/dist/web/system.html +2 -2
  63. package/dist/web/system.txt +26 -25
  64. package/package.json +3 -2
  65. package/prompts/kerrigan1.md +2 -1
  66. package/prompts/lead1.md +2 -1
  67. package/prompts/level1.md +6 -1
  68. package/prompts/review1.md +7 -4
  69. package/dist/web/_next/static/chunks/1077.4da389906036b1bb.js +0 -1
  70. package/dist/web/_next/static/chunks/1548.4aa3e42afe4542ab.js +0 -1
  71. package/dist/web/_next/static/chunks/2163.4c6ce20cf967756c.js +0 -1
  72. package/dist/web/_next/static/chunks/714.ffb1325246519f64.js +0 -1
  73. package/dist/web/_next/static/chunks/7220.f483b83c11525063.js +0 -1
  74. package/dist/web/_next/static/chunks/7921-946e538fe3f9630f.js +0 -1
  75. package/dist/web/_next/static/chunks/9067.03cdfb01ebf6a35d.js +0 -1
  76. package/dist/web/_next/static/chunks/9747.fe06238bc42bd23d.js +0 -1
  77. package/dist/web/_next/static/chunks/app/page-6ec948e0cf4b24f0.js +0 -1
  78. package/dist/web/_next/static/chunks/app/queue/page-9cfc8f78d536cfb6.js +0 -1
  79. package/dist/web/_next/static/chunks/app/settings/page-9c2b961beb8b3dce.js +0 -1
  80. package/dist/web/_next/static/chunks/app/system/page-3466496814a70b62.js +0 -1
  81. /package/dist/web/_next/static/{D3ew46wEw5JXPsTVwZwFC → n8n-2FmbL8PhXulu4hTV5}/_buildManifest.js +0 -0
  82. /package/dist/web/_next/static/{D3ew46wEw5JXPsTVwZwFC → n8n-2FmbL8PhXulu4hTV5}/_ssgManifest.js +0 -0
@@ -13,28 +13,28 @@
13
13
  import { spawn } from 'node:child_process';
14
14
  import { existsSync } from 'node:fs';
15
15
  /** Nothing is interpolated into the script; the start folder goes in as an environment variable. */
16
- const SCRIPT = `
17
- Add-Type -AssemblyName System.Windows.Forms | Out-Null
18
- $dialog = New-Object System.Windows.Forms.FolderBrowserDialog
19
- $dialog.Description = 'Select the project folder'
20
- $dialog.ShowNewFolderButton = $false
21
- if ($env:COP_PICKER_START -and (Test-Path -LiteralPath $env:COP_PICKER_START)) {
22
- $dialog.SelectedPath = $env:COP_PICKER_START
23
- }
24
- # An owner window that is always on top, so the dialog lands in front of the browser
25
- # instead of behind it.
26
- $owner = New-Object System.Windows.Forms.Form
27
- $owner.TopMost = $true
28
- $owner.ShowInTaskbar = $false
29
- $owner.Opacity = 0
30
- $owner.Show()
31
- $result = $dialog.ShowDialog($owner)
32
- $owner.Close()
33
- if ($result -eq [System.Windows.Forms.DialogResult]::OK) {
34
- [Console]::Out.Write('PICKED:' + $dialog.SelectedPath)
35
- } else {
36
- [Console]::Out.Write('CANCELLED')
37
- }
16
+ const SCRIPT = `
17
+ Add-Type -AssemblyName System.Windows.Forms | Out-Null
18
+ $dialog = New-Object System.Windows.Forms.FolderBrowserDialog
19
+ $dialog.Description = 'Select the project folder'
20
+ $dialog.ShowNewFolderButton = $false
21
+ if ($env:COP_PICKER_START -and (Test-Path -LiteralPath $env:COP_PICKER_START)) {
22
+ $dialog.SelectedPath = $env:COP_PICKER_START
23
+ }
24
+ # An owner window that is always on top, so the dialog lands in front of the browser
25
+ # instead of behind it.
26
+ $owner = New-Object System.Windows.Forms.Form
27
+ $owner.TopMost = $true
28
+ $owner.ShowInTaskbar = $false
29
+ $owner.Opacity = 0
30
+ $owner.Show()
31
+ $result = $dialog.ShowDialog($owner)
32
+ $owner.Close()
33
+ if ($result -eq [System.Windows.Forms.DialogResult]::OK) {
34
+ [Console]::Out.Write('PICKED:' + $dialog.SelectedPath)
35
+ } else {
36
+ [Console]::Out.Write('CANCELLED')
37
+ }
38
38
  `;
39
39
  /** Windows PowerShell first: it is always present and its dialog is the familiar one. */
40
40
  function shellCandidates() {
@@ -23,7 +23,7 @@ import { Body, Controller, Delete, Get, Inject, Param, Post, Put, Query, Res, No
23
23
  import { OperatorService } from './operator.service.js';
24
24
  import { SettingsUnusableError } from './settings.js';
25
25
  import { PolicyLockUnusableError } from '../config/lockedPolicy.js';
26
- import { CHANGED_ON_DISK } from '../session/workspace.js';
26
+ import { CHANGED_ON_DISK, GONE_FROM_DISK } from '../session/workspace.js';
27
27
  import { join } from 'node:path';
28
28
  import { DefaultChatLocators, DefaultPickerLocators } from '../transport/locators.js';
29
29
  import { platformTools } from '../exec/platforms.js';
@@ -247,15 +247,20 @@ let OperatorController = class OperatorController {
247
247
  return this.ops.exportSizes();
248
248
  }
249
249
  /** Everything the bot has kept, as a .zip: `data/`, and `runs/` with `?runs=1`. See `config/exportHome.ts`. */
250
- exportHome(runs, res) {
250
+ async exportHome(runs, res) {
251
251
  try {
252
- const { fileName, content } = this.ops.exportHome(runs === '1' || runs === 'true');
252
+ const { fileName, write } = this.ops.exportHome(runs === '1' || runs === 'true');
253
253
  res.type('application/zip');
254
254
  res.setHeader('content-disposition', contentDisposition(fileName));
255
- res.send(content);
255
+ // Sent as it is written (2026-11-19), so its length is not known beforehand.
256
+ await write(res);
257
+ res.end();
256
258
  }
257
259
  catch (e) {
258
- failText(res, e);
260
+ if (!res.headersSent)
261
+ failText(res, e);
262
+ else
263
+ res.destroy(e);
259
264
  }
260
265
  }
261
266
  /** What the bot's console showed, the latest lines, as a text file. See `log/terminal.ts`. */
@@ -313,7 +318,12 @@ let OperatorController = class OperatorController {
313
318
  workspaceFile(path, dir) {
314
319
  if (!path)
315
320
  throw new BadRequestException('path is required');
316
- return this.ops.workspaceFile(path, dir || undefined).catch(fail);
321
+ return this.ops.workspaceFile(path, dir || undefined).catch((e) => {
322
+ // Not there: 404, so the editor can tell it from a refusal (2026-11-19).
323
+ if (e.code === GONE_FROM_DISK)
324
+ throw new NotFoundException(e.message);
325
+ return fail(e);
326
+ });
317
327
  }
318
328
  /**
319
329
  * The editor saving a file of the open folder. `base` is the version it was opened at; a file changed on disk since
@@ -325,11 +335,13 @@ let OperatorController = class OperatorController {
325
335
  if (typeof body.text !== 'string')
326
336
  throw new BadRequestException('text is required');
327
337
  try {
328
- return await this.ops.saveWorkspaceFile(body.path, body.text, typeof body.base === 'string' && body.base ? body.base : undefined, typeof body.dir === 'string' && body.dir ? body.dir : undefined);
338
+ return await this.ops.saveWorkspaceFile(body.path, body.text, typeof body.base === 'string' && body.base ? body.base : undefined, typeof body.dir === 'string' && body.dir ? body.dir : undefined, body.again === true);
329
339
  }
330
340
  catch (e) {
331
341
  if (e.code === CHANGED_ON_DISK)
332
342
  throw new ConflictException(e.message);
343
+ if (e.code === GONE_FROM_DISK)
344
+ throw new NotFoundException(e.message);
333
345
  fail(e);
334
346
  }
335
347
  }
@@ -451,7 +463,7 @@ let OperatorController = class OperatorController {
451
463
  }
452
464
  /** The list as the page edits it: added, changed, moved, taken out, put back to wait. */
453
465
  setQueue(body = {}) {
454
- return this.ops.setQueue(body?.items).catch(fail);
466
+ return this.ops.setQueue(body?.items, body?.seen).catch(fail);
455
467
  }
456
468
  runQueue() {
457
469
  return this.ops.runQueue().catch(fail);
@@ -786,7 +798,7 @@ __decorate([
786
798
  __param(1, Res()),
787
799
  __metadata("design:type", Function),
788
800
  __metadata("design:paramtypes", [Object, Object]),
789
- __metadata("design:returntype", void 0)
801
+ __metadata("design:returntype", Promise)
790
802
  ], OperatorController.prototype, "exportHome", null);
791
803
  __decorate([
792
804
  Get('terminal'),