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
|
@@ -26,7 +26,7 @@ import { basename, join, resolve } from 'node:path';
|
|
|
26
26
|
import { chosenHome, defaultHome, installLayout } from '../config/layout.js';
|
|
27
27
|
import { chooseHome, homeRefusal, movedFrom } from '../config/home.js';
|
|
28
28
|
import { SessionStore, DEFAULT_VCS, DEFAULT_REVIEW, readStoreJson, StoreFileUnusable, writeFileAtomically } from '../session/store.js';
|
|
29
|
-
import { checkItems, emptyQueue, holdsChat, itemTitle, mergeItems, nextStep, parkAfterMs, parkedAnswerFrom, skippedBecause, statusOfTask, waitsByHand, MAX_PARK_AFTER_SEC, PARKED_WORDS } from '../queue/queue.js';
|
|
29
|
+
import { carriesOn, checkItems, emptyQueue, holdsChat, itemTitle, mergeItems, nextStep, rebaseEdit, parkAfterMs, parkedAnswerFrom, skippedBecause, statusOfTask, waitsByHand, MAX_PARK_AFTER_SEC, PARKED_WORDS } from '../queue/queue.js';
|
|
30
30
|
import { branchStart, madeFromRemote, makeQueueBranch, refreshQueueBranch } from '../queue/queueBranch.js';
|
|
31
31
|
import { EventBus } from '../session/events.js';
|
|
32
32
|
import { isContinuable, parkedOver, MAX_INSTRUCTION_CHARS, newId, withProblemAt } from '../session/model.js';
|
|
@@ -76,6 +76,13 @@ function sameFolder(a, b) {
|
|
|
76
76
|
const CARRIES_ON_AFTER = (what) => `${what}; it carries on from where it stopped, in its own chat, when the queue is run again`;
|
|
77
77
|
/** A card answered after it went: by Kerrigan, another tab, or its work having ended (2026-11-18). */
|
|
78
78
|
export const CARD_GONE = 'That card is not waiting any more: it was answered, or its work ended.';
|
|
79
|
+
/** A card pressed as the queue sets its task aside (second bug hunt, 2026-11-19). */
|
|
80
|
+
/**
|
|
81
|
+
* A set-aside task whose chat went on past it (second bug hunt, 2026-11-19): a message written there since. Answered, the
|
|
82
|
+
* older message ran again after the newer one, in the same conversation, where "Continue" carries on only the last.
|
|
83
|
+
*/
|
|
84
|
+
export const PARKED_PASSED = 'The conversation has gone on past this task in its chat (a message was written there since), so its answer cannot carry it on: Stop it here, and say what it still needs in a new message in its chat.';
|
|
85
|
+
export const SET_ASIDE_NOW = "The queue has just set this task aside, as it waited for you: answer it on the queue's page, where it waits now.";
|
|
79
86
|
/** "Run this and the rest" where the run may not go on unasked: said, and the card kept (2026-11-18). */
|
|
80
87
|
/** How long a task of the queue waits for a sign-in Copilot asks for: as long as it takes, a week (2026-11-19). */
|
|
81
88
|
export const QUEUE_SIGN_IN_WAIT_SEC = 7 * 24 * 3600;
|
|
@@ -84,6 +91,7 @@ export const SIGN_IN_IN_THE_RUNS_WINDOW = 'The Copilot window the work opened is
|
|
|
84
91
|
/** Said when a set-aside task's card is pressed after the queue let go of it (2026-11-19). */
|
|
85
92
|
export const PARKED_RELEASED = 'Its card is closed now: "Continue" under its message carries it on in its own chat.';
|
|
86
93
|
/** Said when "Continue" is pressed on a message answered on its card in the queue (2026-11-19). */
|
|
94
|
+
export const PARKED_ALREADY_ANSWERED = 'This card was answered already, on another page: the queue carries the task on with that answer. To stop it, use Stop on the queue\'s page.';
|
|
87
95
|
export const PARKED_ANSWERED = "This message was answered on its card, and the queue carries it on with that answer: at the queue's next turn, or when the queue is run.";
|
|
88
96
|
export const RUN_ALL_REFUSED = (why) => `"Run this and the rest" cannot be given here — ${why} Nothing was run: "Run" runs this step.`;
|
|
89
97
|
/** Whether a folder is another, or inside it: Windows paths, as `sameFolder` reads them. */
|
|
@@ -123,8 +131,7 @@ import { planApprovedMessage, planReviseMessage } from '../orchestrator/planMode
|
|
|
123
131
|
import { leadPlanApproved, leadPlanRevise } from '../orchestrator/leadRunner.js';
|
|
124
132
|
import { coveredByArtifacts } from '../vcs/artifacts.js';
|
|
125
133
|
import { botVersion } from '../config/version.js';
|
|
126
|
-
import {
|
|
127
|
-
import { createZip } from '../util/zip.js';
|
|
134
|
+
import { exportFileName as homeExportName, exportPlan, exportSizes, writeExport } from '../config/exportHome.js';
|
|
128
135
|
import { settingsOf, SettingsUnusableError } from './settings.js';
|
|
129
136
|
import { PolicyLockUnusableError } from '../config/lockedPolicy.js';
|
|
130
137
|
import { chatDenyPatterns } from '../config/schema.js';
|
|
@@ -258,12 +265,16 @@ let OperatorService = class OperatorService {
|
|
|
258
265
|
* and "Sign in to Copilot" points to that window rather than refusing because of it.
|
|
259
266
|
*/
|
|
260
267
|
signInAsked = new Map();
|
|
268
|
+
/** A reading of Copilot's page — the models, "Check the locators" — waits for the operator to sign in (2026-11-19). */
|
|
269
|
+
readingSignIn = false;
|
|
261
270
|
followsActing = this.bus.subscribe('*', (e) => {
|
|
262
271
|
if (e.type === 'acting' && e.data)
|
|
263
272
|
this.acting.set(e.sessionId, e.data);
|
|
264
273
|
// A chat locator that found nothing (2026-11-17): kept for the banner and Settings.
|
|
265
274
|
else if (e.type === 'browser:locator-missing' && e.data)
|
|
266
275
|
this.recordLocatorFailure(e.data);
|
|
276
|
+
else if (e.type === 'browser:locator-found' && e.data)
|
|
277
|
+
this.locatorFound(e.data);
|
|
267
278
|
else if (e.type === 'browser:sign-in-required' || e.type === 'browser:verification-required') {
|
|
268
279
|
// The Copilot window waits for the operator to sign in, or to show a person is there: not counted (2026-10-29).
|
|
269
280
|
this.holdOf(e.sessionId)?.waitFor(`${e.type}:${e.sessionId}`);
|
|
@@ -945,6 +956,15 @@ let OperatorService = class OperatorService {
|
|
|
945
956
|
* "a mechanism that detects which locator exactly the bot failed on"): kept as the last one for that locator, for the
|
|
946
957
|
* banner on every page and the field in red in Settings.
|
|
947
958
|
*/
|
|
959
|
+
/**
|
|
960
|
+
* A locator said to find nothing, found after all (second bug hunt, 2026-11-19: the box, once a slow sign-in was done):
|
|
961
|
+
* its failure goes — the banner, the red field — unless its locator was changed in Settings since.
|
|
962
|
+
*/
|
|
963
|
+
locatorFound(detail) {
|
|
964
|
+
if (typeof detail.key !== 'string' || typeof detail.locator !== 'string')
|
|
965
|
+
return;
|
|
966
|
+
void this.locatorFailures.dismiss(detail.key, detail.locator).catch(() => undefined);
|
|
967
|
+
}
|
|
948
968
|
recordLocatorFailure(detail) {
|
|
949
969
|
const key = detail.key;
|
|
950
970
|
if (typeof key !== 'string' || !(CHAT_LOCATOR_KEYS.includes(key) || isStepKey(key)) || typeof detail.locator !== 'string')
|
|
@@ -968,7 +988,7 @@ let OperatorService = class OperatorService {
|
|
|
968
988
|
...(url ? { url } : {}),
|
|
969
989
|
...(piece ? { piece, ...(around ? { around } : {}) } : {}),
|
|
970
990
|
})
|
|
971
|
-
.catch(() =>
|
|
991
|
+
.catch((e) => console.error(`[locators] the locator of "${key}" found nothing, and that could not be kept for the banner: ${e.message}`));
|
|
972
992
|
}
|
|
973
993
|
/**
|
|
974
994
|
* The failures kept, each with whether its locator has been changed in Settings since (then it is no longer the one
|
|
@@ -1059,9 +1079,11 @@ let OperatorService = class OperatorService {
|
|
|
1059
1079
|
* Everything the bot has kept, as one .zip (operator, 2026-10-23): `data/` — the key and the Edge profile left out,
|
|
1060
1080
|
* the manifest says why — and `runs/` when asked for.
|
|
1061
1081
|
*/
|
|
1082
|
+
/** Written to the download as it goes (2026-11-19): see `writeExport`. Its name first, for the download's header. */
|
|
1062
1083
|
exportHome(runs) {
|
|
1063
1084
|
const now = new Date();
|
|
1064
|
-
|
|
1085
|
+
const plan = exportPlan(this.layout, { runs, version: botVersion(), now });
|
|
1086
|
+
return { fileName: homeExportName(now), write: (out) => writeExport(plan, out) };
|
|
1065
1087
|
}
|
|
1066
1088
|
async terminalReport() {
|
|
1067
1089
|
const cfg = await this.settings.load();
|
|
@@ -1297,6 +1319,17 @@ let OperatorService = class OperatorService {
|
|
|
1297
1319
|
if (s.status === 'stopping')
|
|
1298
1320
|
s.status = 'idle';
|
|
1299
1321
|
}).catch(() => undefined);
|
|
1322
|
+
/*
|
|
1323
|
+
* A sign-in or a password asked for by this run, never answered (third hunt, 2026-11-20): a run Stopped, or out of
|
|
1324
|
+
* time, while its window waited for the sign-in ended with no task finished, and the entry stayed — every later run
|
|
1325
|
+
* said "waiting for you to sign in", and "Sign in to Copilot" was refused, until the program was restarted.
|
|
1326
|
+
*/
|
|
1327
|
+
for (const id of [...this.signInAsked.keys()])
|
|
1328
|
+
if (id === sessionId || this.runKey(id) === sessionId)
|
|
1329
|
+
this.signInAsked.delete(id);
|
|
1330
|
+
for (const id of [...this.passwordAsked.keys()])
|
|
1331
|
+
if (id === sessionId || this.runKey(id) === sessionId)
|
|
1332
|
+
this.passwordAsked.delete(id);
|
|
1300
1333
|
this.running.delete(sessionId);
|
|
1301
1334
|
this.stoppedByOperator.delete(sessionId);
|
|
1302
1335
|
});
|
|
@@ -1406,7 +1439,7 @@ let OperatorService = class OperatorService {
|
|
|
1406
1439
|
// Git asks for a password in its own window, and the work waits for it (2026-10-26).
|
|
1407
1440
|
...(this.passwordAsked.size > 0 ? { password: true } : {}),
|
|
1408
1441
|
// Copilot's window waits for the operator to sign in (2026-11-19): the work goes on by itself once signed in.
|
|
1409
|
-
...(this.signInAsked.size > 0 && this.running.size > 0 ? { signIn: true } : {}),
|
|
1442
|
+
...((this.signInAsked.size > 0 && this.running.size > 0) || this.readingSignIn ? { signIn: true } : {}),
|
|
1410
1443
|
// The queue still has its turn going, between one of its tasks and the next (2026-11-03): the work is not over.
|
|
1411
1444
|
...(this.queueLoop ? { queue: true } : {}),
|
|
1412
1445
|
// Tasks of the queue set aside, waiting for the operator's answer on their cards (2026-11-19): the work is not over.
|
|
@@ -1619,12 +1652,12 @@ let OperatorService = class OperatorService {
|
|
|
1619
1652
|
throw new Error(`That file was opened in ${dir}, and the folder open now is ${open}: nothing was read or saved there. Open ${dir} again to save it.`);
|
|
1620
1653
|
}
|
|
1621
1654
|
/** The editor's text saved over a file of the open folder, over the version it was made on (see `saveWorkspaceFile`). */
|
|
1622
|
-
async saveWorkspaceFile(path, text, base, dir) {
|
|
1655
|
+
async saveWorkspaceFile(path, text, base, dir, again = false) {
|
|
1623
1656
|
const ws = await this.workspace();
|
|
1624
1657
|
if (!ws.ok)
|
|
1625
1658
|
throw new Error(ws.problem ?? 'No project folder is open.');
|
|
1626
1659
|
this.sameOpenFolder(ws.dir, dir);
|
|
1627
|
-
const saved = await saveWorkspaceFile(ws.dir, path, text, base);
|
|
1660
|
+
const saved = await saveWorkspaceFile(ws.dir, path, text, base, again);
|
|
1628
1661
|
console.log(`[editor] saved ${saved.path} (${saved.size} bytes)`);
|
|
1629
1662
|
return saved;
|
|
1630
1663
|
}
|
|
@@ -1870,10 +1903,20 @@ let OperatorService = class OperatorService {
|
|
|
1870
1903
|
queueTurn = Promise.resolve();
|
|
1871
1904
|
queueLoop = null;
|
|
1872
1905
|
queueRecovered = false;
|
|
1906
|
+
/** The recovery under way, so two calls at once do it once; let go when it could not be written, to be tried again. */
|
|
1907
|
+
queueRecovering = null;
|
|
1908
|
+
/** The ending of the queue's task at work, until it is written: written again when the queue's loop ends (2026-11-19). */
|
|
1909
|
+
queueEnding = null;
|
|
1873
1910
|
/** The program is closing: the queue's loop stops where it is. */
|
|
1874
1911
|
queueClosing = false;
|
|
1875
1912
|
/** The session of the queue's task at work now (2026-10-26): where a wait for the operator is timed, to park it. */
|
|
1876
1913
|
queueAtWork = new Set();
|
|
1914
|
+
/**
|
|
1915
|
+
* Cards whose task the queue is setting aside now (second bug hunt, 2026-11-19): a press on one is refused, and said
|
|
1916
|
+
* where to answer. Taken as the setting aside went on, the answer was lost: the task stopped and was set aside all the
|
|
1917
|
+
* same, and asked for it again.
|
|
1918
|
+
*/
|
|
1919
|
+
parking = new Set();
|
|
1877
1920
|
/** The timers of the waits of the queue's task at work: a card, by its id; a password window, by `pw:` and the session. */
|
|
1878
1921
|
parkTimers = new Map();
|
|
1879
1922
|
/** Commands the operator approved on a parked task's card, run without asking when its chat sends them again. */
|
|
@@ -1976,7 +2019,19 @@ let OperatorService = class OperatorService {
|
|
|
1976
2019
|
async recoverQueue() {
|
|
1977
2020
|
if (this.queueRecovered)
|
|
1978
2021
|
return;
|
|
1979
|
-
|
|
2022
|
+
/*
|
|
2023
|
+
* Marked done once it has been written (second bug hunt, 2026-11-19): marked before, a write that failed once — the
|
|
2024
|
+
* file held a moment by a virus scanner — left a task "running" until the program was started again.
|
|
2025
|
+
*/
|
|
2026
|
+
this.queueRecovering ??= this.recoverQueueOnce().then(() => {
|
|
2027
|
+
this.queueRecovered = true;
|
|
2028
|
+
}, (e) => {
|
|
2029
|
+
this.queueRecovering = null;
|
|
2030
|
+
throw e;
|
|
2031
|
+
});
|
|
2032
|
+
await this.queueRecovering;
|
|
2033
|
+
}
|
|
2034
|
+
async recoverQueueOnce() {
|
|
1980
2035
|
const q = await this.readQueue();
|
|
1981
2036
|
/*
|
|
1982
2037
|
* The cards of set-aside tasks the queue does not hold any more (2026-11-19) — taken out, run again, the queue's file
|
|
@@ -2052,12 +2107,19 @@ let OperatorService = class OperatorService {
|
|
|
2052
2107
|
const busy = { kind: 'chat', sessionId: holder.sessionId, title: at?.title ?? s?.name.replace(/^chat: /, '') ?? '' };
|
|
2053
2108
|
return { ...q, busy };
|
|
2054
2109
|
}
|
|
2055
|
-
/**
|
|
2056
|
-
|
|
2110
|
+
/**
|
|
2111
|
+
* The list as the page edits it: added, changed, moved, taken out, put back to wait ("Run again"). `seen` is the list
|
|
2112
|
+
* the page had read: the edit is put onto the queue as it is now (`rebaseEdit`), so a page that read it before a change
|
|
2113
|
+
* — a second tab — drops no task added since and puts back none taken out (second bug hunt, 2026-11-19).
|
|
2114
|
+
*/
|
|
2115
|
+
async setQueue(items, seen) {
|
|
2057
2116
|
await this.recoverQueue();
|
|
2058
2117
|
const checked = checkItems(items, MAX_INSTRUCTION_CHARS);
|
|
2059
2118
|
if ('problem' in checked)
|
|
2060
2119
|
throw new Error(checked.problem);
|
|
2120
|
+
const read = seen === undefined ? undefined : checkItems(seen, Number.MAX_SAFE_INTEGER);
|
|
2121
|
+
if (read && 'problem' in read)
|
|
2122
|
+
throw new Error(`The list the page had read could not be used: ${read.problem}`);
|
|
2061
2123
|
// A skill is one of Settings' (2026-10-25); whether it is for the folder is said when the task runs, in its chat.
|
|
2062
2124
|
const { skills } = await this.skills();
|
|
2063
2125
|
/*
|
|
@@ -2068,6 +2130,8 @@ let OperatorService = class OperatorService {
|
|
|
2068
2130
|
const before = new Map((await this.readQueue()).items.map((x) => [x.id, x]));
|
|
2069
2131
|
const runs = (x) => {
|
|
2070
2132
|
const was = before.get(x.id);
|
|
2133
|
+
if (was && carriesOn(was, x))
|
|
2134
|
+
return false;
|
|
2071
2135
|
return !was || was.skill !== x.skill || (x.status ?? was.status) === 'waiting';
|
|
2072
2136
|
};
|
|
2073
2137
|
const unknown = checked.items.findIndex((x) => x.skill && runs(x) && !skills.some((k) => k.name === x.skill));
|
|
@@ -2078,7 +2142,7 @@ let OperatorService = class OperatorService {
|
|
|
2078
2142
|
let problem;
|
|
2079
2143
|
let letGo = [];
|
|
2080
2144
|
const q = await this.changeQueue((x) => {
|
|
2081
|
-
const merged = mergeItems(x.items, checked.items);
|
|
2145
|
+
const merged = mergeItems(x.items, read ? rebaseEdit(x.items, read.items, checked.items) : checked.items);
|
|
2082
2146
|
if ('problem' in merged)
|
|
2083
2147
|
problem = merged.problem;
|
|
2084
2148
|
else {
|
|
@@ -2160,12 +2224,46 @@ let OperatorService = class OperatorService {
|
|
|
2160
2224
|
.catch((e) => console.error('[queue] the queue stopped:', e.stack ?? e.message))
|
|
2161
2225
|
.finally(() => {
|
|
2162
2226
|
this.queueLoop = null;
|
|
2163
|
-
void this.
|
|
2164
|
-
x.running = false;
|
|
2165
|
-
});
|
|
2227
|
+
void this.settleQueue();
|
|
2166
2228
|
});
|
|
2167
2229
|
return await this.withBusy(started);
|
|
2168
2230
|
}
|
|
2231
|
+
/**
|
|
2232
|
+
* The queue's loop is over: the queue not running, and no task left "running" (second bug hunt, 2026-11-19). A task
|
|
2233
|
+
* whose end could not be written — the file held a moment as it ended — stayed running for good: it could not be
|
|
2234
|
+
* taken out or edited, Stop did nothing to it, and what depended on it waited until the program was started again.
|
|
2235
|
+
* Its end is written now, as it ended; one whose end is not known carries on in its chat at the next run, as after a
|
|
2236
|
+
* restart. Tried again a few times, the file being the one that would not be written.
|
|
2237
|
+
*/
|
|
2238
|
+
async settleQueue() {
|
|
2239
|
+
const left = this.queueEnding;
|
|
2240
|
+
this.queueEnding = null;
|
|
2241
|
+
for (let attempt = 0;; attempt += 1) {
|
|
2242
|
+
try {
|
|
2243
|
+
await this.changeQueue((x) => {
|
|
2244
|
+
x.running = false;
|
|
2245
|
+
for (const item of x.items) {
|
|
2246
|
+
if (item.status !== 'running')
|
|
2247
|
+
continue;
|
|
2248
|
+
if (left?.id === item.id)
|
|
2249
|
+
this.setQueueItem(x, item.id, left.ended);
|
|
2250
|
+
else
|
|
2251
|
+
Object.assign(item, item.sessionId
|
|
2252
|
+
? { status: 'waiting', resume: true, why: CARRIES_ON_AFTER('the queue stopped while it ran'), endedAt: new Date().toISOString() }
|
|
2253
|
+
: { status: 'waiting', why: undefined });
|
|
2254
|
+
}
|
|
2255
|
+
});
|
|
2256
|
+
return;
|
|
2257
|
+
}
|
|
2258
|
+
catch (e) {
|
|
2259
|
+
if (attempt >= 4) {
|
|
2260
|
+
console.error('[queue] the queue could not be written as stopped:', e.message);
|
|
2261
|
+
return;
|
|
2262
|
+
}
|
|
2263
|
+
await new Promise((r) => setTimeout(r, 1_500 * (attempt + 1)));
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2169
2267
|
/**
|
|
2170
2268
|
* Tasks that would wait for the operator to choose their model by hand: none of their own, and no "Model for the
|
|
2171
2269
|
* worker" in Settings — a chat that names no model is asked for it by hand (`modelByHand`), and nobody is there.
|
|
@@ -2205,18 +2303,39 @@ let OperatorService = class OperatorService {
|
|
|
2205
2303
|
if (!this.queueAtWork.has(key))
|
|
2206
2304
|
return;
|
|
2207
2305
|
const timerKey = kind === 'password' ? `pw:${approval.sessionId}` : approval.id;
|
|
2208
|
-
|
|
2306
|
+
// Read again a few times when queue.json is busy (third hunt, 2026-11-20): one failed read set no timer, said nothing.
|
|
2307
|
+
const readSoon = async () => {
|
|
2308
|
+
for (let i = 0;; i++) {
|
|
2309
|
+
try {
|
|
2310
|
+
return await this.readQueue();
|
|
2311
|
+
}
|
|
2312
|
+
catch (e) {
|
|
2313
|
+
if (i >= 3)
|
|
2314
|
+
throw e;
|
|
2315
|
+
await new Promise((r) => setTimeout(r, 1_000 * (i + 1)));
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
};
|
|
2319
|
+
void readSoon().then((q) => {
|
|
2209
2320
|
const ms = parkAfterMs(q);
|
|
2210
2321
|
if (ms === null || this.parkTimers.has(timerKey))
|
|
2211
2322
|
return;
|
|
2212
2323
|
const timer = setTimeout(() => {
|
|
2213
2324
|
this.parkTimers.delete(timerKey);
|
|
2214
2325
|
const still = kind === 'password' ? this.passwordAsked.has(approval.sessionId) : this.waiting.has(approval.id);
|
|
2215
|
-
if (still)
|
|
2216
|
-
|
|
2326
|
+
if (!still)
|
|
2327
|
+
return;
|
|
2328
|
+
if (kind !== 'password')
|
|
2329
|
+
this.parking.add(approval.id);
|
|
2330
|
+
void this.park(key, approval, kind, ms)
|
|
2331
|
+
.catch((e) => console.error('[queue] the task could not be set aside:', e.message))
|
|
2332
|
+
.finally(() => this.parking.delete(approval.id));
|
|
2217
2333
|
}, ms);
|
|
2218
2334
|
timer.unref?.();
|
|
2219
2335
|
this.parkTimers.set(timerKey, timer);
|
|
2336
|
+
}).catch((e) => {
|
|
2337
|
+
this.bus.publish({ sessionId: approval.sessionId, taskId: approval.taskId, type: 'queue-park-unread', level: 'warn',
|
|
2338
|
+
message: `the queue could not be read, so this card is not set aside when its time is up; it waits here: ${e.message}` });
|
|
2220
2339
|
});
|
|
2221
2340
|
}
|
|
2222
2341
|
unparkLater(timerKey) {
|
|
@@ -2270,6 +2389,13 @@ let OperatorService = class OperatorService {
|
|
|
2270
2389
|
* any press, and "Continue" carries its message on in its own chat. A Stop of it is simply taken.
|
|
2271
2390
|
*/
|
|
2272
2391
|
const from = typeof input?.sessionId === 'string' ? input.sessionId : undefined;
|
|
2392
|
+
/*
|
|
2393
|
+
* Answered already, on another page, and waiting to carry on with that answer (third hunt, 2026-11-20): a copy of the
|
|
2394
|
+
* card not yet refreshed was read as one the queue let go of, and its press overwrote the answer with "let go" — a
|
|
2395
|
+
* plan approved was asked for again, a pasted output lost — and a Stop was said taken while the task went on.
|
|
2396
|
+
*/
|
|
2397
|
+
if (item && item.status !== 'parked' && holdsChat(item) && (!from || from === item.sessionId))
|
|
2398
|
+
throw new Error(PARKED_ALREADY_ANSWERED);
|
|
2273
2399
|
if (!item || item.status !== 'parked' || !item.sessionId || (from && from !== item.sessionId)) {
|
|
2274
2400
|
const of = from ?? (item?.status === 'parked' ? undefined : item?.sessionId);
|
|
2275
2401
|
if (of)
|
|
@@ -2303,6 +2429,8 @@ let OperatorService = class OperatorService {
|
|
|
2303
2429
|
}
|
|
2304
2430
|
if (!s || !task?.parked)
|
|
2305
2431
|
throw new Error('What that task waited for is not on its record any more; run it again.');
|
|
2432
|
+
if (s.tasks.at(-1)?.id !== task.id)
|
|
2433
|
+
throw new Error(PARKED_PASSED);
|
|
2306
2434
|
const answer = parkedAnswerFrom(task.parked, input);
|
|
2307
2435
|
if ('problem' in answer)
|
|
2308
2436
|
throw new Error(answer.problem);
|
|
@@ -2344,7 +2472,10 @@ let OperatorService = class OperatorService {
|
|
|
2344
2472
|
// An answered parked task keeps its chat: it carries on there.
|
|
2345
2473
|
await this.changeQueue((x) => this.setQueueItem(x, item.id, { status: 'running', startedAt: now(), why: undefined, endedAt: undefined, waitsFor: undefined, resume: undefined, ...(item.resume ? {} : { sessionId: undefined }) }));
|
|
2346
2474
|
const ended = await this.runQueueItem(item).catch((e) => ({ status: 'failed', why: e.message }));
|
|
2347
|
-
|
|
2475
|
+
// Kept until written: a write that fails ends the loop, and the end is written when it is over (`settleQueue`).
|
|
2476
|
+
this.queueEnding = { id: item.id, ended: { ...ended, endedAt: now() } };
|
|
2477
|
+
await this.changeQueue((x) => this.setQueueItem(x, item.id, this.queueEnding.ended));
|
|
2478
|
+
this.queueEnding = null;
|
|
2348
2479
|
// Stopped — from the queue, or the chat's Stop: the rest wait for the operator. Parked: the queue goes on.
|
|
2349
2480
|
if (ended.status === 'stopped')
|
|
2350
2481
|
return;
|
|
@@ -2356,7 +2487,21 @@ let OperatorService = class OperatorService {
|
|
|
2356
2487
|
/** One task of the queue, in a new chat — or, answered after it was parked, in its own — to its end. */
|
|
2357
2488
|
async runQueueItem(item) {
|
|
2358
2489
|
const pause = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
2359
|
-
|
|
2490
|
+
/*
|
|
2491
|
+
* Whether the queue still runs, as last read when queue.json is busy or unreadable for a moment (third hunt,
|
|
2492
|
+
* 2026-11-20): a lock held a second longer than the reads wait made this poll — once a second for the whole task —
|
|
2493
|
+
* throw, the task was ended "failed" while its chat's run went on, and its cards were never set aside.
|
|
2494
|
+
*/
|
|
2495
|
+
let lastRunning = true;
|
|
2496
|
+
const stillRunning = async () => {
|
|
2497
|
+
try {
|
|
2498
|
+
lastRunning = (await this.readQueue()).running;
|
|
2499
|
+
}
|
|
2500
|
+
catch {
|
|
2501
|
+
/* as last read */
|
|
2502
|
+
}
|
|
2503
|
+
return lastRunning;
|
|
2504
|
+
};
|
|
2360
2505
|
// Read afresh each time: the browser is let go of by other work while this waits.
|
|
2361
2506
|
const holder = () => this.browser;
|
|
2362
2507
|
// The browser may be the chat's, or a reading of the models': the task waits its turn.
|
|
@@ -2380,6 +2525,17 @@ let OperatorService = class OperatorService {
|
|
|
2380
2525
|
const last = s0?.tasks.at(-1);
|
|
2381
2526
|
if (!s0 || !last)
|
|
2382
2527
|
return { status: 'failed', why: 'its chat is not there any more; run it again' };
|
|
2528
|
+
/*
|
|
2529
|
+
* A carry-on that fails before it carries on (third hunt, 2026-11-20): the chat was kept with an answered card — its
|
|
2530
|
+
* "Continue" refused as "the queue carries it on", which it would not now, and no card on the queue's page — and its
|
|
2531
|
+
* work put aside by a task after it was never named. The queue lets go of it, saying where that work is.
|
|
2532
|
+
*/
|
|
2533
|
+
const failed = async (why) => {
|
|
2534
|
+
const left = (await this.readQueue()).items.find((x) => x.id === item.id)?.setAside ?? item.setAside;
|
|
2535
|
+
await this.releaseFromQueue(s0.id, item.id, left);
|
|
2536
|
+
await this.changeQueue((x) => this.setQueueItem(x, item.id, { setAside: undefined })).catch(() => undefined);
|
|
2537
|
+
return { status: 'failed', why, sessionId: s0.id };
|
|
2538
|
+
};
|
|
2383
2539
|
/*
|
|
2384
2540
|
* Back on the branch it began on, a task on "the folder as it is" (bug hunt 2026-11-18): it carried on on whatever
|
|
2385
2541
|
* branch the task after it left the folder on — one made for another task. What that left uncommitted is put
|
|
@@ -2391,13 +2547,13 @@ let OperatorService = class OperatorService {
|
|
|
2391
2547
|
if (onNow !== began) {
|
|
2392
2548
|
const aside = await setAsideUncommitted(ws.dir, `the queue's task "${itemTitle(item)}" carries on on ${began}, where it began, and the folder held changes left on ${onNow ?? 'a detached HEAD'}`);
|
|
2393
2549
|
if (aside && 'problem' in aside)
|
|
2394
|
-
return
|
|
2550
|
+
return await failed(`what was not committed in the folder could not be put aside before it: ${aside.problem}`);
|
|
2395
2551
|
// Kept for whose it is first (2026-11-19): a switch that failed after it said nothing of where it went.
|
|
2396
2552
|
if (aside && 'saved' in aside)
|
|
2397
2553
|
await this.leftoversOf(onNow, item.id, aside.saved);
|
|
2398
2554
|
const back = await git(ws.dir, ['switch', began]);
|
|
2399
2555
|
if (!back.ok)
|
|
2400
|
-
return
|
|
2556
|
+
return await failed(`it could not be put back on ${began}, where it began: ${(back.stderr || back.stdout).trim().slice(0, 300)}${aside ? `; what was not committed in the folder is kept on ${aside.saved}, not pushed` : ''}`);
|
|
2401
2557
|
this.bus.publish({ sessionId: s0.id, type: 'queue-back-on-branch', level: 'info',
|
|
2402
2558
|
message: `back on ${began}, where it began, before it carries on (the folder was on ${onNow ?? 'a detached HEAD'})${aside ? `; what was not committed there is kept on ${aside.saved}, not pushed` : ''}`,
|
|
2403
2559
|
data: { branch: began, was: onNow, ...(aside ? { saved: aside.saved } : {}) } });
|
|
@@ -2418,7 +2574,7 @@ let OperatorService = class OperatorService {
|
|
|
2418
2574
|
if (answered) {
|
|
2419
2575
|
const carried = await this.resumeParked(item.sessionId, ws.dir);
|
|
2420
2576
|
if ('problem' in carried)
|
|
2421
|
-
return
|
|
2577
|
+
return await failed(carried.problem);
|
|
2422
2578
|
taskId = carried.taskId;
|
|
2423
2579
|
}
|
|
2424
2580
|
else {
|
|
@@ -2583,6 +2739,9 @@ let OperatorService = class OperatorService {
|
|
|
2583
2739
|
const a = p?.answer;
|
|
2584
2740
|
if (!s || !task || !p || !a || a.kind === 'stopped' || a.kind === 'released')
|
|
2585
2741
|
return { problem: 'its answer is not on its record any more; run it again' };
|
|
2742
|
+
// Only the last message of a conversation is carried on, as "Continue" holds it (2026-11-19).
|
|
2743
|
+
if (s.tasks.at(-1)?.id !== task.id)
|
|
2744
|
+
return { problem: 'its chat went on past it (a message was written there since), so it is not carried on: say what it still needs in a new message there' };
|
|
2586
2745
|
const continuing = { fromAttempt: task.attempt ?? 1, stoppedBecause: task.reason, how: 'parked', parkedFor: p.kind };
|
|
2587
2746
|
let note = '';
|
|
2588
2747
|
let approvedPlan;
|
|
@@ -2627,6 +2786,7 @@ let OperatorService = class OperatorService {
|
|
|
2627
2786
|
const last = worker?.tasks.find((t) => t.id === p.approval.taskId);
|
|
2628
2787
|
const ended = last ? [`Its last attempt ended ${last.status}${last.reason ? `: ${last.reason}` : ''}.`, ...(last.summary?.trim() ? ['', 'The worker\'s summary:', '', last.summary.trim()] : [])] : [];
|
|
2629
2788
|
note = [`Subtask ${r.n} (${r.title}) is taken as failed, at the operator's word: decide what to do next without it.`, ...(ended.length > 0 ? ['', ...ended] : [])].join('\n');
|
|
2789
|
+
continuing.takenAsFailed = { n: r.n };
|
|
2630
2790
|
}
|
|
2631
2791
|
else {
|
|
2632
2792
|
if (a.choice === 'restore') {
|
|
@@ -2638,7 +2798,7 @@ let OperatorService = class OperatorService {
|
|
|
2638
2798
|
const cp = worker?.tasks.find((t) => t.id === first)?.checkpoint;
|
|
2639
2799
|
const back = cp ? await restoreCheckpoint(dir, cp) : { ok: false, problem: 'the subtask\'s start was not photographed' };
|
|
2640
2800
|
if (!back.ok)
|
|
2641
|
-
return { problem: `the folder could not be put back to the subtask's start (${back.problem});
|
|
2801
|
+
return { problem: `the folder could not be put back to the subtask's start (${back.problem}); carry the message on in its chat with "Continue", or run the task again` };
|
|
2642
2802
|
}
|
|
2643
2803
|
// Put back: the next attempt is told it starts over, not to carry on from what the last one left.
|
|
2644
2804
|
continuing.retrySubtask = { n: r.n, ...(a.choice === 'fresh' ? { fresh: true } : {}), ...(a.choice === 'restore' ? { restored: true } : {}) };
|
|
@@ -2885,6 +3045,8 @@ let OperatorService = class OperatorService {
|
|
|
2885
3045
|
}
|
|
2886
3046
|
/** The operator's choice for a subtask that failed for a technical reason: one of the card's own. */
|
|
2887
3047
|
answerRetry(approvalId, choice, as) {
|
|
3048
|
+
if (this.parking.has(approvalId))
|
|
3049
|
+
return { ok: false, problem: SET_ASIDE_NOW };
|
|
2888
3050
|
const w = this.waiting.get(approvalId);
|
|
2889
3051
|
if (!w?.resolveRetry || !w.approval.retry)
|
|
2890
3052
|
return { ok: false, problem: 'No subtask is waiting for a choice under that id.' };
|
|
@@ -2942,6 +3104,14 @@ let OperatorService = class OperatorService {
|
|
|
2942
3104
|
const last = sub.attempts?.at(-1);
|
|
2943
3105
|
if (last?.status === 'done')
|
|
2944
3106
|
throw new Error(`Subtask ${n} was done; it is not done again.`);
|
|
3107
|
+
/*
|
|
3108
|
+
* A queue task set aside, or answered on its card (third hunt, 2026-11-20): tried again here, its record moved into
|
|
3109
|
+
* the attempts and the queue's card failed at every press but Stop, the task and those after it waiting for good.
|
|
3110
|
+
*/
|
|
3111
|
+
if (task.parked && !task.parked.answer)
|
|
3112
|
+
throw new Error('This message waits for an answer on its card in the queue: answer it there, and the queue carries it on.');
|
|
3113
|
+
if (!parkedOver(task.parked))
|
|
3114
|
+
throw new Error(PARKED_ANSWERED);
|
|
2945
3115
|
// The browser first, as for Continue (2026-11-18): nothing changes when it is not free.
|
|
2946
3116
|
const busy = this.browserBusyFor(threadId);
|
|
2947
3117
|
if (busy)
|
|
@@ -3017,6 +3187,8 @@ let OperatorService = class OperatorService {
|
|
|
3017
3187
|
return await this.start(threadId, cfg.execution.mode);
|
|
3018
3188
|
}
|
|
3019
3189
|
answerQuestion(approvalId, text, ran, outcome, chosen, as) {
|
|
3190
|
+
if (this.parking.has(approvalId))
|
|
3191
|
+
return { ok: false, problem: SET_ASIDE_NOW };
|
|
3020
3192
|
const w = this.waiting.get(approvalId);
|
|
3021
3193
|
if (!w?.resolveAnswer)
|
|
3022
3194
|
return { ok: false, problem: 'No question of the lead is waiting under that id.' };
|
|
@@ -3091,6 +3263,8 @@ let OperatorService = class OperatorService {
|
|
|
3091
3263
|
* another (saying what to change), or stop the task.
|
|
3092
3264
|
*/
|
|
3093
3265
|
decidePlan(approvalId, action, note, as) {
|
|
3266
|
+
if (this.parking.has(approvalId))
|
|
3267
|
+
return { ok: false, problem: SET_ASIDE_NOW };
|
|
3094
3268
|
const w = this.waiting.get(approvalId);
|
|
3095
3269
|
if (!w || !w.resolvePlan)
|
|
3096
3270
|
return { ok: false, problem: 'That plan is not waiting any more.' };
|
|
@@ -3143,6 +3317,8 @@ let OperatorService = class OperatorService {
|
|
|
3143
3317
|
* in the rest. The deny list is untouched by it.
|
|
3144
3318
|
*/
|
|
3145
3319
|
decide(approvalId, action) {
|
|
3320
|
+
if (this.parking.has(approvalId))
|
|
3321
|
+
return { ok: false, problem: SET_ASIDE_NOW };
|
|
3146
3322
|
const w = this.waiting.get(approvalId);
|
|
3147
3323
|
// Said (bug hunt 2026-11-18): answered "ok: false" with 200, the press looked taken, and the card went on waiting.
|
|
3148
3324
|
if (!w)
|
|
@@ -3164,7 +3340,7 @@ let OperatorService = class OperatorService {
|
|
|
3164
3340
|
if (action === 'run-all')
|
|
3165
3341
|
this.setRunMode(this.runKey(w.approval.sessionId), 'unattended');
|
|
3166
3342
|
const decision = action === 'run' || action === 'run-all'
|
|
3167
|
-
? { action: 'run' }
|
|
3343
|
+
? { action: 'run', by: 'operator' }
|
|
3168
3344
|
: action === 'skip'
|
|
3169
3345
|
? { action: 'skip', reason: 'skipped by the operator', by: 'operator' }
|
|
3170
3346
|
: { action: 'abort', reason: 'aborted by the operator', by: 'operator' };
|
|
@@ -3240,6 +3416,9 @@ let OperatorService = class OperatorService {
|
|
|
3240
3416
|
continue;
|
|
3241
3417
|
if (w.approval.scripts && run.policy.writtenScripts !== 'run')
|
|
3242
3418
|
continue;
|
|
3419
|
+
// Being set aside by the queue (2026-11-19): its answer is given on the queue's page.
|
|
3420
|
+
if (this.parking.has(id))
|
|
3421
|
+
continue;
|
|
3243
3422
|
this.waiting.delete(id);
|
|
3244
3423
|
w.resolve({ action: 'run' });
|
|
3245
3424
|
}
|
|
@@ -3704,10 +3883,14 @@ let OperatorService = class OperatorService {
|
|
|
3704
3883
|
}
|
|
3705
3884
|
/*
|
|
3706
3885
|
* A project that may be changed inside one for reference only (bug hunt 2026-11-18): every change made in it would
|
|
3707
|
-
* be put back after each step, so no task there could finish. Refused, with what to do.
|
|
3886
|
+
* be put back after each step, so no task there could finish. Refused, with what to do. Not the chat's own folder
|
|
3887
|
+
* (second bug hunt, 2026-11-19): inside one for reference only, every message there only reads and reports, as
|
|
3888
|
+
* Kerrigan's text says and the chat is told — and "Open a folder" can make it so, after which every save of the
|
|
3889
|
+
* projects, a name or a level 2, was refused for it.
|
|
3708
3890
|
*/
|
|
3709
|
-
const
|
|
3710
|
-
|
|
3891
|
+
const chats = { name: name || rootDir, rootDir, readOnly };
|
|
3892
|
+
const all = [chats, ...others].filter((p) => p.rootDir);
|
|
3893
|
+
for (const w of all.filter((p) => !p.readOnly && p !== chats)) {
|
|
3711
3894
|
const r = all.find((p) => p.readOnly && p !== w && folderInside(w.rootDir, p.rootDir));
|
|
3712
3895
|
if (r) {
|
|
3713
3896
|
throw new Error(`${w.name} (${w.rootDir}) is inside ${r.name} (${r.rootDir}), which is for reference only: every change made in it would be put back after each step. Untick "for reference only" on ${r.name}, or list for reference only the folders of it beside ${w.name}.`);
|
|
@@ -3910,14 +4093,11 @@ let OperatorService = class OperatorService {
|
|
|
3910
4093
|
keepFailurePage: cfg.copilot.keepFailurePage,
|
|
3911
4094
|
// The rows' locator reads the names (Settings' own, 2026-10-24).
|
|
3912
4095
|
...pickerOptions(cfg),
|
|
3913
|
-
onEvent: (event, detail) =>
|
|
3914
|
-
if (event === 'locator-missing' && detail)
|
|
3915
|
-
this.recordLocatorFailure(detail);
|
|
3916
|
-
},
|
|
4096
|
+
onEvent: (event, detail) => this.onReadingEvent(event, detail),
|
|
3917
4097
|
});
|
|
3918
4098
|
await this.closeChatWindow('reading the models needs the browser');
|
|
3919
4099
|
await transport.open();
|
|
3920
|
-
await transport.ensureSignedIn();
|
|
4100
|
+
await transport.ensureSignedIn(undefined, { boxNotWaited: true });
|
|
3921
4101
|
const { options, current, note } = await transport.listModels();
|
|
3922
4102
|
const catalogue = { options, current: current ?? undefined, readAt: new Date().toISOString(), note };
|
|
3923
4103
|
await this.store.saveModels(catalogue);
|
|
@@ -3942,10 +4122,26 @@ let OperatorService = class OperatorService {
|
|
|
3942
4122
|
return catalogue;
|
|
3943
4123
|
}
|
|
3944
4124
|
finally {
|
|
4125
|
+
this.readingSignIn = false;
|
|
3945
4126
|
await transport?.close().catch(() => undefined);
|
|
3946
4127
|
this.releaseBrowser(claim.holder);
|
|
3947
4128
|
}
|
|
3948
4129
|
}
|
|
4130
|
+
/**
|
|
4131
|
+
* What the window of a reading says (the models, "Check the locators"): a locator that found nothing is kept; a sign-in
|
|
4132
|
+
* it waits for is said on the tab and on the page that asked (2026-11-19), where there was only a button that went on
|
|
4133
|
+
* turning.
|
|
4134
|
+
*/
|
|
4135
|
+
onReadingEvent(event, detail) {
|
|
4136
|
+
if (event === 'locator-missing' && detail)
|
|
4137
|
+
this.recordLocatorFailure(detail);
|
|
4138
|
+
if (event === 'locator-found' && detail)
|
|
4139
|
+
this.locatorFound(detail);
|
|
4140
|
+
if (event === 'sign-in-required')
|
|
4141
|
+
this.readingSignIn = true;
|
|
4142
|
+
if (event === 'signed-in')
|
|
4143
|
+
this.readingSignIn = false;
|
|
4144
|
+
}
|
|
3949
4145
|
/**
|
|
3950
4146
|
* "Check the locators" (operator, 2026-11-17): the Copilot window opened as for reading the models, each of the chat's
|
|
3951
4147
|
* locators looked for (`checkLocators`, which only reads and looks), and the window closed. One that found nothing is
|
|
@@ -3968,17 +4164,14 @@ let OperatorService = class OperatorService {
|
|
|
3968
4164
|
headless: cfg.copilot.headless,
|
|
3969
4165
|
keepFailurePage: cfg.copilot.keepFailurePage,
|
|
3970
4166
|
...pickerOptions(cfg),
|
|
3971
|
-
onEvent: (event, detail) =>
|
|
3972
|
-
if (event === 'locator-missing' && detail)
|
|
3973
|
-
this.recordLocatorFailure(detail);
|
|
3974
|
-
},
|
|
4167
|
+
onEvent: (event, detail) => this.onReadingEvent(event, detail),
|
|
3975
4168
|
});
|
|
3976
4169
|
await this.closeChatWindow('checking the locators needs the browser');
|
|
3977
4170
|
await transport.open();
|
|
3978
4171
|
let results;
|
|
3979
4172
|
try {
|
|
3980
4173
|
// A step of the operator's own that is not there does not stop a check, which only reads: each is looked for below.
|
|
3981
|
-
await transport.ensureSignedIn(undefined, { stepsLookOnly: true });
|
|
4174
|
+
await transport.ensureSignedIn(undefined, { stepsLookOnly: true, boxNotWaited: true });
|
|
3982
4175
|
results = await transport.checkLocators();
|
|
3983
4176
|
}
|
|
3984
4177
|
catch (e) {
|
|
@@ -3994,6 +4187,7 @@ let OperatorService = class OperatorService {
|
|
|
3994
4187
|
return { checkedAt: new Date().toISOString(), results };
|
|
3995
4188
|
}
|
|
3996
4189
|
finally {
|
|
4190
|
+
this.readingSignIn = false;
|
|
3997
4191
|
await transport?.close().catch(() => undefined);
|
|
3998
4192
|
this.releaseBrowser(claim.holder);
|
|
3999
4193
|
}
|
|
@@ -4043,7 +4237,7 @@ let OperatorService = class OperatorService {
|
|
|
4043
4237
|
return raw;
|
|
4044
4238
|
});
|
|
4045
4239
|
const chosen = chooseHome(layout, dir, copy);
|
|
4046
|
-
console.log(`[home] the bot's folder will be ${chosen.home} from its next start${chosen.copied.length ? ` (copied: ${chosen.copied.join(', ')})` : ''}`);
|
|
4240
|
+
console.log(`[home] the bot's folder will be ${chosen.home} from its next start${chosen.copied.length ? ` (copied: ${chosen.copied.join(', ')})` : ''}${chosen.asideDir ? `; what it had put aside in ${chosen.asideDir}` : ''}`);
|
|
4047
4241
|
return { ...chosen, restart: true };
|
|
4048
4242
|
}
|
|
4049
4243
|
async doctor() {
|