@yu_robotics/remote-cli 1.6.255 → 1.6.261
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 +5 -12
- package/dist/client/MessageHandler.d.ts.map +1 -1
- package/dist/client/MessageHandler.js +53 -252
- package/dist/client/MessageHandler.js.map +1 -1
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +0 -3
- package/dist/commands/start.js.map +1 -1
- package/dist/delegation/DelegatedWorkerLaneCleanup.d.ts.map +1 -1
- package/dist/delegation/DelegatedWorkerLaneCleanup.js +10 -1
- package/dist/delegation/DelegatedWorkerLaneCleanup.js.map +1 -1
- package/dist/delegation/DelegationManager.d.ts +1 -1
- package/dist/delegation/DelegationManager.js +2 -2
- package/dist/delegation/DelegationManager.js.map +1 -1
- package/dist/executor/AcpExecutor.d.ts.map +1 -1
- package/dist/executor/AcpExecutor.js.map +1 -1
- package/dist/executor/AgyExecutor.d.ts +48 -168
- package/dist/executor/AgyExecutor.d.ts.map +1 -1
- package/dist/executor/AgyExecutor.js +377 -1082
- package/dist/executor/AgyExecutor.js.map +1 -1
- package/dist/executor/ClaudePersistentExecutor.d.ts +3 -7
- package/dist/executor/ClaudePersistentExecutor.d.ts.map +1 -1
- package/dist/executor/ClaudePersistentExecutor.js +14 -224
- package/dist/executor/ClaudePersistentExecutor.js.map +1 -1
- package/dist/executor/DshExecutor.d.ts +7 -14
- package/dist/executor/DshExecutor.d.ts.map +1 -1
- package/dist/executor/DshExecutor.js +48 -50
- package/dist/executor/DshExecutor.js.map +1 -1
- package/dist/executor/IExecutor.d.ts +2 -2
- package/dist/executor/IExecutor.d.ts.map +1 -1
- package/dist/executor/acp/AcpClient.d.ts +15 -1
- package/dist/executor/acp/AcpClient.d.ts.map +1 -1
- package/dist/executor/acp/AcpClient.js +85 -7
- package/dist/executor/acp/AcpClient.js.map +1 -1
- package/dist/executor/agy/AgyAcpDiagnostics.d.ts +8 -0
- package/dist/executor/agy/AgyAcpDiagnostics.d.ts.map +1 -0
- package/dist/executor/agy/AgyAcpDiagnostics.js +47 -0
- package/dist/executor/agy/AgyAcpDiagnostics.js.map +1 -0
- package/dist/executor/agy/AgyAcpRuntime.d.ts +39 -24
- package/dist/executor/agy/AgyAcpRuntime.d.ts.map +1 -1
- package/dist/executor/agy/AgyAcpRuntime.js +234 -202
- package/dist/executor/agy/AgyAcpRuntime.js.map +1 -1
- package/dist/executor/agy/AgyChatHost.d.ts +34 -0
- package/dist/executor/agy/AgyChatHost.d.ts.map +1 -0
- package/dist/executor/agy/AgyChatHost.js +106 -0
- package/dist/executor/agy/AgyChatHost.js.map +1 -0
- package/dist/executor/agy/AgyPermissions.d.ts +13 -0
- package/dist/executor/agy/AgyPermissions.d.ts.map +1 -0
- package/dist/executor/agy/AgyPermissions.js +61 -0
- package/dist/executor/agy/AgyPermissions.js.map +1 -0
- package/dist/executor/agy/AgySessionSelection.d.ts +8 -0
- package/dist/executor/agy/AgySessionSelection.d.ts.map +1 -0
- package/dist/executor/agy/AgySessionSelection.js +86 -0
- package/dist/executor/agy/AgySessionSelection.js.map +1 -0
- package/dist/executor/agy/AgySessionSettings.d.ts +14 -0
- package/dist/executor/agy/AgySessionSettings.d.ts.map +1 -0
- package/dist/executor/agy/AgySessionSettings.js +73 -0
- package/dist/executor/agy/AgySessionSettings.js.map +1 -0
- package/dist/executor/dsh/DshAcpClient.d.ts +1 -1
- package/dist/executor/dsh/DshAcpClient.d.ts.map +1 -1
- package/dist/executor/dsh/DshAcpClient.js +3 -1
- package/dist/executor/dsh/DshAcpClient.js.map +1 -1
- package/dist/executor/index.d.ts +2 -1
- package/dist/executor/index.d.ts.map +1 -1
- package/dist/executor/index.js +3 -3
- package/dist/executor/index.js.map +1 -1
- package/dist/maintenance/release-notes.json +1 -1
- package/dist/scheduling/ScheduleCapabilities.d.ts +2 -2
- package/dist/scheduling/ScheduleCapabilities.js +4 -4
- package/dist/scheduling/ScheduleCapabilities.js.map +1 -1
- package/dist/scheduling/SchedulePurgeVerification.js +1 -1
- package/dist/scheduling/SchedulePurgeVerification.js.map +1 -1
- package/dist/scheduling/ScheduleService.d.ts +10 -29
- package/dist/scheduling/ScheduleService.d.ts.map +1 -1
- package/dist/scheduling/ScheduleService.js +160 -627
- package/dist/scheduling/ScheduleService.js.map +1 -1
- package/dist/scheduling/agy/AgyHookOwnership.d.ts +13 -0
- package/dist/scheduling/agy/AgyHookOwnership.d.ts.map +1 -0
- package/dist/scheduling/agy/AgyHookOwnership.js +449 -0
- package/dist/scheduling/agy/AgyHookOwnership.js.map +1 -0
- package/dist/scheduling/agy/AgyHookRelay.d.ts +3 -4
- package/dist/scheduling/agy/AgyHookRelay.d.ts.map +1 -1
- package/dist/scheduling/agy/AgyHookRelay.js +14 -98
- package/dist/scheduling/agy/AgyHookRelay.js.map +1 -1
- package/dist/scheduling/agy/AgySessionSchedules.d.ts +5 -5
- package/dist/scheduling/agy/AgySessionSchedules.d.ts.map +1 -1
- package/dist/scheduling/agy/AgySessionSchedules.js +20 -17
- package/dist/scheduling/agy/AgySessionSchedules.js.map +1 -1
- package/dist/scheduling/claude/ClaudeScheduleOwnership.d.ts +2 -6
- package/dist/scheduling/claude/ClaudeScheduleOwnership.d.ts.map +1 -1
- package/dist/scheduling/claude/ClaudeScheduleOwnership.js +12 -67
- package/dist/scheduling/claude/ClaudeScheduleOwnership.js.map +1 -1
- package/dist/scheduling/claude/ClaudeSessionSchedules.d.ts +4 -26
- package/dist/scheduling/claude/ClaudeSessionSchedules.d.ts.map +1 -1
- package/dist/scheduling/claude/ClaudeSessionSchedules.js +22 -145
- package/dist/scheduling/claude/ClaudeSessionSchedules.js.map +1 -1
- package/dist/scheduling/dsh/ScheduledSessionGuard.d.ts +12 -0
- package/dist/scheduling/dsh/ScheduledSessionGuard.d.ts.map +1 -0
- package/dist/scheduling/dsh/ScheduledSessionGuard.js +96 -0
- package/dist/scheduling/dsh/ScheduledSessionGuard.js.map +1 -0
- package/dist/scheduling/dsh/SessionScheduleBridge.d.ts.map +1 -1
- package/dist/scheduling/dsh/SessionScheduleBridge.js +0 -25
- 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 +0 -8
- package/dist/scheduling/dsh/SessionScheduleClient.js.map +1 -1
- package/dist/scheduling/dsh/sessionLaunch.js +1 -1
- package/dist/scheduling/dsh/sessionLaunch.js.map +1 -1
- package/dist/scheduling/types.d.ts +26 -77
- package/dist/scheduling/types.d.ts.map +1 -1
- package/dist/scheduling/types.js +1 -10
- package/dist/scheduling/types.js.map +1 -1
- package/dist/service/ServiceManager.js +1 -1
- package/dist/thread/ThreadExecutorPool.d.ts +4 -1
- package/dist/thread/ThreadExecutorPool.d.ts.map +1 -1
- package/dist/thread/ThreadExecutorPool.js +6 -3
- package/dist/thread/ThreadExecutorPool.js.map +1 -1
- package/dist/thread/ThreadManager.d.ts.map +1 -1
- package/dist/thread/ThreadManager.js +23 -2
- package/dist/thread/ThreadManager.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
- package/dist/executor/agy/AgyDelegationConfig.d.ts +0 -3
- package/dist/executor/agy/AgyDelegationConfig.d.ts.map +0 -1
- package/dist/executor/agy/AgyDelegationConfig.js +0 -105
- package/dist/executor/agy/AgyDelegationConfig.js.map +0 -1
- package/dist/scheduling/agy/AgyCheckpoint.d.ts +0 -35
- package/dist/scheduling/agy/AgyCheckpoint.d.ts.map +0 -1
- package/dist/scheduling/agy/AgyCheckpoint.js +0 -160
- package/dist/scheduling/agy/AgyCheckpoint.js.map +0 -1
|
@@ -39,9 +39,6 @@ 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;
|
|
44
|
-
private automaticUpdateRecovering;
|
|
45
42
|
private approvalCardsSupported;
|
|
46
43
|
private streamingContextSupported;
|
|
47
44
|
private delegationProgressSupported;
|
|
@@ -75,8 +72,7 @@ export declare class MessageHandler {
|
|
|
75
72
|
private readonly scheduleCards;
|
|
76
73
|
private schedules?;
|
|
77
74
|
private scheduleInitialization?;
|
|
78
|
-
private
|
|
79
|
-
private scheduleRecoveryThreads;
|
|
75
|
+
private scheduleCatalogPending;
|
|
80
76
|
private scheduleDelivery?;
|
|
81
77
|
private readonly reviewedNativeCleanup;
|
|
82
78
|
private readonly schedulePurgeHosts;
|
|
@@ -88,12 +84,9 @@ export declare class MessageHandler {
|
|
|
88
84
|
* Handle message (supports new IncomingMessage format)
|
|
89
85
|
*/
|
|
90
86
|
handleMessage(message: Message | IncomingMessage): Promise<void>;
|
|
91
|
-
private scheduleContextFenced;
|
|
92
|
-
private releaseSettledUpdateFences;
|
|
93
87
|
tryBeginAutomaticUpdate(): boolean;
|
|
94
88
|
prepareAutomaticUpdate(): Promise<void>;
|
|
95
|
-
endAutomaticUpdate(
|
|
96
|
-
private restoreAfterAutomaticUpdate;
|
|
89
|
+
endAutomaticUpdate(_failed?: boolean): Promise<void>;
|
|
97
90
|
/**
|
|
98
91
|
* Handle command message — route to the correct thread executor.
|
|
99
92
|
*/
|
|
@@ -228,10 +221,10 @@ export declare class MessageHandler {
|
|
|
228
221
|
private executorConfiguration;
|
|
229
222
|
private scheduleGeneration;
|
|
230
223
|
private scheduleDirectory;
|
|
231
|
-
/** Fence the updater before connection/version callbacks can race catalog
|
|
224
|
+
/** Fence the updater before connection/version callbacks can race catalog loading. */
|
|
232
225
|
prepareScheduleStartup(): Promise<void>;
|
|
233
|
-
/**
|
|
234
|
-
private
|
|
226
|
+
/** Catalog loading waits for transport readiness and never creates an absent catalog. */
|
|
227
|
+
private loadScheduleCatalog;
|
|
235
228
|
private initializeSchedules;
|
|
236
229
|
private activeSchedules;
|
|
237
230
|
private assertScheduleCleanupContext;
|
|
@@ -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,CA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,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;CAkC/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.isDestroyed || this.automaticUpdateInProgress
|
|
172
172
|
|| this.delegation.hasActiveTasks(threadId) || this.settingsAdmission.hasCommand(threadId),
|
|
173
173
|
setBusy: (threadId, busy) => {
|
|
174
174
|
if (busy) {
|
|
@@ -194,11 +194,6 @@ 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;
|
|
201
|
-
automaticUpdateRecovering = false;
|
|
202
197
|
approvalCardsSupported = false;
|
|
203
198
|
streamingContextSupported = false;
|
|
204
199
|
delegationProgressSupported = false;
|
|
@@ -232,8 +227,7 @@ class MessageHandler {
|
|
|
232
227
|
scheduleCards;
|
|
233
228
|
schedules;
|
|
234
229
|
scheduleInitialization;
|
|
235
|
-
|
|
236
|
-
scheduleRecoveryThreads = new Set();
|
|
230
|
+
scheduleCatalogPending = false;
|
|
237
231
|
scheduleDelivery;
|
|
238
232
|
reviewedNativeCleanup = new ReviewedNativeCleanup_1.ReviewedNativeCleanup();
|
|
239
233
|
schedulePurgeHosts = new Map();
|
|
@@ -261,7 +255,7 @@ class MessageHandler {
|
|
|
261
255
|
cancel: (owner, id) => this.schedules.cancel(owner, id),
|
|
262
256
|
exclusive: async (owner, body) => {
|
|
263
257
|
if (!this.schedules || this.isDestroyed || this.automaticUpdateInProgress
|
|
264
|
-
|| this.
|
|
258
|
+
|| this.scheduleManagement.has(owner.threadId))
|
|
265
259
|
throw new Error('Schedule controls are busy.');
|
|
266
260
|
this.scheduleManagement.add(owner.threadId);
|
|
267
261
|
try {
|
|
@@ -460,13 +454,11 @@ class MessageHandler {
|
|
|
460
454
|
this.scheduleResultsSupported = data.capabilities?.scheduleResultsV1 === true;
|
|
461
455
|
this.scheduleCardsSupported = this.scheduleResultsSupported && data.capabilities?.scheduleCardsV1 === true;
|
|
462
456
|
this.scheduleToolCardsSupported = this.scheduleCardsSupported && data.capabilities?.scheduleToolCardsV1 === true;
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
});
|
|
469
|
-
}
|
|
457
|
+
void this.loadScheduleCatalog().catch(() => {
|
|
458
|
+
if (this.isDestroyed)
|
|
459
|
+
return;
|
|
460
|
+
console.warn('[Schedules] Local schedule catalog is unavailable. Use /schedule list for details.');
|
|
461
|
+
});
|
|
470
462
|
if (data.capabilities?.outputFilesV1 === true) {
|
|
471
463
|
try {
|
|
472
464
|
if (!this.outputFiles) {
|
|
@@ -538,40 +530,14 @@ class MessageHandler {
|
|
|
538
530
|
});
|
|
539
531
|
}
|
|
540
532
|
}
|
|
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
|
-
}
|
|
563
533
|
tryBeginAutomaticUpdate() {
|
|
564
534
|
// Read-only readiness: never replay a release or a recovery just to retry an update.
|
|
565
|
-
this.releaseSettledUpdateFences();
|
|
566
535
|
this.removeExpiredQueueConfirmations();
|
|
567
536
|
const hasQueuedCommands = Array.from(this.threadQueues.values()).some((queue) => queue.length > 0);
|
|
568
537
|
const hasRunningThread = this.threadPool.getSummaries().some((thread) => thread.status === 'running');
|
|
569
538
|
if (this.automaticUpdateInProgress
|
|
570
539
|
|| this.isDestroyed
|
|
571
|
-
|| this.
|
|
572
|
-
|| this.schedules?.hasUnresolvedHandoff() || this.schedules?.hasUnresolvedRecovery()
|
|
573
|
-
|| this.schedules?.hasPendingRecovery()
|
|
574
|
-
|| this.scheduleRecoveryPending
|
|
540
|
+
|| this.scheduleCatalogPending
|
|
575
541
|
|| this.wsClient.hasPendingTaskResults()
|
|
576
542
|
|| hasRunningThread
|
|
577
543
|
|| hasQueuedCommands
|
|
@@ -579,86 +545,25 @@ class MessageHandler {
|
|
|
579
545
|
|| this.pendingReplaces.size > 0
|
|
580
546
|
|| this.activeThreadOperations.size > 0
|
|
581
547
|
|| this.abortOperations.size > 0
|
|
582
|
-
|| this.scheduleManagement.size > 0 || this.schedules
|
|
583
|
-
|| this.threadManager.listThreads().some(thread => this.settingsAdmission.isBlocked(thread.id)
|
|
548
|
+
|| this.scheduleManagement.size > 0 || this.schedules && !this.schedules.canRestartWithoutActiveWork()
|
|
549
|
+
|| this.threadManager.listThreads().some(thread => this.settingsAdmission.isBlocked(thread.id)
|
|
550
|
+
|| this.threadPool.getExistingExecutor(thread.id)?.hasPendingScheduleMutation?.()
|
|
551
|
+
|| this.threadPool.getExistingExecutor(thread.id)?.hasUncertainShutdown?.())) {
|
|
584
552
|
return false;
|
|
585
553
|
}
|
|
586
554
|
this.automaticUpdateInProgress = true;
|
|
587
|
-
this.automaticUpdateFailed = false;
|
|
588
555
|
return true;
|
|
589
556
|
}
|
|
590
557
|
async prepareAutomaticUpdate() {
|
|
591
558
|
if (!this.automaticUpdateInProgress || this.isDestroyed)
|
|
592
559
|
throw new Error('Automatic update admission expired.');
|
|
593
|
-
if (this.schedules
|
|
594
|
-
|
|
595
|
-
if (this.schedules.hasActiveSchedules(thread.id)) {
|
|
596
|
-
this.automaticUpdateScheduleThreads.set(thread.id, this.scheduleGeneration(thread.id));
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
await this.schedules.suspendForRestart();
|
|
600
|
-
}
|
|
560
|
+
if (this.schedules && !this.schedules.canRestartWithoutActiveWork())
|
|
561
|
+
throw new Error('Scheduled work or delivery is active.');
|
|
601
562
|
if (this.wsClient.hasPendingTaskResults())
|
|
602
563
|
throw new Error('Result delivery remains pending.');
|
|
603
564
|
}
|
|
604
|
-
async endAutomaticUpdate(
|
|
605
|
-
|
|
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() {
|
|
630
|
-
if (this.schedules?.hasUnresolvedHandoff())
|
|
631
|
-
throw new Error('Native restart handoff remains unresolved; affected thread admission is retained.');
|
|
632
|
-
if (!this.schedules?.hasPendingRecovery()) {
|
|
633
|
-
if (this.schedules?.hasUnresolvedRecovery())
|
|
634
|
-
throw new Error('Native recovery remains blocked; affected thread admission is retained.');
|
|
635
|
-
// Terminal-only handoffs still own the predecessor's local admission fence.
|
|
636
|
-
// No job needs recreation, but the shared recovery finalizer must release it.
|
|
637
|
-
if (this.schedules) {
|
|
638
|
-
this.automaticUpdateRecovering = true;
|
|
639
|
-
try {
|
|
640
|
-
await this.schedules.recover();
|
|
641
|
-
}
|
|
642
|
-
finally {
|
|
643
|
-
this.automaticUpdateRecovering = false;
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
return;
|
|
647
|
-
}
|
|
648
|
-
if (this.isDestroyed)
|
|
649
|
-
throw new Error('Shutdown already began; native schedules require startup recovery.');
|
|
650
|
-
// Only finalization authorizes restoration. Reconnect during installation must
|
|
651
|
-
// never restart native timing under the still-active installer.
|
|
652
|
-
this.automaticUpdateRecovering = true;
|
|
653
|
-
try {
|
|
654
|
-
await this.schedules.recover();
|
|
655
|
-
if (this.schedules.hasUnresolvedRecovery()) {
|
|
656
|
-
throw new Error('Native schedule restoration remains unresolved; affected thread admission is retained.');
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
finally {
|
|
660
|
-
this.automaticUpdateRecovering = false;
|
|
661
|
-
}
|
|
565
|
+
async endAutomaticUpdate(_failed = false) {
|
|
566
|
+
this.automaticUpdateInProgress = false;
|
|
662
567
|
}
|
|
663
568
|
/**
|
|
664
569
|
* Handle command message — route to the correct thread executor.
|
|
@@ -667,19 +572,13 @@ class MessageHandler {
|
|
|
667
572
|
const threadId = message.threadId ?? this.threadManager.getDefaultThread().id;
|
|
668
573
|
const content = message.content?.trim() ?? '';
|
|
669
574
|
this.messageOpenIds.set(message.messageId, message.openId);
|
|
670
|
-
if ((this.automaticUpdateInProgress
|
|
575
|
+
if ((this.automaticUpdateInProgress) && content === '/schedule list') {
|
|
671
576
|
this.messageOpenIds.set(message.messageId, message.openId);
|
|
672
577
|
await this.handleScheduleCommand(message, threadId);
|
|
673
578
|
return;
|
|
674
579
|
}
|
|
675
|
-
if (this.
|
|
676
|
-
|
|
677
|
-
this.sendResponse(message.messageId, threadId, { success: false,
|
|
678
|
-
error: 'Native schedule handoff or recovery is unresolved. Use /schedule list for stored status; conflicting operations remain fenced.' });
|
|
679
|
-
return;
|
|
680
|
-
}
|
|
681
|
-
if (this.scheduleRecoveryPending && /^\/(?:clear|new|backend|cd|thread\s+delete)(?:\s|$)/.test(content)) {
|
|
682
|
-
this.sendResponse(message.messageId, threadId, { success: false, error: 'Schedule catalog readiness is unresolved. Retry context changes after recovery or inspect /schedule list.' });
|
|
580
|
+
if (this.scheduleCatalogPending && /^\/(?:clear|new|backend|cd|thread\s+delete)(?:\s|$)/.test(content)) {
|
|
581
|
+
this.sendResponse(message.messageId, threadId, { success: false, error: 'Schedule catalog readiness is unresolved. Retry context changes after catalog loading or inspect /schedule list.' });
|
|
683
582
|
return;
|
|
684
583
|
}
|
|
685
584
|
const clearing = content === '/clear' || content === '/new';
|
|
@@ -704,7 +603,7 @@ class MessageHandler {
|
|
|
704
603
|
};
|
|
705
604
|
this.messageOpenIds.set(message.messageId, message.openId);
|
|
706
605
|
if ((0, SessionResumeService_1.isSessionControl)(content) && this.automaticUpdateInProgress) {
|
|
707
|
-
this.sendResponse(message.messageId, threadId, { success: false, error: 'Automatic update
|
|
606
|
+
this.sendResponse(message.messageId, threadId, { success: false, error: 'Automatic update is in progress. Retry after it finishes.' });
|
|
708
607
|
return;
|
|
709
608
|
}
|
|
710
609
|
if ((0, SessionResumeService_1.isSessionControl)(content)) {
|
|
@@ -800,11 +699,6 @@ class MessageHandler {
|
|
|
800
699
|
return;
|
|
801
700
|
}
|
|
802
701
|
const resolvedThreadId = thread.id;
|
|
803
|
-
if (this.scheduleContextFenced(resolvedThreadId)) {
|
|
804
|
-
this.sendResponse(messageId, resolvedThreadId, { success: false,
|
|
805
|
-
error: 'Native schedule handoff or recovery is unresolved for this thread. Use /schedule list for stored status.' });
|
|
806
|
-
return;
|
|
807
|
-
}
|
|
808
702
|
if (this.automaticUpdateInProgress) {
|
|
809
703
|
this.sendResponse(messageId, resolvedThreadId, {
|
|
810
704
|
success: false,
|
|
@@ -1284,8 +1178,6 @@ class MessageHandler {
|
|
|
1284
1178
|
const thread = this.threadManager.getThread(request.threadId);
|
|
1285
1179
|
if (!thread)
|
|
1286
1180
|
throw new Error('This Worker card has expired. Use the latest Worker card.');
|
|
1287
|
-
if (this.scheduleContextFenced(thread.id))
|
|
1288
|
-
throw new Error('Native schedule ownership remains unresolved for this thread.');
|
|
1289
1181
|
await this.delegation.resetWorkerContext(thread, request.laneId, request.generation);
|
|
1290
1182
|
}
|
|
1291
1183
|
catch (cause) {
|
|
@@ -1354,7 +1246,7 @@ class MessageHandler {
|
|
|
1354
1246
|
this.threadPool.setThreadBusy(threadId, false);
|
|
1355
1247
|
await workers;
|
|
1356
1248
|
this.sendResponse(messageId, threadId, { success: true,
|
|
1357
|
-
output: `${destructiveRecovery ? 'Explicit
|
|
1249
|
+
output: `${destructiveRecovery ? 'Explicit reset 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);
|
|
1358
1250
|
}
|
|
1359
1251
|
catch (error) {
|
|
1360
1252
|
const detail = error instanceof Error ? error.message : 'Local context storage is unavailable';
|
|
@@ -1882,7 +1774,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
1882
1774
|
async startNextQueuedCommand(threadId) {
|
|
1883
1775
|
if (this.settingsAdmission.isBlocked(threadId))
|
|
1884
1776
|
return;
|
|
1885
|
-
if (this.
|
|
1777
|
+
if (this.threadPool.isThreadBusy(threadId) || this.pausedQueues.has(threadId) || this.abortOperations.has(threadId))
|
|
1886
1778
|
return;
|
|
1887
1779
|
const queue = this.threadQueues.get(threadId);
|
|
1888
1780
|
const command = queue?.shift();
|
|
@@ -3508,26 +3400,30 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3508
3400
|
})).digest('hex');
|
|
3509
3401
|
return path_1.default.join(directory, 'schedules', namespace);
|
|
3510
3402
|
}
|
|
3511
|
-
/** Fence the updater before connection/version callbacks can race catalog
|
|
3403
|
+
/** Fence the updater before connection/version callbacks can race catalog loading. */
|
|
3512
3404
|
async prepareScheduleStartup() {
|
|
3405
|
+
this.threadPool.setScheduleCatalog?.(() => {
|
|
3406
|
+
const directory = this.scheduleDirectory();
|
|
3407
|
+
return directory ? path_1.default.join(directory, ScheduleService_1.SCHEDULE_CATALOG_FILE) : undefined;
|
|
3408
|
+
});
|
|
3513
3409
|
const directory = this.scheduleDirectory();
|
|
3514
3410
|
if (!directory)
|
|
3515
3411
|
return;
|
|
3516
|
-
this.
|
|
3412
|
+
this.scheduleCatalogPending = true;
|
|
3517
3413
|
try {
|
|
3518
3414
|
await fs_1.default.promises.lstat(path_1.default.join(directory, ScheduleService_1.SCHEDULE_CATALOG_FILE));
|
|
3519
3415
|
}
|
|
3520
3416
|
catch (error) {
|
|
3521
3417
|
if (['ENOENT', 'ENOTDIR'].includes(error.code ?? '')) {
|
|
3522
|
-
this.
|
|
3418
|
+
this.scheduleCatalogPending = false;
|
|
3523
3419
|
return;
|
|
3524
3420
|
}
|
|
3525
3421
|
throw error;
|
|
3526
3422
|
}
|
|
3527
3423
|
}
|
|
3528
|
-
/**
|
|
3529
|
-
async
|
|
3530
|
-
if (this.isDestroyed
|
|
3424
|
+
/** Catalog loading waits for transport readiness and never creates an absent catalog. */
|
|
3425
|
+
async loadScheduleCatalog() {
|
|
3426
|
+
if (this.isDestroyed)
|
|
3531
3427
|
return;
|
|
3532
3428
|
if (!this.scheduleInitialization) {
|
|
3533
3429
|
const directory = this.scheduleDirectory();
|
|
@@ -3544,26 +3440,15 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3544
3440
|
}
|
|
3545
3441
|
// A disconnect or shutdown can happen while storage is being checked. Never
|
|
3546
3442
|
// create a late service/subscription after shutdown has collected its work.
|
|
3547
|
-
if (this.isDestroyed
|
|
3548
|
-
return;
|
|
3549
|
-
if (this.automaticUpdateFailed && this.automaticUpdateScheduleThreads.size) {
|
|
3550
|
-
// Reconnect can retry durable delivery, but must not restart model-mediated
|
|
3551
|
-
// reconciliation after a failed update merely to reopen unrelated chat.
|
|
3552
|
-
await this.schedules?.retryDeliveries();
|
|
3443
|
+
if (this.isDestroyed)
|
|
3553
3444
|
return;
|
|
3554
|
-
|
|
3555
|
-
this.scheduleRecoveryPending = true;
|
|
3445
|
+
this.scheduleCatalogPending = true;
|
|
3556
3446
|
const service = await this.initializeSchedules();
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
return;
|
|
3562
|
-
}
|
|
3563
|
-
await service.recover();
|
|
3447
|
+
// Catalog safety is local and independent of Router delivery capabilities.
|
|
3448
|
+
// Keep a failed initialization fenced; an unreadable catalog is not absence.
|
|
3449
|
+
this.scheduleCatalogPending = false;
|
|
3450
|
+
if (!this.isDestroyed && this.scheduleResultsSupported)
|
|
3564
3451
|
await service.retryDeliveries();
|
|
3565
|
-
this.scheduleRecoveryPending = false;
|
|
3566
|
-
}
|
|
3567
3452
|
}
|
|
3568
3453
|
initializeSchedules() {
|
|
3569
3454
|
if (this.scheduleInitialization)
|
|
@@ -3578,67 +3463,10 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3578
3463
|
directory,
|
|
3579
3464
|
isNativeMutationPending: owner => this.threadPool.getExistingExecutor(owner.threadId)?.hasPendingScheduleMutation?.() ?? false,
|
|
3580
3465
|
withPurgeVerification: (record, context, accept) => (0, SchedulePurgeVerification_1.verifySchedulePurge)(record, this.schedulePurgeHosts.get(record.threadId), context.isCurrent, accept),
|
|
3581
|
-
|
|
3582
|
-
if (this.scheduleRecoveryThreads.has(record.threadId))
|
|
3583
|
-
throw new Error('Recovery thread admission unavailable.');
|
|
3584
|
-
this.scheduleRecoveryThreads.add(record.threadId);
|
|
3585
|
-
return () => { this.scheduleRecoveryThreads.delete(record.threadId); };
|
|
3586
|
-
},
|
|
3587
|
-
canRecover: record => {
|
|
3588
|
-
try {
|
|
3589
|
-
if (this.isDestroyed || this.automaticUpdateInProgress && !this.automaticUpdateRecovering || !this.scheduleResultsSupported || !this.wsClient.isConnected()
|
|
3590
|
-
|| this.scheduleGeneration(record.threadId) !== record.generation
|
|
3591
|
-
|| this.threadPool.getBackendKey(record.threadId) !== record.backend)
|
|
3592
|
-
return false;
|
|
3593
|
-
const thread = this.threadManager.getThread(record.threadId);
|
|
3594
|
-
const configuration = this.executorConfiguration();
|
|
3595
|
-
if (record.execution?.command !== configuration[record.backend]?.command)
|
|
3596
|
-
return false;
|
|
3597
|
-
const cwd = this.directoryGuard.resolveWorkingDirectory(thread.workingDirectory);
|
|
3598
|
-
(0, WorkingDirectory_1.assertWorkingDirectoryExists)(cwd);
|
|
3599
|
-
if (cwd !== record.cwd || this.threadPool.isThreadBusy(record.threadId) && !this.scheduleRecoveryThreads.has(record.threadId)
|
|
3600
|
-
|| this.activeThreadOperations.has(record.threadId) || this.scheduleManagement.has(record.threadId)
|
|
3601
|
-
|| this.abortOperations.has(record.threadId) || this.coordinatorPreparations.has(record.threadId)
|
|
3602
|
-
|| this.settingsAdmission.isBlocked(record.threadId) || this.settingsAdmission.hasCommand(record.threadId)
|
|
3603
|
-
|| this.hasThreadQueueState(record.threadId) || this.delegation.hasActiveTasks(record.threadId))
|
|
3604
|
-
return false;
|
|
3605
|
-
this.scheduleOwners.set(record.threadId, { threadId: record.threadId, openId: record.openId, generation: record.generation });
|
|
3606
|
-
return true;
|
|
3607
|
-
}
|
|
3608
|
-
catch {
|
|
3609
|
-
return false;
|
|
3610
|
-
}
|
|
3611
|
-
},
|
|
3612
|
-
provider: { recoveryFor: input => {
|
|
3466
|
+
provider: { cleanupFor: input => {
|
|
3613
3467
|
if (!input.threadId || this.threadPool.getBackendKey(input.threadId) !== input.backend)
|
|
3614
3468
|
return undefined;
|
|
3615
|
-
|
|
3616
|
-
// when they implement inventory reconciliation and original-session ownership.
|
|
3617
|
-
const executor = this.threadPool.getExecutor(input.threadId);
|
|
3618
|
-
const capability = executor.nativeScheduleRecovery;
|
|
3619
|
-
if (!capability)
|
|
3620
|
-
return undefined;
|
|
3621
|
-
return { ...capability, reconcile: async (record, context, emit) => {
|
|
3622
|
-
if (!context.isCurrent())
|
|
3623
|
-
throw new Error('Schedule recovery context changed.');
|
|
3624
|
-
if (executor.configureManagedTools) {
|
|
3625
|
-
const bridge = this.delegationBridges.get(record.threadId) ?? new DelegationBridge_1.DelegationBridge();
|
|
3626
|
-
this.delegationBridges.set(record.threadId, bridge);
|
|
3627
|
-
const thread = this.threadManager.getThread(record.threadId);
|
|
3628
|
-
const connection = await bridge.start((0, DelegationSettings_1.isDelegationEnabled)(thread) ? ['delegation', 'scheduling'] : ['scheduling']);
|
|
3629
|
-
if (!context.isCurrent())
|
|
3630
|
-
throw new Error('Schedule recovery context changed.');
|
|
3631
|
-
await executor.configureManagedTools(connection);
|
|
3632
|
-
}
|
|
3633
|
-
if (!context.isCurrent())
|
|
3634
|
-
throw new Error('Schedule recovery context changed.');
|
|
3635
|
-
return capability.reconcile(record, context, event => {
|
|
3636
|
-
const settled = emit(event);
|
|
3637
|
-
if (event.type === 'completed')
|
|
3638
|
-
queueMicrotask(() => { void this.startNextQueuedCommand(record.threadId); });
|
|
3639
|
-
return settled;
|
|
3640
|
-
});
|
|
3641
|
-
} };
|
|
3469
|
+
return this.threadPool.getExecutor(input.threadId).nativeScheduleCleanup;
|
|
3642
3470
|
}, create: (input, onEvent, canAdmitOccurrence) => {
|
|
3643
3471
|
const backend = input.backend === undefined ? 'claude' : input.backend;
|
|
3644
3472
|
let executor;
|
|
@@ -3733,8 +3561,6 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3733
3561
|
}
|
|
3734
3562
|
}
|
|
3735
3563
|
async assertSchedulesIdle(threadId, preserveCleanupContext = true) {
|
|
3736
|
-
if (this.scheduleContextFenced(threadId))
|
|
3737
|
-
throw new Error('Native schedule ownership remains unresolved for this thread.');
|
|
3738
3564
|
if (preserveCleanupContext)
|
|
3739
3565
|
await this.assertScheduleCleanupContext(threadId);
|
|
3740
3566
|
if (this.scheduleManagement.has(threadId) || this.schedules?.hasActiveSchedules(threadId)) {
|
|
@@ -3777,8 +3603,8 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3777
3603
|
return false;
|
|
3778
3604
|
}
|
|
3779
3605
|
};
|
|
3780
|
-
const check = () => { if (!current() || this.automaticUpdateInProgress
|
|
3781
|
-
throw new Error('Scheduling context changed or client is shutting down/updating
|
|
3606
|
+
const check = () => { if (!current() || this.automaticUpdateInProgress)
|
|
3607
|
+
throw new Error('Scheduling context changed or client is shutting down/updating.'); };
|
|
3782
3608
|
check();
|
|
3783
3609
|
if (command.kind === 'list' && this.threadPool.getExistingExecutor(owner.threadId)?.hasPendingCancellation?.()) {
|
|
3784
3610
|
const service = await this.initializeSchedules();
|
|
@@ -3907,8 +3733,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3907
3733
|
const current = () => {
|
|
3908
3734
|
try {
|
|
3909
3735
|
return !this.isDestroyed && !this.automaticUpdateInProgress && this.wsClient.isConnected()
|
|
3910
|
-
&& epoch === this.imageConnectionEpoch && this.scheduleGeneration(owner.threadId) === owner.generation
|
|
3911
|
-
&& !this.scheduleContextFenced(owner.threadId) && !this.abortOperations.has(owner.threadId)
|
|
3736
|
+
&& epoch === this.imageConnectionEpoch && this.scheduleGeneration(owner.threadId) === owner.generation && !this.abortOperations.has(owner.threadId)
|
|
3912
3737
|
&& this.threadPool.getBackendKey(owner.threadId) === backend
|
|
3913
3738
|
&& this.threadPool.getExistingExecutor(owner.threadId) === executor
|
|
3914
3739
|
&& capturedSettings === settings() && (!inTurnCurrent || inTurnCurrent());
|
|
@@ -3944,8 +3769,9 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3944
3769
|
const records = await service.list(owner);
|
|
3945
3770
|
const needsVerification = backend === 'claude' && !!executor.withReviewedNativeCleanup && (cleanup.some(item => ids.includes(item.id) && item.backend === 'claude' && !!item.attribution && !!item.nativeId) || records.some(record => ids.includes(record.id)
|
|
3946
3771
|
&& record.backend === 'claude' && !!record.recovery && !!record.nativeId && !record.cleanupConfirmed && !record.creationRefused && !['active', 'running', 'creating'].includes(record.state)));
|
|
3947
|
-
const needsNative = needsVerification ||
|
|
3948
|
-
&& record.backend ===
|
|
3772
|
+
const needsNative = needsVerification || ['claude', 'agy'].includes(backend) && records.some(record => ids.includes(record.id)
|
|
3773
|
+
&& record.backend === backend && (service.canCancel(owner, record.id)
|
|
3774
|
+
|| backend === 'agy' && service.needsNativePurge(owner, record.id)));
|
|
3949
3775
|
if (!needsNative)
|
|
3950
3776
|
return await run();
|
|
3951
3777
|
if (!executor.withNativeScheduleOperation)
|
|
@@ -3992,7 +3818,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3992
3818
|
const config = settings();
|
|
3993
3819
|
const current = () => {
|
|
3994
3820
|
try {
|
|
3995
|
-
return !this.isDestroyed && !this.automaticUpdateInProgress
|
|
3821
|
+
return !this.isDestroyed && !this.automaticUpdateInProgress
|
|
3996
3822
|
&& !this.abortOperations.has(threadId) && this.wsClient.isConnected() && epoch === this.imageConnectionEpoch
|
|
3997
3823
|
&& this.scheduleGeneration(threadId) === owner.generation && this.threadPool.getExistingExecutor(threadId) === executor
|
|
3998
3824
|
&& this.threadPool.getBackendKey(threadId) === 'claude' && config === settings() && (!inTurnCurrent || inTurnCurrent());
|
|
@@ -4118,7 +3944,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
4118
3944
|
return;
|
|
4119
3945
|
}
|
|
4120
3946
|
const storedOnly = command.kind === 'list' && this.threadPool.getExistingExecutor(threadId)?.hasPendingCancellation?.();
|
|
4121
|
-
const updateSnapshot = (this.automaticUpdateInProgress
|
|
3947
|
+
const updateSnapshot = (this.automaticUpdateInProgress) && command.kind === 'list';
|
|
4122
3948
|
const records = updateSnapshot ? await this.schedules?.list(owner) ?? []
|
|
4123
3949
|
: await this.runScheduleOperation(owner, command.kind === 'list' ? { kind: 'list' } : command);
|
|
4124
3950
|
const record = records[0];
|
|
@@ -4128,12 +3954,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
4128
3954
|
else if (command.kind === 'cancel')
|
|
4129
3955
|
output = `Schedule ${record.id}: ${record.state}.`;
|
|
4130
3956
|
else {
|
|
4131
|
-
const lifecycle =
|
|
4132
|
-
? record.backend === 'agy' ? 'AGY recovery requires exact host retirement before every possible first wake and no unknown queued work. Eligible future definitions recover in the original conversation; due work and dirty shutdowns remain blocked.'
|
|
4133
|
-
: `Managed jobs recover automatically after a confirmed orderly restart. Dirty shutdowns remain blocked. ${record.recovery.handoffPolicy === 'skip-unadmitted'
|
|
4134
|
-
? 'Fired occurrences not yet admitted to execution may be skipped without replay; admitted work must finish.'
|
|
4135
|
-
: 'Queued and executing occurrences must finish before handoff.'}`
|
|
4136
|
-
: 'This host does not support automatic schedule recovery after process exit.';
|
|
3957
|
+
const lifecycle = 'Schedules run only while their native host remains live. After host loss they are interrupted and never automatically restored. Native history and exact cleanup obligations are retained.';
|
|
4137
3958
|
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}.`;
|
|
4138
3959
|
}
|
|
4139
3960
|
if (command.kind === 'list') {
|
|
@@ -4146,7 +3967,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
4146
3967
|
if (storedOnly)
|
|
4147
3968
|
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}`;
|
|
4148
3969
|
if (updateSnapshot)
|
|
4149
|
-
output = `Automatic update
|
|
3970
|
+
output = `Automatic update: stored catalog only, not fresh native inventory. Unconfirmed work remains fenced; inspect the CLI diagnostic before an explicit service stop/restart.\n\n${output}`;
|
|
4150
3971
|
respond({ success: true, scheduleMenu: updateSnapshot ? undefined : menuFor(owner, records), output });
|
|
4151
3972
|
}
|
|
4152
3973
|
catch (error) {
|
|
@@ -4185,7 +4006,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
4185
4006
|
revision: (0, crypto_1.createHash)('sha256').update(JSON.stringify({ thread: projection(thread), all, config: this.executorConfiguration() })).digest('hex') };
|
|
4186
4007
|
}
|
|
4187
4008
|
settingsBusy(threadId, exceptRequest, includeQueue = true, setting) {
|
|
4188
|
-
return this.isDestroyed || this.automaticUpdateInProgress ||
|
|
4009
|
+
return this.isDestroyed || this.automaticUpdateInProgress || (setting === 'model' ? this.threadPool.isThreadBusy(threadId, 'model') : this.threadPool.isThreadBusy(threadId))
|
|
4189
4010
|
|| this.delegation.hasActiveTasks(threadId) || this.abortOperations.has(threadId)
|
|
4190
4011
|
|| this.coordinatorPreparations.has(threadId) || this.settingsAdmission.hasCommand(threadId, exceptRequest) || (includeQueue && this.hasThreadQueueState(threadId));
|
|
4191
4012
|
}
|
|
@@ -4310,8 +4131,6 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
4310
4131
|
async applyBackendSetting(threadId, backend, scope, followGlobal = false) {
|
|
4311
4132
|
try {
|
|
4312
4133
|
for (const thread of scope === 'all' ? this.threadManager.listThreads() : [{ id: threadId }]) {
|
|
4313
|
-
if (this.scheduleContextFenced(thread.id))
|
|
4314
|
-
throw new Error('Native schedule ownership remains unresolved for an affected thread.');
|
|
4315
4134
|
this.threadManager.contextResets.assertReady(thread.id);
|
|
4316
4135
|
}
|
|
4317
4136
|
if (followGlobal) {
|
|
@@ -4470,12 +4289,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
4470
4289
|
* Destroy handler and all executors
|
|
4471
4290
|
*/
|
|
4472
4291
|
async destroy() {
|
|
4473
|
-
|
|
4474
|
-
// waiting schedule races the orderly drain. No foreground work is killed here.
|
|
4475
|
-
if (!this.isDestroyed && this.schedules?.hasActiveSchedules() && this.schedules.canSuspendForRestart()) {
|
|
4476
|
-
this.automaticUpdateInProgress = true;
|
|
4477
|
-
await this.schedules.suspendForRestart();
|
|
4478
|
-
}
|
|
4292
|
+
this.isDestroyed = true;
|
|
4479
4293
|
this.directoryBrowser.destroy();
|
|
4480
4294
|
this.settingsService.destroy();
|
|
4481
4295
|
this.scheduleCards.destroy();
|
|
@@ -4494,19 +4308,6 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
4494
4308
|
await this.outputFiles?.destroy();
|
|
4495
4309
|
this.notificationAdapter.unregister();
|
|
4496
4310
|
try {
|
|
4497
|
-
// Native recovery handoff must finish before executor destruction can stop
|
|
4498
|
-
// its original host. An uncertain handoff keeps that host owned for retry.
|
|
4499
|
-
await this.scheduleInitialization?.then(service => service.requiresShutdownHandoff() ? service.destroy() : undefined, () => undefined);
|
|
4500
|
-
// Uncheckpointed AGY work has no queue-drain contract. Retire its exact owned
|
|
4501
|
-
// group before the catalog asks a handle to stop; never race a management
|
|
4502
|
-
// prompt against host teardown or mistake definition deletion for retirement.
|
|
4503
|
-
// Teardown uses stored backend summaries, not execution admission. A
|
|
4504
|
-
// corrupt reset generation must still block execution, but not host exit.
|
|
4505
|
-
for (const thread of this.threadPool.getSummaries()) {
|
|
4506
|
-
if (thread.backend === 'agy') {
|
|
4507
|
-
await this.threadPool.getExistingExecutor(thread.id)?.destroy();
|
|
4508
|
-
}
|
|
4509
|
-
}
|
|
4510
4311
|
const results = await Promise.allSettled([
|
|
4511
4312
|
this.scheduleInitialization?.then(service => service.destroy(), () => undefined),
|
|
4512
4313
|
this.delegation.destroy(),
|