copilot-operator 0.1.13 → 0.1.15

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 (77) hide show
  1. package/README.md +9 -14
  2. package/dist/src/api/operator.controller.js +31 -42
  3. package/dist/src/api/operator.service.js +663 -367
  4. package/dist/src/api/saveToDesktop.js +1 -1
  5. package/dist/src/api/security.js +40 -10
  6. package/dist/src/api/server.js +75 -12
  7. package/dist/src/api/settings.js +156 -15
  8. package/dist/src/cli.js +108 -97
  9. package/dist/src/config/handWritten.js +36 -0
  10. package/dist/src/config/layout.js +13 -4
  11. package/dist/src/config/lockedPolicy.js +56 -22
  12. package/dist/src/config/schema.js +13 -84
  13. package/dist/src/context/desktopDir.js +44 -0
  14. package/dist/src/exec/authorizer.js +9 -1
  15. package/dist/src/exec/checks.js +240 -23
  16. package/dist/src/exec/dangerous.js +29 -5
  17. package/dist/src/exec/network.js +105 -28
  18. package/dist/src/exec/redaction.js +52 -9
  19. package/dist/src/exec/reportFile.js +4 -5
  20. package/dist/src/exec/runner.js +146 -13
  21. package/dist/src/exec/shells.js +41 -6
  22. package/dist/src/exec/workDir.js +4 -4
  23. package/dist/src/orchestrator/derivedChecks.js +1 -0
  24. package/dist/src/orchestrator/review.js +25 -3
  25. package/dist/src/orchestrator/taskRunner.js +476 -163
  26. package/dist/src/plan/brief.js +37 -44
  27. package/dist/src/plan/importPlan.js +15 -7
  28. package/dist/src/plan/schema.js +64 -29
  29. package/dist/src/plan/script.js +0 -15
  30. package/dist/src/plan/systemGuide.js +2 -177
  31. package/dist/src/protocol/parser.js +5 -1
  32. package/dist/src/session/debugExport.js +1 -1
  33. package/dist/src/session/exportRecord.js +1 -1
  34. package/dist/src/session/exports.js +49 -9
  35. package/dist/src/session/store.js +215 -80
  36. package/dist/src/vcs/scope.js +29 -6
  37. package/dist/src/vcs/taskVcs.js +78 -10
  38. package/dist/web/404.html +2 -2
  39. package/dist/web/_next/static/chunks/36-94660f1cde2da529.js +1 -0
  40. package/dist/web/_next/static/chunks/549-9548d9a132c8c7d4.js +1 -0
  41. package/dist/web/_next/static/chunks/867-8b95ae984befc0e2.js +1 -0
  42. package/dist/web/_next/static/chunks/app/defaults/page-71a43ed69134b48d.js +1 -0
  43. package/dist/web/_next/static/chunks/app/sessions/view/page-886f5fc99e146408.js +1 -0
  44. package/dist/web/_next/static/css/{a0642fdb8adf9edb.css → e2a2c9eb3c226313.css} +1 -1
  45. package/dist/web/appearance.html +2 -2
  46. package/dist/web/appearance.txt +12 -12
  47. package/dist/web/defaults.html +2 -2
  48. package/dist/web/defaults.txt +12 -12
  49. package/dist/web/history.html +2 -2
  50. package/dist/web/history.txt +12 -12
  51. package/dist/web/import.html +2 -2
  52. package/dist/web/import.txt +12 -12
  53. package/dist/web/index.html +2 -2
  54. package/dist/web/index.txt +12 -12
  55. package/dist/web/level1.html +2 -2
  56. package/dist/web/level1.txt +12 -12
  57. package/dist/web/presets.html +2 -2
  58. package/dist/web/presets.txt +12 -12
  59. package/dist/web/sessions/view.html +2 -2
  60. package/dist/web/sessions/view.txt +12 -12
  61. package/dist/web/system.html +2 -2
  62. package/dist/web/system.txt +12 -12
  63. package/package.json +18 -10
  64. package/prompts/level1.md +2 -1
  65. package/prompts/organisation.bg.md +0 -1
  66. package/prompts/organisation.en.md +0 -1
  67. package/dist/src/context/contextFiles.js +0 -295
  68. package/dist/src/context/desktopMirror.js +0 -173
  69. package/dist/src/context/projectMirror.js +0 -432
  70. package/dist/web/_next/static/chunks/295-04151ded0741d18d.js +0 -1
  71. package/dist/web/_next/static/chunks/36-c3dd06c6a459c114.js +0 -1
  72. package/dist/web/_next/static/chunks/549-a5a59a94f92bb3eb.js +0 -1
  73. package/dist/web/_next/static/chunks/867-84c19f047972ffc3.js +0 -1
  74. package/dist/web/_next/static/chunks/app/defaults/page-5f180a88398be4c9.js +0 -1
  75. package/dist/web/_next/static/chunks/app/sessions/view/page-34d7988849f9aa76.js +0 -1
  76. /package/dist/web/_next/static/{NosxirjkOgV-Boyq8dGPl → IwNZiBrEMAcXEUFj2miiU}/_buildManifest.js +0 -0
  77. /package/dist/web/_next/static/{NosxirjkOgV-Boyq8dGPl → IwNZiBrEMAcXEUFj2miiU}/_ssgManifest.js +0 -0
@@ -28,6 +28,8 @@ import { effectiveShell, preferredShell, refusalForChat, resolveShell, shellNote
28
28
  import { describeStep, checkCommandRefusal } from '../exec/policy.js';
29
29
  import { validateDerivedChecks } from './derivedChecks.js';
30
30
  import { writeReport } from '../exec/reportFile.js';
31
+ import { mergeRedactions } from '../exec/redaction.js';
32
+ import { trackedRepoOf } from '../vcs/taskVcs.js';
31
33
  import { buildCoveringMessage, assertSendable } from '../protocol/reporter.js';
32
34
  /** The sentence both sides get when a review left something listening. */
33
35
  function leftoverNote(leftovers) {
@@ -50,7 +52,8 @@ export function deliverableFor(task, summary, tracked, changedFiles) {
50
52
  return undefined;
51
53
  }
52
54
  export function reviewBrief(session, task, changedFiles, cwd, deviations = [], previous, disputes = [], derivedFailing = [], earlier = [], deliverable) {
53
- const repo = session.vcs?.enabled ? session.vcs.repoDir?.trim() : '';
55
+ // The same repository the runner branched and read the changed files from, however it is named.
56
+ const repo = trackedRepoOf(session);
54
57
  const files = changedFiles.length > 0 ? changedFiles.map((f) => `- ${f}`).join('\n') : '(version control recorded no file changes for this task)';
55
58
  return [
56
59
  '## The task that was given',
@@ -224,8 +227,8 @@ export async function runReview(transport, session, task, deps) {
224
227
  // The machine's shells, when they are not what the contract's example assumes — the same note
225
228
  // the implementer's conversation opens with, for a conversation working to the same example.
226
229
  const machineNote = shellNote(undefined, defaultShell);
227
- let before = await transport.sendAndConfirm(machineNote ? `${contract}
228
-
230
+ let before = await transport.sendAndConfirm(machineNote ? `${contract}
231
+
229
232
  ${machineNote}` : contract);
230
233
  await transport.waitForReply(before);
231
234
  await pacer.throttleSend();
@@ -375,10 +378,17 @@ ${machineNote}` : contract);
375
378
  defaultShell,
376
379
  tracker: deps.tracker,
377
380
  passEnv: cfg.execution.passEnv,
381
+ // What these checks say goes back to the reviewer (below) and into the next brief, so it
382
+ // is redacted with the operator's patterns where it is said, as the gate's checks are.
383
+ redactPatterns: cfg.report.redactPatterns,
378
384
  });
379
385
  if (validation.refused.length > 0 && !derivedRetried) {
380
386
  derivedRetried = true;
381
387
  deps.event('review-check-refused', { round, refused: validation.refused.map((r) => r.finding.id) }, `${validation.refused.length} check(s) given with findings pass on the work as it is, so they do not capture the defect; sent back once`, 'warn');
388
+ const redactions = mergeRedactions(validation.refused.map((r) => r.outcome.redactions ?? []));
389
+ if (redactions.length > 0) {
390
+ deps.event('report-redacted', { round, refusedChecks: true, redactions }, `redacted from the checks sent back to the reviewer: ${redactions.map((r) => `${r.count}× ${r.name}`).join(', ')}`, 'warn');
391
+ }
382
392
  await pacer.throttleSend();
383
393
  const b = await transport.sendAndConfirm(refusedChecksMessage(validation.refused.map((r) => ({ id: r.finding.id, detail: r.outcome.detail }))));
384
394
  markdown = (await transport.waitForReply(b)).markdown;
@@ -463,6 +473,9 @@ ${machineNote}` : contract);
463
473
  stepsRun += 1;
464
474
  results.push(result);
465
475
  deps.event('review-step-finished', { round, id: step.id, outcome: result.outcome, exitCode: result.exitCode, shell: result.shell, requestedShell: result.requestedShell ?? null, shellPath: result.shellPath ?? '' }, `review step ${step.id}: ${result.outcome}, exit ${result.exitCode}, ${(result.durationMs / 1000).toFixed(1)}s`);
476
+ // Stopped while it ran: no step after it is started, and the report waits below.
477
+ if (signal?.aborted)
478
+ break;
466
479
  await pacer.settle();
467
480
  }
468
481
  const report = await writeReport(results, {
@@ -479,6 +492,15 @@ ${machineNote}` : contract);
479
492
  if (report.redactions.length > 0) {
480
493
  deps.event('report-redacted', { round, iteration: iterations, redactions: report.redactions }, `redacted before upload: ${report.redactions.map((r) => `${r.count}× ${r.name}`).join(', ')}`, 'warn');
481
494
  }
495
+ /*
496
+ * Stopped while a step ran. Looked at only at the top of the loop, the signal let the report of
497
+ * the cut-short step be uploaded and the reviewer's answer be waited for before the review
498
+ * noticed. The runner's chat refuses to send once the run is stopped (`sendsUntilStopped`),
499
+ * but that is the runner covering for this loop; the review ends on a Stop by itself, the way
500
+ * the runner's own loop does: the report is written for the record and nothing more is sent.
501
+ */
502
+ if (signal?.aborted)
503
+ return { verdict: 'error', findings: [], stepsRun, iterations, problem: 'the run was stopped' };
482
504
  const covering = buildCoveringMessage({
483
505
  task: `review of "${task.title}"`,
484
506
  iteration: iterations,