@yu_robotics/remote-cli 1.6.231 → 1.6.232
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 +14 -0
- package/dist/client/MessageHandler.d.ts.map +1 -1
- package/dist/client/MessageHandler.js +230 -0
- package/dist/client/MessageHandler.js.map +1 -1
- package/dist/client/WebSocketClient.d.ts +4 -1
- package/dist/client/WebSocketClient.d.ts.map +1 -1
- package/dist/client/WebSocketClient.js +37 -3
- package/dist/client/WebSocketClient.js.map +1 -1
- package/dist/maintenance/release-notes.json +1 -1
- package/dist/scheduling/ClaudeNativeScheduleProvider.d.ts +19 -0
- package/dist/scheduling/ClaudeNativeScheduleProvider.d.ts.map +1 -0
- package/dist/scheduling/ClaudeNativeScheduleProvider.js +570 -0
- package/dist/scheduling/ClaudeNativeScheduleProvider.js.map +1 -0
- package/dist/scheduling/DshNativeScheduleProvider.d.ts +19 -0
- package/dist/scheduling/DshNativeScheduleProvider.d.ts.map +1 -0
- package/dist/scheduling/DshNativeScheduleProvider.js +470 -0
- package/dist/scheduling/DshNativeScheduleProvider.js.map +1 -0
- package/dist/scheduling/ScheduleCapabilities.d.ts +53 -0
- package/dist/scheduling/ScheduleCapabilities.d.ts.map +1 -0
- package/dist/scheduling/ScheduleCapabilities.js +65 -0
- package/dist/scheduling/ScheduleCapabilities.js.map +1 -0
- package/dist/scheduling/ScheduleCommand.d.ts +27 -0
- package/dist/scheduling/ScheduleCommand.d.ts.map +1 -0
- package/dist/scheduling/ScheduleCommand.js +173 -0
- package/dist/scheduling/ScheduleCommand.js.map +1 -0
- package/dist/scheduling/ScheduleDeliveryClient.d.ts +17 -0
- package/dist/scheduling/ScheduleDeliveryClient.d.ts.map +1 -0
- package/dist/scheduling/ScheduleDeliveryClient.js +109 -0
- package/dist/scheduling/ScheduleDeliveryClient.js.map +1 -0
- package/dist/scheduling/ScheduleService.d.ts +73 -0
- package/dist/scheduling/ScheduleService.d.ts.map +1 -0
- package/dist/scheduling/ScheduleService.js +742 -0
- package/dist/scheduling/ScheduleService.js.map +1 -0
- package/dist/scheduling/claude/rules.d.ts +8 -0
- package/dist/scheduling/claude/rules.d.ts.map +1 -0
- package/dist/scheduling/claude/rules.js +46 -0
- package/dist/scheduling/claude/rules.js.map +1 -0
- package/dist/scheduling/dsh/HostBridge.d.ts +96 -0
- package/dist/scheduling/dsh/HostBridge.d.ts.map +1 -0
- package/dist/scheduling/dsh/HostBridge.js +364 -0
- package/dist/scheduling/dsh/HostBridge.js.map +1 -0
- package/dist/scheduling/dsh/ScopePlugin.d.ts +9 -0
- package/dist/scheduling/dsh/ScopePlugin.d.ts.map +1 -0
- package/dist/scheduling/dsh/ScopePlugin.js +13 -0
- package/dist/scheduling/dsh/ScopePlugin.js.map +1 -0
- package/dist/scheduling/dsh/launch.d.ts +13 -0
- package/dist/scheduling/dsh/launch.d.ts.map +1 -0
- package/dist/scheduling/dsh/launch.js +58 -0
- package/dist/scheduling/dsh/launch.js.map +1 -0
- package/dist/scheduling/dsh/protocol.d.ts +28 -0
- package/dist/scheduling/dsh/protocol.d.ts.map +1 -0
- package/dist/scheduling/dsh/protocol.js +142 -0
- package/dist/scheduling/dsh/protocol.js.map +1 -0
- package/dist/scheduling/types.d.ts +79 -0
- package/dist/scheduling/types.d.ts.map +1 -0
- package/dist/scheduling/types.js +13 -0
- package/dist/scheduling/types.js.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.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
|
@@ -64,6 +64,12 @@ export declare class MessageHandler {
|
|
|
64
64
|
private pendingOutputSupported;
|
|
65
65
|
private readonly pendingOutputFiles;
|
|
66
66
|
private imageConnectionEpoch;
|
|
67
|
+
private scheduleResultsSupported;
|
|
68
|
+
private schedules?;
|
|
69
|
+
private scheduleInitialization?;
|
|
70
|
+
private scheduleDelivery?;
|
|
71
|
+
private readonly scheduleOwners;
|
|
72
|
+
private readonly scheduleManagement;
|
|
67
73
|
constructor(wsClient: WebSocketClient, threadPool: ThreadExecutorPool, threadManager: ThreadManager, directoryGuard: DirectoryGuard, config: ConfigManager);
|
|
68
74
|
reconcilePendingDelegatedWorkers(): Promise<void>;
|
|
69
75
|
/**
|
|
@@ -204,6 +210,14 @@ export declare class MessageHandler {
|
|
|
204
210
|
private sendStructuredContent;
|
|
205
211
|
private sendResponse;
|
|
206
212
|
private executorConfiguration;
|
|
213
|
+
private scheduleGeneration;
|
|
214
|
+
private scheduleDirectory;
|
|
215
|
+
/** Binding recovery only reads existing storage; first use belongs to /schedule. */
|
|
216
|
+
private recoverSchedules;
|
|
217
|
+
private initializeSchedules;
|
|
218
|
+
private activeSchedules;
|
|
219
|
+
private assertSchedulesIdle;
|
|
220
|
+
private handleScheduleCommand;
|
|
207
221
|
/** Shared card/text Apply path. Callers hold exclusive settings admission. */
|
|
208
222
|
private changeWorkingDirectory;
|
|
209
223
|
private settingsState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageHandler.d.ts","sourceRoot":"","sources":["../../src/client/MessageHandler.ts"],"names":[],"mappings":"AAOA,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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B,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;CA+B/B"}
|
|
@@ -51,6 +51,13 @@ const SessionResumeService_1 = require("../session/SessionResumeService");
|
|
|
51
51
|
const adapters_1 = require("../session/adapters");
|
|
52
52
|
const PiSessionCatalog_1 = require("../session/adapters/PiSessionCatalog");
|
|
53
53
|
const SessionControl_1 = require("../session/SessionControl");
|
|
54
|
+
const ScheduleService_1 = require("../scheduling/ScheduleService");
|
|
55
|
+
const ClaudeNativeScheduleProvider_1 = require("../scheduling/ClaudeNativeScheduleProvider");
|
|
56
|
+
const DshNativeScheduleProvider_1 = require("../scheduling/DshNativeScheduleProvider");
|
|
57
|
+
const ScheduleDeliveryClient_1 = require("../scheduling/ScheduleDeliveryClient");
|
|
58
|
+
const ScheduleCommand_1 = require("../scheduling/ScheduleCommand");
|
|
59
|
+
const ScheduleCapabilities_1 = require("../scheduling/ScheduleCapabilities");
|
|
60
|
+
const ClaudeSandbox_1 = require("../executor/claude/ClaudeSandbox");
|
|
54
61
|
const EFFORT_BACKENDS = new Set(['claude', 'codex', 'agy', 'opencode', 'kimi', 'zcode', 'pi', 'dsh']);
|
|
55
62
|
const SLASH_SESSION_BACKENDS = new Set(['opencode', 'kimi', 'zcode', 'pi']);
|
|
56
63
|
const NATIVE_SKILLS_BACKENDS = new Set(['claude', 'agy', 'opencode', 'kimi', 'zcode', 'pi']);
|
|
@@ -206,6 +213,12 @@ class MessageHandler {
|
|
|
206
213
|
pendingOutputSupported = false;
|
|
207
214
|
pendingOutputFiles = new PendingOutputFiles_1.PendingOutputFiles();
|
|
208
215
|
imageConnectionEpoch = 0;
|
|
216
|
+
scheduleResultsSupported = false;
|
|
217
|
+
schedules;
|
|
218
|
+
scheduleInitialization;
|
|
219
|
+
scheduleDelivery;
|
|
220
|
+
scheduleOwners = new Map();
|
|
221
|
+
scheduleManagement = new Set();
|
|
209
222
|
constructor(wsClient, threadPool, threadManager, directoryGuard, config) {
|
|
210
223
|
this.wsClient = wsClient;
|
|
211
224
|
this.threadPool = threadPool;
|
|
@@ -214,6 +227,7 @@ class MessageHandler {
|
|
|
214
227
|
this.config = config;
|
|
215
228
|
this.wsClient.onClose?.(() => {
|
|
216
229
|
this.imageConnectionEpoch++;
|
|
230
|
+
this.scheduleResultsSupported = false;
|
|
217
231
|
this.routerVersion = undefined;
|
|
218
232
|
this.fileInbox?.disconnect();
|
|
219
233
|
this.outputFiles?.disconnect();
|
|
@@ -359,6 +373,14 @@ class MessageHandler {
|
|
|
359
373
|
this.attachmentHintsSupported = data.capabilities?.outputAttachmentHintsV1 === true;
|
|
360
374
|
this.pendingOutputSupported = data.capabilities?.pendingOutputFilesV1 === true;
|
|
361
375
|
this.routerVersion = typeof data.routerVersion === 'string' ? data.routerVersion : undefined;
|
|
376
|
+
this.scheduleResultsSupported = data.capabilities?.scheduleResultsV1 === true;
|
|
377
|
+
if (this.scheduleResultsSupported) {
|
|
378
|
+
void this.recoverSchedules().catch(() => {
|
|
379
|
+
if (this.isDestroyed || !this.scheduleResultsSupported)
|
|
380
|
+
return;
|
|
381
|
+
console.warn('[Schedules] Local schedule recovery is unavailable. Use /schedule list for details.');
|
|
382
|
+
});
|
|
383
|
+
}
|
|
362
384
|
if (data.capabilities?.outputFilesV1 === true) {
|
|
363
385
|
try {
|
|
364
386
|
if (!this.outputFiles) {
|
|
@@ -442,6 +464,7 @@ class MessageHandler {
|
|
|
442
464
|
|| this.pendingReplaces.size > 0
|
|
443
465
|
|| this.activeThreadOperations.size > 0
|
|
444
466
|
|| this.abortOperations.size > 0
|
|
467
|
+
|| this.scheduleManagement.size > 0 || this.schedules?.hasActiveSchedules()
|
|
445
468
|
|| this.threadManager.listThreads().some(thread => this.settingsAdmission.isBlocked(thread.id))) {
|
|
446
469
|
return false;
|
|
447
470
|
}
|
|
@@ -579,6 +602,10 @@ class MessageHandler {
|
|
|
579
602
|
return;
|
|
580
603
|
}
|
|
581
604
|
const settingsCommand = content?.trim() ?? '';
|
|
605
|
+
if (/^\/schedule(?:\s|$)/.test(settingsCommand)) {
|
|
606
|
+
await this.handleScheduleCommand(message, resolvedThreadId);
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
582
609
|
if (settingsCommand === '/clear' || settingsCommand === '/new') {
|
|
583
610
|
await this.clearThreadConversation(messageId, resolvedThreadId);
|
|
584
611
|
return;
|
|
@@ -1051,6 +1078,7 @@ class MessageHandler {
|
|
|
1051
1078
|
void bridge.close().catch(() => undefined);
|
|
1052
1079
|
}
|
|
1053
1080
|
async clearThreadConversation(messageId, threadId) {
|
|
1081
|
+
await this.assertSchedulesIdle(threadId);
|
|
1054
1082
|
this.conversationRevisions.set(threadId, (this.conversationRevisions.get(threadId) ?? 0) + 1);
|
|
1055
1083
|
this.settingsService.invalidate(threadId);
|
|
1056
1084
|
this.directoryBrowser.invalidate(threadId);
|
|
@@ -1190,6 +1218,8 @@ class MessageHandler {
|
|
|
1190
1218
|
}
|
|
1191
1219
|
}
|
|
1192
1220
|
if (trimmed === '/sandbox' || trimmed.startsWith('/sandbox ')) {
|
|
1221
|
+
if (trimmed !== '/sandbox')
|
|
1222
|
+
await this.assertSchedulesIdle(threadId);
|
|
1193
1223
|
if (!('getSandboxStatus' in executor) || !('configureSandbox' in executor)) {
|
|
1194
1224
|
this.sendResponse(messageId, threadId, { success: false, error: '/sandbox is currently supported by the Codex and Claude Code backends.' });
|
|
1195
1225
|
return true;
|
|
@@ -1305,6 +1335,7 @@ Use /compact to reduce conversation context or /clear to start a fresh context.`
|
|
|
1305
1335
|
- /effort [auto|level] - Open effort settings, or set a native supported level with a text argument
|
|
1306
1336
|
- /goal [objective|pause|resume|clear] - Manage a native Codex goal; optional --budget <tokens> on start or resume
|
|
1307
1337
|
- /sandbox [on|off|read-only|default|allow <directory>|remove <directory>|network on|off] - Configure this thread's sandbox (Codex, Claude Code)
|
|
1338
|
+
- /schedule [capabilities|list|cancel <id>|after|at|cron] - Manage native scheduled tasks; /schedule shows examples
|
|
1308
1339
|
- /delegation [on|off|reset [backend]] - Delegate tasks between installed agent backends; reset saved worker context when needed
|
|
1309
1340
|
- /backend - Open backend settings (Current thread by default; Confirm applies)
|
|
1310
1341
|
- /backend <index> - Switch all threads and clear per-thread backend overrides
|
|
@@ -1835,6 +1866,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
1835
1866
|
return;
|
|
1836
1867
|
}
|
|
1837
1868
|
try {
|
|
1869
|
+
await this.assertSchedulesIdle(target.id);
|
|
1838
1870
|
await this.delegation.cancelThread(target.id);
|
|
1839
1871
|
await this.delegationBridges.get(target.id)?.close();
|
|
1840
1872
|
this.delegationBridges.delete(target.id);
|
|
@@ -3129,8 +3161,204 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3129
3161
|
executorConfiguration() {
|
|
3130
3162
|
return this.config.get('executor') ?? { type: 'auto' };
|
|
3131
3163
|
}
|
|
3164
|
+
scheduleGeneration(threadId) {
|
|
3165
|
+
const thread = this.threadManager.getThread(threadId);
|
|
3166
|
+
if (!thread)
|
|
3167
|
+
throw new Error('This thread no longer exists.');
|
|
3168
|
+
this.threadManager.contextResets.assertReady(threadId);
|
|
3169
|
+
return (0, crypto_1.createHash)('sha256').update(JSON.stringify({
|
|
3170
|
+
server: this.config.get('serverUrl'), device: this.config.get('deviceId'),
|
|
3171
|
+
thread: threadId, cwd: thread.workingDirectory,
|
|
3172
|
+
generation: this.threadManager.contextResets.generation(threadId, thread.delegationWorkspaceGeneration ?? 0),
|
|
3173
|
+
})).digest('hex');
|
|
3174
|
+
}
|
|
3175
|
+
scheduleDirectory() {
|
|
3176
|
+
const directory = this.config.getConfigDir?.();
|
|
3177
|
+
if (typeof directory !== 'string' || !directory)
|
|
3178
|
+
return undefined;
|
|
3179
|
+
const namespace = (0, crypto_1.createHash)('sha256').update(JSON.stringify({
|
|
3180
|
+
server: this.config.get('serverUrl'), device: this.config.get('deviceId'),
|
|
3181
|
+
})).digest('hex');
|
|
3182
|
+
return path_1.default.join(directory, 'schedules', namespace);
|
|
3183
|
+
}
|
|
3184
|
+
/** Binding recovery only reads existing storage; first use belongs to /schedule. */
|
|
3185
|
+
async recoverSchedules() {
|
|
3186
|
+
if (this.isDestroyed || !this.scheduleResultsSupported)
|
|
3187
|
+
return;
|
|
3188
|
+
if (!this.scheduleInitialization) {
|
|
3189
|
+
const directory = this.scheduleDirectory();
|
|
3190
|
+
if (!directory)
|
|
3191
|
+
return;
|
|
3192
|
+
try {
|
|
3193
|
+
await fs_1.default.promises.lstat(path_1.default.join(directory, ScheduleService_1.SCHEDULE_CATALOG_FILE));
|
|
3194
|
+
}
|
|
3195
|
+
catch (error) {
|
|
3196
|
+
if (['ENOENT', 'ENOTDIR'].includes(error.code ?? ''))
|
|
3197
|
+
return;
|
|
3198
|
+
throw error;
|
|
3199
|
+
}
|
|
3200
|
+
}
|
|
3201
|
+
// A disconnect or shutdown can happen while storage is being checked. Never
|
|
3202
|
+
// create a late service/subscription after shutdown has collected its work.
|
|
3203
|
+
if (this.isDestroyed || !this.scheduleResultsSupported)
|
|
3204
|
+
return;
|
|
3205
|
+
const service = await this.initializeSchedules();
|
|
3206
|
+
if (!this.isDestroyed && this.scheduleResultsSupported)
|
|
3207
|
+
await service.retryDeliveries();
|
|
3208
|
+
}
|
|
3209
|
+
initializeSchedules() {
|
|
3210
|
+
if (this.scheduleInitialization)
|
|
3211
|
+
return this.scheduleInitialization;
|
|
3212
|
+
this.scheduleInitialization = (async () => {
|
|
3213
|
+
if (this.isDestroyed)
|
|
3214
|
+
throw new Error('The client is shutting down.');
|
|
3215
|
+
const directory = this.scheduleDirectory();
|
|
3216
|
+
if (!directory)
|
|
3217
|
+
throw new Error('Local schedule storage is unavailable.');
|
|
3218
|
+
const providers = { claude: new ClaudeNativeScheduleProvider_1.ClaudeNativeScheduleProvider(), dsh: new DshNativeScheduleProvider_1.DshNativeScheduleProvider() };
|
|
3219
|
+
const service = new ScheduleService_1.ScheduleService({
|
|
3220
|
+
directory,
|
|
3221
|
+
provider: { create: (input, onEvent) => {
|
|
3222
|
+
const backend = input.backend === undefined ? 'claude' : input.backend;
|
|
3223
|
+
(0, ScheduleCapabilities_1.assertNativeScheduleBackend)(backend);
|
|
3224
|
+
return providers[backend].create(input, onEvent);
|
|
3225
|
+
} },
|
|
3226
|
+
isOwnerCurrent: owner => {
|
|
3227
|
+
// Shutdown blocks delivery separately; it does not invalidate persisted ownership.
|
|
3228
|
+
try {
|
|
3229
|
+
return this.scheduleGeneration(owner.threadId) === owner.generation;
|
|
3230
|
+
}
|
|
3231
|
+
catch {
|
|
3232
|
+
return false;
|
|
3233
|
+
}
|
|
3234
|
+
},
|
|
3235
|
+
deliver: async (delivery) => {
|
|
3236
|
+
if (!this.scheduleResultsSupported || this.isDestroyed)
|
|
3237
|
+
throw new Error('Scheduled result delivery is unavailable.');
|
|
3238
|
+
const thread = this.threadManager.getThread(delivery.schedule.threadId);
|
|
3239
|
+
if (!thread)
|
|
3240
|
+
throw new Error('The original thread no longer exists.');
|
|
3241
|
+
await this.scheduleDelivery.deliver(delivery, thread.name);
|
|
3242
|
+
},
|
|
3243
|
+
});
|
|
3244
|
+
await service.initialize();
|
|
3245
|
+
if (!this.isDestroyed)
|
|
3246
|
+
this.scheduleDelivery = new ScheduleDeliveryClient_1.ScheduleDeliveryClient(this.wsClient);
|
|
3247
|
+
this.schedules = service;
|
|
3248
|
+
return service;
|
|
3249
|
+
})();
|
|
3250
|
+
return this.scheduleInitialization;
|
|
3251
|
+
}
|
|
3252
|
+
async activeSchedules(threadId) {
|
|
3253
|
+
const owner = this.scheduleOwners.get(threadId);
|
|
3254
|
+
if (!owner || !this.schedules)
|
|
3255
|
+
return [];
|
|
3256
|
+
const records = await this.schedules.list(owner);
|
|
3257
|
+
const active = records.filter(record => ['creating', 'active', 'running'].includes(record.state));
|
|
3258
|
+
if (!active.length && !this.scheduleManagement.has(threadId))
|
|
3259
|
+
this.scheduleOwners.delete(threadId);
|
|
3260
|
+
return active;
|
|
3261
|
+
}
|
|
3262
|
+
async assertSchedulesIdle(threadId) {
|
|
3263
|
+
if (this.scheduleManagement.has(threadId) || this.schedules?.hasActiveSchedules(threadId)) {
|
|
3264
|
+
throw new Error('Cancel this thread\'s schedules with /schedule cancel <id> before resetting context, changing directory, or deleting the thread.');
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3267
|
+
async handleScheduleCommand(message, threadId) {
|
|
3268
|
+
const respond = (result) => this.sendResponse(message.messageId, threadId, result, true);
|
|
3269
|
+
let reserved = false;
|
|
3270
|
+
try {
|
|
3271
|
+
const command = (0, ScheduleCommand_1.parseScheduleCommand)(message.content ?? '');
|
|
3272
|
+
if (!command || command.kind === 'help') {
|
|
3273
|
+
respond({ success: true, output: ScheduleCommand_1.SCHEDULE_USAGE });
|
|
3274
|
+
return;
|
|
3275
|
+
}
|
|
3276
|
+
if (command.kind === 'invalid') {
|
|
3277
|
+
respond({ success: false, error: command.message });
|
|
3278
|
+
return;
|
|
3279
|
+
}
|
|
3280
|
+
if (command.kind === 'capabilities') {
|
|
3281
|
+
respond({ success: true, output: ScheduleCapabilities_1.SCHEDULE_CAPABILITIES });
|
|
3282
|
+
return;
|
|
3283
|
+
}
|
|
3284
|
+
if (!message.openId)
|
|
3285
|
+
throw new Error('Scheduled tasks require an authenticated thread owner.');
|
|
3286
|
+
if (message.attachments?.length || message.fileIds?.length || message.workingDirectory) {
|
|
3287
|
+
throw new Error('Use /cd first and include a self-contained text prompt. Schedule commands do not accept attachments or directory overrides.');
|
|
3288
|
+
}
|
|
3289
|
+
const owner = { threadId, openId: message.openId, generation: this.scheduleGeneration(threadId) };
|
|
3290
|
+
if (command.kind === 'create' || command.kind === 'cancel') {
|
|
3291
|
+
if (this.scheduleManagement.has(threadId))
|
|
3292
|
+
throw new Error('A schedule operation is already in progress for this thread.');
|
|
3293
|
+
this.scheduleManagement.add(threadId);
|
|
3294
|
+
reserved = true;
|
|
3295
|
+
}
|
|
3296
|
+
const service = await this.initializeSchedules();
|
|
3297
|
+
if (command.kind === 'list') {
|
|
3298
|
+
await service.refresh(owner);
|
|
3299
|
+
const records = await service.list(owner);
|
|
3300
|
+
void service.retryDeliveries().catch(() => { });
|
|
3301
|
+
await this.activeSchedules(threadId);
|
|
3302
|
+
respond({ success: true, output: records.length ? records.map(record => `${record.id} — ${record.state}\n${record.rule.kind === 'once' ? record.rule.at : `${record.rule.expression} (${record.rule.timezone})`}\n${record.prompt.slice(0, 240)}${record.error ? `\n${record.error}` : ''}`).join('\n\n') : 'No schedules in this thread. Use /schedule for examples.' });
|
|
3303
|
+
return;
|
|
3304
|
+
}
|
|
3305
|
+
try {
|
|
3306
|
+
if (command.kind === 'cancel') {
|
|
3307
|
+
const record = await service.cancel(owner, command.id);
|
|
3308
|
+
respond({ success: true, output: `Schedule ${record.id}: ${record.state}.` });
|
|
3309
|
+
return;
|
|
3310
|
+
}
|
|
3311
|
+
if (command.kind !== 'create')
|
|
3312
|
+
throw new Error('Unknown schedule operation.');
|
|
3313
|
+
if (this.isDestroyed || this.automaticUpdateInProgress)
|
|
3314
|
+
throw new Error('The client is updating or shutting down. No schedule was created.');
|
|
3315
|
+
if (!this.scheduleResultsSupported || !this.wsClient.isConnected()) {
|
|
3316
|
+
throw new Error('Schedule creation requires a connected Router with scheduleResultsV1 support. Update both CLI and Router.');
|
|
3317
|
+
}
|
|
3318
|
+
const backend = this.threadPool.getBackendKey(threadId);
|
|
3319
|
+
(0, ScheduleCapabilities_1.assertNativeScheduleBackend)(backend);
|
|
3320
|
+
const config = this.executorConfiguration();
|
|
3321
|
+
if (backend === 'claude' && new ClaudeSandbox_1.ClaudeSandbox(this.directoryGuard, config.claude?.sandbox, threadId).isRestricted()) {
|
|
3322
|
+
throw new Error('This native scheduling adapter does not support restricted Claude sandboxes. No schedule was created and sandbox settings were not changed.');
|
|
3323
|
+
}
|
|
3324
|
+
const thread = this.threadManager.getThread(threadId);
|
|
3325
|
+
const cwd = this.directoryGuard.resolveWorkingDirectory(thread.workingDirectory);
|
|
3326
|
+
(0, WorkingDirectory_1.assertWorkingDirectoryExists)(cwd);
|
|
3327
|
+
const existingOwner = this.scheduleOwners.get(threadId);
|
|
3328
|
+
if (existingOwner && existingOwner.openId !== owner.openId && (await this.activeSchedules(threadId)).length) {
|
|
3329
|
+
throw new Error('This thread has schedules belonging to a different owner.');
|
|
3330
|
+
}
|
|
3331
|
+
this.scheduleOwners.set(threadId, owner);
|
|
3332
|
+
const record = await service.create(owner, {
|
|
3333
|
+
id: (0, uuid_1.v4)(), backend, cwd, rule: command.rule, prompt: command.prompt,
|
|
3334
|
+
command: config[backend]?.command,
|
|
3335
|
+
model: thread.models?.[backend] ?? (backend === 'claude' ? thread.model || undefined : config.dsh?.model),
|
|
3336
|
+
effort: thread.efforts?.[backend],
|
|
3337
|
+
});
|
|
3338
|
+
const lifecycle = backend === 'claude'
|
|
3339
|
+
? 'Schedules are lost when the native process exits; recurring tasks expire after seven days.'
|
|
3340
|
+
: 'Native job storage is isolated and is never automatically reopened after process exit.';
|
|
3341
|
+
respond({ success: true, output: `Schedule ${record.id}: ${record.state}.\n${record.rule.kind === 'once' ? record.rule.at : `${record.rule.expression} (${record.rule.timezone})`}\n\nRuns in its own ${ScheduleCapabilities_1.NATIVE_SCHEDULE_CAPABILITIES[backend].label} session and returns results to this thread. Keep the CLI running; native timing is approximate. ${lifecycle}\nUse /schedule list or /schedule cancel ${record.id}.` });
|
|
3342
|
+
}
|
|
3343
|
+
finally {
|
|
3344
|
+
this.scheduleManagement.delete(threadId);
|
|
3345
|
+
reserved = false;
|
|
3346
|
+
await this.activeSchedules(threadId).catch(() => undefined);
|
|
3347
|
+
}
|
|
3348
|
+
}
|
|
3349
|
+
catch (error) {
|
|
3350
|
+
respond({ success: false, error: error instanceof Error ? error.message : 'Schedule operation failed.' });
|
|
3351
|
+
}
|
|
3352
|
+
finally {
|
|
3353
|
+
if (reserved) {
|
|
3354
|
+
this.scheduleManagement.delete(threadId);
|
|
3355
|
+
await this.activeSchedules(threadId).catch(() => undefined);
|
|
3356
|
+
}
|
|
3357
|
+
}
|
|
3358
|
+
}
|
|
3132
3359
|
/** Shared card/text Apply path. Callers hold exclusive settings admission. */
|
|
3133
3360
|
async changeWorkingDirectory(threadId, targetDir) {
|
|
3361
|
+
await this.assertSchedulesIdle(threadId);
|
|
3134
3362
|
if (this.isDestroyed || this.automaticUpdateInProgress || this.abortOperations.has(threadId)
|
|
3135
3363
|
|| this.threadPool.isThreadBusy(threadId) || this.coordinatorPreparations.has(threadId) || this.hasThreadQueueState(threadId)) {
|
|
3136
3364
|
throw new Error('Cannot change working directory while the thread has active or queued work. Retry when it is idle.');
|
|
@@ -3446,6 +3674,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3446
3674
|
this.directoryBrowser.destroy();
|
|
3447
3675
|
this.settingsService.destroy();
|
|
3448
3676
|
this.isDestroyed = true;
|
|
3677
|
+
this.scheduleDelivery?.destroy();
|
|
3449
3678
|
this.pendingOutputFiles.clear();
|
|
3450
3679
|
for (const threadId of this.activeThreadOperations.keys()) {
|
|
3451
3680
|
this.settingsAdmission.cancelRecoverable(threadId);
|
|
@@ -3459,6 +3688,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3459
3688
|
this.notificationAdapter.unregister();
|
|
3460
3689
|
try {
|
|
3461
3690
|
const results = await Promise.allSettled([
|
|
3691
|
+
this.scheduleInitialization?.then(service => service.destroy(), () => undefined),
|
|
3462
3692
|
this.delegation.destroy(),
|
|
3463
3693
|
...[...this.delegationBridges.values()].map(bridge => bridge.close()),
|
|
3464
3694
|
this.threadPool.destroyAll({ deleteData: false, shutdown: true }),
|