@yu_robotics/remote-cli 1.6.243 → 1.6.247
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 +1 -0
- package/dist/client/MessageHandler.d.ts.map +1 -1
- package/dist/client/MessageHandler.js +86 -26
- package/dist/client/MessageHandler.js.map +1 -1
- package/dist/executor/AgyExecutor.d.ts +39 -2
- package/dist/executor/AgyExecutor.d.ts.map +1 -1
- package/dist/executor/AgyExecutor.js +383 -38
- package/dist/executor/AgyExecutor.js.map +1 -1
- package/dist/executor/ClaudePersistentExecutor.d.ts +1 -0
- package/dist/executor/ClaudePersistentExecutor.d.ts.map +1 -1
- package/dist/executor/ClaudePersistentExecutor.js +24 -15
- package/dist/executor/ClaudePersistentExecutor.js.map +1 -1
- package/dist/executor/DshExecutor.d.ts +1 -0
- package/dist/executor/DshExecutor.d.ts.map +1 -1
- package/dist/executor/IExecutor.d.ts +3 -1
- package/dist/executor/IExecutor.d.ts.map +1 -1
- package/dist/executor/acp/AcpClient.d.ts +5 -0
- package/dist/executor/acp/AcpClient.d.ts.map +1 -1
- package/dist/executor/acp/AcpClient.js +19 -1
- package/dist/executor/acp/AcpClient.js.map +1 -1
- package/dist/executor/agy/AgyAcpRuntime.d.ts +82 -0
- package/dist/executor/agy/AgyAcpRuntime.d.ts.map +1 -0
- package/dist/executor/agy/AgyAcpRuntime.js +390 -0
- package/dist/executor/agy/AgyAcpRuntime.js.map +1 -0
- package/dist/executor/index.d.ts.map +1 -1
- package/dist/executor/index.js +2 -1
- package/dist/executor/index.js.map +1 -1
- package/dist/maintenance/release-notes.json +1 -1
- package/dist/managed/tools.d.ts +4 -4
- package/dist/scheduling/ReviewedNativeCleanup.d.ts +2 -0
- package/dist/scheduling/ReviewedNativeCleanup.d.ts.map +1 -1
- package/dist/scheduling/ReviewedNativeCleanup.js.map +1 -1
- package/dist/scheduling/ScheduleCapabilities.d.ts +4 -4
- package/dist/scheduling/ScheduleCapabilities.d.ts.map +1 -1
- package/dist/scheduling/ScheduleCapabilities.js +6 -6
- package/dist/scheduling/ScheduleCapabilities.js.map +1 -1
- package/dist/scheduling/ScheduleCleanup.d.ts +31 -0
- package/dist/scheduling/ScheduleCleanup.d.ts.map +1 -0
- package/dist/scheduling/ScheduleCleanup.js +42 -0
- package/dist/scheduling/ScheduleCleanup.js.map +1 -0
- package/dist/scheduling/ScheduleCommand.d.ts +1 -0
- package/dist/scheduling/ScheduleCommand.d.ts.map +1 -1
- package/dist/scheduling/ScheduleCommand.js +9 -3
- package/dist/scheduling/ScheduleCommand.js.map +1 -1
- package/dist/scheduling/SchedulePurgeVerification.d.ts +2 -1
- package/dist/scheduling/SchedulePurgeVerification.d.ts.map +1 -1
- package/dist/scheduling/SchedulePurgeVerification.js +61 -5
- package/dist/scheduling/SchedulePurgeVerification.js.map +1 -1
- package/dist/scheduling/ScheduleService.d.ts +29 -4
- package/dist/scheduling/ScheduleService.d.ts.map +1 -1
- package/dist/scheduling/ScheduleService.js +305 -50
- package/dist/scheduling/ScheduleService.js.map +1 -1
- package/dist/scheduling/ScheduleToolScope.d.ts +12 -0
- package/dist/scheduling/ScheduleToolScope.d.ts.map +1 -1
- package/dist/scheduling/ScheduleToolScope.js +7 -2
- package/dist/scheduling/ScheduleToolScope.js.map +1 -1
- package/dist/scheduling/agy/AgyCheckpoint.d.ts +35 -0
- package/dist/scheduling/agy/AgyCheckpoint.d.ts.map +1 -0
- package/dist/scheduling/agy/AgyCheckpoint.js +160 -0
- package/dist/scheduling/agy/AgyCheckpoint.js.map +1 -0
- package/dist/scheduling/agy/AgyHookRelay.d.ts +33 -0
- package/dist/scheduling/agy/AgyHookRelay.d.ts.map +1 -0
- package/dist/scheduling/agy/AgyHookRelay.js +274 -0
- package/dist/scheduling/agy/AgyHookRelay.js.map +1 -0
- package/dist/scheduling/agy/AgyScheduleHost.d.ts +42 -0
- package/dist/scheduling/agy/AgyScheduleHost.d.ts.map +1 -0
- package/dist/scheduling/agy/AgyScheduleHost.js +121 -0
- package/dist/scheduling/agy/AgyScheduleHost.js.map +1 -0
- package/dist/scheduling/agy/AgySessionSchedules.d.ts +109 -0
- package/dist/scheduling/agy/AgySessionSchedules.d.ts.map +1 -0
- package/dist/scheduling/agy/AgySessionSchedules.js +476 -0
- package/dist/scheduling/agy/AgySessionSchedules.js.map +1 -0
- package/dist/scheduling/agy/hookClient.d.ts +4 -0
- package/dist/scheduling/agy/hookClient.d.ts.map +1 -0
- package/dist/scheduling/agy/hookClient.js +62 -0
- package/dist/scheduling/agy/hookClient.js.map +1 -0
- package/dist/scheduling/agy/transcript.d.ts +36 -0
- package/dist/scheduling/agy/transcript.d.ts.map +1 -0
- package/dist/scheduling/agy/transcript.js +108 -0
- package/dist/scheduling/agy/transcript.js.map +1 -0
- package/dist/scheduling/claude/ClaudeSessionSchedules.d.ts +1 -0
- package/dist/scheduling/claude/ClaudeSessionSchedules.d.ts.map +1 -1
- package/dist/scheduling/claude/ClaudeSessionSchedules.js +40 -21
- package/dist/scheduling/claude/ClaudeSessionSchedules.js.map +1 -1
- package/dist/scheduling/toolContract.d.ts +2 -2
- package/dist/scheduling/toolContract.js +2 -2
- package/dist/scheduling/toolContract.js.map +1 -1
- package/dist/scheduling/types.d.ts +10 -2
- package/dist/scheduling/types.d.ts.map +1 -1
- package/dist/scheduling/types.js.map +1 -1
- package/dist/thread/ThreadManager.d.ts.map +1 -1
- package/dist/thread/ThreadManager.js +33 -0
- package/dist/thread/ThreadManager.js.map +1 -1
- package/dist/types/ScheduleCards.d.ts +1 -1
- package/dist/types/ScheduleCards.d.ts.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
|
@@ -230,6 +230,7 @@ export declare class MessageHandler {
|
|
|
230
230
|
private recoverSchedules;
|
|
231
231
|
private initializeSchedules;
|
|
232
232
|
private activeSchedules;
|
|
233
|
+
private assertScheduleCleanupContext;
|
|
233
234
|
private assertSchedulesIdle;
|
|
234
235
|
private clearScheduleCardReceipts;
|
|
235
236
|
private deliverScheduleToolCard;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageHandler.d.ts","sourceRoot":"","sources":["../../src/client/MessageHandler.ts"],"names":[],"mappings":"
|
|
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,CA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Y;YAUN,cAAc;YAuBd,oBAAoB;IAgHlC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAoD/B"}
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.MessageHandler = void 0;
|
|
7
|
+
const ScheduleCleanup_1 = require("../scheduling/ScheduleCleanup");
|
|
7
8
|
const SchedulePurgeVerification_1 = require("../scheduling/SchedulePurgeVerification");
|
|
8
9
|
const ReviewedNativeCleanup_1 = require("../scheduling/ReviewedNativeCleanup");
|
|
9
10
|
const ScheduleToolScope_1 = require("../scheduling/ScheduleToolScope");
|
|
@@ -61,6 +62,7 @@ const ScheduleService_1 = require("../scheduling/ScheduleService");
|
|
|
61
62
|
const ScheduleDeliveryClient_1 = require("../scheduling/ScheduleDeliveryClient");
|
|
62
63
|
const ScheduleCommand_1 = require("../scheduling/ScheduleCommand");
|
|
63
64
|
const ScheduleCapabilities_1 = require("../scheduling/ScheduleCapabilities");
|
|
65
|
+
const types_2 = require("../scheduling/types");
|
|
64
66
|
const ClaudeSandbox_1 = require("../executor/claude/ClaudeSandbox");
|
|
65
67
|
const EFFORT_BACKENDS = new Set(['claude', 'codex', 'agy', 'opencode', 'kimi', 'zcode', 'pi', 'dsh']);
|
|
66
68
|
const SLASH_SESSION_BACKENDS = new Set(['opencode', 'kimi', 'zcode', 'pi']);
|
|
@@ -261,7 +263,7 @@ class MessageHandler {
|
|
|
261
263
|
this.scheduleManagement.add(owner.threadId);
|
|
262
264
|
try {
|
|
263
265
|
const executor = this.threadPool.getExecutor(owner.threadId);
|
|
264
|
-
if (this.threadPool.getBackendKey(owner.threadId)
|
|
266
|
+
if (!['claude', 'agy'].includes(this.threadPool.getBackendKey(owner.threadId)) || !executor.withNativeScheduleOperation
|
|
265
267
|
|| !this.schedules.hasActiveSchedules(owner.threadId))
|
|
266
268
|
return await body();
|
|
267
269
|
const epoch = this.imageConnectionEpoch;
|
|
@@ -1246,6 +1248,7 @@ class MessageHandler {
|
|
|
1246
1248
|
throw new Error('Direct backend abort is still pending; retry /clear after it settles.');
|
|
1247
1249
|
const existing = this.threadPool.getExistingExecutor(threadId);
|
|
1248
1250
|
const destructiveRecovery = existing?.hasPendingCancellation?.() === true || existing?.hasPendingSettingsChange?.() === true;
|
|
1251
|
+
await this.assertScheduleCleanupContext(threadId);
|
|
1249
1252
|
if (!destructiveRecovery)
|
|
1250
1253
|
await this.assertSchedulesIdle(threadId);
|
|
1251
1254
|
this.conversationRevisions.set(threadId, (this.conversationRevisions.get(threadId) ?? 0) + 1);
|
|
@@ -1391,7 +1394,7 @@ class MessageHandler {
|
|
|
1391
1394
|
}
|
|
1392
1395
|
if (trimmed === '/sandbox' || trimmed.startsWith('/sandbox ')) {
|
|
1393
1396
|
if (trimmed !== '/sandbox')
|
|
1394
|
-
await this.assertSchedulesIdle(threadId);
|
|
1397
|
+
await this.assertSchedulesIdle(threadId, false);
|
|
1395
1398
|
if (!('getSandboxStatus' in executor) || !('configureSandbox' in executor)) {
|
|
1396
1399
|
this.sendResponse(messageId, threadId, { success: false, error: '/sandbox is currently supported by the Codex and Claude Code backends.' });
|
|
1397
1400
|
return true;
|
|
@@ -2729,6 +2732,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
2729
2732
|
scheduleScope = this.scheduleToolOperations.scope({ owner, messageId, backend, current: context.current,
|
|
2730
2733
|
nativeAction: id => executor.nativeScheduleAction?.(id),
|
|
2731
2734
|
deleteCleanup: (command, id) => this.runReviewedNativeCleanup(owner, command, id, context.current),
|
|
2735
|
+
listCleanup: async () => (await (await this.initializeSchedules()).listCleanup(owner)).map(ScheduleCleanup_1.cleanupSummary),
|
|
2732
2736
|
purge: (selection, id) => this.runSchedulePurge(owner, selection, id, context.current),
|
|
2733
2737
|
reviewCleanup: id => this.runReviewedNativeCleanup(owner, { kind: 'cleanup-review' }, id, context.current),
|
|
2734
2738
|
run: (command, id) => this.runScheduleOperation(owner, command, id, context),
|
|
@@ -3505,6 +3509,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3505
3509
|
throw new Error('Local schedule storage is unavailable.');
|
|
3506
3510
|
const service = new ScheduleService_1.ScheduleService({
|
|
3507
3511
|
directory,
|
|
3512
|
+
isNativeMutationPending: owner => this.threadPool.getExistingExecutor(owner.threadId)?.hasPendingScheduleMutation?.() ?? false,
|
|
3508
3513
|
withPurgeVerification: (record, context, accept) => (0, SchedulePurgeVerification_1.verifySchedulePurge)(record, this.schedulePurgeHosts.get(record.threadId), context.isCurrent, accept),
|
|
3509
3514
|
acquireRecovery: record => {
|
|
3510
3515
|
if (this.scheduleRecoveryThreads.has(record.threadId))
|
|
@@ -3561,24 +3566,32 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3561
3566
|
if (!context.isCurrent())
|
|
3562
3567
|
throw new Error('Schedule recovery context changed.');
|
|
3563
3568
|
return capability.reconcile(record, context, event => {
|
|
3564
|
-
emit(event);
|
|
3569
|
+
const settled = emit(event);
|
|
3565
3570
|
if (event.type === 'completed')
|
|
3566
3571
|
queueMicrotask(() => { void this.startNextQueuedCommand(record.threadId); });
|
|
3572
|
+
return settled;
|
|
3567
3573
|
});
|
|
3568
3574
|
} };
|
|
3569
3575
|
}, create: (input, onEvent, canAdmitOccurrence) => {
|
|
3570
3576
|
const backend = input.backend === undefined ? 'claude' : input.backend;
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3577
|
+
let executor;
|
|
3578
|
+
let generation;
|
|
3579
|
+
try {
|
|
3580
|
+
(0, ScheduleCapabilities_1.assertNativeScheduleBackend)(backend);
|
|
3581
|
+
if (!input.threadId)
|
|
3582
|
+
throw new Error('Native scheduling requires the original thread.');
|
|
3583
|
+
if (this.threadPool.getBackendKey(input.threadId) !== backend)
|
|
3584
|
+
throw new Error('Foreground scheduling backend changed before native admission.');
|
|
3585
|
+
executor = this.threadPool.getExecutor(input.threadId);
|
|
3586
|
+
if (!executor.createNativeSchedule)
|
|
3587
|
+
throw new Error('The original executor does not support native session scheduling.');
|
|
3588
|
+
generation = this.scheduleGeneration(input.threadId);
|
|
3589
|
+
}
|
|
3590
|
+
catch (error) {
|
|
3591
|
+
throw new types_2.NativeScheduleNotAdmittedError(error instanceof Error ? error.message : 'Native schedule provider refused admission.');
|
|
3592
|
+
}
|
|
3580
3593
|
return executor.createNativeSchedule(input, event => {
|
|
3581
|
-
onEvent(event);
|
|
3594
|
+
const settled = onEvent(event);
|
|
3582
3595
|
// A foreground message confirmed into the thread queue while an
|
|
3583
3596
|
// autonomous native occurrence was running must be retried when
|
|
3584
3597
|
// that occurrence reaches a terminal state. The executor's own
|
|
@@ -3586,6 +3599,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3586
3599
|
if (event.type === 'completed' || (event.type === 'stopped' && event.exitConfirmed !== false)) {
|
|
3587
3600
|
queueMicrotask(() => { void this.startNextQueuedCommand(input.threadId); });
|
|
3588
3601
|
}
|
|
3602
|
+
return settled;
|
|
3589
3603
|
}, () => {
|
|
3590
3604
|
try {
|
|
3591
3605
|
return !this.isDestroyed && this.scheduleGeneration(input.threadId) === generation
|
|
@@ -3632,7 +3646,28 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3632
3646
|
this.scheduleOwners.delete(threadId);
|
|
3633
3647
|
return active;
|
|
3634
3648
|
}
|
|
3635
|
-
async
|
|
3649
|
+
async assertScheduleCleanupContext(threadId) {
|
|
3650
|
+
if (!this.schedules) {
|
|
3651
|
+
const directory = this.scheduleDirectory();
|
|
3652
|
+
if (!directory)
|
|
3653
|
+
return;
|
|
3654
|
+
try {
|
|
3655
|
+
await fs_1.default.promises.lstat(path_1.default.join(directory, ScheduleService_1.SCHEDULE_CATALOG_FILE));
|
|
3656
|
+
}
|
|
3657
|
+
catch (error) {
|
|
3658
|
+
if (['ENOENT', 'ENOTDIR'].includes(error.code ?? ''))
|
|
3659
|
+
return;
|
|
3660
|
+
throw error;
|
|
3661
|
+
}
|
|
3662
|
+
await this.initializeSchedules();
|
|
3663
|
+
}
|
|
3664
|
+
if (this.schedules?.hasCleanupContext(threadId)) {
|
|
3665
|
+
throw new Error('Unresolved native cleanup still needs this original session. Use /schedule list and purge or cleanup review/delete before resetting, changing directory or deleting this context.');
|
|
3666
|
+
}
|
|
3667
|
+
}
|
|
3668
|
+
async assertSchedulesIdle(threadId, preserveCleanupContext = true) {
|
|
3669
|
+
if (preserveCleanupContext)
|
|
3670
|
+
await this.assertScheduleCleanupContext(threadId);
|
|
3636
3671
|
if (this.scheduleManagement.has(threadId) || this.schedules?.hasActiveSchedules(threadId)) {
|
|
3637
3672
|
throw new Error('Cancel this thread\'s schedules with /schedule cancel <id> before resetting context, changing directory, or deleting the thread.');
|
|
3638
3673
|
}
|
|
@@ -3695,10 +3730,10 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3695
3730
|
throw new Error('This native scheduling adapter does not support restricted Claude sandboxes. No schedule was created and sandbox settings were not changed.');
|
|
3696
3731
|
}
|
|
3697
3732
|
}
|
|
3698
|
-
const nativeCancellation = !nativeBound && backend === 'claude' && command.kind === 'cancel'
|
|
3733
|
+
const nativeCancellation = !nativeBound && (backend === 'claude' || backend === 'agy') && command.kind === 'cancel'
|
|
3699
3734
|
&& (await this.initializeSchedules()).canCancel(owner, command.id);
|
|
3700
3735
|
check();
|
|
3701
|
-
if (!nativeBound && backend === 'claude' && (command.kind === 'create' || nativeCancellation
|
|
3736
|
+
if (!nativeBound && (backend === 'claude' || backend === 'agy') && (command.kind === 'create' || nativeCancellation
|
|
3702
3737
|
|| command.kind !== 'cancel' && this.schedules?.hasActiveSchedules(owner.threadId))) {
|
|
3703
3738
|
const executor = this.threadPool.getExecutor(owner.threadId);
|
|
3704
3739
|
if (!executor.withNativeScheduleOperation)
|
|
@@ -3776,7 +3811,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3776
3811
|
}
|
|
3777
3812
|
const record = await service.create(owner, { id, threadId: owner.threadId, backend, cwd, rule: command.rule, prompt: command.prompt,
|
|
3778
3813
|
command: config[backend]?.command,
|
|
3779
|
-
model: context ? context.model : thread.models?.[backend] ?? (backend === 'claude' ? thread.model || undefined : config
|
|
3814
|
+
model: context ? context.model : thread.models?.[backend] ?? (backend === 'claude' ? thread.model || undefined : config[backend]?.model),
|
|
3780
3815
|
effort: context ? context.effort : thread.efforts?.[backend] });
|
|
3781
3816
|
if (!current() && !nativeBound) {
|
|
3782
3817
|
await service.cancel(owner, record.id);
|
|
@@ -3824,18 +3859,22 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3824
3859
|
if (!current())
|
|
3825
3860
|
throw new Error('Schedule purge context changed.');
|
|
3826
3861
|
// Freeze all before native calls; retries of this operation must not select new tasks.
|
|
3827
|
-
const
|
|
3862
|
+
const cleanup = await service.listCleanup(owner);
|
|
3863
|
+
const ids = await service.freezePurgeSelection(owner, selection, id, current);
|
|
3828
3864
|
const run = async () => {
|
|
3829
3865
|
if (!current())
|
|
3830
3866
|
throw new Error('Schedule purge context changed before cleanup.');
|
|
3831
|
-
const result = await service.purge(owner, { ids
|
|
3867
|
+
const result = await service.purge(owner, { ids,
|
|
3868
|
+
...('forgetUnresolved' in selection && selection.forgetUnresolved ? { forgetUnresolved: true } : {}) }, current);
|
|
3832
3869
|
if (result.removedIds.length)
|
|
3833
3870
|
this.scheduleCards.invalidate();
|
|
3834
3871
|
return result;
|
|
3835
3872
|
};
|
|
3873
|
+
if ('forgetUnresolved' in selection && selection.forgetUnresolved)
|
|
3874
|
+
return await run();
|
|
3836
3875
|
const records = await service.list(owner);
|
|
3837
|
-
const needsVerification = backend === 'claude' && !!executor.withReviewedNativeCleanup && records.some(record => ids.includes(record.id)
|
|
3838
|
-
&& record.backend === 'claude' && !!record.recovery && !!record.nativeId && !record.cleanupConfirmed && !record.creationRefused && !['active', 'running', 'creating'].includes(record.state));
|
|
3876
|
+
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)
|
|
3877
|
+
&& record.backend === 'claude' && !!record.recovery && !!record.nativeId && !record.cleanupConfirmed && !record.creationRefused && !['active', 'running', 'creating'].includes(record.state)));
|
|
3839
3878
|
const needsNative = needsVerification || backend === 'claude' && records.some(record => ids.includes(record.id)
|
|
3840
3879
|
&& record.backend === 'claude' && service.canCancel(owner, record.id));
|
|
3841
3880
|
if (!needsNative)
|
|
@@ -3998,12 +4037,15 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3998
4037
|
const result = await this.runSchedulePurge(owner, command.selection, (0, crypto_1.createHash)('sha256').update(message.messageId ?? (0, uuid_1.v4)()).digest('hex'));
|
|
3999
4038
|
const lines = [`Removed history: ${result.removedIds.join(', ') || 'none'}.`,
|
|
4000
4039
|
`Already removed: ${result.alreadyRemovedIds.join(', ') || 'none'}.`,
|
|
4040
|
+
...(result.forgottenCleanupIds ? [`Forgotten cleanup tracking: ${result.forgottenCleanupIds.join(', ') || 'none'}.`] : []),
|
|
4041
|
+
...(result.warning ? [result.warning] : []),
|
|
4042
|
+
...result.nativeCleanupUnresolved.map(entry => `Native cleanup unresolved ${entry.id} (${entry.reason}): ${entry.detail}`),
|
|
4001
4043
|
...result.pending.map(entry => `Pending ${entry.id}: ${entry.detail}`),
|
|
4002
4044
|
...result.errors.map(entry => `Failed ${entry.id}: ${entry.error}`)];
|
|
4003
|
-
if (result.pending.length || result.errors.length)
|
|
4045
|
+
if (result.nativeCleanupUnresolved.length || result.pending.length || result.errors.length)
|
|
4004
4046
|
lines.push('Cleanup is incomplete. Retry only the unresolved managed IDs; do not infer native absence from history state.');
|
|
4005
4047
|
lines.push('Native-only definitions require native cleanup review and deletion in their original session.');
|
|
4006
|
-
respond({ success: !result.pending.length && !result.errors.length, output: lines.join('\n') });
|
|
4048
|
+
respond({ success: !result.nativeCleanupUnresolved.length && !result.pending.length && !result.errors.length, output: lines.join('\n') });
|
|
4007
4049
|
return;
|
|
4008
4050
|
}
|
|
4009
4051
|
const storedOnly = command.kind === 'list' && this.threadPool.getExistingExecutor(threadId)?.hasPendingCancellation?.();
|
|
@@ -4018,12 +4060,20 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
4018
4060
|
output = `Schedule ${record.id}: ${record.state}.`;
|
|
4019
4061
|
else {
|
|
4020
4062
|
const lifecycle = record.recovery
|
|
4021
|
-
?
|
|
4022
|
-
|
|
4023
|
-
|
|
4063
|
+
? 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.'
|
|
4064
|
+
: `Managed jobs recover automatically after a confirmed orderly restart. Dirty shutdowns remain blocked. ${record.recovery.handoffPolicy === 'skip-unadmitted'
|
|
4065
|
+
? 'Fired occurrences not yet admitted to execution may be skipped without replay; admitted work must finish.'
|
|
4066
|
+
: 'Queued and executing occurrences must finish before handoff.'}`
|
|
4024
4067
|
: 'This host does not support automatic schedule recovery after process exit.';
|
|
4025
4068
|
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}.`;
|
|
4026
4069
|
}
|
|
4070
|
+
if (command.kind === 'list') {
|
|
4071
|
+
const cleanup = await this.schedules?.listCleanup(owner) ?? [];
|
|
4072
|
+
if (cleanup.length)
|
|
4073
|
+
output += '\n\nNative cleanup tracking (history removed; not execution-ready):\n'
|
|
4074
|
+
+ cleanup.map(item => `${item.id} (${item.backend}; ${item.reason}${item.nativeId ? `; native ID ${item.nativeId}` : ''}${item.attribution ? `; original session ${item.attribution.sessionId}` : ''}) — ${(0, ScheduleCleanup_1.cleanupDetail)(item.reason)}`).join('\n')
|
|
4075
|
+
+ '\nRetry /schedule purge <managed-id,...>; use cleanup review/delete for exact native definitions in their original bound session.';
|
|
4076
|
+
}
|
|
4027
4077
|
if (storedOnly)
|
|
4028
4078
|
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}`;
|
|
4029
4079
|
if (updateSnapshot)
|
|
@@ -4376,6 +4426,16 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
4376
4426
|
// Native recovery handoff must finish before executor destruction can stop
|
|
4377
4427
|
// its original host. An uncertain handoff keeps that host owned for retry.
|
|
4378
4428
|
await this.scheduleInitialization?.then(service => service.requiresShutdownHandoff() ? service.destroy() : undefined, () => undefined);
|
|
4429
|
+
// Uncheckpointed AGY work has no queue-drain contract. Retire its exact owned
|
|
4430
|
+
// group before the catalog asks a handle to stop; never race a management
|
|
4431
|
+
// prompt against host teardown or mistake definition deletion for retirement.
|
|
4432
|
+
// Teardown uses stored backend summaries, not execution admission. A
|
|
4433
|
+
// corrupt reset generation must still block execution, but not host exit.
|
|
4434
|
+
for (const thread of this.threadPool.getSummaries()) {
|
|
4435
|
+
if (thread.backend === 'agy') {
|
|
4436
|
+
await this.threadPool.getExistingExecutor(thread.id)?.destroy();
|
|
4437
|
+
}
|
|
4438
|
+
}
|
|
4379
4439
|
const results = await Promise.allSettled([
|
|
4380
4440
|
this.scheduleInitialization?.then(service => service.destroy(), () => undefined),
|
|
4381
4441
|
this.delegation.destroy(),
|