@yu_robotics/remote-cli 1.6.236 → 1.6.238
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 +9 -2
- package/dist/client/MessageHandler.d.ts.map +1 -1
- package/dist/client/MessageHandler.js +266 -34
- package/dist/client/MessageHandler.js.map +1 -1
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +1 -0
- package/dist/commands/start.js.map +1 -1
- package/dist/executor/AcpExecutor.d.ts +2 -0
- package/dist/executor/AcpExecutor.d.ts.map +1 -1
- package/dist/executor/AcpExecutor.js +9 -0
- package/dist/executor/AcpExecutor.js.map +1 -1
- package/dist/executor/ClaudePersistentExecutor.d.ts +52 -12
- package/dist/executor/ClaudePersistentExecutor.d.ts.map +1 -1
- package/dist/executor/ClaudePersistentExecutor.js +795 -123
- package/dist/executor/ClaudePersistentExecutor.js.map +1 -1
- package/dist/executor/DshExecutor.d.ts +13 -1
- package/dist/executor/DshExecutor.d.ts.map +1 -1
- package/dist/executor/DshExecutor.js +39 -1
- package/dist/executor/DshExecutor.js.map +1 -1
- package/dist/executor/IExecutor.d.ts +14 -0
- package/dist/executor/IExecutor.d.ts.map +1 -1
- package/dist/executor/claude/TurnLedger.d.ts +33 -0
- package/dist/executor/claude/TurnLedger.d.ts.map +1 -0
- package/dist/executor/claude/TurnLedger.js +126 -0
- package/dist/executor/claude/TurnLedger.js.map +1 -0
- package/dist/maintenance/release-notes.json +1 -1
- package/dist/managed/ManagedToolBridge.d.ts +4 -1
- package/dist/managed/ManagedToolBridge.d.ts.map +1 -1
- package/dist/managed/ManagedToolBridge.js +17 -2
- package/dist/managed/ManagedToolBridge.js.map +1 -1
- package/dist/scheduling/ScheduleCapabilities.d.ts +1 -1
- package/dist/scheduling/ScheduleCapabilities.d.ts.map +1 -1
- package/dist/scheduling/ScheduleCapabilities.js +3 -2
- package/dist/scheduling/ScheduleCapabilities.js.map +1 -1
- package/dist/scheduling/ScheduleService.d.ts +28 -0
- package/dist/scheduling/ScheduleService.d.ts.map +1 -1
- package/dist/scheduling/ScheduleService.js +562 -17
- package/dist/scheduling/ScheduleService.js.map +1 -1
- package/dist/scheduling/claude/ClaudeSessionSchedules.d.ts +28 -2
- package/dist/scheduling/claude/ClaudeSessionSchedules.d.ts.map +1 -1
- package/dist/scheduling/claude/ClaudeSessionSchedules.js +158 -18
- package/dist/scheduling/claude/ClaudeSessionSchedules.js.map +1 -1
- package/dist/scheduling/dsh/SessionScheduleBridge.d.ts.map +1 -1
- package/dist/scheduling/dsh/SessionScheduleBridge.js +21 -0
- package/dist/scheduling/dsh/SessionScheduleBridge.js.map +1 -1
- package/dist/scheduling/dsh/SessionScheduleClient.d.ts.map +1 -1
- package/dist/scheduling/dsh/SessionScheduleClient.js +8 -0
- package/dist/scheduling/dsh/SessionScheduleClient.js.map +1 -1
- package/dist/scheduling/types.d.ts +84 -0
- package/dist/scheduling/types.d.ts.map +1 -1
- package/dist/scheduling/types.js.map +1 -1
- package/dist/settings/SettingsService.d.ts +1 -1
- package/dist/settings/SettingsService.d.ts.map +1 -1
- package/dist/settings/SettingsService.js +3 -3
- package/dist/settings/SettingsService.js.map +1 -1
- package/dist/thread/ThreadExecutorPool.d.ts +1 -1
- package/dist/thread/ThreadExecutorPool.d.ts.map +1 -1
- package/dist/thread/ThreadExecutorPool.js +5 -3
- package/dist/thread/ThreadExecutorPool.js.map +1 -1
- package/dist/update/AutomaticUpdater.d.ts +2 -1
- package/dist/update/AutomaticUpdater.d.ts.map +1 -1
- package/dist/update/AutomaticUpdater.js +11 -3
- package/dist/update/AutomaticUpdater.js.map +1 -1
- 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,6 +39,8 @@ export declare class MessageHandler {
|
|
|
39
39
|
private readonly abortOperations;
|
|
40
40
|
private readonly pendingGoalActivations;
|
|
41
41
|
private automaticUpdateInProgress;
|
|
42
|
+
private automaticUpdateRecovering;
|
|
43
|
+
private automaticUpdateRecoveryPending;
|
|
42
44
|
private approvalCardsSupported;
|
|
43
45
|
private streamingContextSupported;
|
|
44
46
|
private delegationProgressSupported;
|
|
@@ -72,6 +74,8 @@ export declare class MessageHandler {
|
|
|
72
74
|
private readonly scheduleCards;
|
|
73
75
|
private schedules?;
|
|
74
76
|
private scheduleInitialization?;
|
|
77
|
+
private scheduleRecoveryPending;
|
|
78
|
+
private scheduleRecoveryThreads;
|
|
75
79
|
private scheduleDelivery?;
|
|
76
80
|
private readonly scheduleOwners;
|
|
77
81
|
private readonly scheduleManagement;
|
|
@@ -82,7 +86,8 @@ export declare class MessageHandler {
|
|
|
82
86
|
*/
|
|
83
87
|
handleMessage(message: Message | IncomingMessage): Promise<void>;
|
|
84
88
|
tryBeginAutomaticUpdate(): boolean;
|
|
85
|
-
|
|
89
|
+
prepareAutomaticUpdate(): Promise<void>;
|
|
90
|
+
endAutomaticUpdate(): Promise<void>;
|
|
86
91
|
/**
|
|
87
92
|
* Handle command message — route to the correct thread executor.
|
|
88
93
|
*/
|
|
@@ -217,7 +222,9 @@ export declare class MessageHandler {
|
|
|
217
222
|
private executorConfiguration;
|
|
218
223
|
private scheduleGeneration;
|
|
219
224
|
private scheduleDirectory;
|
|
220
|
-
/**
|
|
225
|
+
/** Fence the updater before connection/version callbacks can race catalog recovery. */
|
|
226
|
+
prepareScheduleStartup(): Promise<void>;
|
|
227
|
+
/** Binding recovery waits for transport readiness and never creates an absent catalog. */
|
|
221
228
|
private recoverSchedules;
|
|
222
229
|
private initializeSchedules;
|
|
223
230
|
private activeSchedules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,qBAAqB;IA2CnC,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;IA0BjC,OAAO,CAAC,YAAY;YAUN,cAAc;YAuBd,oBAAoB;IAgHlC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CA0C/B"}
|
|
@@ -163,7 +163,7 @@ class MessageHandler {
|
|
|
163
163
|
threadName: threadId => this.threadManager.getThread(threadId)?.name,
|
|
164
164
|
// Queued or pending work counts as busy: a confirmation must never redirect it into another session.
|
|
165
165
|
isBusy: threadId => this.threadPool.isThreadBusy(threadId) || this.hasThreadQueueState(threadId)
|
|
166
|
-
|| this.abortOperations.has(threadId) || this.isDestroyed || this.automaticUpdateInProgress
|
|
166
|
+
|| this.abortOperations.has(threadId) || this.scheduleRecoveryThreads.has(threadId) || this.isDestroyed || this.automaticUpdateInProgress
|
|
167
167
|
|| this.delegation.hasActiveTasks(threadId) || this.settingsAdmission.hasCommand(threadId),
|
|
168
168
|
setBusy: (threadId, busy) => {
|
|
169
169
|
if (busy) {
|
|
@@ -189,6 +189,8 @@ class MessageHandler {
|
|
|
189
189
|
abortOperations = new Map();
|
|
190
190
|
pendingGoalActivations = new Map();
|
|
191
191
|
automaticUpdateInProgress = false;
|
|
192
|
+
automaticUpdateRecovering = false;
|
|
193
|
+
automaticUpdateRecoveryPending = false;
|
|
192
194
|
approvalCardsSupported = false;
|
|
193
195
|
streamingContextSupported = false;
|
|
194
196
|
delegationProgressSupported = false;
|
|
@@ -222,6 +224,8 @@ class MessageHandler {
|
|
|
222
224
|
scheduleCards;
|
|
223
225
|
schedules;
|
|
224
226
|
scheduleInitialization;
|
|
227
|
+
scheduleRecoveryPending = false;
|
|
228
|
+
scheduleRecoveryThreads = new Set();
|
|
225
229
|
scheduleDelivery;
|
|
226
230
|
scheduleOwners = new Map();
|
|
227
231
|
scheduleManagement = new Set();
|
|
@@ -247,7 +251,7 @@ class MessageHandler {
|
|
|
247
251
|
cancel: (owner, id) => this.schedules.cancel(owner, id),
|
|
248
252
|
exclusive: async (owner, body) => {
|
|
249
253
|
if (!this.schedules || this.isDestroyed || this.automaticUpdateInProgress
|
|
250
|
-
|| this.scheduleManagement.has(owner.threadId))
|
|
254
|
+
|| this.scheduleRecoveryThreads.has(owner.threadId) || this.scheduleManagement.has(owner.threadId))
|
|
251
255
|
throw new Error('Schedule controls are busy.');
|
|
252
256
|
this.scheduleManagement.add(owner.threadId);
|
|
253
257
|
try {
|
|
@@ -306,7 +310,7 @@ class MessageHandler {
|
|
|
306
310
|
const config = this.executorConfiguration();
|
|
307
311
|
return this.settingsCatalogReader.read(config, thread, this.threadPool.getBackendKey(id), target, kind, this.modelSpeedSettingsSupported);
|
|
308
312
|
},
|
|
309
|
-
busy: (id, except, queue = true) => this.settingsBusy(id, except, queue),
|
|
313
|
+
busy: (id, except, queue = true, setting) => this.settingsBusy(id, except, queue, setting),
|
|
310
314
|
threads: () => this.threadManager.listThreads().map(thread => thread.id),
|
|
311
315
|
exclusive: async (target, body) => {
|
|
312
316
|
try {
|
|
@@ -529,6 +533,8 @@ class MessageHandler {
|
|
|
529
533
|
const hasQueuedCommands = Array.from(this.threadQueues.values()).some((queue) => queue.length > 0);
|
|
530
534
|
const hasRunningThread = this.threadPool.getSummaries().some((thread) => thread.status === 'running');
|
|
531
535
|
if (this.automaticUpdateInProgress
|
|
536
|
+
|| this.isDestroyed
|
|
537
|
+
|| this.scheduleRecoveryPending
|
|
532
538
|
|| this.wsClient.hasPendingTaskResults()
|
|
533
539
|
|| hasRunningThread
|
|
534
540
|
|| hasQueuedCommands
|
|
@@ -536,15 +542,59 @@ class MessageHandler {
|
|
|
536
542
|
|| this.pendingReplaces.size > 0
|
|
537
543
|
|| this.activeThreadOperations.size > 0
|
|
538
544
|
|| this.abortOperations.size > 0
|
|
539
|
-
|| this.scheduleManagement.size > 0 || this.schedules?.hasActiveSchedules()
|
|
545
|
+
|| this.scheduleManagement.size > 0 || this.schedules?.hasActiveSchedules() && !this.schedules.canSuspendForRestart()
|
|
540
546
|
|| this.threadManager.listThreads().some(thread => this.settingsAdmission.isBlocked(thread.id))) {
|
|
541
547
|
return false;
|
|
542
548
|
}
|
|
543
549
|
this.automaticUpdateInProgress = true;
|
|
544
550
|
return true;
|
|
545
551
|
}
|
|
546
|
-
|
|
547
|
-
this.automaticUpdateInProgress
|
|
552
|
+
async prepareAutomaticUpdate() {
|
|
553
|
+
if (!this.automaticUpdateInProgress || this.isDestroyed)
|
|
554
|
+
throw new Error('Automatic update admission expired.');
|
|
555
|
+
if (this.schedules?.hasActiveSchedules())
|
|
556
|
+
await this.schedules.suspendForRestart();
|
|
557
|
+
if (this.wsClient.hasPendingTaskResults())
|
|
558
|
+
throw new Error('Result delivery remains pending.');
|
|
559
|
+
}
|
|
560
|
+
async endAutomaticUpdate() {
|
|
561
|
+
if (this.schedules?.hasUnresolvedHandoff())
|
|
562
|
+
throw new Error('Native restart handoff remains unresolved; update admission is retained.');
|
|
563
|
+
if (!this.schedules?.hasPendingRecovery()) {
|
|
564
|
+
if (this.schedules?.hasUnresolvedRecovery())
|
|
565
|
+
throw new Error('Native recovery remains blocked; update admission is retained.');
|
|
566
|
+
// Terminal-only handoffs still own the predecessor's local admission fence.
|
|
567
|
+
// No job needs recreation, but the shared recovery finalizer must release it.
|
|
568
|
+
if (this.schedules) {
|
|
569
|
+
this.automaticUpdateRecovering = true;
|
|
570
|
+
try {
|
|
571
|
+
await this.schedules.recover();
|
|
572
|
+
}
|
|
573
|
+
finally {
|
|
574
|
+
this.automaticUpdateRecovering = false;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
this.automaticUpdateInProgress = false;
|
|
578
|
+
this.automaticUpdateRecoveryPending = false;
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
if (this.isDestroyed)
|
|
582
|
+
throw new Error('Shutdown already began; native schedules require startup recovery.');
|
|
583
|
+
// Only finalization authorizes restoration. Reconnect during installation must
|
|
584
|
+
// never restart native timing under the still-active installer.
|
|
585
|
+
this.automaticUpdateRecoveryPending = true;
|
|
586
|
+
this.automaticUpdateRecovering = true;
|
|
587
|
+
try {
|
|
588
|
+
await this.schedules.recover();
|
|
589
|
+
if (this.schedules.hasUnresolvedRecovery()) {
|
|
590
|
+
throw new Error('Native schedule restoration remains unresolved; update admission is retained.');
|
|
591
|
+
}
|
|
592
|
+
this.automaticUpdateInProgress = false;
|
|
593
|
+
this.automaticUpdateRecoveryPending = false;
|
|
594
|
+
}
|
|
595
|
+
finally {
|
|
596
|
+
this.automaticUpdateRecovering = false;
|
|
597
|
+
}
|
|
548
598
|
}
|
|
549
599
|
/**
|
|
550
600
|
* Handle command message — route to the correct thread executor.
|
|
@@ -552,6 +602,21 @@ class MessageHandler {
|
|
|
552
602
|
async handleCommandMessage(message, fileOrder) {
|
|
553
603
|
const threadId = message.threadId ?? this.threadManager.getDefaultThread().id;
|
|
554
604
|
const content = message.content?.trim() ?? '';
|
|
605
|
+
if (this.automaticUpdateInProgress && content === '/schedule list') {
|
|
606
|
+
this.messageOpenIds.set(message.messageId, message.openId);
|
|
607
|
+
await this.handleScheduleCommand(message, threadId);
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
if (this.scheduleRecoveryThreads.has(threadId)
|
|
611
|
+
|| this.scheduleRecoveryThreads.size > 0 && /^\/backend\s/.test(content) && !/\s@$/.test(content)) {
|
|
612
|
+
this.sendResponse(message.messageId, threadId, { success: false,
|
|
613
|
+
error: 'Native schedule recovery is in progress. Retry after reconciliation finishes.' });
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
616
|
+
if (this.scheduleRecoveryPending && /^\/(?:clear|new|backend|cd|thread\s+delete)(?:\s|$)/.test(content)) {
|
|
617
|
+
this.sendResponse(message.messageId, threadId, { success: false, error: 'Schedule catalog readiness is unresolved. Retry context changes after recovery or inspect /schedule list.' });
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
555
620
|
const clearing = content === '/clear' || content === '/new';
|
|
556
621
|
const management = content === '/abort' || /^\/thread(?:\s+list)?$/.test(content) || /^\/thread\s+new(?:\s|$)/.test(content);
|
|
557
622
|
let admissionCurrent = () => true;
|
|
@@ -573,6 +638,10 @@ class MessageHandler {
|
|
|
573
638
|
return this.handleAdmittedCommandMessage(message, fileOrder, () => admissionCurrent());
|
|
574
639
|
};
|
|
575
640
|
this.messageOpenIds.set(message.messageId, message.openId);
|
|
641
|
+
if ((0, SessionResumeService_1.isSessionControl)(content) && this.automaticUpdateInProgress) {
|
|
642
|
+
this.sendResponse(message.messageId, threadId, { success: false, error: 'Automatic update handoff is in progress. Retry after it finishes.' });
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
576
645
|
if ((0, SessionResumeService_1.isSessionControl)(content)) {
|
|
577
646
|
if (!this.threadManager.getThread(threadId)) {
|
|
578
647
|
this.sendResponse(message.messageId, undefined, { success: false, error: 'The selected thread no longer exists.' });
|
|
@@ -666,6 +735,11 @@ class MessageHandler {
|
|
|
666
735
|
return;
|
|
667
736
|
}
|
|
668
737
|
const resolvedThreadId = thread.id;
|
|
738
|
+
if (this.scheduleRecoveryThreads.has(resolvedThreadId)) {
|
|
739
|
+
this.sendResponse(messageId, resolvedThreadId, { success: false,
|
|
740
|
+
error: 'Native schedule recovery is in progress for this thread. Retry after reconciliation finishes.' });
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
669
743
|
if (this.automaticUpdateInProgress) {
|
|
670
744
|
this.sendResponse(messageId, resolvedThreadId, {
|
|
671
745
|
success: false,
|
|
@@ -877,7 +951,8 @@ class MessageHandler {
|
|
|
877
951
|
}
|
|
878
952
|
if (!admissionCurrent())
|
|
879
953
|
return;
|
|
880
|
-
const threadBusy =
|
|
954
|
+
const threadBusy = /^\/model\s+\S/.test(settingsCommand)
|
|
955
|
+
? this.threadPool.isThreadBusy(resolvedThreadId, 'model') : this.threadPool.isThreadBusy(resolvedThreadId);
|
|
881
956
|
const queuedCount = this.threadQueues.get(resolvedThreadId)?.length ?? 0;
|
|
882
957
|
if (!threadBusy && !this.hasThreadQueueState(resolvedThreadId))
|
|
883
958
|
this.pausedQueues.delete(resolvedThreadId);
|
|
@@ -1001,6 +1076,11 @@ class MessageHandler {
|
|
|
1001
1076
|
* Handle /abort command for a specific thread executor
|
|
1002
1077
|
*/
|
|
1003
1078
|
async handleAbortCommand(messageId, threadId, executor) {
|
|
1079
|
+
if (executor?.hasPendingSettingsChange?.()) {
|
|
1080
|
+
this.sendResponse(messageId, threadId, { success: false,
|
|
1081
|
+
error: 'Native settings change is pending or unconfirmed. Wait for its reply or retry the setting after a terminal error. /clear is destructive recovery and loses session-only schedules.' });
|
|
1082
|
+
return;
|
|
1083
|
+
}
|
|
1004
1084
|
this.conversationRevisions.set(threadId, (this.conversationRevisions.get(threadId) ?? 0) + 1);
|
|
1005
1085
|
this.settingsAdmission.cancelRecoverable(threadId);
|
|
1006
1086
|
this.fileInbox?.cancelThread(threadId);
|
|
@@ -1011,6 +1091,11 @@ class MessageHandler {
|
|
|
1011
1091
|
const existingAbort = this.abortOperations.get(threadId);
|
|
1012
1092
|
if (existingAbort) {
|
|
1013
1093
|
await existingAbort;
|
|
1094
|
+
if (executor?.hasPendingCancellation?.()) {
|
|
1095
|
+
this.sendResponse(messageId, threadId, { success: false,
|
|
1096
|
+
error: 'Native cancellation cleanup remains pending. Retry /abort, or use /clear to stop the host and lose its session-only schedules.' });
|
|
1097
|
+
return;
|
|
1098
|
+
}
|
|
1014
1099
|
if (executor?.hasUncertainShutdown?.()) {
|
|
1015
1100
|
this.sendResponse(messageId, threadId, {
|
|
1016
1101
|
success: false,
|
|
@@ -1034,7 +1119,10 @@ class MessageHandler {
|
|
|
1034
1119
|
const wasExecuting = this.threadPool.isThreadBusy(threadId);
|
|
1035
1120
|
const clearedCount = this.clearThreadQueue(threadId);
|
|
1036
1121
|
const activeOperation = this.cancelThreadOperation(threadId);
|
|
1037
|
-
|
|
1122
|
+
if (executor?.preservesProcessOnAbort?.())
|
|
1123
|
+
this.delegationBridges.get(threadId)?.retireCurrentActivation();
|
|
1124
|
+
else
|
|
1125
|
+
this.detachDelegationBridge(threadId);
|
|
1038
1126
|
for (const [id, approval] of this.pendingApprovalCards) {
|
|
1039
1127
|
if (approval.request.threadId === threadId)
|
|
1040
1128
|
this.resolveApprovalCard(id, 'expired');
|
|
@@ -1078,7 +1166,7 @@ class MessageHandler {
|
|
|
1078
1166
|
this.threadPool.setThreadBusy(threadId, false);
|
|
1079
1167
|
this.sendResponse(messageId, threadId, {
|
|
1080
1168
|
success: true,
|
|
1081
|
-
output: `${wasExecuting ? '✅ Current command has been aborted' : '⚠️ No command was executing, but executor has been reset'}${clearedCount ? `\n🗑️ Cleared ${clearedCount} queued message${clearedCount === 1 ? '' : 's'}.` : ''}`,
|
|
1169
|
+
output: `${executor?.abortStatusMessage?.() ?? (wasExecuting ? '✅ Current command has been aborted' : '⚠️ No command was executing, but executor has been reset')}${clearedCount ? `\n🗑️ Cleared ${clearedCount} queued message${clearedCount === 1 ? '' : 's'}.` : ''}`,
|
|
1082
1170
|
});
|
|
1083
1171
|
}
|
|
1084
1172
|
else {
|
|
@@ -1145,12 +1233,16 @@ class MessageHandler {
|
|
|
1145
1233
|
const bridge = this.delegationBridges.get(threadId);
|
|
1146
1234
|
if (!bridge)
|
|
1147
1235
|
return;
|
|
1148
|
-
bridge.activate(undefined);
|
|
1149
1236
|
this.delegationBridges.delete(threadId);
|
|
1150
1237
|
void bridge.close().catch(() => undefined);
|
|
1151
1238
|
}
|
|
1152
1239
|
async clearThreadConversation(messageId, threadId) {
|
|
1153
|
-
|
|
1240
|
+
if (this.abortOperations.has(threadId))
|
|
1241
|
+
throw new Error('Direct backend abort is still pending; retry /clear after it settles.');
|
|
1242
|
+
const existing = this.threadPool.getExistingExecutor(threadId);
|
|
1243
|
+
const destructiveRecovery = existing?.hasPendingCancellation?.() === true || existing?.hasPendingSettingsChange?.() === true;
|
|
1244
|
+
if (!destructiveRecovery)
|
|
1245
|
+
await this.assertSchedulesIdle(threadId);
|
|
1154
1246
|
this.conversationRevisions.set(threadId, (this.conversationRevisions.get(threadId) ?? 0) + 1);
|
|
1155
1247
|
this.settingsService.invalidate(threadId);
|
|
1156
1248
|
this.directoryBrowser.invalidate(threadId);
|
|
@@ -1177,7 +1269,10 @@ class MessageHandler {
|
|
|
1177
1269
|
throw new Error('Direct backend abort is still pending; retry after it settles');
|
|
1178
1270
|
const executor = this.threadPool.getExistingExecutor(threadId);
|
|
1179
1271
|
if (executor) {
|
|
1180
|
-
|
|
1272
|
+
if (executor.stopForContextReset)
|
|
1273
|
+
await executor.stopForContextReset();
|
|
1274
|
+
else
|
|
1275
|
+
await executor.abort();
|
|
1181
1276
|
if (executor.hasUncertainShutdown?.())
|
|
1182
1277
|
throw new Error('Direct backend shutdown is unconfirmed');
|
|
1183
1278
|
}
|
|
@@ -1191,7 +1286,7 @@ class MessageHandler {
|
|
|
1191
1286
|
this.threadPool.setThreadBusy(threadId, false);
|
|
1192
1287
|
await workers;
|
|
1193
1288
|
this.sendResponse(messageId, threadId, { success: true,
|
|
1194
|
-
output: 'Started a fresh conversation for direct backends and managed workers. Permanent deletion of old managed child native sessions is queued. Verified Codex, Kimi, Pi, and Claude child sessions are supported on Linux; unsupported versions, layouts, backends, platforms, and unconfirmed targets remain pending. Task artifacts and recovery evidence are retained. Pending native writers still block conflicting execution
|
|
1289
|
+
output: `${destructiveRecovery ? 'Explicit recovery stopped the Claude host; its session-only schedules were lost. ' : ''}Started a fresh conversation for direct backends and managed workers. Permanent deletion of old managed child native sessions is queued. Verified Codex, Kimi, Pi, and Claude child sessions are supported on Linux; unsupported versions, layouts, backends, platforms, and unconfirmed targets remain pending. Task artifacts and recovery evidence are retained. Pending native writers still block conflicting execution.` }, true);
|
|
1195
1290
|
}
|
|
1196
1291
|
catch (error) {
|
|
1197
1292
|
const detail = error instanceof Error ? error.message : 'Local context storage is unavailable';
|
|
@@ -1719,7 +1814,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
1719
1814
|
async startNextQueuedCommand(threadId) {
|
|
1720
1815
|
if (this.settingsAdmission.isBlocked(threadId))
|
|
1721
1816
|
return;
|
|
1722
|
-
if (this.threadPool.isThreadBusy(threadId) || this.pausedQueues.has(threadId) || this.abortOperations.has(threadId))
|
|
1817
|
+
if (this.scheduleRecoveryThreads.has(threadId) || this.threadPool.isThreadBusy(threadId) || this.pausedQueues.has(threadId) || this.abortOperations.has(threadId))
|
|
1723
1818
|
return;
|
|
1724
1819
|
const queue = this.threadQueues.get(threadId);
|
|
1725
1820
|
const command = queue?.shift();
|
|
@@ -2255,6 +2350,8 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
2255
2350
|
}
|
|
2256
2351
|
if (executor.hasUncertainShutdown?.())
|
|
2257
2352
|
throw new Error('Direct backend shutdown is unconfirmed. Retry /abort or /clear before sending more work.');
|
|
2353
|
+
if (executor.hasPendingCancellation?.())
|
|
2354
|
+
throw new Error('Native cancellation cleanup is pending. Retry /abort or use /clear (session-only schedules will be lost).');
|
|
2258
2355
|
await this.delegation.assertExecutionSafe(executor.getCurrentWorkingDirectory(), threadId);
|
|
2259
2356
|
if (this.isDestroyed || this.abortOperations.has(threadId) || (token &&
|
|
2260
2357
|
(this.cancelledOperations.has(token) || this.activeThreadOperations.get(threadId)?.token !== token))) {
|
|
@@ -2403,6 +2500,8 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
2403
2500
|
}
|
|
2404
2501
|
if (executor.hasUncertainShutdown?.())
|
|
2405
2502
|
throw new Error('Direct backend shutdown is unconfirmed. Retry /abort or /clear before sending more work.');
|
|
2503
|
+
if (executor.hasPendingCancellation?.())
|
|
2504
|
+
throw new Error('Native cancellation cleanup is pending. Retry /abort or use /clear (session-only schedules will be lost).');
|
|
2406
2505
|
this.pendingOutputFiles.invalidateThread(threadId);
|
|
2407
2506
|
const conversationRevision = this.conversationRevisions.get(threadId) ?? 0;
|
|
2408
2507
|
const operationToken = this.activeThreadOperations.get(threadId)?.token;
|
|
@@ -2423,6 +2522,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
2423
2522
|
let scheduleScope;
|
|
2424
2523
|
let clearScheduleModelOverride;
|
|
2425
2524
|
let delegationBridge;
|
|
2525
|
+
let retireActivation;
|
|
2426
2526
|
let executionMetadata;
|
|
2427
2527
|
let requestFinished = false;
|
|
2428
2528
|
let imageDelivery;
|
|
@@ -2464,7 +2564,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
2464
2564
|
this.imageDeliveries.delete(threadId);
|
|
2465
2565
|
requestFinished = true;
|
|
2466
2566
|
activity.dispose();
|
|
2467
|
-
|
|
2567
|
+
retireActivation?.();
|
|
2468
2568
|
const retained = !success && delegationScope && !delegationScope.isClosed()
|
|
2469
2569
|
&& !this.isDestroyed && !this.abortOperations.has(threadId)
|
|
2470
2570
|
? delegationScope.getRetainedResults() : [];
|
|
@@ -2754,7 +2854,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
2754
2854
|
scope?.beginExecution(continuationResults.map(task => task.taskId));
|
|
2755
2855
|
const launchRevision = scope?.getLaunchRevision();
|
|
2756
2856
|
if (scope || scheduleScope)
|
|
2757
|
-
delegationBridge?.activate((name, args, callId) => {
|
|
2857
|
+
retireActivation = delegationBridge?.activate((name, args, callId) => {
|
|
2758
2858
|
if (!active || !isCurrent())
|
|
2759
2859
|
return Promise.reject(new Error('The coordinator execution has ended'));
|
|
2760
2860
|
if (name.startsWith('remote_cli_schedule_') && scheduleScope)
|
|
@@ -2843,7 +2943,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
2843
2943
|
active = false;
|
|
2844
2944
|
executionActive = false;
|
|
2845
2945
|
activity.clear();
|
|
2846
|
-
|
|
2946
|
+
retireActivation?.();
|
|
2847
2947
|
assertCoordinatorActive();
|
|
2848
2948
|
scope?.finishExecution(result.success);
|
|
2849
2949
|
finished = true;
|
|
@@ -2881,7 +2981,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
2881
2981
|
active = false;
|
|
2882
2982
|
executionActive = false;
|
|
2883
2983
|
activity.clear();
|
|
2884
|
-
|
|
2984
|
+
retireActivation?.();
|
|
2885
2985
|
if (!finished)
|
|
2886
2986
|
scope?.finishExecution(false);
|
|
2887
2987
|
// Goal activation mutates durable native state; never replay it as a model retry.
|
|
@@ -2934,7 +3034,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
2934
3034
|
}
|
|
2935
3035
|
if (!delegationScope || !result.success)
|
|
2936
3036
|
return complete(result.success, result.error);
|
|
2937
|
-
|
|
3037
|
+
retireActivation?.();
|
|
2938
3038
|
if (delegationScope.hasPendingResults())
|
|
2939
3039
|
showState('Waiting for worker results');
|
|
2940
3040
|
const results = await delegationScope.collectPendingResults();
|
|
@@ -2980,7 +3080,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
2980
3080
|
finally {
|
|
2981
3081
|
finishPreparation();
|
|
2982
3082
|
await scheduleScope?.close();
|
|
2983
|
-
|
|
3083
|
+
retireActivation?.();
|
|
2984
3084
|
if (delegationBridge && this.delegationBridges.get(threadId) !== delegationBridge) {
|
|
2985
3085
|
void delegationBridge.close().catch(() => undefined);
|
|
2986
3086
|
}
|
|
@@ -3325,7 +3425,24 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3325
3425
|
})).digest('hex');
|
|
3326
3426
|
return path_1.default.join(directory, 'schedules', namespace);
|
|
3327
3427
|
}
|
|
3328
|
-
/**
|
|
3428
|
+
/** Fence the updater before connection/version callbacks can race catalog recovery. */
|
|
3429
|
+
async prepareScheduleStartup() {
|
|
3430
|
+
const directory = this.scheduleDirectory();
|
|
3431
|
+
if (!directory)
|
|
3432
|
+
return;
|
|
3433
|
+
this.scheduleRecoveryPending = true;
|
|
3434
|
+
try {
|
|
3435
|
+
await fs_1.default.promises.lstat(path_1.default.join(directory, ScheduleService_1.SCHEDULE_CATALOG_FILE));
|
|
3436
|
+
}
|
|
3437
|
+
catch (error) {
|
|
3438
|
+
if (['ENOENT', 'ENOTDIR'].includes(error.code ?? '')) {
|
|
3439
|
+
this.scheduleRecoveryPending = false;
|
|
3440
|
+
return;
|
|
3441
|
+
}
|
|
3442
|
+
throw error;
|
|
3443
|
+
}
|
|
3444
|
+
}
|
|
3445
|
+
/** Binding recovery waits for transport readiness and never creates an absent catalog. */
|
|
3329
3446
|
async recoverSchedules() {
|
|
3330
3447
|
if (this.isDestroyed || !this.scheduleResultsSupported)
|
|
3331
3448
|
return;
|
|
@@ -3346,9 +3463,17 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3346
3463
|
// create a late service/subscription after shutdown has collected its work.
|
|
3347
3464
|
if (this.isDestroyed || !this.scheduleResultsSupported)
|
|
3348
3465
|
return;
|
|
3466
|
+
this.scheduleRecoveryPending = true;
|
|
3349
3467
|
const service = await this.initializeSchedules();
|
|
3350
|
-
if (!this.isDestroyed && this.scheduleResultsSupported)
|
|
3468
|
+
if (!this.isDestroyed && this.scheduleResultsSupported) {
|
|
3469
|
+
if (this.automaticUpdateRecoveryPending && !this.automaticUpdateRecovering) {
|
|
3470
|
+
await this.endAutomaticUpdate();
|
|
3471
|
+
}
|
|
3472
|
+
else
|
|
3473
|
+
await service.recover();
|
|
3351
3474
|
await service.retryDeliveries();
|
|
3475
|
+
this.scheduleRecoveryPending = false;
|
|
3476
|
+
}
|
|
3352
3477
|
}
|
|
3353
3478
|
initializeSchedules() {
|
|
3354
3479
|
if (this.scheduleInitialization)
|
|
@@ -3361,7 +3486,67 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3361
3486
|
throw new Error('Local schedule storage is unavailable.');
|
|
3362
3487
|
const service = new ScheduleService_1.ScheduleService({
|
|
3363
3488
|
directory,
|
|
3364
|
-
|
|
3489
|
+
acquireRecovery: record => {
|
|
3490
|
+
if (this.scheduleRecoveryThreads.has(record.threadId))
|
|
3491
|
+
throw new Error('Recovery thread admission unavailable.');
|
|
3492
|
+
this.scheduleRecoveryThreads.add(record.threadId);
|
|
3493
|
+
return () => { this.scheduleRecoveryThreads.delete(record.threadId); };
|
|
3494
|
+
},
|
|
3495
|
+
canRecover: record => {
|
|
3496
|
+
try {
|
|
3497
|
+
if (this.isDestroyed || this.automaticUpdateInProgress && !this.automaticUpdateRecovering || !this.scheduleResultsSupported || !this.wsClient.isConnected()
|
|
3498
|
+
|| this.scheduleGeneration(record.threadId) !== record.generation
|
|
3499
|
+
|| this.threadPool.getBackendKey(record.threadId) !== record.backend)
|
|
3500
|
+
return false;
|
|
3501
|
+
const thread = this.threadManager.getThread(record.threadId);
|
|
3502
|
+
const configuration = this.executorConfiguration();
|
|
3503
|
+
if (record.execution?.command !== configuration[record.backend]?.command)
|
|
3504
|
+
return false;
|
|
3505
|
+
const cwd = this.directoryGuard.resolveWorkingDirectory(thread.workingDirectory);
|
|
3506
|
+
(0, WorkingDirectory_1.assertWorkingDirectoryExists)(cwd);
|
|
3507
|
+
if (cwd !== record.cwd || this.threadPool.isThreadBusy(record.threadId) && !this.scheduleRecoveryThreads.has(record.threadId)
|
|
3508
|
+
|| this.activeThreadOperations.has(record.threadId) || this.scheduleManagement.has(record.threadId)
|
|
3509
|
+
|| this.abortOperations.has(record.threadId) || this.coordinatorPreparations.has(record.threadId)
|
|
3510
|
+
|| this.settingsAdmission.isBlocked(record.threadId) || this.settingsAdmission.hasCommand(record.threadId)
|
|
3511
|
+
|| this.hasThreadQueueState(record.threadId) || this.delegation.hasActiveTasks(record.threadId))
|
|
3512
|
+
return false;
|
|
3513
|
+
this.scheduleOwners.set(record.threadId, { threadId: record.threadId, openId: record.openId, generation: record.generation });
|
|
3514
|
+
return true;
|
|
3515
|
+
}
|
|
3516
|
+
catch {
|
|
3517
|
+
return false;
|
|
3518
|
+
}
|
|
3519
|
+
},
|
|
3520
|
+
provider: { recoveryFor: input => {
|
|
3521
|
+
if (!input.threadId || this.threadPool.getBackendKey(input.threadId) !== input.backend)
|
|
3522
|
+
return undefined;
|
|
3523
|
+
// Capability lookup never starts native work. Native adapters opt in only
|
|
3524
|
+
// when they implement inventory reconciliation and original-session ownership.
|
|
3525
|
+
const executor = this.threadPool.getExecutor(input.threadId);
|
|
3526
|
+
const capability = executor.nativeScheduleRecovery;
|
|
3527
|
+
if (!capability)
|
|
3528
|
+
return undefined;
|
|
3529
|
+
return { ...capability, reconcile: async (record, context, emit) => {
|
|
3530
|
+
if (!context.isCurrent())
|
|
3531
|
+
throw new Error('Schedule recovery context changed.');
|
|
3532
|
+
if (executor.configureManagedTools) {
|
|
3533
|
+
const bridge = this.delegationBridges.get(record.threadId) ?? new DelegationBridge_1.DelegationBridge();
|
|
3534
|
+
this.delegationBridges.set(record.threadId, bridge);
|
|
3535
|
+
const thread = this.threadManager.getThread(record.threadId);
|
|
3536
|
+
const connection = await bridge.start((0, DelegationSettings_1.isDelegationEnabled)(thread) ? ['delegation', 'scheduling'] : ['scheduling']);
|
|
3537
|
+
if (!context.isCurrent())
|
|
3538
|
+
throw new Error('Schedule recovery context changed.');
|
|
3539
|
+
await executor.configureManagedTools(connection);
|
|
3540
|
+
}
|
|
3541
|
+
if (!context.isCurrent())
|
|
3542
|
+
throw new Error('Schedule recovery context changed.');
|
|
3543
|
+
return capability.reconcile(record, context, event => {
|
|
3544
|
+
emit(event);
|
|
3545
|
+
if (event.type === 'completed')
|
|
3546
|
+
queueMicrotask(() => { void this.startNextQueuedCommand(record.threadId); });
|
|
3547
|
+
});
|
|
3548
|
+
} };
|
|
3549
|
+
}, create: (input, onEvent) => {
|
|
3365
3550
|
const backend = input.backend === undefined ? 'claude' : input.backend;
|
|
3366
3551
|
(0, ScheduleCapabilities_1.assertNativeScheduleBackend)(backend);
|
|
3367
3552
|
if (!input.threadId)
|
|
@@ -3468,9 +3653,14 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3468
3653
|
return false;
|
|
3469
3654
|
}
|
|
3470
3655
|
};
|
|
3471
|
-
const check = () => { if (!current() || this.automaticUpdateInProgress)
|
|
3472
|
-
throw new Error('Scheduling context changed or client is shutting down/updating.'); };
|
|
3656
|
+
const check = () => { if (!current() || this.automaticUpdateInProgress || this.scheduleRecoveryThreads.has(owner.threadId))
|
|
3657
|
+
throw new Error('Scheduling context changed or client is shutting down/updating/recovering.'); };
|
|
3473
3658
|
check();
|
|
3659
|
+
if (command.kind === 'list' && this.threadPool.getExistingExecutor(owner.threadId)?.hasPendingCancellation?.()) {
|
|
3660
|
+
const service = await this.initializeSchedules();
|
|
3661
|
+
check();
|
|
3662
|
+
return service.list(owner); // Catalog-only recovery visibility; never acquire native management admission.
|
|
3663
|
+
}
|
|
3474
3664
|
if (!nativeBound && this.scheduleManagement.has(owner.threadId))
|
|
3475
3665
|
throw new Error('A schedule operation is already in progress for this thread.');
|
|
3476
3666
|
this.scheduleManagement.add(owner.threadId);
|
|
@@ -3500,7 +3690,31 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3500
3690
|
await executor.configureManagedTools(connection);
|
|
3501
3691
|
check();
|
|
3502
3692
|
}
|
|
3503
|
-
|
|
3693
|
+
const records = await executor.withNativeScheduleOperation(id, current, () => this.runScheduleOperation(owner, command, id, context, true), !!context);
|
|
3694
|
+
if (command.kind === 'create' && !current()) {
|
|
3695
|
+
const cleanupCurrent = () => {
|
|
3696
|
+
try {
|
|
3697
|
+
return !this.isDestroyed && this.scheduleGeneration(owner.threadId) === owner.generation
|
|
3698
|
+
&& this.threadPool.getExistingExecutor(owner.threadId) === executor;
|
|
3699
|
+
}
|
|
3700
|
+
catch {
|
|
3701
|
+
return false;
|
|
3702
|
+
}
|
|
3703
|
+
};
|
|
3704
|
+
const service = await this.initializeSchedules();
|
|
3705
|
+
try {
|
|
3706
|
+
if (!executor.reconcileNativeSchedule) {
|
|
3707
|
+
throw new Error(`Schedule ${id} requires explicit cancellation; native cleanup admission is unavailable.`);
|
|
3708
|
+
}
|
|
3709
|
+
await executor.reconcileNativeSchedule(id, cleanupCurrent, () => service.cancel(owner, id));
|
|
3710
|
+
}
|
|
3711
|
+
catch (error) {
|
|
3712
|
+
await service.retainCleanupError(owner, id, error);
|
|
3713
|
+
throw error;
|
|
3714
|
+
}
|
|
3715
|
+
throw new Error('Scheduling context retired during creation. Inspect /schedule list for the final task state.');
|
|
3716
|
+
}
|
|
3717
|
+
return records;
|
|
3504
3718
|
}
|
|
3505
3719
|
const service = await this.initializeSchedules();
|
|
3506
3720
|
check();
|
|
@@ -3540,7 +3754,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3540
3754
|
command: config[backend]?.command,
|
|
3541
3755
|
model: context ? context.model : thread.models?.[backend] ?? (backend === 'claude' ? thread.model || undefined : config.dsh?.model),
|
|
3542
3756
|
effort: context ? context.effort : thread.efforts?.[backend] });
|
|
3543
|
-
if (!current()) {
|
|
3757
|
+
if (!current() && !nativeBound) {
|
|
3544
3758
|
await service.cancel(owner, record.id);
|
|
3545
3759
|
throw new Error('Scheduling context retired during creation; the native task was cancelled.');
|
|
3546
3760
|
}
|
|
@@ -3585,7 +3799,10 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3585
3799
|
throw new Error('Use /cd first and include a self-contained text prompt. Schedule commands do not accept attachments or directory overrides.');
|
|
3586
3800
|
}
|
|
3587
3801
|
const owner = { threadId, openId: message.openId, generation: this.scheduleGeneration(threadId) };
|
|
3588
|
-
const
|
|
3802
|
+
const storedOnly = command.kind === 'list' && this.threadPool.getExistingExecutor(threadId)?.hasPendingCancellation?.();
|
|
3803
|
+
const updateSnapshot = this.automaticUpdateInProgress && command.kind === 'list';
|
|
3804
|
+
const records = updateSnapshot ? await this.schedules?.list(owner) ?? []
|
|
3805
|
+
: await this.runScheduleOperation(owner, command.kind === 'list' ? { kind: 'list' } : command);
|
|
3589
3806
|
const record = records[0];
|
|
3590
3807
|
let output;
|
|
3591
3808
|
if (command.kind === 'list')
|
|
@@ -3593,12 +3810,18 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3593
3810
|
else if (command.kind === 'cancel')
|
|
3594
3811
|
output = `Schedule ${record.id}: ${record.state}.`;
|
|
3595
3812
|
else {
|
|
3596
|
-
const lifecycle = record.
|
|
3597
|
-
?
|
|
3598
|
-
|
|
3813
|
+
const lifecycle = record.recovery
|
|
3814
|
+
? `Managed jobs recover automatically after a confirmed orderly restart. Dirty shutdowns remain blocked. ${record.recovery.handoffPolicy === 'skip-unadmitted'
|
|
3815
|
+
? 'Fired occurrences not yet admitted to execution may be skipped without replay; admitted work must finish.'
|
|
3816
|
+
: 'Queued and executing occurrences must finish before handoff.'}`
|
|
3817
|
+
: 'This host does not support automatic schedule recovery after process exit.';
|
|
3599
3818
|
output = `Schedule ${record.id}: ${record.state}.\n${record.rule.kind === 'once' ? record.rule.at : `${record.rule.expression} (${record.rule.timezone})`}\n\nRuns in this thread's foreground ${ScheduleCapabilities_1.NATIVE_SCHEDULE_CAPABILITIES[record.backend].label} conversation and returns results here. Keep the CLI running; native timing is approximate. ${lifecycle}\nUse /schedule list or /schedule cancel ${record.id}.`;
|
|
3600
3819
|
}
|
|
3601
|
-
|
|
3820
|
+
if (storedOnly)
|
|
3821
|
+
output = `Native cancellation cleanup is pending. This is the stored catalog, not a fresh native inventory. Retry /abort; /clear stops the host and loses session-only schedules.\n\n${output}`;
|
|
3822
|
+
if (updateSnapshot)
|
|
3823
|
+
output = `Automatic update handoff: stored catalog only, not fresh native inventory. Unconfirmed work remains fenced; inspect the CLI diagnostic before an explicit service stop/restart.\n\n${output}`;
|
|
3824
|
+
respond({ success: true, scheduleMenu: updateSnapshot ? undefined : menuFor(owner, records), output });
|
|
3602
3825
|
}
|
|
3603
3826
|
catch (error) {
|
|
3604
3827
|
respond({ success: false, error: error instanceof Error ? error.message : 'Schedule operation failed.' });
|
|
@@ -3635,8 +3858,8 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3635
3858
|
followsGlobal: !thread.backend, configuredModels, configuredEfforts: { ...thread.efforts }, delegationEnabled: (0, DelegationSettings_1.isDelegationEnabled)(thread),
|
|
3636
3859
|
revision: (0, crypto_1.createHash)('sha256').update(JSON.stringify({ thread: projection(thread), all, config: this.executorConfiguration() })).digest('hex') };
|
|
3637
3860
|
}
|
|
3638
|
-
settingsBusy(threadId, exceptRequest, includeQueue = true) {
|
|
3639
|
-
return this.isDestroyed || this.automaticUpdateInProgress || this.threadPool.isThreadBusy(threadId)
|
|
3861
|
+
settingsBusy(threadId, exceptRequest, includeQueue = true, setting) {
|
|
3862
|
+
return this.isDestroyed || this.automaticUpdateInProgress || this.scheduleRecoveryThreads.has(threadId) || (setting === 'model' ? this.threadPool.isThreadBusy(threadId, 'model') : this.threadPool.isThreadBusy(threadId))
|
|
3640
3863
|
|| this.delegation.hasActiveTasks(threadId) || this.abortOperations.has(threadId)
|
|
3641
3864
|
|| this.coordinatorPreparations.has(threadId) || this.settingsAdmission.hasCommand(threadId, exceptRequest) || (includeQueue && this.hasThreadQueueState(threadId));
|
|
3642
3865
|
}
|
|
@@ -3919,6 +4142,12 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3919
4142
|
* Destroy handler and all executors
|
|
3920
4143
|
*/
|
|
3921
4144
|
async destroy() {
|
|
4145
|
+
// Fence new commands first, but keep result acknowledgements alive while a
|
|
4146
|
+
// waiting schedule races the orderly drain. No foreground work is killed here.
|
|
4147
|
+
if (!this.isDestroyed && this.schedules?.hasActiveSchedules() && this.schedules.canSuspendForRestart()) {
|
|
4148
|
+
this.automaticUpdateInProgress = true;
|
|
4149
|
+
await this.schedules.suspendForRestart();
|
|
4150
|
+
}
|
|
3922
4151
|
this.directoryBrowser.destroy();
|
|
3923
4152
|
this.settingsService.destroy();
|
|
3924
4153
|
this.scheduleCards.destroy();
|
|
@@ -3937,6 +4166,9 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3937
4166
|
await this.outputFiles?.destroy();
|
|
3938
4167
|
this.notificationAdapter.unregister();
|
|
3939
4168
|
try {
|
|
4169
|
+
// Native recovery handoff must finish before executor destruction can stop
|
|
4170
|
+
// its original host. An uncertain handoff keeps that host owned for retry.
|
|
4171
|
+
await this.scheduleInitialization?.then(service => service.requiresShutdownHandoff() ? service.destroy() : undefined, () => undefined);
|
|
3940
4172
|
const results = await Promise.allSettled([
|
|
3941
4173
|
this.scheduleInitialization?.then(service => service.destroy(), () => undefined),
|
|
3942
4174
|
this.delegation.destroy(),
|