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.
- package/dist/src/api/folderPicker.js +22 -22
- package/dist/src/api/operator.controller.js +21 -9
- package/dist/src/api/operator.service.js +233 -39
- package/dist/src/config/exportHome.js +51 -9
- package/dist/src/config/home.js +27 -11
- package/dist/src/exec/authorizer.js +11 -4
- package/dist/src/exec/commandHeads.js +25 -0
- package/dist/src/exec/confinement.js +50 -4
- package/dist/src/exec/network.js +11 -1
- package/dist/src/exec/npmScripts.js +33 -0
- package/dist/src/exec/policy.js +70 -6
- package/dist/src/exec/processes.js +24 -5
- package/dist/src/exec/programs.js +21 -0
- package/dist/src/exec/reportFile.js +2 -1
- package/dist/src/exec/runner.js +31 -9
- package/dist/src/exec/scriptFiles.js +133 -6
- package/dist/src/orchestrator/handoff.js +3 -3
- package/dist/src/orchestrator/kerriganRunner.js +14 -6
- package/dist/src/orchestrator/leadRunner.js +43 -23
- package/dist/src/orchestrator/review.js +66 -10
- package/dist/src/orchestrator/taskRunner.js +73 -14
- package/dist/src/plan/kerrigan.js +253 -253
- package/dist/src/plan/schema.js +3 -13
- package/dist/src/plan/systemGuide.js +2 -2
- package/dist/src/protocol/kerriganSchema.js +5 -1
- package/dist/src/protocol/replySchema.js +2 -2
- package/dist/src/queue/queue.js +86 -0
- package/dist/src/session/compose.js +14 -10
- package/dist/src/session/locatorFailures.js +27 -6
- package/dist/src/session/model.js +19 -0
- package/dist/src/session/workspace.js +20 -5
- package/dist/src/transport/copilotTransport.js +82 -62
- package/dist/src/util/zip.js +147 -44
- package/dist/src/vcs/newBranch.js +20 -3
- package/dist/src/vcs/referenceGuard.js +9 -4
- package/dist/web/404.html +2 -2
- package/dist/web/_next/static/chunks/1077.a4fe6ae48f3d3ff9.js +1 -0
- package/dist/web/_next/static/chunks/1548.765d6eed5325bd01.js +1 -0
- package/dist/web/_next/static/chunks/2163.e8d6c85412d5d411.js +1 -0
- package/dist/web/_next/static/chunks/{8124-967df691ec1bfeeb.js → 6240-8ba644c53ffab87d.js} +1 -1
- package/dist/web/_next/static/chunks/714.f2dcd6b41b58d1a7.js +1 -0
- package/dist/web/_next/static/chunks/7220.652a8a339c1e7401.js +1 -0
- package/dist/web/_next/static/chunks/7921-9cf1ece94fc89bb3.js +1 -0
- package/dist/web/_next/static/chunks/{8584.3301b056c97be517.js → 8584.7c438425140f1d8d.js} +1 -1
- package/dist/web/_next/static/chunks/9067.8c4e6a64620a45d9.js +1 -0
- package/dist/web/_next/static/chunks/9747.43d25bdff8737d09.js +1 -0
- package/dist/web/_next/static/chunks/app/{layout-7943a4391ad2f88f.js → layout-97259931ed97e20d.js} +1 -1
- package/dist/web/_next/static/chunks/app/page-26e4ea30eb076e6b.js +1 -0
- package/dist/web/_next/static/chunks/app/queue/page-7228e045f8ea10c4.js +1 -0
- package/dist/web/_next/static/chunks/app/settings/page-c915d61553e1025b.js +1 -0
- package/dist/web/_next/static/chunks/app/system/page-4d24f44eb9077fb7.js +1 -0
- package/dist/web/_next/static/chunks/{webpack-710628d673fa4afb.js → webpack-31db88c3d5781520.js} +1 -1
- package/dist/web/_next/static/css/{523d11041085f836.css → 87999096d96266fd.css} +1 -1
- package/dist/web/defaults.html +2 -2
- package/dist/web/defaults.txt +26 -25
- package/dist/web/index.html +3 -3
- package/dist/web/index.txt +26 -25
- package/dist/web/queue.html +2 -2
- package/dist/web/queue.txt +26 -25
- package/dist/web/settings.html +2 -2
- package/dist/web/settings.txt +26 -25
- package/dist/web/system.html +2 -2
- package/dist/web/system.txt +26 -25
- package/package.json +3 -2
- package/prompts/kerrigan1.md +2 -1
- package/prompts/lead1.md +2 -1
- package/prompts/level1.md +6 -1
- package/prompts/review1.md +7 -4
- package/dist/web/_next/static/chunks/1077.4da389906036b1bb.js +0 -1
- package/dist/web/_next/static/chunks/1548.4aa3e42afe4542ab.js +0 -1
- package/dist/web/_next/static/chunks/2163.4c6ce20cf967756c.js +0 -1
- package/dist/web/_next/static/chunks/714.ffb1325246519f64.js +0 -1
- package/dist/web/_next/static/chunks/7220.f483b83c11525063.js +0 -1
- package/dist/web/_next/static/chunks/7921-946e538fe3f9630f.js +0 -1
- package/dist/web/_next/static/chunks/9067.03cdfb01ebf6a35d.js +0 -1
- package/dist/web/_next/static/chunks/9747.fe06238bc42bd23d.js +0 -1
- package/dist/web/_next/static/chunks/app/page-6ec948e0cf4b24f0.js +0 -1
- package/dist/web/_next/static/chunks/app/queue/page-9cfc8f78d536cfb6.js +0 -1
- package/dist/web/_next/static/chunks/app/settings/page-9c2b961beb8b3dce.js +0 -1
- package/dist/web/_next/static/chunks/app/system/page-3466496814a70b62.js +0 -1
- /package/dist/web/_next/static/{D3ew46wEw5JXPsTVwZwFC → n8n-2FmbL8PhXulu4hTV5}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{D3ew46wEw5JXPsTVwZwFC → n8n-2FmbL8PhXulu4hTV5}/_ssgManifest.js +0 -0
|
@@ -38,6 +38,7 @@ import { allAboutTheTask, isRepeat, findingId } from '../protocol/reviewSchema.j
|
|
|
38
38
|
import { repoState, workingTreePaths } from '../vcs/git.js';
|
|
39
39
|
import { describeStep, checkAccessRefusal, checkCommandRefusal, commandRefusal } from '../exec/policy.js';
|
|
40
40
|
import { networkFetchReason } from '../exec/network.js';
|
|
41
|
+
import { npmHooksNote } from '../exec/npmScripts.js';
|
|
41
42
|
import { handoffCard, handoffOutcomeOf, handoffResultMessage, HANDOFF_NOBODY, MAX_SHELL_ENDING_RETURNS, shellEndingLines, shellEndingMessage } from './handoff.js';
|
|
42
43
|
import { chosenSaid } from './chosenAnswers.js';
|
|
43
44
|
import { gitConfigMessage, watchGitConfig } from '../vcs/gitConfigGuard.js';
|
|
@@ -58,7 +59,7 @@ import { composeHandoff } from '../session/handoff.js';
|
|
|
58
59
|
import { ProgressWatch } from './progress.js';
|
|
59
60
|
import { contractConflicts, readsTreeClean } from './contract.js';
|
|
60
61
|
import { commitFiles, treeFingerprint } from '../vcs/git.js';
|
|
61
|
-
import { isContinuable, withProblemAt } from '../session/model.js';
|
|
62
|
+
import { approvedPlanOf, isContinuable, withProblemAt } from '../session/model.js';
|
|
62
63
|
import { prepareForTask, commitTaskResult, commitShortfall, repoDirOf, trackedRepoOf, whereLeft } from '../vcs/taskVcs.js';
|
|
63
64
|
import { protectInputs, inputsMessage, inputsAtCommit, untrackedInputs, blobOfFile } from '../vcs/inputs.js';
|
|
64
65
|
import { artifactPatterns, artifactState, keepArtifacts } from '../vcs/artifacts.js';
|
|
@@ -584,8 +585,13 @@ export async function enterSessionConversation(transport, session, opts) {
|
|
|
584
585
|
if (!byName) {
|
|
585
586
|
if (opts.closeOnFailure)
|
|
586
587
|
await transport.close();
|
|
587
|
-
|
|
588
|
-
|
|
588
|
+
/*
|
|
589
|
+
* A stop, as any conversation the window cannot be put back on (second bug hunt, 2026-11-19): a plain error ended
|
|
590
|
+
* the lead's message, or Kerrigan's, "failed" when the window went back to it from another conversation, telling
|
|
591
|
+
* the operator to start a new session, which the chat has none of. Continue tries it again.
|
|
592
|
+
*/
|
|
593
|
+
throw new ChatLost(session.chat.chatId, 'neither its address nor its name in the sidebar', `The conversation "${session.chat.name}" could not be opened again, by its address or by its name in Copilot's sidebar: ` +
|
|
594
|
+
'it may have been deleted in Copilot. Nothing was sent to it. Carried on with "Continue", or sent again, it is tried again; a new chat starts a fresh conversation.');
|
|
589
595
|
}
|
|
590
596
|
}
|
|
591
597
|
}
|
|
@@ -993,14 +999,6 @@ const CHAT_NOTE = [
|
|
|
993
999
|
'never rewrite history; the runner refuses those. The operator can put the folder back to before any message.',
|
|
994
1000
|
].join('\n');
|
|
995
1001
|
/** Runs one task to completion inside an already-open transport. */
|
|
996
|
-
/** The approved plan a task works to: its own attempt's, else, for a continuation, the latest one before it. */
|
|
997
|
-
function approvedPlanOf(task) {
|
|
998
|
-
if (task.plan?.approved)
|
|
999
|
-
return task.plan;
|
|
1000
|
-
if (!task.continuing)
|
|
1001
|
-
return undefined;
|
|
1002
|
-
return [...(task.attempts ?? [])].reverse().find((a) => a.plan?.approved)?.plan;
|
|
1003
|
-
}
|
|
1004
1002
|
export async function runTask(transport, session, task, deps) {
|
|
1005
1003
|
const { cfg, store, bus, authorizer, signal } = deps;
|
|
1006
1004
|
// Every attempt gets its own folder. The first keeps the original name, so nothing that
|
|
@@ -1282,9 +1280,13 @@ export async function runTask(transport, session, task, deps) {
|
|
|
1282
1280
|
const reap = async (since, by) => {
|
|
1283
1281
|
if (!since)
|
|
1284
1282
|
return [];
|
|
1285
|
-
const result = await reapLeftovers(work.cwd, since, tracker).catch(() =>
|
|
1286
|
-
|
|
1283
|
+
const result = await reapLeftovers(work.cwd, since, tracker).catch((e) => ({ killed: [], failed: [], notOurs: [], unread: e.message }));
|
|
1284
|
+
// Not read is not "nothing left" (third hunt, 2026-11-20): said, on the record and in the run.
|
|
1285
|
+
if (result.unread) {
|
|
1286
|
+
sink.event('processes-unread', { by, why: result.unread }, `what ${by} left running could not be looked at: ${result.unread}. A server it started may still be running and holding its port.`, 'warn');
|
|
1287
|
+
await record(`LEFT RUNNING BY ${by.toUpperCase()}: NOT KNOWN`, `${result.unread}. Nothing was stopped; a server it started may still be running.`);
|
|
1287
1288
|
return [];
|
|
1289
|
+
}
|
|
1288
1290
|
if (result.notOurs.length > 0) {
|
|
1289
1291
|
sink.event('processes-not-ours', { by, count: result.notOurs.length, pids: result.notOurs.map((l) => l.pid) }, `${result.notOurs.length} new process(es) in the project folder were not started by the bot, so they were left running: ` +
|
|
1290
1292
|
result.notOurs.map((l) => `${l.name} pid ${l.pid}${l.ports.length > 0 ? ` (port ${l.ports.join(', ')})` : ''}`).join('; '), 'info');
|
|
@@ -1340,6 +1342,19 @@ export async function runTask(transport, session, task, deps) {
|
|
|
1340
1342
|
await record(`ENDING: ${status.toUpperCase()}`, [summary ?? '', reason ? `Reason: ${reason}` : ''].filter(Boolean).join('\n\n') || '(no details)');
|
|
1341
1343
|
// The net under the plan's own checks: whatever the task left running is stopped and named.
|
|
1342
1344
|
await reap(processesBefore, 'the task');
|
|
1345
|
+
/*
|
|
1346
|
+
* The projects for reference looked at once more, after what the task left running is stopped (third hunt,
|
|
1347
|
+
* 2026-11-20): a step stopped by the operator ended the round before its look, and a server left running kept writing
|
|
1348
|
+
* after the last one — what they changed stayed changed.
|
|
1349
|
+
*/
|
|
1350
|
+
if (reference?.active) {
|
|
1351
|
+
const touched = await reference.check().catch(() => []);
|
|
1352
|
+
if (touched.length > 0) {
|
|
1353
|
+
const all = touched.every((c) => c.putBack);
|
|
1354
|
+
sink.event('reference-put-back', { end: true, changes: touched }, `at the end of the task, a project for reference only had changed, ${all ? 'put back' : 'NOT all put back'}: ${touched.map((c) => `${c.name}: ${describeChange(c)}`).join('; ')}`, all ? 'warn' : 'error');
|
|
1355
|
+
await record('REFERENCE PUT BACK AT THE END', referenceMessage(touched));
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1343
1358
|
await reference?.close().catch(() => undefined);
|
|
1344
1359
|
reference = null;
|
|
1345
1360
|
/*
|
|
@@ -1951,6 +1966,8 @@ export async function runTask(transport, session, task, deps) {
|
|
|
1951
1966
|
const openingNotes = await store.takeUnsentNotes(session.id, task.id).catch(() => []);
|
|
1952
1967
|
const opening = composeOpening({
|
|
1953
1968
|
level1,
|
|
1969
|
+
// Nothing is committed in the operator's chat: a carry-on there is not told its changes were (third hunt, 2026-11-20).
|
|
1970
|
+
...(session.vcs?.enabled ? {} : { noCommits: true }),
|
|
1954
1971
|
level2: task.level2,
|
|
1955
1972
|
prompt: task.prompt,
|
|
1956
1973
|
taskTitle: task.title,
|
|
@@ -2162,6 +2179,13 @@ export async function runTask(transport, session, task, deps) {
|
|
|
2162
2179
|
const ran = await runChecks(checks, checkOptions);
|
|
2163
2180
|
for (const o of ran)
|
|
2164
2181
|
lastGate.set(o.check.name, { passed: o.passed, detail: o.detail });
|
|
2182
|
+
// What the checks changed in a project for reference is put back now, not blamed on the next step (third hunt, 2026-11-20).
|
|
2183
|
+
const touchedByChecks = reference?.active ? await reference.check().catch(() => []) : [];
|
|
2184
|
+
if (touchedByChecks.length > 0) {
|
|
2185
|
+
const all = touchedByChecks.every((c) => c.putBack);
|
|
2186
|
+
sink.event('reference-put-back', { checks: true, changes: touchedByChecks }, `the checks changed a project for reference only, ${all ? 'put back' : 'NOT all put back'}: ${touchedByChecks.map((c) => `${c.name}: ${describeChange(c)}`).join('; ')}`, all ? 'warn' : 'error');
|
|
2187
|
+
runnerNotes.push(referenceMessage(touchedByChecks, 'checks'));
|
|
2188
|
+
}
|
|
2165
2189
|
/*
|
|
2166
2190
|
* The operator stopped the run, which is not a verdict on the work. The check in flight was
|
|
2167
2191
|
* killed and the ones after it never ran, so what this round "found" is only the Stop: it is
|
|
@@ -2479,6 +2503,8 @@ export async function runTask(transport, session, task, deps) {
|
|
|
2479
2503
|
deliverable,
|
|
2480
2504
|
deviations,
|
|
2481
2505
|
disputes,
|
|
2506
|
+
// The operator's notes the implementer was given, for the reviewer to judge the work by them too (third hunt, 2026-11-20).
|
|
2507
|
+
notes: ((await store.getSession(session.id).catch(() => null))?.tasks.find((x) => x.id === task.id)?.notes ?? []).filter((n) => n.sentAt).map((n) => n.text),
|
|
2482
2508
|
/*
|
|
2483
2509
|
* The approved plan, for the review to hold the work to (plan mode, 2026-10-13): this attempt's, or —
|
|
2484
2510
|
* carried on in its chat — the one the attempt it continues worked to.
|
|
@@ -2729,6 +2755,29 @@ export async function runTask(transport, session, task, deps) {
|
|
|
2729
2755
|
* recorded as skipped. Ended `aborted` "before the review", it named a review that did not
|
|
2730
2756
|
* exist, and a batch that stops on a failure counted it as one and skipped the sessions after.
|
|
2731
2757
|
*/
|
|
2758
|
+
/*
|
|
2759
|
+
* The operator's notes not sent yet, sent before a "done" is accepted (third hunt, 2026-11-20): they went out only with
|
|
2760
|
+
* the opening and with a round's report, so a note written while the chat wrote its "done", or during the checks or
|
|
2761
|
+
* the review, was never sent once the review passed — and "where it and the task disagree, this wins". True when some
|
|
2762
|
+
* went, with the chat's answer to them in `lastMarkdown` for the loop to read.
|
|
2763
|
+
*/
|
|
2764
|
+
const sendLateNotes = async () => {
|
|
2765
|
+
const late = await store.takeUnsentNotes(session.id, task.id).catch(() => []);
|
|
2766
|
+
if (late.length === 0)
|
|
2767
|
+
return false;
|
|
2768
|
+
const message = `${operatorNotesSection(late, true)}\n\n` +
|
|
2769
|
+
'The operator wrote this before your "done" was accepted. If the work already does what it asks, say "done" again; if not, ' +
|
|
2770
|
+
'carry on with status "continue".';
|
|
2771
|
+
sink.event('operator-note-sent', { notes: late.length, with: 'before done', iteration: iterations }, `${late.length} note(s) from the operator go out before the "done" is accepted`);
|
|
2772
|
+
await record('OPERATOR NOTES BEFORE DONE — MESSAGE SENT', message);
|
|
2773
|
+
await pacer.throttleSend();
|
|
2774
|
+
const before = await transport.sendAndConfirm(message);
|
|
2775
|
+
const next = await transport.waitForReply(before);
|
|
2776
|
+
await saveReply(`notes-before-done-${iterations}`, next);
|
|
2777
|
+
lastMarkdown = next.markdown;
|
|
2778
|
+
await pacer.settle();
|
|
2779
|
+
return true;
|
|
2780
|
+
};
|
|
2732
2781
|
const settleDone = async (summary) => {
|
|
2733
2782
|
const verdict = await gateOnChecks();
|
|
2734
2783
|
if (verdict === 'stopped')
|
|
@@ -2755,8 +2804,12 @@ export async function runTask(transport, session, task, deps) {
|
|
|
2755
2804
|
const reviewed = await gateOnReview(summary);
|
|
2756
2805
|
if (reviewed === 'stopped')
|
|
2757
2806
|
return await finish('aborted', 'stopped by the operator during the review', summary, lastMarkdown);
|
|
2758
|
-
if (reviewed === 'accept')
|
|
2807
|
+
if (reviewed === 'accept') {
|
|
2808
|
+
// A note written during the checks or the review goes out, and the work is judged again on the chat's answer.
|
|
2809
|
+
if (await sendLateNotes())
|
|
2810
|
+
return null;
|
|
2759
2811
|
return await finish('done', undefined, summary, lastMarkdown);
|
|
2812
|
+
}
|
|
2760
2813
|
if (reviewed === 'give-up')
|
|
2761
2814
|
return await finish('blocked', reviewBlockedReason(), summary, lastMarkdown);
|
|
2762
2815
|
return null;
|
|
@@ -3203,6 +3256,8 @@ export async function runTask(transport, session, task, deps) {
|
|
|
3203
3256
|
return await finish('blocked', sentences(blockedReason(reply.tried, reply.needed), early), reply.summary, lastMarkdown);
|
|
3204
3257
|
}
|
|
3205
3258
|
if (done && reply.steps.length === 0) {
|
|
3259
|
+
if (await sendLateNotes())
|
|
3260
|
+
continue;
|
|
3206
3261
|
const ended = await settleDone(reply.summary);
|
|
3207
3262
|
if (ended)
|
|
3208
3263
|
return ended;
|
|
@@ -3392,6 +3447,10 @@ export async function runTask(transport, session, task, deps) {
|
|
|
3392
3447
|
sink.event('step-environment', { id: step.id, requested: result.requestedShell ?? null, available: result.shellProblem.available }, result.shellProblem.message, 'error');
|
|
3393
3448
|
break;
|
|
3394
3449
|
}
|
|
3450
|
+
// npm's "pre" and "post" scripts, left out with scripts off: said with the step's output (third hunt, 2026-11-20).
|
|
3451
|
+
const hooks = result.outcome === 'refused' ? null : npmHooksNote(step.cmd, work.cwd, effectiveShell(step.shell));
|
|
3452
|
+
if (hooks)
|
|
3453
|
+
result.stderr = `${result.stderr}${result.stderr.endsWith('\n') || !result.stderr ? '' : '\n'}[runner] ${hooks}\n`;
|
|
3395
3454
|
/*
|
|
3396
3455
|
* A project for reference only changed: put back as it was, the chat told with the step's own output, and
|
|
3397
3456
|
* the rest of the round not run — a step after it could build on what was just undone.
|