copilot-operator 0.1.51 → 0.1.53
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/README.md +24 -3
- package/dist/src/api/operator.controller.js +55 -71
- package/dist/src/api/operator.service.js +243 -109
- package/dist/src/config/schema.js +45 -0
- package/dist/src/exec/policy.js +11 -1
- package/dist/src/exec/scriptFiles.js +108 -2
- package/dist/src/orchestrator/leadRunner.js +605 -0
- package/dist/src/orchestrator/review.js +9 -3
- package/dist/src/orchestrator/taskRunner.js +110 -20
- package/dist/src/plan/kerrigan.js +203 -47
- package/dist/src/plan/systemGuide.js +555 -499
- package/dist/src/protocol/leadSchema.js +156 -0
- package/dist/src/protocol/parser.js +1 -1
- package/dist/src/session/chatNotice.js +115 -0
- package/dist/src/session/checkpoint.js +19 -0
- package/dist/src/session/compose.js +17 -5
- package/dist/src/session/store.js +21 -72
- package/dist/src/transport/copilotTransport.js +2 -0
- package/dist/src/util/pacing.js +33 -2
- package/dist/src/vcs/git.js +11 -1
- package/dist/src/vcs/referenceGuard.js +299 -0
- package/dist/web/404.html +14 -18
- package/dist/web/_next/static/FGzV3mVZpXRCVjiw1diNu/_buildManifest.js +1 -0
- package/dist/web/_next/static/chunks/163.980c5145848efbdf.js +1 -0
- package/dist/web/_next/static/chunks/220.447d1d8624d4644c.js +1 -0
- package/dist/web/_next/static/chunks/500-34d01f8d8d73eb2c.js +1 -0
- package/dist/web/_next/static/chunks/548.c6dfd1cb270f3c93.js +1 -0
- package/dist/web/_next/static/chunks/584.fc9e061dd4069406.js +1 -0
- package/dist/web/_next/static/chunks/67.1a3ca07919abce27.js +1 -0
- package/dist/web/_next/static/chunks/714.5b2e291a430adc9c.js +1 -0
- package/dist/web/_next/static/chunks/747.157732b5b3f3c435.js +1 -0
- package/dist/web/_next/static/chunks/77.d478a6f2eafe31e3.js +1 -0
- package/dist/web/_next/static/chunks/921-b2219533c5a6e38f.js +1 -0
- package/dist/web/_next/static/chunks/app/defaults/page-b7e4e94a55e65806.js +1 -0
- package/dist/web/_next/static/chunks/app/layout-2b3718748721c1ac.js +1 -0
- package/dist/web/_next/static/chunks/app/page-59b9867b52914a6c.js +1 -0
- package/dist/web/_next/static/chunks/app/system/page-1cf9e75e76da59ed.js +1 -0
- package/dist/web/_next/static/chunks/webpack-0c3cad1f3181d857.js +1 -0
- package/dist/web/_next/static/css/06f314fa5fccd68d.css +1 -0
- package/dist/web/defaults.html +14 -18
- package/dist/web/defaults.txt +9 -9
- package/dist/web/index.html +14 -18
- package/dist/web/index.txt +9 -9
- package/dist/web/system.html +14 -18
- package/dist/web/system.txt +9 -9
- package/package.json +8 -5
- package/prompts/lead1.md +116 -0
- package/prompts/level1.md +32 -12
- package/prompts/review1.md +287 -286
- package/dist/src/vcs/prepareFromRemote.js +0 -288
- package/dist/src/vcs/remoteAuth.js +0 -117
- package/dist/src/vcs/syncCommand.js +0 -97
- package/dist/web/_next/static/chunks/190-70555f20dd0da19b.js +0 -1
- package/dist/web/_next/static/chunks/643-e85d221d57900ed7.js +0 -1
- package/dist/web/_next/static/chunks/867-869900ec999e6345.js +0 -1
- package/dist/web/_next/static/chunks/app/appearance/page-cdef33c421397cbe.js +0 -1
- package/dist/web/_next/static/chunks/app/defaults/page-e0a2b8f9a41a94c4.js +0 -1
- package/dist/web/_next/static/chunks/app/layout-b4fc21e26e1bad95.js +0 -1
- package/dist/web/_next/static/chunks/app/level1/page-31b74cae86d960d8.js +0 -1
- package/dist/web/_next/static/chunks/app/page-1075921d44db3e4d.js +0 -1
- package/dist/web/_next/static/chunks/app/presets/page-f8abdd83cdf468f7.js +0 -1
- package/dist/web/_next/static/chunks/app/system/page-2a270bb885885821.js +0 -1
- package/dist/web/_next/static/chunks/webpack-0f31b926d9a9c5a4.js +0 -1
- package/dist/web/_next/static/css/8b14cb3cf0051138.css +0 -1
- package/dist/web/_next/static/eqTUTH_SJtBgNgq8Zzy3n/_buildManifest.js +0 -1
- package/dist/web/appearance.html +0 -18
- package/dist/web/appearance.txt +0 -25
- package/dist/web/level1.html +0 -18
- package/dist/web/level1.txt +0 -25
- package/dist/web/presets.html +0 -21
- package/dist/web/presets.txt +0 -25
- /package/dist/web/_next/static/{eqTUTH_SJtBgNgq8Zzy3n → FGzV3mVZpXRCVjiw1diNu}/_ssgManifest.js +0 -0
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { createHash } from 'node:crypto';
|
|
14
14
|
import { readFile, mkdir, writeFile, appendFile } from 'node:fs/promises';
|
|
15
|
-
import { join, resolve } from 'node:path';
|
|
15
|
+
import { basename, join, resolve } from 'node:path';
|
|
16
16
|
import { buttonShows, normModel } from '../transport/modelMatch.js';
|
|
17
17
|
import { createTransport, isReplyTimeout, WindowClosed } from '../transport/chatTransport.js';
|
|
18
18
|
import { buildChatName, chatCode, loadPointer, savePointer } from '../transport/chatSession.js';
|
|
@@ -35,12 +35,13 @@ import { describeStep, checkCommandRefusal, commandRefusal } from '../exec/polic
|
|
|
35
35
|
import { networkFetchReason } from '../exec/network.js';
|
|
36
36
|
import { collectPolicyManifest, describePolicyManifest } from '../exec/policyManifest.js';
|
|
37
37
|
import { assessIsolation, readIsolationSignals } from '../exec/isolation.js';
|
|
38
|
-
import { confinementRefusal, sessionRoots } from '../exec/confinement.js';
|
|
38
|
+
import { confinementRefusal, isWithin, sessionRoots } from '../exec/confinement.js';
|
|
39
39
|
import { writeReport } from '../exec/reportFile.js';
|
|
40
|
-
import { Pacer } from '../util/pacing.js';
|
|
40
|
+
import { gapFrom, Pacer } from '../util/pacing.js';
|
|
41
41
|
import { RunLog } from '../log/runLog.js';
|
|
42
42
|
import { composeOpening, operatorNotesSection, readOnlyNote } from '../session/compose.js';
|
|
43
|
-
import {
|
|
43
|
+
import { describeChange, ReferenceGuard, referenceMessage, referenceNote } from '../vcs/referenceGuard.js';
|
|
44
|
+
import { changedSince, takeAfter, takeCheckpoint } from '../session/checkpoint.js';
|
|
44
45
|
import { MIN_TRIED_APPROACHES } from '../protocol/replySchema.js';
|
|
45
46
|
import { enforceScope, scopeMessage, scopeNote } from '../vcs/scope.js';
|
|
46
47
|
import { PLAN_FIRST, PLAN_NOT_NOW, PLAN_NUDGE_AFTER, describePlan, planApprovedMessage, planFrom, planModeNote, planNudge, planReviseMessage } from './planMode.js';
|
|
@@ -53,6 +54,7 @@ import { prepareForTask, commitTaskResult, commitShortfall, repoDirOf, trackedRe
|
|
|
53
54
|
import { protectInputs, inputsMessage, inputsAtCommit, untrackedInputs, blobOfFile } from '../vcs/inputs.js';
|
|
54
55
|
import { artifactPatterns, artifactState, keepArtifacts } from '../vcs/artifacts.js';
|
|
55
56
|
import { exportMachine, writeAttemptRecord } from '../session/exports.js';
|
|
57
|
+
import { runLeadTask } from './leadRunner.js';
|
|
56
58
|
/**
|
|
57
59
|
* Causes no conversation can change: the task contradicts itself, the machine lacks what a step needs,
|
|
58
60
|
* a check can never run. A fresh chat is no cure for these, and retrying them in one only repeats the
|
|
@@ -277,7 +279,7 @@ export class StoppedSend extends Error {
|
|
|
277
279
|
* checks — and holding here holds all of them, the ones added later included. `hold` resolves true when the run
|
|
278
280
|
* was stopped while held: then nothing is sent.
|
|
279
281
|
*/
|
|
280
|
-
function holdsWhilePaused(transport, hold) {
|
|
282
|
+
export function holdsWhilePaused(transport, hold) {
|
|
281
283
|
return new Proxy(transport, {
|
|
282
284
|
get(target, key) {
|
|
283
285
|
if (key === 'sendAndConfirm') {
|
|
@@ -293,7 +295,7 @@ function holdsWhilePaused(transport, hold) {
|
|
|
293
295
|
});
|
|
294
296
|
}
|
|
295
297
|
/** One place that writes to the transcript, the console and the live stream at once. */
|
|
296
|
-
class Sink {
|
|
298
|
+
export class Sink {
|
|
297
299
|
log;
|
|
298
300
|
bus;
|
|
299
301
|
sessionId;
|
|
@@ -540,6 +542,10 @@ async function joinGroupConversation(store, session, bus) {
|
|
|
540
542
|
});
|
|
541
543
|
return updated;
|
|
542
544
|
}
|
|
545
|
+
/** Which conversation of the two-chat mode a session's is, for the cards that ask about its model (2026-10-20). */
|
|
546
|
+
export function roleOf(session) {
|
|
547
|
+
return session.workerOf ? { role: 'worker' } : session.lead ? { role: 'lead' } : {};
|
|
548
|
+
}
|
|
543
549
|
/**
|
|
544
550
|
* Marks a run's failure as one of opening the browser, its profile, the sign-in or the conversation, so the notice of
|
|
545
551
|
* a start that could not begin says "opening the browser" rather than "the run" (2026-10-20: with the batch's own
|
|
@@ -608,7 +614,7 @@ export function modelByHand(session, cfg) {
|
|
|
608
614
|
return true;
|
|
609
615
|
return session.kind === 'chat' && !effectiveModels(session, cfg).model;
|
|
610
616
|
}
|
|
611
|
-
async function applySessionModel(transport, session, bus, cfg, store, hooks,
|
|
617
|
+
export async function applySessionModel(transport, session, bus, cfg, store, hooks,
|
|
612
618
|
/** Whether the conversation was opened new for this run, rather than one the session already had. */
|
|
613
619
|
fresh = true,
|
|
614
620
|
/** The run's Stop: the picker's waits end with it, and nothing is sent. */
|
|
@@ -644,7 +650,7 @@ signal) {
|
|
|
644
650
|
const why = cfg.copilot.manualModel ? 'Settings ask for the model to be chosen by hand' : 'the session asks for the model to be set by hand';
|
|
645
651
|
const hand = wanted && buttonShows(shown, wanted)
|
|
646
652
|
? { result: { ok: true, current: wanted, by: 'already' }, goOnAsItIs: false }
|
|
647
|
-
: await withOperatorHand(transport, wanted, { ok: false, current: shown, reason: why }, hooks, session.id, bus, true);
|
|
653
|
+
: await withOperatorHand(transport, wanted, { ok: false, current: shown, reason: why }, hooks, session.id, bus, true, roleOf(session));
|
|
648
654
|
if (!wanted) {
|
|
649
655
|
const now = await transport.currentModel().catch(() => null);
|
|
650
656
|
if (hand.result.ok || hand.goOnAsItIs) {
|
|
@@ -732,16 +738,20 @@ signal) {
|
|
|
732
738
|
* choose it in the Copilot window; "check and go on" reads the picker button again, and asks again while it
|
|
733
739
|
* still shows another model. With no model asked for, whatever the operator chose is taken.
|
|
734
740
|
*/
|
|
735
|
-
async function withOperatorHand(transport, wanted, first, hooks, sessionId, bus, manual
|
|
741
|
+
async function withOperatorHand(transport, wanted, first, hooks, sessionId, bus, manual,
|
|
742
|
+
/** For the review's own conversation: the card says so, and why its model is best another, stronger one. For the
|
|
743
|
+
* lead's or the worker's conversation of the two-chat mode: the card says which it is (2026-10-20). */
|
|
744
|
+
opts = {}) {
|
|
736
745
|
let result = first;
|
|
737
746
|
for (let tries = 1; !result.ok && hooks?.askHelp; tries += 1) {
|
|
738
747
|
const shown = await transport.currentModel().catch(() => null);
|
|
748
|
+
const what = `${wanted ? `"${wanted}"` : 'the model'}${opts.review ? ' for the review' : opts.role ? ` for the ${opts.role}` : ''}`;
|
|
739
749
|
bus.publish({ sessionId, type: 'model-help-asked', level: 'warn',
|
|
740
750
|
message: manual
|
|
741
|
-
? `asking the operator to choose ${
|
|
742
|
-
: `the chat could not be put on
|
|
743
|
-
data: { asked: wanted, shown, why: result.reason ?? '', tries, manual } });
|
|
744
|
-
const answer = await hooks.askHelp({ sessionId, asked: wanted, shown, why: result.reason ?? 'unknown reason', tries, ...(manual ? { manual: true } : {}) });
|
|
751
|
+
? `asking the operator to choose ${what} in the Copilot window (by hand; picker shows "${shown ?? 'nothing'}")`
|
|
752
|
+
: `the chat could not be put on ${what} by the runner; asking the operator to choose it in the Copilot window (picker shows "${shown ?? 'nothing'}")`,
|
|
753
|
+
data: { asked: wanted, shown, why: result.reason ?? '', tries, manual, ...(opts.review ? { review: true } : {}), ...(opts.role ? { role: opts.role } : {}) } });
|
|
754
|
+
const answer = await hooks.askHelp({ sessionId, asked: wanted, shown, why: result.reason ?? 'unknown reason', tries, ...(manual ? { manual: true } : {}), ...(opts.review ? { review: true } : {}), ...(opts.role ? { role: opts.role } : {}) });
|
|
745
755
|
if (answer === 'stop')
|
|
746
756
|
return { result, goOnAsItIs: false };
|
|
747
757
|
if (answer === 'continue') {
|
|
@@ -863,6 +873,10 @@ export async function runTask(transport, session, task, deps) {
|
|
|
863
873
|
enabled: cfg.pacing.enabled,
|
|
864
874
|
settleMs: cfg.pacing.settleMs,
|
|
865
875
|
maxMessagesPerHour: cfg.pacing.maxMessagesPerHour,
|
|
876
|
+
// The operator's pause between messages (2026-10-21), said in the log when a message waits for it.
|
|
877
|
+
gapMs: gapFrom(cfg.pacing),
|
|
878
|
+
signal,
|
|
879
|
+
onGap: (ms) => sink.event('pacing-gap', { ms }, `the next message waits ${Math.ceil(ms / 1000)} s: Settings ask for a pause between messages`),
|
|
866
880
|
});
|
|
867
881
|
const artifactsDir = log.path('artifacts');
|
|
868
882
|
const reportsDir = log.path('reports');
|
|
@@ -925,6 +939,8 @@ export async function runTask(transport, session, task, deps) {
|
|
|
925
939
|
let disputes = [];
|
|
926
940
|
/** What the runner tells the model in its next message about the reply just processed. */
|
|
927
941
|
let runnerNotes = [];
|
|
942
|
+
/** The projects for reference only, watched for the length of the task (see `vcs/referenceGuard.ts`). */
|
|
943
|
+
let reference = null;
|
|
928
944
|
/** Steps the chat sent that were not run, for the handoff at the end. */
|
|
929
945
|
const notRun = [];
|
|
930
946
|
/**
|
|
@@ -1044,6 +1060,8 @@ export async function runTask(transport, session, task, deps) {
|
|
|
1044
1060
|
await record(`ENDING: ${status.toUpperCase()}`, [summary ?? '', reason ? `Reason: ${reason}` : ''].filter(Boolean).join('\n\n') || '(no details)');
|
|
1045
1061
|
// The net under the plan's own checks: whatever the task left running is stopped and named.
|
|
1046
1062
|
await reap(processesBefore, 'the task');
|
|
1063
|
+
await reference?.close().catch(() => undefined);
|
|
1064
|
+
reference = null;
|
|
1047
1065
|
/*
|
|
1048
1066
|
* A chat message: the folder photographed again after it, on top of its checkpoint, so what it changed is
|
|
1049
1067
|
* one commit's worth of files, shown under the message and in the changes view. Nothing is committed on the
|
|
@@ -1394,8 +1412,26 @@ export async function runTask(transport, session, task, deps) {
|
|
|
1394
1412
|
const confinement = {
|
|
1395
1413
|
roots: sessionRoots(work.cwd, [cfg.project.rootDir, ...cfg.project.others.map((o) => o.rootDir)]),
|
|
1396
1414
|
cwd: work.cwd,
|
|
1415
|
+
// A script committed after this is the work's, not the project's (see `ownScriptRefusal`).
|
|
1416
|
+
workStartedAt: session.createdAt,
|
|
1397
1417
|
};
|
|
1398
1418
|
sink.event('confinement', { roots: confinement.roots }, `commands are confined to ${confinement.roots.join(', ')}`);
|
|
1419
|
+
/*
|
|
1420
|
+
* The projects for reference only (operator, 2026-10-21) that this task can reach: photographed now, and after every
|
|
1421
|
+
* step compared with that, whatever changed put back (see `vcs/referenceGuard.ts`).
|
|
1422
|
+
*/
|
|
1423
|
+
const forReference = [
|
|
1424
|
+
...(cfg.project.readOnly && cfg.project.rootDir ? [{ name: cfg.project.name || basename(cfg.project.rootDir), dir: cfg.project.rootDir }] : []),
|
|
1425
|
+
...cfg.project.others.filter((o) => o.readOnly).map((o) => ({ name: o.name, dir: o.rootDir })),
|
|
1426
|
+
].filter((p) => isWithin(p.dir, confinement.roots));
|
|
1427
|
+
if (forReference.length > 0) {
|
|
1428
|
+
reference = await ReferenceGuard.start(forReference, runId);
|
|
1429
|
+
for (const p of reference.projects)
|
|
1430
|
+
sink.event('reference', { name: p.name, dir: p.dir }, `for reference only, nothing may change there: ${p.name} (${p.dir})`);
|
|
1431
|
+
for (const p of reference.unwatched) {
|
|
1432
|
+
sink.event('reference-unwatched', { name: p.name, dir: p.dir, problem: p.problem }, `for reference only, but it cannot be watched (${p.problem}): ${p.name} (${p.dir}); the chat is told to leave it alone`, 'warn');
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1399
1435
|
const isolation = assessIsolation(cfg.execution.isolation, readIsolationSignals());
|
|
1400
1436
|
for (const concern of isolation.warnings) {
|
|
1401
1437
|
sink.event('isolation', { claim: isolation.claim, elevated: isolation.signals.elevated }, concern, 'warn');
|
|
@@ -1597,6 +1633,7 @@ export async function runTask(transport, session, task, deps) {
|
|
|
1597
1633
|
// Said of the session's conversation, so with none on record nothing has had it: this run
|
|
1598
1634
|
// entered a fresh one (see `enterSessionConversation`), whatever an older record says.
|
|
1599
1635
|
contractAlreadySent: session.contractSent && !!session.chat,
|
|
1636
|
+
skill: task.skill,
|
|
1600
1637
|
continuing,
|
|
1601
1638
|
buildsOn,
|
|
1602
1639
|
// The operator's new prompt goes out whether or not the attempt it follows reached a conversation.
|
|
@@ -1604,6 +1641,7 @@ export async function runTask(transport, session, task, deps) {
|
|
|
1604
1641
|
workDirNote: workingDirNote(work),
|
|
1605
1642
|
vcsNote: session.kind === 'chat' ? CHAT_NOTE : prepared.note,
|
|
1606
1643
|
// What is said about a commit is true only where one happens (live run 2026-10-03: promised with commits off).
|
|
1644
|
+
referenceNote: forReference.length > 0 ? referenceNote(forReference, work.cwd) : undefined,
|
|
1607
1645
|
readOnlyNote: task.readOnly ? readOnlyNote(!!(session.vcs?.enabled && session.vcs.commitOnFinish !== false && trackedRepoOf(session)), artifactPatterns(session.vcs)) : undefined,
|
|
1608
1646
|
scopeNote: [
|
|
1609
1647
|
scopeNote(scope, scopeEnforced, {
|
|
@@ -2033,18 +2071,29 @@ export async function runTask(transport, session, task, deps) {
|
|
|
2033
2071
|
}
|
|
2034
2072
|
reviewRounds += 1;
|
|
2035
2073
|
const model = effectiveModels(session, cfg).reviewModel;
|
|
2074
|
+
/*
|
|
2075
|
+
* Chosen by hand: in the Copilot window, as the work's model is (see `modelByHand`). The chat's model is by
|
|
2076
|
+
* hand unless one is named (2026-10-17), and its review is too: asked on a card that says it is the review's
|
|
2077
|
+
* and why a different, stronger model is worth choosing for it (operator, 2026-10-20).
|
|
2078
|
+
*/
|
|
2079
|
+
const reviewByHand = cfg.copilot.manualModel || !!session.manualModel || (session.kind === 'chat' && !model);
|
|
2036
2080
|
const repoDir = trackedRepoOf(session);
|
|
2037
2081
|
/*
|
|
2038
2082
|
* What changed, read from git rather than from anybody's account of it.
|
|
2039
2083
|
*
|
|
2040
2084
|
* The commit happens when the task closes, which is after this, so the task's changes are
|
|
2041
2085
|
* still sitting in the working tree. That is exactly the list wanted: the branch was cut
|
|
2042
|
-
* before this task started, so everything dirty now is this task's doing.
|
|
2086
|
+
* before this task started, so everything dirty now is this task's doing. A chat message
|
|
2087
|
+
* works on the operator's own branch, where much may be uncommitted that is not its doing:
|
|
2088
|
+
* what it changed is the folder against its photograph from before it (2026-10-20).
|
|
2043
2089
|
*/
|
|
2044
|
-
const
|
|
2090
|
+
const chatChanged = !repoDir && session.kind === 'chat' && chatCheckpoint && chatDir
|
|
2091
|
+
? await changedSince(chatDir, chatCheckpoint, `${task.id}-r${reviewRounds}`).catch(() => null)
|
|
2092
|
+
: null;
|
|
2093
|
+
const changedFiles = repoDir ? (await repoState(repoDir).catch(() => null))?.changed ?? [] : chatChanged ?? [];
|
|
2045
2094
|
// When nothing changed, or nothing was allowed to, the closing account is the product and
|
|
2046
2095
|
// the reviewer is given it — as claims to test. See `Deliverable` in review.ts.
|
|
2047
|
-
const deliverable = deliverableFor(task, closing, repoDir !== '', changedFiles);
|
|
2096
|
+
const deliverable = deliverableFor(task, closing, repoDir !== '' || chatChanged !== null, changedFiles);
|
|
2048
2097
|
sink.event('review-started', { round: reviewRounds, model: model || '(the session model)', files: changedFiles.length, deliverable: deliverable?.why }, `an independent review is opening a fresh conversation (round ${reviewRounds} of ${maxReviewRounds})` +
|
|
2049
2098
|
(deliverable ? `; the closing summary goes with it as the product (${deliverable.why})` : ''));
|
|
2050
2099
|
// What is running before the review, so that what the review leaves is its own.
|
|
@@ -2053,14 +2102,17 @@ export async function runTask(transport, session, task, deps) {
|
|
|
2053
2102
|
let outcome;
|
|
2054
2103
|
try {
|
|
2055
2104
|
await transport.newChat();
|
|
2056
|
-
if (model) {
|
|
2105
|
+
if (model || (reviewByHand && deps.models?.askHelp)) {
|
|
2057
2106
|
let picked;
|
|
2058
|
-
if (
|
|
2107
|
+
if (reviewByHand && deps.models?.askHelp) {
|
|
2059
2108
|
// By hand, as the work's model (see `applySessionModel`): the review's fresh conversation is asked about too.
|
|
2060
2109
|
const shown = await transport.currentModel().catch(() => null);
|
|
2061
|
-
picked = buttonShows(shown, model)
|
|
2110
|
+
picked = model && buttonShows(shown, model)
|
|
2062
2111
|
? { ok: true, current: model, by: 'already' }
|
|
2063
|
-
: (await withOperatorHand(transport, model, { ok: false, current: shown, reason: '
|
|
2112
|
+
: (await withOperatorHand(transport, model, { ok: false, current: shown, reason: 'the model is chosen by hand (the review)' }, deps.models, session.id, bus, true, { review: true })).result;
|
|
2113
|
+
// Stopped on the card: the run stops, as it does on the work's card, and nothing is sent to the review.
|
|
2114
|
+
if (!picked.ok && signal?.aborted)
|
|
2115
|
+
throw new StoppedSend();
|
|
2064
2116
|
}
|
|
2065
2117
|
else {
|
|
2066
2118
|
const reviewLocator = await deps.models?.locate?.(model).catch(() => undefined);
|
|
@@ -2080,6 +2132,16 @@ export async function runTask(transport, session, task, deps) {
|
|
|
2080
2132
|
round: reviewRounds,
|
|
2081
2133
|
cwd: work.cwd,
|
|
2082
2134
|
roots: confinement.roots,
|
|
2135
|
+
workStartedAt: confinement.workStartedAt,
|
|
2136
|
+
afterStep: reference?.active
|
|
2137
|
+
? async () => {
|
|
2138
|
+
const touched = await reference.check();
|
|
2139
|
+
if (touched.length === 0)
|
|
2140
|
+
return null;
|
|
2141
|
+
sink.event('reference-put-back', { review: true, changes: touched }, `a review step changed a project for reference only: ${touched.map((c) => `${c.name}: ${describeChange(c)}`).join('; ')}`, 'warn');
|
|
2142
|
+
return referenceMessage(touched);
|
|
2143
|
+
}
|
|
2144
|
+
: undefined,
|
|
2083
2145
|
tracker,
|
|
2084
2146
|
changedFiles,
|
|
2085
2147
|
deliverable,
|
|
@@ -2799,6 +2861,19 @@ export async function runTask(transport, session, task, deps) {
|
|
|
2799
2861
|
sink.event('step-environment', { id: step.id, requested: result.requestedShell ?? null, available: result.shellProblem.available }, result.shellProblem.message, 'error');
|
|
2800
2862
|
break;
|
|
2801
2863
|
}
|
|
2864
|
+
/*
|
|
2865
|
+
* A project for reference only changed: put back as it was, the chat told with the step's own output, and
|
|
2866
|
+
* the rest of the round not run — a step after it could build on what was just undone.
|
|
2867
|
+
*/
|
|
2868
|
+
const touched = reference?.active ? await reference.check() : [];
|
|
2869
|
+
if (touched.length > 0) {
|
|
2870
|
+
const told = referenceMessage(touched);
|
|
2871
|
+
const all = touched.every((c) => c.putBack);
|
|
2872
|
+
sink.event('reference-put-back', { id: step.id, changes: touched }, `step ${step.id} changed a project for reference only, ${all ? 'put back' : 'NOT all put back'}: ${touched.map((c) => `${c.name}: ${describeChange(c)}`).join('; ')}`, all ? 'warn' : 'error');
|
|
2873
|
+
result.stderr = `${result.stderr}${result.stderr.endsWith('\n') || !result.stderr ? '' : '\n'}[runner] ${told}\n`;
|
|
2874
|
+
runnerNotes.push(told);
|
|
2875
|
+
break;
|
|
2876
|
+
}
|
|
2802
2877
|
if (cfg.execution.stopOnFailure && result.exitCode !== 0) {
|
|
2803
2878
|
sink.event('stop-on-failure', { id: step.id }, 'stopping the iteration: stopOnFailure is set', 'warn');
|
|
2804
2879
|
break;
|
|
@@ -3152,6 +3227,21 @@ export async function runSession(sessionId, deps) {
|
|
|
3152
3227
|
});
|
|
3153
3228
|
task = session.tasks.find((t) => t.id === queuedTask.id);
|
|
3154
3229
|
}
|
|
3230
|
+
/*
|
|
3231
|
+
* A message of a conversation in the two-chat mode (2026-10-20): its lead directs it and its worker carries out the
|
|
3232
|
+
* subtasks (see `leadRunner.ts`). Not carried on or retried in a fresh chat here: the lead decides what to do when
|
|
3233
|
+
* a subtask falls short, and its own limits bound it.
|
|
3234
|
+
*/
|
|
3235
|
+
if (session.lead && session.kind === 'chat') {
|
|
3236
|
+
const led = await runLeadTask(chat, session, task, deps);
|
|
3237
|
+
ran += 1;
|
|
3238
|
+
lastStatus = led.status;
|
|
3239
|
+
if (chat.closedOutside()) {
|
|
3240
|
+
bus.publish({ sessionId, type: 'session-stopped', level: 'info', message: 'the browser window was closed; the tasks after this one stay queued' });
|
|
3241
|
+
break;
|
|
3242
|
+
}
|
|
3243
|
+
continue;
|
|
3244
|
+
}
|
|
3155
3245
|
let outcome = await runTask(chat, session, task, deps);
|
|
3156
3246
|
ran += 1;
|
|
3157
3247
|
// The operator closed the window with its X: a stop, for the tasks after it too (2026-10-19).
|