@yu_robotics/remote-cli 1.6.247 → 1.6.251
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/client/MessageHandler.d.ts +6 -2
- package/dist/client/MessageHandler.d.ts.map +1 -1
- package/dist/client/MessageHandler.js +99 -29
- package/dist/client/MessageHandler.js.map +1 -1
- package/dist/client/WebSocketClient.d.ts +3 -0
- package/dist/client/WebSocketClient.d.ts.map +1 -1
- package/dist/client/WebSocketClient.js +3 -1
- package/dist/client/WebSocketClient.js.map +1 -1
- package/dist/commands/start.d.ts +5 -0
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +37 -0
- package/dist/commands/start.js.map +1 -1
- package/dist/executor/ClaudePersistentExecutor.d.ts.map +1 -1
- package/dist/executor/ClaudePersistentExecutor.js +7 -1
- package/dist/executor/ClaudePersistentExecutor.js.map +1 -1
- package/dist/files/FileInbox.d.ts +1 -0
- package/dist/files/FileInbox.d.ts.map +1 -1
- package/dist/files/FileInbox.js +49 -4
- package/dist/files/FileInbox.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/maintenance/release-notes.json +1 -1
- package/dist/scheduling/ScheduleService.d.ts +20 -1
- package/dist/scheduling/ScheduleService.d.ts.map +1 -1
- package/dist/scheduling/ScheduleService.js +137 -36
- package/dist/scheduling/ScheduleService.js.map +1 -1
- package/dist/scheduling/ScheduleToolScope.d.ts.map +1 -1
- package/dist/scheduling/ScheduleToolScope.js +7 -0
- package/dist/scheduling/ScheduleToolScope.js.map +1 -1
- package/dist/scheduling/claude/ClaudeSessionSchedules.d.ts +7 -0
- package/dist/scheduling/claude/ClaudeSessionSchedules.d.ts.map +1 -1
- package/dist/scheduling/claude/ClaudeSessionSchedules.js +121 -38
- package/dist/scheduling/claude/ClaudeSessionSchedules.js.map +1 -1
- package/dist/service/SessionHostSupervisor.d.ts +63 -0
- package/dist/service/SessionHostSupervisor.d.ts.map +1 -0
- package/dist/service/SessionHostSupervisor.js +323 -0
- package/dist/service/SessionHostSupervisor.js.map +1 -0
- package/dist/sessionHost/HostClient.d.ts +49 -0
- package/dist/sessionHost/HostClient.d.ts.map +1 -0
- package/dist/sessionHost/HostClient.js +101 -0
- package/dist/sessionHost/HostClient.js.map +1 -0
- package/dist/sessionHost/HostProtocol.d.ts +65 -0
- package/dist/sessionHost/HostProtocol.d.ts.map +1 -0
- package/dist/sessionHost/HostProtocol.js +78 -0
- package/dist/sessionHost/HostProtocol.js.map +1 -0
- package/dist/sessionHost/HostServer.d.ts +52 -0
- package/dist/sessionHost/HostServer.d.ts.map +1 -0
- package/dist/sessionHost/HostServer.js +413 -0
- package/dist/sessionHost/HostServer.js.map +1 -0
- package/dist/sessionHost/HostStore.d.ts +43 -0
- package/dist/sessionHost/HostStore.d.ts.map +1 -0
- package/dist/sessionHost/HostStore.js +206 -0
- package/dist/sessionHost/HostStore.js.map +1 -0
- package/dist/sessionHost/RetainedFrontend.d.ts +63 -0
- package/dist/sessionHost/RetainedFrontend.d.ts.map +1 -0
- package/dist/sessionHost/RetainedFrontend.js +244 -0
- package/dist/sessionHost/RetainedFrontend.js.map +1 -0
- package/dist/sessionHost/RetainedHostLauncher.d.ts +25 -0
- package/dist/sessionHost/RetainedHostLauncher.d.ts.map +1 -0
- package/dist/sessionHost/RetainedHostLauncher.js +132 -0
- package/dist/sessionHost/RetainedHostLauncher.js.map +1 -0
- package/dist/sessionHost/RetainedRuntime.d.ts +62 -0
- package/dist/sessionHost/RetainedRuntime.d.ts.map +1 -0
- package/dist/sessionHost/RetainedRuntime.js +478 -0
- package/dist/sessionHost/RetainedRuntime.js.map +1 -0
- package/dist/sessionHost/RuntimeJournal.d.ts +47 -0
- package/dist/sessionHost/RuntimeJournal.d.ts.map +1 -0
- package/dist/sessionHost/RuntimeJournal.js +103 -0
- package/dist/sessionHost/RuntimeJournal.js.map +1 -0
- package/dist/sessionHost/entry.d.ts +13 -0
- package/dist/sessionHost/entry.d.ts.map +1 -0
- package/dist/sessionHost/entry.js +107 -0
- package/dist/sessionHost/entry.js.map +1 -0
- package/dist/update/AutomaticUpdater.d.ts +2 -1
- package/dist/update/AutomaticUpdater.d.ts.map +1 -1
- package/dist/update/AutomaticUpdater.js +26 -12
- package/dist/update/AutomaticUpdater.js.map +1 -1
- package/dist/update/PinnedHostBundle.d.ts +49 -0
- package/dist/update/PinnedHostBundle.d.ts.map +1 -0
- package/dist/update/PinnedHostBundle.js +309 -0
- package/dist/update/PinnedHostBundle.js.map +1 -0
- package/native/prebuilds/darwin-arm64/managed_native.node +0 -0
- package/native/prebuilds/darwin-arm64/manifest.json +1 -1
- package/native/prebuilds/darwin-x64/managed_native.node +0 -0
- package/native/prebuilds/darwin-x64/manifest.json +1 -1
- package/native/prebuilds/win32-arm64/managed_native.node +0 -0
- package/native/prebuilds/win32-arm64/manifest.json +1 -1
- package/native/prebuilds/win32-x64/managed_native.node +0 -0
- package/native/prebuilds/win32-x64/manifest.json +1 -1
- package/package.json +1 -1
|
@@ -39,8 +39,9 @@ export declare class MessageHandler {
|
|
|
39
39
|
private readonly abortOperations;
|
|
40
40
|
private readonly pendingGoalActivations;
|
|
41
41
|
private automaticUpdateInProgress;
|
|
42
|
+
private readonly automaticUpdateScheduleThreads;
|
|
43
|
+
private automaticUpdateFailed;
|
|
42
44
|
private automaticUpdateRecovering;
|
|
43
|
-
private automaticUpdateRecoveryPending;
|
|
44
45
|
private approvalCardsSupported;
|
|
45
46
|
private streamingContextSupported;
|
|
46
47
|
private delegationProgressSupported;
|
|
@@ -87,9 +88,12 @@ export declare class MessageHandler {
|
|
|
87
88
|
* Handle message (supports new IncomingMessage format)
|
|
88
89
|
*/
|
|
89
90
|
handleMessage(message: Message | IncomingMessage): Promise<void>;
|
|
91
|
+
private scheduleContextFenced;
|
|
92
|
+
private releaseSettledUpdateFences;
|
|
90
93
|
tryBeginAutomaticUpdate(): boolean;
|
|
91
94
|
prepareAutomaticUpdate(): Promise<void>;
|
|
92
|
-
endAutomaticUpdate(): Promise<void>;
|
|
95
|
+
endAutomaticUpdate(failed?: boolean): Promise<void>;
|
|
96
|
+
private restoreAfterAutomaticUpdate;
|
|
93
97
|
/**
|
|
94
98
|
* Handle command message — route to the correct thread executor.
|
|
95
99
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageHandler.d.ts","sourceRoot":"","sources":["../../src/client/MessageHandler.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAQpD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAgK,MAAM,UAAU,CAAC;AACzM,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAOxD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAqIxD;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAsBD,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,aAAa,CAAC,CAAS;IAC/B,OAAO,CAAC,mBAAmB,CAA4B;IACvD,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,eAAe,CAA0C;IACjE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAsC;IACnE,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAA+C;IACzF,OAAO,CAAC,Q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,wBAAwB;YAiExB,qBAAqB;IA8EnC,8EAA8E;YAChE,sBAAsB;IAepC,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,gBAAgB;IAYxB,uFAAuF;YACzE,sBAAsB;IAsBpC,mFAAmF;YACrE,eAAe;YAuDf,mBAAmB;IA2BjC,OAAO,CAAC,YAAY;YAUN,cAAc;YAuBd,oBAAoB;IAgHlC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAoD/B"}
|
|
@@ -168,7 +168,7 @@ class MessageHandler {
|
|
|
168
168
|
threadName: threadId => this.threadManager.getThread(threadId)?.name,
|
|
169
169
|
// Queued or pending work counts as busy: a confirmation must never redirect it into another session.
|
|
170
170
|
isBusy: threadId => this.threadPool.isThreadBusy(threadId) || this.hasThreadQueueState(threadId)
|
|
171
|
-
|| this.abortOperations.has(threadId) || this.
|
|
171
|
+
|| this.abortOperations.has(threadId) || this.scheduleContextFenced(threadId) || this.isDestroyed || this.automaticUpdateInProgress
|
|
172
172
|
|| this.delegation.hasActiveTasks(threadId) || this.settingsAdmission.hasCommand(threadId),
|
|
173
173
|
setBusy: (threadId, busy) => {
|
|
174
174
|
if (busy) {
|
|
@@ -194,8 +194,11 @@ class MessageHandler {
|
|
|
194
194
|
abortOperations = new Map();
|
|
195
195
|
pendingGoalActivations = new Map();
|
|
196
196
|
automaticUpdateInProgress = false;
|
|
197
|
+
// Captured before native release starts. A rejected bounded waiter does not
|
|
198
|
+
// retire the underlying host operation or authorize changes to its context.
|
|
199
|
+
automaticUpdateScheduleThreads = new Map();
|
|
200
|
+
automaticUpdateFailed = false;
|
|
197
201
|
automaticUpdateRecovering = false;
|
|
198
|
-
automaticUpdateRecoveryPending = false;
|
|
199
202
|
approvalCardsSupported = false;
|
|
200
203
|
streamingContextSupported = false;
|
|
201
204
|
delegationProgressSupported = false;
|
|
@@ -258,7 +261,7 @@ class MessageHandler {
|
|
|
258
261
|
cancel: (owner, id) => this.schedules.cancel(owner, id),
|
|
259
262
|
exclusive: async (owner, body) => {
|
|
260
263
|
if (!this.schedules || this.isDestroyed || this.automaticUpdateInProgress
|
|
261
|
-
|| this.
|
|
264
|
+
|| this.scheduleContextFenced(owner.threadId) || this.scheduleManagement.has(owner.threadId))
|
|
262
265
|
throw new Error('Schedule controls are busy.');
|
|
263
266
|
this.scheduleManagement.add(owner.threadId);
|
|
264
267
|
try {
|
|
@@ -535,12 +538,39 @@ class MessageHandler {
|
|
|
535
538
|
});
|
|
536
539
|
}
|
|
537
540
|
}
|
|
541
|
+
scheduleContextFenced(threadId) {
|
|
542
|
+
return this.scheduleRecoveryThreads.has(threadId) || this.automaticUpdateScheduleThreads.has(threadId);
|
|
543
|
+
}
|
|
544
|
+
releaseSettledUpdateFences() {
|
|
545
|
+
if (!this.automaticUpdateScheduleThreads.size || !this.schedules
|
|
546
|
+
|| this.schedules.hasUnresolvedHandoff() || this.schedules.hasUnresolvedRecovery()
|
|
547
|
+
|| this.schedules.hasPendingRecovery() || !this.schedules.canSuspendForRestart())
|
|
548
|
+
return;
|
|
549
|
+
for (const [threadId, generation] of this.automaticUpdateScheduleThreads) {
|
|
550
|
+
const executor = this.threadPool.getExistingExecutor(threadId);
|
|
551
|
+
try {
|
|
552
|
+
if (this.scheduleGeneration(threadId) !== generation || executor?.hasPendingScheduleMutation?.()
|
|
553
|
+
|| executor?.hasUncertainShutdown?.())
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
catch {
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
this.automaticUpdateScheduleThreads.clear();
|
|
561
|
+
this.automaticUpdateFailed = false;
|
|
562
|
+
}
|
|
538
563
|
tryBeginAutomaticUpdate() {
|
|
564
|
+
// Read-only readiness: never replay a release or a recovery just to retry an update.
|
|
565
|
+
this.releaseSettledUpdateFences();
|
|
539
566
|
this.removeExpiredQueueConfirmations();
|
|
540
567
|
const hasQueuedCommands = Array.from(this.threadQueues.values()).some((queue) => queue.length > 0);
|
|
541
568
|
const hasRunningThread = this.threadPool.getSummaries().some((thread) => thread.status === 'running');
|
|
542
569
|
if (this.automaticUpdateInProgress
|
|
543
570
|
|| this.isDestroyed
|
|
571
|
+
|| this.automaticUpdateScheduleThreads.size > 0
|
|
572
|
+
|| this.schedules?.hasUnresolvedHandoff() || this.schedules?.hasUnresolvedRecovery()
|
|
573
|
+
|| this.schedules?.hasPendingRecovery()
|
|
544
574
|
|| this.scheduleRecoveryPending
|
|
545
575
|
|| this.wsClient.hasPendingTaskResults()
|
|
546
576
|
|| hasRunningThread
|
|
@@ -554,22 +584,54 @@ class MessageHandler {
|
|
|
554
584
|
return false;
|
|
555
585
|
}
|
|
556
586
|
this.automaticUpdateInProgress = true;
|
|
587
|
+
this.automaticUpdateFailed = false;
|
|
557
588
|
return true;
|
|
558
589
|
}
|
|
559
590
|
async prepareAutomaticUpdate() {
|
|
560
591
|
if (!this.automaticUpdateInProgress || this.isDestroyed)
|
|
561
592
|
throw new Error('Automatic update admission expired.');
|
|
562
|
-
if (this.schedules?.hasActiveSchedules())
|
|
593
|
+
if (this.schedules?.hasActiveSchedules()) {
|
|
594
|
+
for (const thread of this.threadManager.listThreads()) {
|
|
595
|
+
if (this.schedules.hasActiveSchedules(thread.id)) {
|
|
596
|
+
this.automaticUpdateScheduleThreads.set(thread.id, this.scheduleGeneration(thread.id));
|
|
597
|
+
}
|
|
598
|
+
}
|
|
563
599
|
await this.schedules.suspendForRestart();
|
|
600
|
+
}
|
|
564
601
|
if (this.wsClient.hasPendingTaskResults())
|
|
565
602
|
throw new Error('Result delivery remains pending.');
|
|
566
603
|
}
|
|
567
|
-
async endAutomaticUpdate() {
|
|
604
|
+
async endAutomaticUpdate(failed = false) {
|
|
605
|
+
try {
|
|
606
|
+
if (failed)
|
|
607
|
+
this.automaticUpdateFailed = true;
|
|
608
|
+
if (this.automaticUpdateFailed) {
|
|
609
|
+
this.releaseSettledUpdateFences();
|
|
610
|
+
if (this.automaticUpdateScheduleThreads.size || this.schedules?.hasUnresolvedHandoff()
|
|
611
|
+
|| this.schedules?.hasUnresolvedRecovery() || this.schedules?.hasPendingRecovery()) {
|
|
612
|
+
throw new Error('Native schedule ownership remains unresolved; affected thread admission is retained.');
|
|
613
|
+
}
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
616
|
+
await this.restoreAfterAutomaticUpdate();
|
|
617
|
+
this.automaticUpdateScheduleThreads.clear();
|
|
618
|
+
}
|
|
619
|
+
catch (error) {
|
|
620
|
+
this.automaticUpdateFailed = true;
|
|
621
|
+
throw error;
|
|
622
|
+
}
|
|
623
|
+
finally {
|
|
624
|
+
// The schedule service and exact affected contexts retain their own leases.
|
|
625
|
+
// Releasing this global lock never cancels or forgets a native operation.
|
|
626
|
+
this.automaticUpdateInProgress = false;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
async restoreAfterAutomaticUpdate() {
|
|
568
630
|
if (this.schedules?.hasUnresolvedHandoff())
|
|
569
|
-
throw new Error('Native restart handoff remains unresolved;
|
|
631
|
+
throw new Error('Native restart handoff remains unresolved; affected thread admission is retained.');
|
|
570
632
|
if (!this.schedules?.hasPendingRecovery()) {
|
|
571
633
|
if (this.schedules?.hasUnresolvedRecovery())
|
|
572
|
-
throw new Error('Native recovery remains blocked;
|
|
634
|
+
throw new Error('Native recovery remains blocked; affected thread admission is retained.');
|
|
573
635
|
// Terminal-only handoffs still own the predecessor's local admission fence.
|
|
574
636
|
// No job needs recreation, but the shared recovery finalizer must release it.
|
|
575
637
|
if (this.schedules) {
|
|
@@ -581,23 +643,18 @@ class MessageHandler {
|
|
|
581
643
|
this.automaticUpdateRecovering = false;
|
|
582
644
|
}
|
|
583
645
|
}
|
|
584
|
-
this.automaticUpdateInProgress = false;
|
|
585
|
-
this.automaticUpdateRecoveryPending = false;
|
|
586
646
|
return;
|
|
587
647
|
}
|
|
588
648
|
if (this.isDestroyed)
|
|
589
649
|
throw new Error('Shutdown already began; native schedules require startup recovery.');
|
|
590
650
|
// Only finalization authorizes restoration. Reconnect during installation must
|
|
591
651
|
// never restart native timing under the still-active installer.
|
|
592
|
-
this.automaticUpdateRecoveryPending = true;
|
|
593
652
|
this.automaticUpdateRecovering = true;
|
|
594
653
|
try {
|
|
595
654
|
await this.schedules.recover();
|
|
596
655
|
if (this.schedules.hasUnresolvedRecovery()) {
|
|
597
|
-
throw new Error('Native schedule restoration remains unresolved;
|
|
656
|
+
throw new Error('Native schedule restoration remains unresolved; affected thread admission is retained.');
|
|
598
657
|
}
|
|
599
|
-
this.automaticUpdateInProgress = false;
|
|
600
|
-
this.automaticUpdateRecoveryPending = false;
|
|
601
658
|
}
|
|
602
659
|
finally {
|
|
603
660
|
this.automaticUpdateRecovering = false;
|
|
@@ -609,15 +666,15 @@ class MessageHandler {
|
|
|
609
666
|
async handleCommandMessage(message, fileOrder) {
|
|
610
667
|
const threadId = message.threadId ?? this.threadManager.getDefaultThread().id;
|
|
611
668
|
const content = message.content?.trim() ?? '';
|
|
612
|
-
if (this.automaticUpdateInProgress && content === '/schedule list') {
|
|
669
|
+
if ((this.automaticUpdateInProgress || this.automaticUpdateScheduleThreads.has(threadId)) && content === '/schedule list') {
|
|
613
670
|
this.messageOpenIds.set(message.messageId, message.openId);
|
|
614
671
|
await this.handleScheduleCommand(message, threadId);
|
|
615
672
|
return;
|
|
616
673
|
}
|
|
617
|
-
if (this.
|
|
618
|
-
|| this.scheduleRecoveryThreads.size > 0 && /^\/backend\s/.test(content) && !/\s@$/.test(content)) {
|
|
674
|
+
if (this.scheduleContextFenced(threadId)
|
|
675
|
+
|| (this.scheduleRecoveryThreads.size > 0 || this.automaticUpdateScheduleThreads.size > 0) && /^\/backend\s/.test(content) && !/\s@$/.test(content)) {
|
|
619
676
|
this.sendResponse(message.messageId, threadId, { success: false,
|
|
620
|
-
error: 'Native schedule recovery is
|
|
677
|
+
error: 'Native schedule handoff or recovery is unresolved. Use /schedule list for stored status; conflicting operations remain fenced.' });
|
|
621
678
|
return;
|
|
622
679
|
}
|
|
623
680
|
if (this.scheduleRecoveryPending && /^\/(?:clear|new|backend|cd|thread\s+delete)(?:\s|$)/.test(content)) {
|
|
@@ -742,9 +799,9 @@ class MessageHandler {
|
|
|
742
799
|
return;
|
|
743
800
|
}
|
|
744
801
|
const resolvedThreadId = thread.id;
|
|
745
|
-
if (this.
|
|
802
|
+
if (this.scheduleContextFenced(resolvedThreadId)) {
|
|
746
803
|
this.sendResponse(messageId, resolvedThreadId, { success: false,
|
|
747
|
-
error: 'Native schedule recovery is
|
|
804
|
+
error: 'Native schedule handoff or recovery is unresolved for this thread. Use /schedule list for stored status.' });
|
|
748
805
|
return;
|
|
749
806
|
}
|
|
750
807
|
if (this.automaticUpdateInProgress) {
|
|
@@ -1226,6 +1283,8 @@ class MessageHandler {
|
|
|
1226
1283
|
const thread = this.threadManager.getThread(request.threadId);
|
|
1227
1284
|
if (!thread)
|
|
1228
1285
|
throw new Error('This Worker card has expired. Use the latest Worker card.');
|
|
1286
|
+
if (this.scheduleContextFenced(thread.id))
|
|
1287
|
+
throw new Error('Native schedule ownership remains unresolved for this thread.');
|
|
1229
1288
|
await this.delegation.resetWorkerContext(thread, request.laneId, request.generation);
|
|
1230
1289
|
}
|
|
1231
1290
|
catch (cause) {
|
|
@@ -1822,7 +1881,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
1822
1881
|
async startNextQueuedCommand(threadId) {
|
|
1823
1882
|
if (this.settingsAdmission.isBlocked(threadId))
|
|
1824
1883
|
return;
|
|
1825
|
-
if (this.
|
|
1884
|
+
if (this.scheduleContextFenced(threadId) || this.threadPool.isThreadBusy(threadId) || this.pausedQueues.has(threadId) || this.abortOperations.has(threadId))
|
|
1826
1885
|
return;
|
|
1827
1886
|
const queue = this.threadQueues.get(threadId);
|
|
1828
1887
|
const command = queue?.shift();
|
|
@@ -3486,14 +3545,21 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3486
3545
|
// create a late service/subscription after shutdown has collected its work.
|
|
3487
3546
|
if (this.isDestroyed || !this.scheduleResultsSupported)
|
|
3488
3547
|
return;
|
|
3548
|
+
if (this.automaticUpdateFailed && this.automaticUpdateScheduleThreads.size) {
|
|
3549
|
+
// Reconnect can retry durable delivery, but must not restart model-mediated
|
|
3550
|
+
// reconciliation after a failed update merely to reopen unrelated chat.
|
|
3551
|
+
await this.schedules?.retryDeliveries();
|
|
3552
|
+
return;
|
|
3553
|
+
}
|
|
3489
3554
|
this.scheduleRecoveryPending = true;
|
|
3490
3555
|
const service = await this.initializeSchedules();
|
|
3491
3556
|
if (!this.isDestroyed && this.scheduleResultsSupported) {
|
|
3492
|
-
if (this.
|
|
3493
|
-
await
|
|
3557
|
+
if (this.automaticUpdateFailed && this.automaticUpdateScheduleThreads.size) {
|
|
3558
|
+
await service.retryDeliveries();
|
|
3559
|
+
this.scheduleRecoveryPending = false;
|
|
3560
|
+
return;
|
|
3494
3561
|
}
|
|
3495
|
-
|
|
3496
|
-
await service.recover();
|
|
3562
|
+
await service.recover();
|
|
3497
3563
|
await service.retryDeliveries();
|
|
3498
3564
|
this.scheduleRecoveryPending = false;
|
|
3499
3565
|
}
|
|
@@ -3666,6 +3732,8 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3666
3732
|
}
|
|
3667
3733
|
}
|
|
3668
3734
|
async assertSchedulesIdle(threadId, preserveCleanupContext = true) {
|
|
3735
|
+
if (this.scheduleContextFenced(threadId))
|
|
3736
|
+
throw new Error('Native schedule ownership remains unresolved for this thread.');
|
|
3669
3737
|
if (preserveCleanupContext)
|
|
3670
3738
|
await this.assertScheduleCleanupContext(threadId);
|
|
3671
3739
|
if (this.scheduleManagement.has(threadId) || this.schedules?.hasActiveSchedules(threadId)) {
|
|
@@ -3708,7 +3776,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3708
3776
|
return false;
|
|
3709
3777
|
}
|
|
3710
3778
|
};
|
|
3711
|
-
const check = () => { if (!current() || this.automaticUpdateInProgress || this.
|
|
3779
|
+
const check = () => { if (!current() || this.automaticUpdateInProgress || this.scheduleContextFenced(owner.threadId))
|
|
3712
3780
|
throw new Error('Scheduling context changed or client is shutting down/updating/recovering.'); };
|
|
3713
3781
|
check();
|
|
3714
3782
|
if (command.kind === 'list' && this.threadPool.getExistingExecutor(owner.threadId)?.hasPendingCancellation?.()) {
|
|
@@ -3839,7 +3907,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3839
3907
|
try {
|
|
3840
3908
|
return !this.isDestroyed && !this.automaticUpdateInProgress && this.wsClient.isConnected()
|
|
3841
3909
|
&& epoch === this.imageConnectionEpoch && this.scheduleGeneration(owner.threadId) === owner.generation
|
|
3842
|
-
&& !this.
|
|
3910
|
+
&& !this.scheduleContextFenced(owner.threadId) && !this.abortOperations.has(owner.threadId)
|
|
3843
3911
|
&& this.threadPool.getBackendKey(owner.threadId) === backend
|
|
3844
3912
|
&& this.threadPool.getExistingExecutor(owner.threadId) === executor
|
|
3845
3913
|
&& capturedSettings === settings() && (!inTurnCurrent || inTurnCurrent());
|
|
@@ -3923,7 +3991,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3923
3991
|
const config = settings();
|
|
3924
3992
|
const current = () => {
|
|
3925
3993
|
try {
|
|
3926
|
-
return !this.isDestroyed && !this.automaticUpdateInProgress && !this.
|
|
3994
|
+
return !this.isDestroyed && !this.automaticUpdateInProgress && !this.scheduleContextFenced(threadId)
|
|
3927
3995
|
&& !this.abortOperations.has(threadId) && this.wsClient.isConnected() && epoch === this.imageConnectionEpoch
|
|
3928
3996
|
&& this.scheduleGeneration(threadId) === owner.generation && this.threadPool.getExistingExecutor(threadId) === executor
|
|
3929
3997
|
&& this.threadPool.getBackendKey(threadId) === 'claude' && config === settings() && (!inTurnCurrent || inTurnCurrent());
|
|
@@ -4049,7 +4117,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
4049
4117
|
return;
|
|
4050
4118
|
}
|
|
4051
4119
|
const storedOnly = command.kind === 'list' && this.threadPool.getExistingExecutor(threadId)?.hasPendingCancellation?.();
|
|
4052
|
-
const updateSnapshot = this.automaticUpdateInProgress && command.kind === 'list';
|
|
4120
|
+
const updateSnapshot = (this.automaticUpdateInProgress || this.automaticUpdateScheduleThreads.has(threadId)) && command.kind === 'list';
|
|
4053
4121
|
const records = updateSnapshot ? await this.schedules?.list(owner) ?? []
|
|
4054
4122
|
: await this.runScheduleOperation(owner, command.kind === 'list' ? { kind: 'list' } : command);
|
|
4055
4123
|
const record = records[0];
|
|
@@ -4116,7 +4184,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
4116
4184
|
revision: (0, crypto_1.createHash)('sha256').update(JSON.stringify({ thread: projection(thread), all, config: this.executorConfiguration() })).digest('hex') };
|
|
4117
4185
|
}
|
|
4118
4186
|
settingsBusy(threadId, exceptRequest, includeQueue = true, setting) {
|
|
4119
|
-
return this.isDestroyed || this.automaticUpdateInProgress || this.
|
|
4187
|
+
return this.isDestroyed || this.automaticUpdateInProgress || this.scheduleContextFenced(threadId) || (setting === 'model' ? this.threadPool.isThreadBusy(threadId, 'model') : this.threadPool.isThreadBusy(threadId))
|
|
4120
4188
|
|| this.delegation.hasActiveTasks(threadId) || this.abortOperations.has(threadId)
|
|
4121
4189
|
|| this.coordinatorPreparations.has(threadId) || this.settingsAdmission.hasCommand(threadId, exceptRequest) || (includeQueue && this.hasThreadQueueState(threadId));
|
|
4122
4190
|
}
|
|
@@ -4241,6 +4309,8 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
4241
4309
|
async applyBackendSetting(threadId, backend, scope, followGlobal = false) {
|
|
4242
4310
|
try {
|
|
4243
4311
|
for (const thread of scope === 'all' ? this.threadManager.listThreads() : [{ id: threadId }]) {
|
|
4312
|
+
if (this.scheduleContextFenced(thread.id))
|
|
4313
|
+
throw new Error('Native schedule ownership remains unresolved for an affected thread.');
|
|
4244
4314
|
this.threadManager.contextResets.assertReady(thread.id);
|
|
4245
4315
|
}
|
|
4246
4316
|
if (followGlobal) {
|