copilot-operator 0.1.93 → 0.1.94
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 +640 -625
- package/dist/src/api/operator.service.js +83 -17
- package/dist/src/exec/readOnly.js +27 -2
- package/dist/src/orchestrator/kerriganRunner.js +9 -2
- package/dist/src/orchestrator/taskRunner.js +14 -3
- package/dist/src/plan/kerrigan.js +263 -243
- package/dist/src/plan/systemGuide.js +122 -74
- package/dist/src/session/compose.js +13 -0
- package/dist/src/session/locatorFailures.js +8 -5
- package/dist/src/transport/copilotTransport.js +20 -2
- package/dist/src/vcs/newBranch.js +46 -0
- package/dist/web/404.html +2 -2
- package/dist/web/_next/static/chunks/1077.b7df9cb8ca810075.js +1 -0
- package/dist/web/_next/static/chunks/1548.417c17b63c371f00.js +1 -0
- package/dist/web/_next/static/chunks/2163.469367b8fbcc862d.js +1 -0
- package/dist/web/_next/static/chunks/714.72112704f3cb8127.js +1 -0
- package/dist/web/_next/static/chunks/{7220.1eba10bd9d449cea.js → 7220.8bd897c7ddfee701.js} +1 -1
- package/dist/web/_next/static/chunks/7921-25d1755799107ea7.js +1 -0
- package/dist/web/_next/static/chunks/8584.f87df7324303ab75.js +1 -0
- package/dist/web/_next/static/chunks/9067.67a7c7cf3b019b5c.js +1 -0
- package/dist/web/_next/static/chunks/9747.a87dbd4acd45e39d.js +1 -0
- package/dist/web/_next/static/chunks/app/{page-b71841852e6b9ff5.js → page-7eae1e8848525e1d.js} +1 -1
- package/dist/web/_next/static/chunks/{webpack-33252b1a0a7d93ba.js → webpack-91b2de9c3da6f8b9.js} +1 -1
- package/dist/web/_next/static/css/{6b92f118889ca88b.css → 523d11041085f836.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 +2 -1
- package/dist/web/_next/static/chunks/1077.626a11362f53d35c.js +0 -1
- package/dist/web/_next/static/chunks/1548.79f05ff765581b0a.js +0 -1
- package/dist/web/_next/static/chunks/2163.09f1212655504f3a.js +0 -1
- package/dist/web/_next/static/chunks/714.acea3698b6af7a61.js +0 -1
- package/dist/web/_next/static/chunks/7921-29256ac683ea4bc5.js +0 -1
- package/dist/web/_next/static/chunks/8584.b5aac5354f124d4b.js +0 -1
- package/dist/web/_next/static/chunks/9067.177163495f3bd8fa.js +0 -1
- package/dist/web/_next/static/chunks/9747.5b9d763e89abc7e4.js +0 -1
- /package/dist/web/_next/static/{ZrEcjGdZEXe66UUxUqine → UNygvDtRnBVZrGJt53IE4}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{ZrEcjGdZEXe66UUxUqine → UNygvDtRnBVZrGJt53IE4}/_ssgManifest.js +0 -0
|
@@ -98,7 +98,7 @@ import { sessionRoots } from '../exec/confinement.js';
|
|
|
98
98
|
import { dirtyPolicy } from '../vcs/snapshot.js';
|
|
99
99
|
import { runVcsPreflight } from '../vcs/runPreflight.js';
|
|
100
100
|
import { inputSettings, normalisePatterns } from '../vcs/inputs.js';
|
|
101
|
-
import { createNewBranch, planNewBranch } from '../vcs/newBranch.js';
|
|
101
|
+
import { createNewBranch, planNewBranch, setAsideUncommitted } from '../vcs/newBranch.js';
|
|
102
102
|
import { commitAsOperator, identityOf, pushAsOperator, setIdentity, stageFiles, TrustedHooks } from '../vcs/operatorGit.js';
|
|
103
103
|
import { askpassProgram, closePasswordWindows } from '../vcs/remoteAuth.js';
|
|
104
104
|
import { planApprovedMessage, planReviseMessage } from '../orchestrator/planMode.js';
|
|
@@ -732,6 +732,10 @@ let OperatorService = class OperatorService {
|
|
|
732
732
|
this.browser = holder;
|
|
733
733
|
return { holder };
|
|
734
734
|
}
|
|
735
|
+
/** Why a run of `sessionId` could not have the browser now, without taking it; null when it could. */
|
|
736
|
+
browserBusyFor(sessionId) {
|
|
737
|
+
return this.browser ? browserRefusal(this.browser, { kind: 'run', sessionId }) : null;
|
|
738
|
+
}
|
|
735
739
|
releaseBrowser(holder) {
|
|
736
740
|
if (this.browser === holder)
|
|
737
741
|
this.browser = null;
|
|
@@ -1652,11 +1656,17 @@ let OperatorService = class OperatorService {
|
|
|
1652
1656
|
}
|
|
1653
1657
|
throw new Error('Kerrigan is at work with this chat: write to her conversation, or Stop her first.');
|
|
1654
1658
|
}
|
|
1655
|
-
|
|
1659
|
+
/*
|
|
1660
|
+
* While the run starts — the window opening, the sign-in, the model's card — its message is still queued (2026-11-18:
|
|
1661
|
+
* "Add to it" then made a message of its own, refused to start and left waiting). The note goes with that message,
|
|
1662
|
+
* which takes the notes not sent yet with its opening.
|
|
1663
|
+
*/
|
|
1664
|
+
const atWork = inFlight ?? (this.running.has(session.id) ? session.tasks.find((t) => t.status === 'queued') : undefined);
|
|
1665
|
+
if (atWork && this.running.has(session.id)) {
|
|
1656
1666
|
if (skill)
|
|
1657
1667
|
throw new Error(`A skill goes with a new message, and this one would be a note to the message at work. Send /${skill.name} when it has finished.`);
|
|
1658
|
-
await this.addTaskNote(session.id,
|
|
1659
|
-
return { threadId: session.id, taskId:
|
|
1668
|
+
await this.addTaskNote(session.id, atWork.id, text);
|
|
1669
|
+
return { threadId: session.id, taskId: atWork.id, noted: true, needsStart: false };
|
|
1660
1670
|
}
|
|
1661
1671
|
}
|
|
1662
1672
|
else {
|
|
@@ -1732,15 +1742,19 @@ let OperatorService = class OperatorService {
|
|
|
1732
1742
|
});
|
|
1733
1743
|
}
|
|
1734
1744
|
// After going back, the conversation is told with this message: it still holds what was undone.
|
|
1735
|
-
|
|
1736
|
-
if (pending) {
|
|
1737
|
-
await this.store.addTaskNote(session.id, task.id, pending);
|
|
1738
|
-
await this.store.updateSession(session.id, (s) => {
|
|
1739
|
-
s.rewindNote = undefined;
|
|
1740
|
-
});
|
|
1741
|
-
}
|
|
1745
|
+
await this.moveRewindNote(session.id, task.id);
|
|
1742
1746
|
return { threadId: session.id, taskId: task.id, needsStart: false };
|
|
1743
1747
|
}
|
|
1748
|
+
/** What going back undid, told to the conversation with the next message that goes to it: a new one, or one carried on. */
|
|
1749
|
+
async moveRewindNote(sessionId, taskId) {
|
|
1750
|
+
const pending = (await this.store.getSession(sessionId))?.rewindNote;
|
|
1751
|
+
if (!pending)
|
|
1752
|
+
return;
|
|
1753
|
+
await this.store.addTaskNote(sessionId, taskId, pending);
|
|
1754
|
+
await this.store.updateSession(sessionId, (s) => {
|
|
1755
|
+
s.rewindNote = undefined;
|
|
1756
|
+
});
|
|
1757
|
+
}
|
|
1744
1758
|
// --- the queue of tasks (2026-10-24) ----------------------------------------------------------------
|
|
1745
1759
|
//
|
|
1746
1760
|
// Tasks written beforehand, each run in a new chat on its own model while nobody watches; one that failed takes
|
|
@@ -2040,11 +2054,13 @@ let OperatorService = class OperatorService {
|
|
|
2040
2054
|
throw new Error('That task is not waiting for an answer.');
|
|
2041
2055
|
const s = await this.store.getSession(item.sessionId);
|
|
2042
2056
|
const task = s?.tasks.find((t) => t.parked && !t.parked.answer);
|
|
2043
|
-
|
|
2044
|
-
|
|
2057
|
+
// Stopped whatever its record says (2026-11-18): a Stop that failed with the record gone left the task, and the ones
|
|
2058
|
+
// that depend on it, waiting for good.
|
|
2045
2059
|
if (input?.stop === true) {
|
|
2046
2060
|
return await this.withBusy(await this.changeQueue((x) => this.setQueueItem(x, itemId, { status: 'stopped', why: 'stopped by the operator at its card', waitsFor: undefined })));
|
|
2047
2061
|
}
|
|
2062
|
+
if (!s || !task?.parked)
|
|
2063
|
+
throw new Error('What that task waited for is not on its record any more; run it again.');
|
|
2048
2064
|
const answer = parkedAnswerFrom(task.parked, input);
|
|
2049
2065
|
if ('problem' in answer)
|
|
2050
2066
|
throw new Error(answer.problem);
|
|
@@ -2175,6 +2191,25 @@ let OperatorService = class OperatorService {
|
|
|
2175
2191
|
}
|
|
2176
2192
|
await this.changeQueue((x) => this.setQueueItem(x, item.id, { sessionId }));
|
|
2177
2193
|
}
|
|
2194
|
+
/*
|
|
2195
|
+
* On a branch of its own, in a folder another task left changes in (2026-11-18): those are put aside, kept whole on a
|
|
2196
|
+
* branch of their own and never pushed, as "New branch from main" puts them aside — or the task is refused for them,
|
|
2197
|
+
* and so is every task that depends on it, in a queue nobody is watching. Left alone when the folder is already on
|
|
2198
|
+
* this task's own branch: what is there is its own work, carried on.
|
|
2199
|
+
*/
|
|
2200
|
+
const runOn = (await this.store.getSession(sessionId))?.vcs;
|
|
2201
|
+
if (ws.isRepo && runOn?.enabled && runOn.startFrom === 'existing-branch' && runOn.existingBranch) {
|
|
2202
|
+
const onNow = (await git(ws.dir, ['symbolic-ref', '--quiet', '--short', 'HEAD']).catch(() => null))?.stdout || null;
|
|
2203
|
+
if (onNow !== runOn.existingBranch) {
|
|
2204
|
+
const aside = await setAsideUncommitted(ws.dir, `the queue's task "${itemTitle(item)}" works on its own branch ${runOn.existingBranch}, and the folder held changes left on ${onNow ?? 'a detached HEAD'}`);
|
|
2205
|
+
if (aside && 'problem' in aside)
|
|
2206
|
+
return { status: 'failed', why: `what was not committed in the folder could not be put aside before it: ${aside.problem}`, sessionId };
|
|
2207
|
+
if (aside) {
|
|
2208
|
+
this.bus.publish({ sessionId, type: 'queue-set-aside', level: 'warn',
|
|
2209
|
+
message: `what was not committed in the folder (${aside.files} file(s), on ${onNow ?? 'a detached HEAD'}) was put aside on ${aside.saved}, not pushed, before this task started on its own branch` });
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
}
|
|
2178
2213
|
/*
|
|
2179
2214
|
* A message of the chat sent meanwhile has the browser: this one starts after it, never refused for it. The browser
|
|
2180
2215
|
* is looked at and taken in the same moment — `start` takes it before it awaits anything.
|
|
@@ -2571,6 +2606,10 @@ let OperatorService = class OperatorService {
|
|
|
2571
2606
|
const last = sub.attempts?.at(-1);
|
|
2572
2607
|
if (last?.status === 'done')
|
|
2573
2608
|
throw new Error(`Subtask ${n} was done; it is not done again.`);
|
|
2609
|
+
// The browser first, as for Continue (2026-11-18): nothing changes when it is not free.
|
|
2610
|
+
const busy = this.browserBusyFor(threadId);
|
|
2611
|
+
if (busy)
|
|
2612
|
+
throw new Error(busy);
|
|
2574
2613
|
await this.store.rerunTask(threadId, taskId, {}, { fromAttempt: task.attempt ?? 1, stoppedBecause: task.reason, how: 'stopped', retrySubtask: { n, ...(fresh ? { fresh: true } : {}) } });
|
|
2575
2614
|
const cfg = await this.settings.load();
|
|
2576
2615
|
return await this.start(threadId, cfg.execution.mode);
|
|
@@ -2597,12 +2636,31 @@ let OperatorService = class OperatorService {
|
|
|
2597
2636
|
throw new Error('That message is not in this conversation.');
|
|
2598
2637
|
if (session.tasks.at(-1)?.id !== taskId)
|
|
2599
2638
|
throw new Error('Only the last message of a conversation is carried on: the conversation has gone on past this one.');
|
|
2639
|
+
/*
|
|
2640
|
+
* The browser first (2026-11-18): the message was put back on the queue and then refused the browser — another
|
|
2641
|
+
* conversation, the queue, a read of the models had it — and was left "waiting to start", with no Continue and only
|
|
2642
|
+
* "Go back" under it. Now nothing changes when the browser is not free.
|
|
2643
|
+
*/
|
|
2644
|
+
// A queue task set aside is answered on its card (2026-11-18): carried on here, its queue entry lost what it waited for.
|
|
2645
|
+
if (task.parked && !task.parked.answer)
|
|
2646
|
+
throw new Error('This message waits for an answer on its card in the queue: answer it there, and the queue carries it on.');
|
|
2647
|
+
const busy = this.browserBusyFor(threadId);
|
|
2648
|
+
if (busy)
|
|
2649
|
+
throw new Error(busy);
|
|
2650
|
+
const cfg = await this.settings.load();
|
|
2651
|
+
/*
|
|
2652
|
+
* A message never sent (2026-11-18): stopped while the window opened, the sign-in was awaited or the model chosen, its
|
|
2653
|
+
* start refused, or the bot closed first. It is sent now as it is: not "carried on", which Copilot never saw begin.
|
|
2654
|
+
*/
|
|
2655
|
+
if (task.status === 'queued')
|
|
2656
|
+
return await this.start(threadId, cfg.execution.mode);
|
|
2600
2657
|
if (!isContinuable(task)) {
|
|
2601
2658
|
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.');
|
|
2602
2659
|
}
|
|
2603
|
-
const cfg = await this.settings.load();
|
|
2604
2660
|
const stoppedAt = task.status === 'aborted' && !task.interruption && task.runId ? await readInterruption(join(cfg.resolved.runsDir, task.runId)).catch(() => null) : null;
|
|
2605
2661
|
const queued = await this.store.continueTask(threadId, taskId, stoppedAt);
|
|
2662
|
+
// After going back, the conversation is told with the message that carries on, as with a new one (2026-11-18).
|
|
2663
|
+
await this.moveRewindNote(threadId, taskId);
|
|
2606
2664
|
await appendSessionLog(cfg.resolved.runsDir, threadId, {
|
|
2607
2665
|
type: 'continue',
|
|
2608
2666
|
message: `"${queued.title}" carried on as attempt ${queued.attempt ?? 1}, from where it stopped: ${task.reason ?? task.status}`,
|
|
@@ -2728,6 +2786,14 @@ let OperatorService = class OperatorService {
|
|
|
2728
2786
|
w.resolve(decision);
|
|
2729
2787
|
this.bus.publish({ sessionId: w.approval.sessionId, taskId: w.approval.taskId, type: 'approval-decided', level: 'info',
|
|
2730
2788
|
message: `step ${w.approval.stepId}: ${action}`, data: { approvalId, action } });
|
|
2789
|
+
/*
|
|
2790
|
+
* "Stop" on the card that asks for the model to be chosen by hand (2026-11-18): the run stops, as the chat's own Stop
|
|
2791
|
+
* stops it — nothing failed, the operator stopped. Only the card was answered before: the work then ended "failed"
|
|
2792
|
+
* with two chats or Kerrigan, with no Continue, and a single chat was said as a start that did not happen. On the card
|
|
2793
|
+
* of a model the bot could not choose, a failure it is, and is said with what the page offers.
|
|
2794
|
+
*/
|
|
2795
|
+
if (w.approval.model?.manual && action === 'abort')
|
|
2796
|
+
void this.stop(w.approval.sessionId).catch(() => undefined);
|
|
2731
2797
|
return { ok: true };
|
|
2732
2798
|
}
|
|
2733
2799
|
/**
|
|
@@ -2902,7 +2968,7 @@ let OperatorService = class OperatorService {
|
|
|
2902
2968
|
'use-current-branch': `Use the current branch instead of ${g.baseBranch ?? 'the base branch'}`,
|
|
2903
2969
|
'allow-snapshot': 'Take uncommitted changes as a starting snapshot',
|
|
2904
2970
|
};
|
|
2905
|
-
note('snapshot-approval-required', `${g.repoDir}: nothing runs until
|
|
2971
|
+
note('snapshot-approval-required', `${g.repoDir}: nothing runs until what is not committed there is dealt with. Commit what is not committed in the folder (the Git view), or put it aside ("⎇ New branch from main" → "Put them aside"), then run it again.`, { repoDir: g.repoDir, actions: fixes }, ids, 'warn');
|
|
2906
2972
|
}
|
|
2907
2973
|
}
|
|
2908
2974
|
const open = groups.filter((g) => !g.ready);
|
|
@@ -2927,7 +2993,7 @@ let OperatorService = class OperatorService {
|
|
|
2927
2993
|
? [
|
|
2928
2994
|
'Version control is not ready for this run, so nothing was opened or sent. ' +
|
|
2929
2995
|
open.map((g) => `${g.repoDir}: ${g.problem ?? 'it needs your approval'}`).join(' ') +
|
|
2930
|
-
'
|
|
2996
|
+
' Commit what is not committed in the folder (the Git view), or put it aside ("⎇ New branch from main" → "Put them aside"), then run it again.',
|
|
2931
2997
|
]
|
|
2932
2998
|
: []),
|
|
2933
2999
|
...(contradictions.length > 0 ? [`${open.length > 0 ? '' : 'Nothing was opened or sent. '}${contradictions.join(' ')}`] : []),
|
|
@@ -3068,7 +3134,7 @@ let OperatorService = class OperatorService {
|
|
|
3068
3134
|
return null;
|
|
3069
3135
|
// The panel is named only where it has a fix to offer: for a chain waiting on its predecessor the remedy is that one's Continue (live run 2026-10-04).
|
|
3070
3136
|
const panel = group.actions.some((a) => a.available && a.id !== 'review-inputs');
|
|
3071
|
-
return `Version control is not ready for "${session.name}", so it did not start and its tasks stay queued: ${group.problem ?? 'it needs your approval'}${panel ? '
|
|
3137
|
+
return `Version control is not ready for "${session.name}", so it did not start and its tasks stay queued: ${group.problem ?? 'it needs your approval'}${panel ? ' Commit what is not committed in the folder (the Git view), or put it aside ("⎇ New branch from main" → "Put them aside"), then run it again.' : ''}`;
|
|
3072
3138
|
}
|
|
3073
3139
|
/** Recorded in the run's log just before the browser is opened for it: see `runPreflight`. */
|
|
3074
3140
|
async browserRequested(runId, sessionIds) {
|
|
@@ -99,6 +99,9 @@ const AZ_SECRET = /(?:^|-)(?:keys?|credentials?|secrets?|passwords?|tokens?|sas|
|
|
|
99
99
|
const AZ_READ = /^(?:list|show|query|exists|wait|version|what-if|(?:list|show|get)-[a-z0-9-]+|check-name(?:-availability)?)$/;
|
|
100
100
|
/** The verbs that change something, in Azure or in az's own setup; and the ones named after them (`create-for-rbac`). */
|
|
101
101
|
const AZ_WRITE = /^(?:create|delete|update|set|unset|add|remove|start|stop|restart|reboot|deploy|redeploy|reimage|deallocate|generalize|capture|resize|scale|swap|assign|unassign|purge|recover|restore|backup|renew|regenerate|rotate|reset|import|upload|sync|move|lock|unlock|enable|disable|approve|reject|attach|detach|connect|disconnect|apply|cancel|abort|run|invoke|execute|install|uninstall|register|unregister|grant|revoke|push|tag|untag|migrate|upgrade|failover|promote|convert|link|unlink|clear|flush|cordon|drain|retry|rerun|trigger|publish|release|merge|close|reopen|accept|archive|unarchive|schedule|power-off|rollback|repair|refresh|replace|rename|copy|patch|put|post|send|mount|unmount|activate|deactivate|pause|resume|suspend|terminate|kill)(?:-[a-z0-9-]+)?$/;
|
|
102
|
+
/** az's own options, which it takes anywhere, before its command too: alone, and with a value. */
|
|
103
|
+
const AZ_GLOBAL_FLAGS = new Set(['--debug', '--verbose', '--only-show-errors']);
|
|
104
|
+
const AZ_GLOBAL_WITH_VALUE = new Set(['--output', '-o', '--query', '--subscription']);
|
|
102
105
|
/**
|
|
103
106
|
* One `az` invocation. Its command is the group path and the verb at its end, the words before the first option:
|
|
104
107
|
* `az storage account list --query ...` is `storage account list`, read by `list`. `--help` anywhere only prints help.
|
|
@@ -106,15 +109,37 @@ const AZ_WRITE = /^(?:create|delete|update|set|unset|add|remove|start|stop|resta
|
|
|
106
109
|
function azReading(args) {
|
|
107
110
|
if (args.some((a) => !a.dynamic && /^(?:--help|-h)$/i.test(a.literal)))
|
|
108
111
|
return { kind: 'reads' };
|
|
112
|
+
/*
|
|
113
|
+
* az's own options may come before its command (2026-11-18: `az -o none group delete -n rg --yes` was read as `az`
|
|
114
|
+
* alone, "nothing but the version", and ran with no card where az is read only). Those are passed over, with the value
|
|
115
|
+
* of one that takes a value; any other option there is not read as anything, and is put to the operator.
|
|
116
|
+
*/
|
|
117
|
+
let i = 0;
|
|
118
|
+
while (i < args.length) {
|
|
119
|
+
const a = args[i];
|
|
120
|
+
if (a.dynamic)
|
|
121
|
+
return { kind: 'unclear', why: 'a word of the az command is known only when it runs' };
|
|
122
|
+
if (!a.literal.startsWith('-'))
|
|
123
|
+
break;
|
|
124
|
+
const name = a.literal.split('=')[0].toLowerCase();
|
|
125
|
+
if (name === '--version' && args.length === 1)
|
|
126
|
+
return { kind: 'reads' };
|
|
127
|
+
if (AZ_GLOBAL_FLAGS.has(name))
|
|
128
|
+
i += 1;
|
|
129
|
+
else if (AZ_GLOBAL_WITH_VALUE.has(name))
|
|
130
|
+
i += a.literal.includes('=') ? 1 : 2;
|
|
131
|
+
else
|
|
132
|
+
return { kind: 'unclear', why: `az's option ${a.literal} comes before its command, and is not one of az's own options this check knows` };
|
|
133
|
+
}
|
|
109
134
|
const path = [];
|
|
110
|
-
for (const a of args) {
|
|
135
|
+
for (const a of args.slice(i)) {
|
|
111
136
|
if (a.dynamic)
|
|
112
137
|
return { kind: 'unclear', why: 'a word of the az command is known only when it runs' };
|
|
113
138
|
if (a.literal.startsWith('-'))
|
|
114
139
|
break;
|
|
115
140
|
path.push(a.literal.toLowerCase());
|
|
116
141
|
}
|
|
117
|
-
// `az`, `az --version`: nothing but the version or the help.
|
|
142
|
+
// `az`, `az --version`, `az -o table`: nothing but the version or the help.
|
|
118
143
|
if (path.length === 0)
|
|
119
144
|
return { kind: 'reads' };
|
|
120
145
|
const p = path.join(' ');
|
|
@@ -161,7 +161,13 @@ export async function runKerriganTask(transport, session, task, deps) {
|
|
|
161
161
|
sink.event('acting', acting, `at work now: ${actor === 'kerrigan' ? 'Kerrigan' : actor}`);
|
|
162
162
|
};
|
|
163
163
|
const maxSends = () => Math.max(1, cfg.limits.maxKerriganSends ?? 6);
|
|
164
|
-
|
|
164
|
+
/*
|
|
165
|
+
* Carried on (2026-11-18): the attempt before, of this same message — its chats, and how many messages she sent. Each
|
|
166
|
+
* attempt started from none, so "same" was refused ("no chat of yours is there yet"), the chat she was directing was
|
|
167
|
+
* lost with its conversation, and the most messages she may send began again.
|
|
168
|
+
*/
|
|
169
|
+
const before = task.continuing ? task.attempts?.at(-1)?.kerrigan : undefined;
|
|
170
|
+
const k = { rounds: [], sent: before?.sent ?? 0, maxSends: maxSends(), messages: 0, chats: [...(before?.chats ?? [])] };
|
|
165
171
|
const save = async () => {
|
|
166
172
|
const copy = JSON.parse(JSON.stringify(k));
|
|
167
173
|
await setTask((t) => {
|
|
@@ -320,7 +326,8 @@ export async function runKerriganTask(transport, session, task, deps) {
|
|
|
320
326
|
let lastChat = null;
|
|
321
327
|
let lastTitle = '';
|
|
322
328
|
{
|
|
323
|
-
|
|
329
|
+
// This message's own attempt before, when it is carried on; else the last message of hers that sent to a chat.
|
|
330
|
+
const earlier = (before?.chats.length ?? 0) > 0 ? { kerrigan: before } : [...session.tasks].reverse().find((x) => x.id !== task.id && (x.kerrigan?.chats.length ?? 0) > 0);
|
|
324
331
|
const id = earlier?.kerrigan?.chats.at(-1);
|
|
325
332
|
const found = id ? await store.getSession(id) : null;
|
|
326
333
|
if (found) {
|
|
@@ -825,6 +825,12 @@ signal) {
|
|
|
825
825
|
const hand = wanted && buttonShows(shown, wanted)
|
|
826
826
|
? { result: { ok: true, current: wanted, by: 'already' }, goOnAsItIs: false }
|
|
827
827
|
: await withOperatorHand(transport, wanted, { ok: false, current: shown, reason: why }, hooks, session.id, bus, true, asks);
|
|
828
|
+
/*
|
|
829
|
+
* Stopped on the card (2026-11-18): the run stops, as the card's "Stop" says — with a model named too, which asked
|
|
830
|
+
* the operator a second time ("could not choose the model") before.
|
|
831
|
+
*/
|
|
832
|
+
if ('stopped' in hand && hand.stopped)
|
|
833
|
+
return { refused: 'The model was to be chosen by hand, and the operator stopped the run. Nothing was sent.' };
|
|
828
834
|
if (!wanted) {
|
|
829
835
|
const now = await transport.currentModel().catch(() => null);
|
|
830
836
|
if (hand.result.ok || hand.goOnAsItIs) {
|
|
@@ -938,7 +944,7 @@ opts = {}) {
|
|
|
938
944
|
actor: opts.actor ?? (opts.review ? 'review' : opts.role ?? 'worker'),
|
|
939
945
|
});
|
|
940
946
|
if (answer === 'stop')
|
|
941
|
-
return { result, goOnAsItIs: false };
|
|
947
|
+
return { result, goOnAsItIs: false, stopped: true };
|
|
942
948
|
if (answer === 'continue') {
|
|
943
949
|
bus.publish({ sessionId, type: 'model-help-continue', level: 'warn', message: `the operator chose to go on with the model the chat is on ("${shown ?? 'unknown'}")${wanted ? `, not "${wanted}"` : ''}`, data: { asked: wanted, shown } });
|
|
944
950
|
return { result: { ok: false, current: shown, reason: `the operator chose to go on with "${shown ?? 'unknown'}"` }, goOnAsItIs: true };
|
|
@@ -1792,8 +1798,13 @@ export async function runTask(transport, session, task, deps) {
|
|
|
1792
1798
|
* the way a read-only task is wherever the task has a branch of its own.
|
|
1793
1799
|
*/
|
|
1794
1800
|
const planMode = session.planMode ?? cfg.execution.planMode ?? 'off';
|
|
1795
|
-
|
|
1796
|
-
|
|
1801
|
+
/*
|
|
1802
|
+
* A continued task does not plan again when a plan was approved for it — it carries on from that plan — nor when it
|
|
1803
|
+
* was sent back while the queue had it set aside it does (2026-10-26). One carried on with no plan approved at all
|
|
1804
|
+
* plans first (2026-11-18: a Stop at the plan's card, a restart, or a limit while planning, then "Continue" or the
|
|
1805
|
+
* carrying on after a limit, went straight to the work, and files changed with no plan approved).
|
|
1806
|
+
*/
|
|
1807
|
+
let planning = planMode !== 'off' && (!task.continuing || task.continuing.replan === true || !approvedPlanOf(task));
|
|
1797
1808
|
await actingNow(planning ? 'plan' : 'worker');
|
|
1798
1809
|
const planEnforced = planning && onOwnBranch;
|
|
1799
1810
|
let planVersion = 0;
|