copilot-operator 0.1.85 → 0.1.90
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/operator.controller.js +89 -3
- package/dist/src/api/operator.service.js +200 -2
- package/dist/src/api/server.js +5 -1
- package/dist/src/cli.js +6 -0
- package/dist/src/config/live.js +1 -1
- package/dist/src/config/schema.js +27 -0
- package/dist/src/orchestrator/kerriganRunner.js +3 -1
- package/dist/src/orchestrator/leadRunner.js +3 -1
- package/dist/src/orchestrator/taskRunner.js +64 -32
- package/dist/src/plan/systemGuide.js +193 -4
- package/dist/src/session/compose.js +5 -1
- package/dist/src/session/locatorFailures.js +55 -0
- package/dist/src/transport/chatTransport.js +6 -2
- package/dist/src/transport/copilotTransport.js +519 -59
- package/dist/src/transport/keptWindow.js +250 -0
- package/dist/src/transport/locators.js +140 -9
- package/dist/src/transport/pageHtml.js +62 -0
- package/dist/web/404.html +2 -2
- package/dist/web/_next/static/chunks/1077.1cc6d439e3dd0fa9.js +1 -0
- package/dist/web/_next/static/chunks/1548.3de9dc874e47558e.js +1 -0
- package/dist/web/_next/static/chunks/2163.66458fb9c54fb52d.js +1 -0
- package/dist/web/_next/static/chunks/714.cffed2b87154be0f.js +1 -0
- package/dist/web/_next/static/chunks/7220.30b6a3e1bd41e51a.js +1 -0
- package/dist/web/_next/static/chunks/7921-d3a4a261e08950e0.js +1 -0
- package/dist/web/_next/static/chunks/8584.36422ed19d6c43e9.js +1 -0
- package/dist/web/_next/static/chunks/9067.e579f97591576de2.js +1 -0
- package/dist/web/_next/static/chunks/9747.11247f0e21542f6d.js +1 -0
- package/dist/web/_next/static/chunks/app/layout-7b5fa7c74ecd6939.js +1 -0
- package/dist/web/_next/static/chunks/app/page-b71841852e6b9ff5.js +1 -0
- package/dist/web/_next/static/chunks/app/queue/{page-317151444eda8115.js → page-7909ba7c9e3d4c2d.js} +1 -1
- package/dist/web/_next/static/chunks/app/settings/page-7651920337bbb580.js +1 -0
- package/dist/web/_next/static/chunks/{webpack-13ccb80d7b7094ca.js → webpack-78ec62098b09e4a0.js} +1 -1
- package/dist/web/_next/static/css/{6e2b8656501f0dd7.css → d74aa18c98dacdb4.css} +1 -1
- package/dist/web/defaults.html +2 -2
- package/dist/web/defaults.txt +8 -8
- package/dist/web/index.html +3 -3
- package/dist/web/index.txt +9 -9
- package/dist/web/queue.html +2 -2
- package/dist/web/queue.txt +9 -9
- package/dist/web/settings.html +2 -2
- package/dist/web/settings.txt +9 -9
- package/dist/web/system.html +2 -2
- package/dist/web/system.txt +9 -9
- package/package.json +4 -2
- package/dist/web/_next/static/chunks/1077.06fe73b2c16f8f49.js +0 -1
- package/dist/web/_next/static/chunks/1548.b38c5d8d00ab2a72.js +0 -1
- package/dist/web/_next/static/chunks/2163.ba933c9a506302ca.js +0 -1
- package/dist/web/_next/static/chunks/714.575273a189d030fe.js +0 -1
- package/dist/web/_next/static/chunks/7220.988dfd28e00f407c.js +0 -1
- package/dist/web/_next/static/chunks/7921-65dd56d87144bd44.js +0 -1
- package/dist/web/_next/static/chunks/8584.2221587201bc2fa2.js +0 -1
- package/dist/web/_next/static/chunks/9067.8d94a08830c3d1da.js +0 -1
- package/dist/web/_next/static/chunks/9747.8671194406acd839.js +0 -1
- package/dist/web/_next/static/chunks/app/layout-127e5af1ebf21876.js +0 -1
- package/dist/web/_next/static/chunks/app/page-76139370c7ca3715.js +0 -1
- package/dist/web/_next/static/chunks/app/settings/page-116da78c83f0c5c9.js +0 -1
- /package/dist/web/_next/static/{aCQe1FDhYTj4zGeI5ueVq → 3VkK1sxEugkae88HSFR-i}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{aCQe1FDhYTj4zGeI5ueVq → 3VkK1sxEugkae88HSFR-i}/_ssgManifest.js +0 -0
|
@@ -19,13 +19,13 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
19
19
|
* What is here is what the chat and its workbench use, with Settings and Kerrigan (2026-10-20: the sessions, the task
|
|
20
20
|
* register and the plan from JSON were removed, and their routes with them).
|
|
21
21
|
*/
|
|
22
|
-
import { Body, Controller, Get, Inject, Param, Post, Put, Query, Res, NotFoundException, BadRequestException, ConflictException } from '@nestjs/common';
|
|
22
|
+
import { Body, Controller, Delete, Get, Inject, Param, Post, Put, Query, Res, NotFoundException, BadRequestException, ConflictException } from '@nestjs/common';
|
|
23
23
|
import { OperatorService } from './operator.service.js';
|
|
24
24
|
import { SettingsUnusableError } from './settings.js';
|
|
25
25
|
import { PolicyLockUnusableError } from '../config/lockedPolicy.js';
|
|
26
26
|
import { CHANGED_ON_DISK } from '../session/workspace.js';
|
|
27
27
|
import { join } from 'node:path';
|
|
28
|
-
import { DefaultPickerLocators } from '../transport/locators.js';
|
|
28
|
+
import { DefaultChatLocators, DefaultPickerLocators } from '../transport/locators.js';
|
|
29
29
|
import { platformTools } from '../exec/platforms.js';
|
|
30
30
|
import { readOnlyCapable } from '../exec/readOnly.js';
|
|
31
31
|
function fail(e) {
|
|
@@ -101,7 +101,9 @@ let OperatorController = class OperatorController {
|
|
|
101
101
|
const programs = { platforms: platformTools(), readOnly: readOnlyCapable(), inForce: resolved.execution.allowedPrograms };
|
|
102
102
|
// The scripts the bot may run, as in force (2026-10-27): a lock may have emptied the boxes for its own.
|
|
103
103
|
const scripts = { inForce: resolved.execution.scripts, writtenScripts: resolved.execution.writtenScripts };
|
|
104
|
-
|
|
104
|
+
// The chat page's own locators (2026-11-17): their defaults, which Settings shows and puts back.
|
|
105
|
+
const chat = { defaults: DefaultChatLocators };
|
|
106
|
+
return { raw, defaults, resolved: resolved.resolved, picker, chat, programs, scripts };
|
|
105
107
|
}
|
|
106
108
|
/** Saved, and taken at once by the work going on where it can be (2026-11-03): the answer says what was, and what waits. */
|
|
107
109
|
async saveSettings(body) {
|
|
@@ -177,6 +179,40 @@ let OperatorController = class OperatorController {
|
|
|
177
179
|
startFailures(unanswered) {
|
|
178
180
|
return this.ops.recentStartFailures(unanswered === '1' || unanswered === 'true');
|
|
179
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* The chat's locators that found nothing where the bot needed them (2026-11-17): the last time for each, whether it
|
|
184
|
+
* has been changed in Settings since, and the text for a chatbot. Read by the banner on every page and by Settings.
|
|
185
|
+
*/
|
|
186
|
+
locatorFailures() {
|
|
187
|
+
return this.ops.listLocatorFailures();
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* The page's HTML kept with one, to hand to a chatbot. Always a download, never a page of this origin: what the page
|
|
191
|
+
* held is not this program's, however much of it was taken out.
|
|
192
|
+
*/
|
|
193
|
+
async locatorFailureHtml(key, res) {
|
|
194
|
+
try {
|
|
195
|
+
const { fileName, content } = await this.ops.locatorFailureHtml(key);
|
|
196
|
+
res.type('application/octet-stream');
|
|
197
|
+
res.setHeader('content-disposition', contentDisposition(fileName));
|
|
198
|
+
res.setHeader('x-content-type-options', 'nosniff');
|
|
199
|
+
res.send(Buffer.from(content, 'utf8'));
|
|
200
|
+
}
|
|
201
|
+
catch (e) {
|
|
202
|
+
failText(res, e);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* "Check the locators" (2026-11-17): the Copilot window opened, each of the chat's locators looked for, and what each
|
|
207
|
+
* found. Takes as long as the window takes to open, a sign-in included.
|
|
208
|
+
*/
|
|
209
|
+
checkLocators() {
|
|
210
|
+
return this.ops.checkLocators().catch(fail);
|
|
211
|
+
}
|
|
212
|
+
/** Closed by the operator: its banner and its red go. */
|
|
213
|
+
async dismissLocatorFailure(key) {
|
|
214
|
+
return { dismissed: await this.ops.locatorFailures.dismiss(key) };
|
|
215
|
+
}
|
|
180
216
|
/** One of them as a text file: the error, where it stopped, the run's record, the events and the console. */
|
|
181
217
|
async startFailureReport(id, res) {
|
|
182
218
|
try {
|
|
@@ -440,6 +476,10 @@ let OperatorController = class OperatorController {
|
|
|
440
476
|
throw new BadRequestException(result.problem);
|
|
441
477
|
return result;
|
|
442
478
|
}
|
|
479
|
+
/** "Continue" (2026-11-13): the last message of a conversation, stopped before it was done, carried on from where it got to. */
|
|
480
|
+
chatContinue(id, taskId) {
|
|
481
|
+
return this.ops.chatContinue(id, taskId).catch(fail);
|
|
482
|
+
}
|
|
443
483
|
/** After a Stop (two chats, 2026-10-25): the stopped message carried on with one of its subtasks tried again first. */
|
|
444
484
|
chatRetrySubtask(id, taskId, body = {}) {
|
|
445
485
|
const n = Number(body?.n);
|
|
@@ -527,6 +567,10 @@ let OperatorController = class OperatorController {
|
|
|
527
567
|
setDefaultLeadModel(body) {
|
|
528
568
|
return this.ops.setDefaultLeadModel(body?.model ?? '').catch(fail);
|
|
529
569
|
}
|
|
570
|
+
/** The model Kerrigan's conversation starts on (2026-11-13). An empty name: the lead's, else the worker's. */
|
|
571
|
+
setDefaultKerriganModel(body) {
|
|
572
|
+
return this.ops.setDefaultKerriganModel(body?.model ?? '').catch(fail);
|
|
573
|
+
}
|
|
530
574
|
/** The model of the independent review. An empty name means "the session's own". */
|
|
531
575
|
setDefaultReviewModel(body) {
|
|
532
576
|
return this.ops.setDefaultReviewModel(body?.model ?? '').catch(fail);
|
|
@@ -659,6 +703,33 @@ __decorate([
|
|
|
659
703
|
__metadata("design:paramtypes", [String]),
|
|
660
704
|
__metadata("design:returntype", Object)
|
|
661
705
|
], OperatorController.prototype, "startFailures", null);
|
|
706
|
+
__decorate([
|
|
707
|
+
Get('locators/failures'),
|
|
708
|
+
__metadata("design:type", Function),
|
|
709
|
+
__metadata("design:paramtypes", []),
|
|
710
|
+
__metadata("design:returntype", Promise)
|
|
711
|
+
], OperatorController.prototype, "locatorFailures", null);
|
|
712
|
+
__decorate([
|
|
713
|
+
Get('locators/failures/:key/html'),
|
|
714
|
+
__param(0, Param('key')),
|
|
715
|
+
__param(1, Res()),
|
|
716
|
+
__metadata("design:type", Function),
|
|
717
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
718
|
+
__metadata("design:returntype", Promise)
|
|
719
|
+
], OperatorController.prototype, "locatorFailureHtml", null);
|
|
720
|
+
__decorate([
|
|
721
|
+
Post('locators/check'),
|
|
722
|
+
__metadata("design:type", Function),
|
|
723
|
+
__metadata("design:paramtypes", []),
|
|
724
|
+
__metadata("design:returntype", Promise)
|
|
725
|
+
], OperatorController.prototype, "checkLocators", null);
|
|
726
|
+
__decorate([
|
|
727
|
+
Delete('locators/failures/:key'),
|
|
728
|
+
__param(0, Param('key')),
|
|
729
|
+
__metadata("design:type", Function),
|
|
730
|
+
__metadata("design:paramtypes", [String]),
|
|
731
|
+
__metadata("design:returntype", Promise)
|
|
732
|
+
], OperatorController.prototype, "dismissLocatorFailure", null);
|
|
662
733
|
__decorate([
|
|
663
734
|
Get('start/failures/:id/report'),
|
|
664
735
|
__param(0, Param('id')),
|
|
@@ -943,6 +1014,14 @@ __decorate([
|
|
|
943
1014
|
__metadata("design:paramtypes", [String, Object]),
|
|
944
1015
|
__metadata("design:returntype", Object)
|
|
945
1016
|
], OperatorController.prototype, "answerRetry", null);
|
|
1017
|
+
__decorate([
|
|
1018
|
+
Post('chat/:id/tasks/:taskId/continue'),
|
|
1019
|
+
__param(0, Param('id')),
|
|
1020
|
+
__param(1, Param('taskId')),
|
|
1021
|
+
__metadata("design:type", Function),
|
|
1022
|
+
__metadata("design:paramtypes", [String, String]),
|
|
1023
|
+
__metadata("design:returntype", Promise)
|
|
1024
|
+
], OperatorController.prototype, "chatContinue", null);
|
|
946
1025
|
__decorate([
|
|
947
1026
|
Post('chat/:id/tasks/:taskId/retry-subtask'),
|
|
948
1027
|
__param(0, Param('id')),
|
|
@@ -1033,6 +1112,13 @@ __decorate([
|
|
|
1033
1112
|
__metadata("design:paramtypes", [Object]),
|
|
1034
1113
|
__metadata("design:returntype", Promise)
|
|
1035
1114
|
], OperatorController.prototype, "setDefaultLeadModel", null);
|
|
1115
|
+
__decorate([
|
|
1116
|
+
Put('models/kerrigan-default'),
|
|
1117
|
+
__param(0, Body()),
|
|
1118
|
+
__metadata("design:type", Function),
|
|
1119
|
+
__metadata("design:paramtypes", [Object]),
|
|
1120
|
+
__metadata("design:returntype", Promise)
|
|
1121
|
+
], OperatorController.prototype, "setDefaultKerriganModel", null);
|
|
1036
1122
|
__decorate([
|
|
1037
1123
|
Put('models/review-default'),
|
|
1038
1124
|
__param(0, Body()),
|
|
@@ -15,6 +15,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
15
15
|
import { pageModelFor, sameModel } from '../transport/modelMatch.js';
|
|
16
16
|
import { Injectable } from '@nestjs/common';
|
|
17
17
|
import { existsSync } from 'node:fs';
|
|
18
|
+
import { isAbsolute, relative } from 'node:path';
|
|
19
|
+
import { readFile as readFileText } from 'node:fs/promises';
|
|
20
|
+
import { LocatorFailures } from '../session/locatorFailures.js';
|
|
21
|
+
import { CHAT_LOCATOR_KEYS, locatorPrompt, resolveChatLocators } from '../transport/locators.js';
|
|
22
|
+
import { LocatorMissing } from '../transport/copilotTransport.js';
|
|
18
23
|
import { readFile } from 'node:fs/promises';
|
|
19
24
|
import { join, resolve } from 'node:path';
|
|
20
25
|
import { chosenHome, defaultHome, installLayout } from '../config/layout.js';
|
|
@@ -23,7 +28,7 @@ import { SessionStore, DEFAULT_VCS, DEFAULT_REVIEW, writeFileAtomically } from '
|
|
|
23
28
|
import { checkItems, emptyQueue, itemTitle, mergeItems, nextStep, parkAfterMs, parkedAnswerFrom, skippedBecause, statusOfTask, waitsByHand, MAX_PARK_AFTER_SEC, PARKED_WORDS } from '../queue/queue.js';
|
|
24
29
|
import { branchStart, makeQueueBranch, refreshQueueBranch } from '../queue/queueBranch.js';
|
|
25
30
|
import { EventBus } from '../session/events.js';
|
|
26
|
-
import { MAX_INSTRUCTION_CHARS, newId, withProblemAt } from '../session/model.js';
|
|
31
|
+
import { isContinuable, MAX_INSTRUCTION_CHARS, newId, withProblemAt } from '../session/model.js';
|
|
27
32
|
import { handoffOutcomeOf, handoffResultMessage } from '../orchestrator/handoff.js';
|
|
28
33
|
import { runSession, queuedToRun, failedWhileOpening, pickerOptions } from '../orchestrator/taskRunner.js';
|
|
29
34
|
import { Hold, WaitsFor } from '../orchestrator/hold.js';
|
|
@@ -150,6 +155,14 @@ function browserRefusal(held, ask) {
|
|
|
150
155
|
}
|
|
151
156
|
if (ask.kind === 'login')
|
|
152
157
|
return loginWhileBusy;
|
|
158
|
+
// "Check the locators" (2026-11-17) holds the browser for the moment it looks.
|
|
159
|
+
if (held.kind === 'locators') {
|
|
160
|
+
return ask.kind === 'locators'
|
|
161
|
+
? 'The locators are already being checked.'
|
|
162
|
+
: "the chat's locators are being checked in the browser; start this once that has finished";
|
|
163
|
+
}
|
|
164
|
+
if (ask.kind === 'locators')
|
|
165
|
+
return 'The browser profile is in use right now (a run, or a reading of the models). Check the locators once it has finished.';
|
|
153
166
|
if (held.kind === 'models') {
|
|
154
167
|
return ask.kind === 'models'
|
|
155
168
|
? 'The model list is already being read.'
|
|
@@ -187,6 +200,8 @@ let OperatorService = class OperatorService {
|
|
|
187
200
|
layout = installLayout();
|
|
188
201
|
projectRoot = this.layout.projectRoot;
|
|
189
202
|
dataDir = this.layout.dataDir;
|
|
203
|
+
/** The chat's locators that found nothing, the last time for each (2026-11-17): the banner's and Settings' red fields. */
|
|
204
|
+
locatorFailures = new LocatorFailures(join(this.layout.dataDir, 'locator-failures.json'));
|
|
190
205
|
settings = settingsOf(this.layout);
|
|
191
206
|
store = new SessionStore(this.dataDir, join(this.layout.promptsDir, 'level1.md'));
|
|
192
207
|
bus = new EventBus();
|
|
@@ -208,6 +223,9 @@ let OperatorService = class OperatorService {
|
|
|
208
223
|
followsActing = this.bus.subscribe('*', (e) => {
|
|
209
224
|
if (e.type === 'acting' && e.data)
|
|
210
225
|
this.acting.set(e.sessionId, e.data);
|
|
226
|
+
// A chat locator that found nothing (2026-11-17): kept for the banner and Settings.
|
|
227
|
+
else if (e.type === 'browser:locator-missing' && e.data)
|
|
228
|
+
this.recordLocatorFailure(e.data);
|
|
211
229
|
else if (e.type === 'browser:sign-in-required' || e.type === 'browser:verification-required') {
|
|
212
230
|
// The Copilot window waits for the operator to sign in, or to show a person is there: not counted (2026-10-29).
|
|
213
231
|
this.holdOf(e.sessionId)?.waitFor(`${e.type}:${e.sessionId}`);
|
|
@@ -866,6 +884,65 @@ let OperatorService = class OperatorService {
|
|
|
866
884
|
* One of them as a file: what failed and where, the run's record, the sessions' events from the press,
|
|
867
885
|
* and the console lines from the press to a few seconds after — secret-shaped text taken out.
|
|
868
886
|
*/
|
|
887
|
+
/**
|
|
888
|
+
* A chat locator that found nothing where the bot needed it (the transport's `locator-missing`, operator 2026-11-17:
|
|
889
|
+
* "a mechanism that detects which locator exactly the bot failed on"): kept as the last one for that locator, for the
|
|
890
|
+
* banner on every page and the field in red in Settings.
|
|
891
|
+
*/
|
|
892
|
+
recordLocatorFailure(detail) {
|
|
893
|
+
const key = detail.key;
|
|
894
|
+
if (typeof key !== 'string' || !CHAT_LOCATOR_KEYS.includes(key) || typeof detail.locator !== 'string')
|
|
895
|
+
return;
|
|
896
|
+
const str = (v) => (typeof v === 'string' && v ? v : undefined);
|
|
897
|
+
const html = str(detail.html);
|
|
898
|
+
const picture = str(detail.picture);
|
|
899
|
+
const url = str(detail.url);
|
|
900
|
+
void this.locatorFailures
|
|
901
|
+
.record({
|
|
902
|
+
key: key,
|
|
903
|
+
locator: detail.locator,
|
|
904
|
+
at: new Date().toISOString(),
|
|
905
|
+
why: str(detail.why) ?? '',
|
|
906
|
+
stopped: detail.stopped !== false,
|
|
907
|
+
...(html ? { html } : {}),
|
|
908
|
+
...(picture ? { picture } : {}),
|
|
909
|
+
...(url ? { url } : {}),
|
|
910
|
+
})
|
|
911
|
+
.catch(() => undefined);
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* The failures kept, each with whether its locator has been changed in Settings since (then it is no longer the one
|
|
915
|
+
* that found nothing, and the banner and the red go), whether its HTML is there to download, and the text for a
|
|
916
|
+
* chatbot. The files' places are not given out: the HTML is downloaded through the API.
|
|
917
|
+
*/
|
|
918
|
+
async listLocatorFailures() {
|
|
919
|
+
const cfg = await this.settings.load();
|
|
920
|
+
const inForce = resolveChatLocators(cfg.copilot.chatLocators).locators;
|
|
921
|
+
return (await this.locatorFailures.list()).map(({ html, picture: _picture, ...f }) => ({
|
|
922
|
+
...f,
|
|
923
|
+
html: !!html && existsSync(html),
|
|
924
|
+
changed: inForce[f.key] !== f.locator,
|
|
925
|
+
prompt: locatorPrompt(f.key, f.locator),
|
|
926
|
+
}));
|
|
927
|
+
}
|
|
928
|
+
/** The page's HTML kept with a failure, to download: only a file in the bot's runs folder. */
|
|
929
|
+
async locatorFailureHtml(key) {
|
|
930
|
+
const f = await this.locatorFailures.get(key);
|
|
931
|
+
if (!f?.html)
|
|
932
|
+
throw new Error(`No HTML is kept for the "${key}" locator.`);
|
|
933
|
+
const cfg = await this.settings.load();
|
|
934
|
+
const runs = resolve(cfg.resolved.runsDir);
|
|
935
|
+
const file = resolve(f.html);
|
|
936
|
+
const inside = relative(runs, file);
|
|
937
|
+
if (!inside || inside.startsWith('..') || isAbsolute(inside)) {
|
|
938
|
+
throw new Error(`The HTML kept for the "${key}" locator is not in the bot's runs folder.`);
|
|
939
|
+
}
|
|
940
|
+
const content = await readFileText(file, 'utf8').catch(() => {
|
|
941
|
+
throw new Error(`The HTML kept for the "${key}" locator is gone (${file}).`);
|
|
942
|
+
});
|
|
943
|
+
const stamp = f.at.replace(/[-:]/g, '').replace('T', '-').slice(0, 15);
|
|
944
|
+
return { fileName: `copilot-page-${key}-${stamp}.html`, content };
|
|
945
|
+
}
|
|
869
946
|
async startFailureReport(id) {
|
|
870
947
|
await this.init();
|
|
871
948
|
const f = this.startFailures.get(id);
|
|
@@ -1053,6 +1130,8 @@ let OperatorService = class OperatorService {
|
|
|
1053
1130
|
await this.setDefaultReviewModel(to);
|
|
1054
1131
|
if (which === 'lead' && (now.defaultLeadModel ?? '').trim() === from)
|
|
1055
1132
|
await this.setDefaultLeadModel(to);
|
|
1133
|
+
if (which === 'kerrigan' && (now.defaultKerriganModel ?? '').trim() === from)
|
|
1134
|
+
await this.setDefaultKerriganModel(to);
|
|
1056
1135
|
},
|
|
1057
1136
|
seen: async (options, current) => {
|
|
1058
1137
|
await this.store.saveModels({ options, current: current ?? undefined, readAt: new Date().toISOString() });
|
|
@@ -2461,6 +2540,42 @@ let OperatorService = class OperatorService {
|
|
|
2461
2540
|
const cfg = await this.settings.load();
|
|
2462
2541
|
return await this.start(threadId, cfg.execution.mode);
|
|
2463
2542
|
}
|
|
2543
|
+
/**
|
|
2544
|
+
* "Continue" under a message that stopped before it was done (operator, 2026-11-13: "for every stop" — a window closed
|
|
2545
|
+
* past the times it is opened again, Stop, the bot itself stopped or restarted, a limit): carried on in its conversation
|
|
2546
|
+
* from where it got to. The chat is told how it stopped and, for one that was stopped, which of its last commands ran,
|
|
2547
|
+
* with the end of what they printed, which was cut off and which never ran — read from its run folder — rather than
|
|
2548
|
+
* only that it was stopped, after which it ran its inspections again (live run, 2026-10-03). Only the last message of
|
|
2549
|
+
* a conversation: one the conversation has gone on past is not carried on in it. A chat Kerrigan directs is hers.
|
|
2550
|
+
*/
|
|
2551
|
+
async chatContinue(threadId, taskId) {
|
|
2552
|
+
await this.init();
|
|
2553
|
+
const session = await this.store.getSession(threadId);
|
|
2554
|
+
if (!session || session.kind !== 'chat')
|
|
2555
|
+
throw new Error('That conversation is not there any more.');
|
|
2556
|
+
if (session.directedBy)
|
|
2557
|
+
throw new Error('Kerrigan directs this chat: carry her conversation on instead.');
|
|
2558
|
+
if (this.running.has(this.runKey(threadId)))
|
|
2559
|
+
throw new Error('The conversation is working: stop it first, or let it finish.');
|
|
2560
|
+
const task = session.tasks.find((t) => t.id === taskId);
|
|
2561
|
+
if (!task)
|
|
2562
|
+
throw new Error('That message is not in this conversation.');
|
|
2563
|
+
if (session.tasks.at(-1)?.id !== taskId)
|
|
2564
|
+
throw new Error('Only the last message of a conversation is carried on: the conversation has gone on past this one.');
|
|
2565
|
+
if (!isContinuable(task)) {
|
|
2566
|
+
throw new Error(task.status === 'done' ? 'This message is done.' : 'Only a message that stopped before it was done is carried on; write the next message instead.');
|
|
2567
|
+
}
|
|
2568
|
+
const cfg = await this.settings.load();
|
|
2569
|
+
const stoppedAt = task.status === 'aborted' && !task.interruption && task.runId ? await readInterruption(join(cfg.resolved.runsDir, task.runId)).catch(() => null) : null;
|
|
2570
|
+
const queued = await this.store.continueTask(threadId, taskId, stoppedAt);
|
|
2571
|
+
await appendSessionLog(cfg.resolved.runsDir, threadId, {
|
|
2572
|
+
type: 'continue',
|
|
2573
|
+
message: `"${queued.title}" carried on as attempt ${queued.attempt ?? 1}, from where it stopped: ${task.reason ?? task.status}`,
|
|
2574
|
+
data: { taskId, attempt: queued.attempt, was: task.status },
|
|
2575
|
+
}).catch(() => undefined);
|
|
2576
|
+
this.bus.publish({ sessionId: threadId, taskId, type: 'task-requeued', level: 'info', message: `"${queued.title}" carried on from where it stopped` });
|
|
2577
|
+
return await this.start(threadId, cfg.execution.mode);
|
|
2578
|
+
}
|
|
2464
2579
|
answerQuestion(approvalId, text, ran, outcome, chosen, as) {
|
|
2465
2580
|
const w = this.waiting.get(approvalId);
|
|
2466
2581
|
if (!w?.resolveAnswer)
|
|
@@ -3076,7 +3191,10 @@ let OperatorService = class OperatorService {
|
|
|
3076
3191
|
const defaultModel = cfg.copilot.defaultModel ?? '';
|
|
3077
3192
|
const defaultReviewModel = cfg.copilot.defaultReviewModel ?? '';
|
|
3078
3193
|
const defaultLeadModel = cfg.copilot.defaultLeadModel ?? '';
|
|
3079
|
-
|
|
3194
|
+
const defaultKerriganModel = cfg.copilot.defaultKerriganModel ?? '';
|
|
3195
|
+
return cached
|
|
3196
|
+
? { ...cached, defaultModel, defaultLeadModel, defaultKerriganModel, defaultReviewModel }
|
|
3197
|
+
: { defaultModel, defaultLeadModel, defaultKerriganModel, defaultReviewModel, options: [], readAt: null };
|
|
3080
3198
|
}
|
|
3081
3199
|
/**
|
|
3082
3200
|
* Sets the model a new session's independent review starts on. An empty name clears it,
|
|
@@ -3095,6 +3213,18 @@ let OperatorService = class OperatorService {
|
|
|
3095
3213
|
});
|
|
3096
3214
|
return { defaultLeadModel: name.trim() };
|
|
3097
3215
|
}
|
|
3216
|
+
/** Sets the model Kerrigan's conversation starts on (2026-11-13). An empty name: the lead's, else the worker's. */
|
|
3217
|
+
async setDefaultKerriganModel(name) {
|
|
3218
|
+
await this.init();
|
|
3219
|
+
await this.settings.update((raw) => ({ ...raw, copilot: { ...(raw.copilot ?? {}), defaultKerriganModel: name.trim() } }));
|
|
3220
|
+
this.bus.publish({
|
|
3221
|
+
sessionId: '*',
|
|
3222
|
+
type: 'default-kerrigan-model-changed',
|
|
3223
|
+
level: 'info',
|
|
3224
|
+
message: name.trim() ? `Kerrigan will start on ${name.trim()}` : "Kerrigan starts on the lead's model",
|
|
3225
|
+
});
|
|
3226
|
+
return { defaultKerriganModel: name.trim() };
|
|
3227
|
+
}
|
|
3098
3228
|
async setDefaultReviewModel(name) {
|
|
3099
3229
|
await this.init();
|
|
3100
3230
|
await this.settings.update((raw) => ({ ...raw, copilot: { ...(raw.copilot ?? {}), defaultReviewModel: name.trim() } }));
|
|
@@ -3161,6 +3291,12 @@ let OperatorService = class OperatorService {
|
|
|
3161
3291
|
await this.init();
|
|
3162
3292
|
const cfg = await this.settings.load();
|
|
3163
3293
|
transport = createTransport({
|
|
3294
|
+
// The box to write in by Settings' locator (2026-11-17): the sign-in ends when it shows; one that finds nothing is kept.
|
|
3295
|
+
...(cfg.copilot.chatLocators ? { chatLocators: cfg.copilot.chatLocators } : {}),
|
|
3296
|
+
onEvent: (event, detail) => {
|
|
3297
|
+
if (event === 'locator-missing' && detail)
|
|
3298
|
+
this.recordLocatorFailure(detail);
|
|
3299
|
+
},
|
|
3164
3300
|
profileDir: cfg.resolved.profileDir,
|
|
3165
3301
|
transportDir: join(cfg.resolved.runsDir, '_login'),
|
|
3166
3302
|
chatUrl: cfg.copilot.url,
|
|
@@ -3230,6 +3366,10 @@ let OperatorService = class OperatorService {
|
|
|
3230
3366
|
keepFailurePage: cfg.copilot.keepFailurePage,
|
|
3231
3367
|
// The rows' locator reads the names (Settings' own, 2026-10-24).
|
|
3232
3368
|
...pickerOptions(cfg),
|
|
3369
|
+
onEvent: (event, detail) => {
|
|
3370
|
+
if (event === 'locator-missing' && detail)
|
|
3371
|
+
this.recordLocatorFailure(detail);
|
|
3372
|
+
},
|
|
3233
3373
|
});
|
|
3234
3374
|
await this.closeChatWindow('reading the models needs the browser');
|
|
3235
3375
|
await transport.open();
|
|
@@ -3242,15 +3382,19 @@ let OperatorService = class OperatorService {
|
|
|
3242
3382
|
const work = (saved.defaultModel ?? '').trim();
|
|
3243
3383
|
const review = (saved.defaultReviewModel ?? '').trim();
|
|
3244
3384
|
const lead = (saved.defaultLeadModel ?? '').trim();
|
|
3385
|
+
const kerrigan = (saved.defaultKerriganModel ?? '').trim();
|
|
3245
3386
|
const workNow = work ? pageModelFor(work, options) : null;
|
|
3246
3387
|
const reviewNow = review ? pageModelFor(review, options) : null;
|
|
3247
3388
|
const leadNow = lead ? pageModelFor(lead, options) : null;
|
|
3389
|
+
const kerriganNow = kerrigan ? pageModelFor(kerrigan, options) : null;
|
|
3248
3390
|
if (workNow && !sameModel(workNow.name, work))
|
|
3249
3391
|
await this.setDefaultModel(workNow.name);
|
|
3250
3392
|
if (reviewNow && !sameModel(reviewNow.name, review))
|
|
3251
3393
|
await this.setDefaultReviewModel(reviewNow.name);
|
|
3252
3394
|
if (leadNow && !sameModel(leadNow.name, lead))
|
|
3253
3395
|
await this.setDefaultLeadModel(leadNow.name);
|
|
3396
|
+
if (kerriganNow && !sameModel(kerriganNow.name, kerrigan))
|
|
3397
|
+
await this.setDefaultKerriganModel(kerriganNow.name);
|
|
3254
3398
|
return catalogue;
|
|
3255
3399
|
}
|
|
3256
3400
|
finally {
|
|
@@ -3258,6 +3402,60 @@ let OperatorService = class OperatorService {
|
|
|
3258
3402
|
this.releaseBrowser(claim.holder);
|
|
3259
3403
|
}
|
|
3260
3404
|
}
|
|
3405
|
+
/**
|
|
3406
|
+
* "Check the locators" (operator, 2026-11-17): the Copilot window opened as for reading the models, each of the chat's
|
|
3407
|
+
* locators looked for (`checkLocators`, which only reads and looks), and the window closed. One that found nothing is
|
|
3408
|
+
* kept as a failure (its field red, its HTML kept); one found whose failure is still kept has it taken away: it works
|
|
3409
|
+
* again. The box itself not found: the chat did not open, said for the box, the others not looked for.
|
|
3410
|
+
*/
|
|
3411
|
+
async checkLocators() {
|
|
3412
|
+
const claim = this.claimBrowser({ kind: 'locators' });
|
|
3413
|
+
if ('refused' in claim)
|
|
3414
|
+
throw new Error(claim.refused);
|
|
3415
|
+
let transport = null;
|
|
3416
|
+
try {
|
|
3417
|
+
await this.init();
|
|
3418
|
+
const cfg = await this.settings.load();
|
|
3419
|
+
transport = createTransport({
|
|
3420
|
+
profileDir: cfg.resolved.profileDir,
|
|
3421
|
+
transportDir: join(cfg.resolved.runsDir, '_locators'),
|
|
3422
|
+
chatUrl: cfg.copilot.url,
|
|
3423
|
+
channel: cfg.copilot.channel,
|
|
3424
|
+
headless: cfg.copilot.headless,
|
|
3425
|
+
replyTimeoutMs: cfg.copilot.replyTimeoutSec * 1000,
|
|
3426
|
+
signInTimeoutMs: cfg.copilot.signInTimeoutSec * 1000,
|
|
3427
|
+
humanWaitMs: cfg.copilot.humanWaitSec * 1000,
|
|
3428
|
+
keepFailurePage: cfg.copilot.keepFailurePage,
|
|
3429
|
+
...pickerOptions(cfg),
|
|
3430
|
+
onEvent: (event, detail) => {
|
|
3431
|
+
if (event === 'locator-missing' && detail)
|
|
3432
|
+
this.recordLocatorFailure(detail);
|
|
3433
|
+
},
|
|
3434
|
+
});
|
|
3435
|
+
await this.closeChatWindow('checking the locators needs the browser');
|
|
3436
|
+
await transport.open();
|
|
3437
|
+
let results;
|
|
3438
|
+
try {
|
|
3439
|
+
await transport.ensureSignedIn();
|
|
3440
|
+
results = await transport.checkLocators();
|
|
3441
|
+
}
|
|
3442
|
+
catch (e) {
|
|
3443
|
+
if (!(e instanceof LocatorMissing) || e.key !== 'composer')
|
|
3444
|
+
throw e;
|
|
3445
|
+
results = CHAT_LOCATOR_KEYS.map((key) => (key === 'composer' ? { key, status: 'none', count: 0 } : { key, status: 'not-here', count: 0, note: 'noChat' }));
|
|
3446
|
+
}
|
|
3447
|
+
// Found now: no longer a failure, whatever was kept.
|
|
3448
|
+
const kept = await this.locatorFailures.list();
|
|
3449
|
+
for (const r of results)
|
|
3450
|
+
if (r.status === 'found' && kept.some((f) => f.key === r.key))
|
|
3451
|
+
await this.locatorFailures.dismiss(r.key);
|
|
3452
|
+
return { checkedAt: new Date().toISOString(), results };
|
|
3453
|
+
}
|
|
3454
|
+
finally {
|
|
3455
|
+
await transport?.close().catch(() => undefined);
|
|
3456
|
+
this.releaseBrowser(claim.holder);
|
|
3457
|
+
}
|
|
3458
|
+
}
|
|
3261
3459
|
// --- the registry ---------------------------------------------------------------------
|
|
3262
3460
|
// --- environment ----------------------------------------------------------------------
|
|
3263
3461
|
/** Opens the machine's own folder dialog and reports what was picked. */
|
package/dist/src/api/server.js
CHANGED
|
@@ -149,7 +149,11 @@ export async function startApi(opts = {}) {
|
|
|
149
149
|
await app.close();
|
|
150
150
|
throw e;
|
|
151
151
|
});
|
|
152
|
-
|
|
152
|
+
// A port that cannot be taken (in use, or reserved by Windows: EACCES) closes what was opened, so a caller can try another.
|
|
153
|
+
await app.listen(PORT, '127.0.0.1').catch(async (e) => {
|
|
154
|
+
await app.close().catch(() => undefined);
|
|
155
|
+
throw e;
|
|
156
|
+
});
|
|
153
157
|
// Close whatever the previous process left open before anyone can look at it, rather than
|
|
154
158
|
// waiting for the first request to trigger it.
|
|
155
159
|
await ops.bootstrap();
|
package/dist/src/cli.js
CHANGED
|
@@ -126,7 +126,10 @@ program
|
|
|
126
126
|
console.log('No existing profile to delete.');
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
+
// The box to write in by Settings' locator (2026-11-17): the sign-in ends when it shows.
|
|
130
|
+
const saved = await settingsOf(installLayout()).load().catch(() => null);
|
|
129
131
|
const transport = new CopilotTransport({
|
|
132
|
+
...(saved?.copilot.chatLocators ? { chatLocators: saved.copilot.chatLocators } : {}),
|
|
130
133
|
profileDir: opts.profile,
|
|
131
134
|
transportDir: join(opts.profile, '_transport'),
|
|
132
135
|
chatUrl: opts.url,
|
|
@@ -187,7 +190,9 @@ program
|
|
|
187
190
|
.option('-p, --profile <dir>', 'profile directory', DEFAULT_PROFILE)
|
|
188
191
|
.option('--url <url>', 'chat url', Url.chat)
|
|
189
192
|
.action(async (opts) => {
|
|
193
|
+
const saved = await settingsOf(installLayout()).load().catch(() => null);
|
|
190
194
|
const transport = new CopilotTransport({
|
|
195
|
+
...(saved?.copilot.chatLocators ? { chatLocators: saved.copilot.chatLocators } : {}),
|
|
191
196
|
profileDir: opts.profile,
|
|
192
197
|
transportDir: join(opts.profile, '_transport'),
|
|
193
198
|
chatUrl: opts.url,
|
|
@@ -392,6 +397,7 @@ program
|
|
|
392
397
|
const saved = await settingsOf(installLayout()).load().catch(() => null);
|
|
393
398
|
const transport = new CopilotTransport({
|
|
394
399
|
...(saved?.copilot.pickerLocators ? { pickerLocators: saved.copilot.pickerLocators } : {}),
|
|
400
|
+
...(saved?.copilot.chatLocators ? { chatLocators: saved.copilot.chatLocators } : {}),
|
|
395
401
|
profileDir: opts.profile,
|
|
396
402
|
transportDir: join(installLayout().runsDir, '_models'),
|
|
397
403
|
chatUrl: opts.url,
|
package/dist/src/config/live.js
CHANGED
|
@@ -36,7 +36,7 @@ const NOT_NOW = {
|
|
|
36
36
|
};
|
|
37
37
|
/** What the chat window was opened with. */
|
|
38
38
|
const WINDOW = {
|
|
39
|
-
copilot: ['url', 'profileDir', 'channel', 'headless', 'replyTimeoutSec', 'signInTimeoutSec', 'humanWaitSec', 'keepFailurePage', 'pickerLocators', 'pickerSteps'],
|
|
39
|
+
copilot: ['url', 'profileDir', 'channel', 'headless', 'replyTimeoutSec', 'signInTimeoutSec', 'humanWaitSec', 'keepFailurePage', 'pickerLocators', 'chatLocators', 'pickerSteps'],
|
|
40
40
|
};
|
|
41
41
|
/** The sections a run compares; the rest (where the bot keeps its records) is read when the bot starts. */
|
|
42
42
|
const SECTIONS = ['copilot', 'task', 'execution', 'report', 'project', 'skills', 'pacing', 'limits'];
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { SCRIPT_KINDS } from '../exec/scriptKinds.js';
|
|
10
|
+
import { CHAT_LOCATOR_KEYS } from '../transport/locators.js';
|
|
10
11
|
import { parse as parseYaml } from 'yaml';
|
|
11
12
|
import { readHandWritten } from './handWritten.js';
|
|
12
13
|
import { applyPolicyLock, readPolicyLocks } from './lockedPolicy.js';
|
|
@@ -124,6 +125,12 @@ export const RunConfigSchema = z.object({
|
|
|
124
125
|
* lead's conversation on whatever it is set to.
|
|
125
126
|
*/
|
|
126
127
|
defaultLeadModel: z.string().default(''),
|
|
128
|
+
/**
|
|
129
|
+
* The model Kerrigan's own conversation starts on (operator, 2026-11-13: "add the section in Settings"). Empty, she
|
|
130
|
+
* starts on the lead's, else the worker's — as before she had one of her own. The chats she sends to are the
|
|
131
|
+
* worker's (and, with two chats, the lead's), not this.
|
|
132
|
+
*/
|
|
133
|
+
defaultKerriganModel: z.string().default(''),
|
|
127
134
|
/**
|
|
128
135
|
* Choose the model by hand (operator's workaround, 2026-10-06): at the start of a run, and of a review's
|
|
129
136
|
* conversation, the runner does not touch the picker; a card in the UI asks the operator to choose the
|
|
@@ -135,6 +142,8 @@ export const RunConfigSchema = z.object({
|
|
|
135
142
|
/** The lead's and the review's models chosen by hand, each on its own (2026-10-23); absent, as `manualModel`. */
|
|
136
143
|
leadManualModel: z.boolean().optional(),
|
|
137
144
|
reviewManualModel: z.boolean().optional(),
|
|
145
|
+
/** Kerrigan's model chosen by hand (2026-11-13); absent, as the lead's (`leadManualModel`, then `manualModel`). */
|
|
146
|
+
kerriganManualModel: z.boolean().optional(),
|
|
138
147
|
replyTimeoutSec: z.number().int().positive().default(900),
|
|
139
148
|
signInTimeoutSec: z.number().int().positive().default(900),
|
|
140
149
|
humanWaitSec: z.number().int().positive().default(900),
|
|
@@ -161,6 +170,17 @@ export const RunConfigSchema = z.object({
|
|
|
161
170
|
providerModel: z.string().optional(),
|
|
162
171
|
})
|
|
163
172
|
.optional(),
|
|
173
|
+
/**
|
|
174
|
+
* The chat page's locators (operator, 2026-11-17: "a field in Settings to set it by hand", after the work page's
|
|
175
|
+
* box to write in changed and the start was refused as "not the Microsoft 365 Copilot chat"; then "each of the
|
|
176
|
+
* locators"): every one the bot finds the chat by. Left out, or empty, the default in `transport/locators.ts`
|
|
177
|
+
* (`DefaultChatLocators`); one that cannot be used is not, and the run says why. Taken by the next Copilot window.
|
|
178
|
+
* Made from the keys themselves: written out by hand, it kept only the box's, and a locator saved for Send was
|
|
179
|
+
* dropped when the settings were read.
|
|
180
|
+
*/
|
|
181
|
+
chatLocators: z
|
|
182
|
+
.object(Object.fromEntries(CHAT_LOCATOR_KEYS.map((k) => [k, z.string().optional()])))
|
|
183
|
+
.optional(),
|
|
164
184
|
/**
|
|
165
185
|
* A picture and the menu's HTML at every step of choosing a model, with what each locator found (operator,
|
|
166
186
|
* 2026-10-24: "an option in Settings to keep this information"), beside the run's other browser files. Off: only
|
|
@@ -537,6 +557,13 @@ export const RunConfigSchema = z.object({
|
|
|
537
557
|
* Zero turns it off.
|
|
538
558
|
*/
|
|
539
559
|
autoContinue: z.number().int().min(0).max(20).default(3),
|
|
560
|
+
/*
|
|
561
|
+
* How many times the chat's Edge window, closed while a message is at work — its X pressed, by accident or not, or
|
|
562
|
+
* Edge ending — is opened again on its conversation for that message, and the work carried on there (operator,
|
|
563
|
+
* 2026-11-13; see `transport/keptWindow.ts`). Past it, the message stops and "Continue" carries it on. Zero: a
|
|
564
|
+
* window closed under the work stops the message, as before. Stop is the way to stop the work. Settings → limits.
|
|
565
|
+
*/
|
|
566
|
+
reopenWindow: z.number().int().min(0).max(10).default(3),
|
|
540
567
|
/*
|
|
541
568
|
* The most subtasks the lead of a two-chat conversation may give its worker for one message (2026-10-20). Each
|
|
542
569
|
* subtask is a task of the worker's, with the limits above; this bounds the whole. Settings → Execution.
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
*/
|
|
26
26
|
import { appendFile, mkdir, writeFile } from 'node:fs/promises';
|
|
27
27
|
import { ChatLost, isReplyTimeout, WindowClosed } from '../transport/chatTransport.js';
|
|
28
|
+
import { CLOSED_NOT_REOPENED } from '../transport/keptWindow.js';
|
|
28
29
|
import { buildChatName, chatCode, savePointer } from '../transport/chatSession.js';
|
|
29
30
|
import { RunLog } from '../log/runLog.js';
|
|
30
31
|
import { gapFrom, Pacer } from '../util/pacing.js';
|
|
@@ -904,8 +905,9 @@ export async function runKerriganTask(transport, session, task, deps) {
|
|
|
904
905
|
limitHit = { setting: 'replyTimeoutSec', value: e.seconds };
|
|
905
906
|
return await finish('limit-reached', `replyTimeoutSec (${e.seconds}) reached: ${message}`);
|
|
906
907
|
}
|
|
908
|
+
// Why, as the kept window says it (2026-11-13): not opened again by Settings, past the times allowed, or not found.
|
|
907
909
|
if (e instanceof WindowClosed || transport.closedOutside())
|
|
908
|
-
return await finish('aborted',
|
|
910
|
+
return await finish('aborted', e instanceof WindowClosed ? e.message : CLOSED_NOT_REOPENED);
|
|
909
911
|
sink.event('task-error', { error: message, stack: e.stack }, message, 'error');
|
|
910
912
|
return await finish('failed', message);
|
|
911
913
|
}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import { appendFile, mkdir, writeFile } from 'node:fs/promises';
|
|
23
23
|
import { isReplyTimeout, WindowClosed } from '../transport/chatTransport.js';
|
|
24
|
+
import { CLOSED_NOT_REOPENED } from '../transport/keptWindow.js';
|
|
24
25
|
import { buildChatName, chatCode, savePointer } from '../transport/chatSession.js';
|
|
25
26
|
import { RunLog } from '../log/runLog.js';
|
|
26
27
|
import { gapFrom, Pacer } from '../util/pacing.js';
|
|
@@ -922,8 +923,9 @@ export async function runLeadTask(transport, session, task, deps) {
|
|
|
922
923
|
limitHit = { setting: 'replyTimeoutSec', value: e.seconds };
|
|
923
924
|
return await finish('limit-reached', `replyTimeoutSec (${e.seconds}) reached: ${message}`);
|
|
924
925
|
}
|
|
926
|
+
// Why, as the kept window says it (2026-11-13): not opened again by Settings, past the times allowed, or not found.
|
|
925
927
|
if (e instanceof WindowClosed || transport.closedOutside())
|
|
926
|
-
return await finish('aborted',
|
|
928
|
+
return await finish('aborted', e instanceof WindowClosed ? e.message : CLOSED_NOT_REOPENED);
|
|
927
929
|
sink.event('task-error', { error: message, stack: e.stack }, message, 'error');
|
|
928
930
|
return await finish('failed', message);
|
|
929
931
|
}
|