@yu_robotics/remote-cli 1.6.240 → 1.6.241
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 +4 -0
- package/dist/client/MessageHandler.d.ts.map +1 -1
- package/dist/client/MessageHandler.js +122 -14
- package/dist/client/MessageHandler.js.map +1 -1
- package/dist/delegation/ArtifactCloseoutContinuation.d.ts +14 -0
- package/dist/delegation/ArtifactCloseoutContinuation.d.ts.map +1 -0
- package/dist/delegation/ArtifactCloseoutContinuation.js +37 -0
- package/dist/delegation/ArtifactCloseoutContinuation.js.map +1 -0
- package/dist/delegation/DelegationManager.d.ts +0 -1
- package/dist/delegation/DelegationManager.d.ts.map +1 -1
- package/dist/delegation/DelegationManager.js +1 -1
- package/dist/delegation/DelegationManager.js.map +1 -1
- package/dist/executor/ClaudePersistentExecutor.d.ts +6 -1
- package/dist/executor/ClaudePersistentExecutor.d.ts.map +1 -1
- package/dist/executor/ClaudePersistentExecutor.js +75 -19
- package/dist/executor/ClaudePersistentExecutor.js.map +1 -1
- package/dist/executor/IExecutor.d.ts +3 -1
- package/dist/executor/IExecutor.d.ts.map +1 -1
- package/dist/maintenance/release-notes.json +1 -1
- package/dist/managed/tools.d.ts +18 -0
- package/dist/managed/tools.d.ts.map +1 -1
- package/dist/scheduling/ReviewedNativeCleanup.d.ts +44 -0
- package/dist/scheduling/ReviewedNativeCleanup.d.ts.map +1 -0
- package/dist/scheduling/ReviewedNativeCleanup.js +165 -0
- package/dist/scheduling/ReviewedNativeCleanup.js.map +1 -0
- package/dist/scheduling/ScheduleCommand.d.ts +8 -0
- package/dist/scheduling/ScheduleCommand.d.ts.map +1 -1
- package/dist/scheduling/ScheduleCommand.js +15 -0
- package/dist/scheduling/ScheduleCommand.js.map +1 -1
- package/dist/scheduling/ScheduleService.d.ts +3 -0
- package/dist/scheduling/ScheduleService.d.ts.map +1 -1
- package/dist/scheduling/ScheduleService.js +33 -3
- package/dist/scheduling/ScheduleService.js.map +1 -1
- package/dist/scheduling/ScheduleToolScope.d.ts +3 -0
- package/dist/scheduling/ScheduleToolScope.d.ts.map +1 -1
- package/dist/scheduling/ScheduleToolScope.js +10 -0
- package/dist/scheduling/ScheduleToolScope.js.map +1 -1
- package/dist/scheduling/claude/ClaudeScheduleOwnership.d.ts +5 -0
- package/dist/scheduling/claude/ClaudeScheduleOwnership.d.ts.map +1 -1
- package/dist/scheduling/claude/ClaudeScheduleOwnership.js +22 -0
- package/dist/scheduling/claude/ClaudeScheduleOwnership.js.map +1 -1
- package/dist/scheduling/claude/ClaudeSessionSchedules.d.ts +11 -1
- package/dist/scheduling/claude/ClaudeSessionSchedules.d.ts.map +1 -1
- package/dist/scheduling/claude/ClaudeSessionSchedules.js +55 -6
- package/dist/scheduling/claude/ClaudeSessionSchedules.js.map +1 -1
- package/dist/scheduling/toolContract.d.ts +9 -0
- package/dist/scheduling/toolContract.d.ts.map +1 -1
- package/dist/scheduling/toolContract.js +1 -0
- package/dist/scheduling/toolContract.js.map +1 -1
- package/dist/scheduling/types.d.ts +3 -1
- package/dist/scheduling/types.d.ts.map +1 -1
- package/dist/scheduling/types.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
|
@@ -432,7 +432,7 @@ class ClaudePersistentExecutor extends events_1.EventEmitter {
|
|
|
432
432
|
const timezone = await this.readNativeScheduleTimezone();
|
|
433
433
|
if (!current() || this.claudeProcess !== child)
|
|
434
434
|
throw new Error('Claude recovery host changed.');
|
|
435
|
-
handle = await adapter.inToolOperation(`restore-${record.id}`, current, () => adapter.create(input, emit, context.isOwnerCurrent ?? context.isCurrent, timezone, clean ? 'adopt' : 'adopt-existing', record.nativeId), false);
|
|
435
|
+
handle = await adapter.inToolOperation(`restore-${record.id}`, current, () => adapter.create(input, emit, context.isOwnerCurrent ?? context.isCurrent, timezone, clean ? 'adopt' : 'adopt-existing', record.nativeId, context.canAdmitOccurrence), false);
|
|
436
436
|
if (!current() || this.claudeProcess !== child || !this.turnLedger.supported(child?.pid))
|
|
437
437
|
throw new types_1.NativeScheduleCleanupError('Claude recovery host or protocol changed.', handle);
|
|
438
438
|
const recovered = this.recoverableScheduleHandle(handle, input, restoration);
|
|
@@ -541,6 +541,7 @@ class ClaudePersistentExecutor extends events_1.EventEmitter {
|
|
|
541
541
|
}
|
|
542
542
|
sessionSchedules;
|
|
543
543
|
scheduleHooksReady = false;
|
|
544
|
+
scheduleGuardRequired = false;
|
|
544
545
|
currentScheduleManagement = false;
|
|
545
546
|
nativeScheduleTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
546
547
|
schedules() {
|
|
@@ -563,6 +564,54 @@ class ClaudePersistentExecutor extends events_1.EventEmitter {
|
|
|
563
564
|
wake: () => { this.turnLedger.changed(); void this.processQueue(); },
|
|
564
565
|
});
|
|
565
566
|
}
|
|
567
|
+
reviewedCleanupActive = false;
|
|
568
|
+
cleanupHosts = new WeakMap();
|
|
569
|
+
async withReviewedNativeCleanup(id, current, run, inTurn = false) {
|
|
570
|
+
if (!this.sessionId)
|
|
571
|
+
throw new Error('No bound Claude session. Select the original thread/session; cleanup never searches or creates another session.');
|
|
572
|
+
if (!current() || this.reviewedCleanupActive || this.modelChange || this.retainedAbort || this.abortOperation
|
|
573
|
+
|| this.hasUncertainShutdown() || this.delegationWorker || this.isDestroyed || this.isStopping
|
|
574
|
+
|| this.sandbox.isRestricted() || this.scheduleRestart || this.scheduleRestoring || (!inTurn && this.isBusy())
|
|
575
|
+
|| !this.delegation?.groups?.includes('scheduling'))
|
|
576
|
+
throw new Error('Bound native cleanup is unavailable or busy. Retry when this thread is idle.');
|
|
577
|
+
this.reviewedCleanupActive = true;
|
|
578
|
+
const sessionId = this.sessionId, cwd = this.currentWorkingDirectory;
|
|
579
|
+
let lease;
|
|
580
|
+
try {
|
|
581
|
+
lease = this.scheduleHostOwnership().reviewedRemovalLease();
|
|
582
|
+
if (!inTurn)
|
|
583
|
+
await this.listModels();
|
|
584
|
+
const child = this.claudeProcess, epoch = this.stopEpoch;
|
|
585
|
+
if (!child || !this.scheduleHooksReady || this.sessionId !== sessionId)
|
|
586
|
+
throw new Error('Bound native session changed during cleanup startup.');
|
|
587
|
+
if (!this.cleanupHosts.has(child))
|
|
588
|
+
this.cleanupHosts.set(child, (0, crypto_1.randomUUID)());
|
|
589
|
+
const settings = JSON.stringify([this.model, this.effort, this.delegation]);
|
|
590
|
+
const valid = () => {
|
|
591
|
+
try {
|
|
592
|
+
lease.verify();
|
|
593
|
+
return current() && !this.isDestroyed && !this.isStopping && !this.abortOperation
|
|
594
|
+
&& !this.modelChange && this.claudeProcess === child && this.stopEpoch === epoch && this.sessionId === sessionId
|
|
595
|
+
&& this.currentWorkingDirectory === cwd && settings === JSON.stringify([this.model, this.effort, this.delegation]);
|
|
596
|
+
}
|
|
597
|
+
catch {
|
|
598
|
+
return false;
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
this.scheduleCleanupHost = child;
|
|
602
|
+
const adapter = this.schedules();
|
|
603
|
+
return await adapter.inToolOperation(id, valid, () => run({
|
|
604
|
+
binding: (0, crypto_1.createHash)('sha256').update(JSON.stringify([this.cleanupHosts.get(child), sessionId, cwd, epoch, settings])).digest('hex'),
|
|
605
|
+
sessionId, current: valid,
|
|
606
|
+
inventory: () => adapter.reviewedInventory(valid), remove: target => adapter.reviewedDelete(target, valid),
|
|
607
|
+
}), inTurn);
|
|
608
|
+
}
|
|
609
|
+
finally {
|
|
610
|
+
lease?.close();
|
|
611
|
+
this.scheduleCleanupHost = undefined;
|
|
612
|
+
this.reviewedCleanupActive = false;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
566
615
|
async withNativeScheduleOperation(id, current, run, inTurn) {
|
|
567
616
|
if (this.modelChange || this.retainedAbort || this.delegationWorker || this.isDestroyed || this.isStopping || this.sandbox.isRestricted())
|
|
568
617
|
throw new Error('Native schedule owner or sandbox is unavailable.');
|
|
@@ -594,7 +643,7 @@ class ClaudePersistentExecutor extends events_1.EventEmitter {
|
|
|
594
643
|
}
|
|
595
644
|
}
|
|
596
645
|
nativeScheduleAction(id) { return this.sessionSchedules?.action(id); }
|
|
597
|
-
async createNativeSchedule(input, onEvent, isOwnerCurrent) {
|
|
646
|
+
async createNativeSchedule(input, onEvent, isOwnerCurrent, canAdmitOccurrence) {
|
|
598
647
|
if (this.scheduleRestart || this.modelChange || this.delegationWorker || this.isDestroyed || this.isStopping || this.sandbox.isRestricted()
|
|
599
648
|
|| input.cwd !== this.currentWorkingDirectory)
|
|
600
649
|
throw new Error('Native schedule context or sandbox is unavailable.');
|
|
@@ -607,7 +656,7 @@ class ClaudePersistentExecutor extends events_1.EventEmitter {
|
|
|
607
656
|
throw new Error('Claude recovery protocol is unsupported.');
|
|
608
657
|
if (input.recovery)
|
|
609
658
|
this.scheduleHostOwnership().reserve(true);
|
|
610
|
-
return this.recoverableScheduleHandle(await this.schedules().create(input, onEvent, isOwnerCurrent, timezone), input);
|
|
659
|
+
return this.recoverableScheduleHandle(await this.schedules().create(input, onEvent, isOwnerCurrent, timezone, false, undefined, canAdmitOccurrence), input);
|
|
611
660
|
}
|
|
612
661
|
/** Inspect only the effective TZ; never log, retain, or expose settings to a model. */
|
|
613
662
|
readNativeScheduleTimezone() {
|
|
@@ -688,7 +737,7 @@ class ClaudePersistentExecutor extends events_1.EventEmitter {
|
|
|
688
737
|
hasUncertainShutdown() { return this.shutdownUncertain || this.isStopping || !!this.stopOperation; }
|
|
689
738
|
isBusy() { return !!this.modelChange || this.isWorkBusy(); }
|
|
690
739
|
isWorkBusy() {
|
|
691
|
-
if (this.scheduleRestoring || this.retainedAbort || this.abortOperation || this.hasUncertainShutdown() || this.scheduleCleanupHost
|
|
740
|
+
if (this.reviewedCleanupActive || this.scheduleRestoring || this.retainedAbort || this.abortOperation || this.hasUncertainShutdown() || this.scheduleCleanupHost
|
|
692
741
|
|| this.scheduleRestart && this.claudeProcess === this.scheduleRestart.child)
|
|
693
742
|
return true;
|
|
694
743
|
if (this.sessionSchedules?.busy)
|
|
@@ -752,13 +801,15 @@ class ClaudePersistentExecutor extends events_1.EventEmitter {
|
|
|
752
801
|
// Note: --output-format=stream-json requires --verbose
|
|
753
802
|
const restricted = this.sandbox.isRestricted();
|
|
754
803
|
// Claude restores session-only cron jobs from the resumed transcript, even
|
|
755
|
-
// when the original CronCreate used durable:false.
|
|
756
|
-
//
|
|
757
|
-
//
|
|
758
|
-
// restart or in a restricted/worker process.
|
|
804
|
+
// when the original CronCreate used durable:false. Scheduling hosts need
|
|
805
|
+
// bootstrap admission hooks; every other launch disables the native Cron
|
|
806
|
+
// feature itself rather than relying on a scheduler preference setting.
|
|
759
807
|
const managedScheduling = !this.delegationWorker && !restricted
|
|
760
808
|
&& this.delegation?.groups?.includes('scheduling') === true;
|
|
761
|
-
|
|
809
|
+
this.scheduleGuardRequired = !this.delegationWorker && (!!this.sessionId || managedScheduling);
|
|
810
|
+
// Non-owning hosts must not start the native scheduler or expose Cron tools.
|
|
811
|
+
// The settings flag does not suppress transcript-restored definitions.
|
|
812
|
+
const disableNativeSchedules = !managedScheduling;
|
|
762
813
|
const mcpServers = {};
|
|
763
814
|
const args = [
|
|
764
815
|
'--input-format=stream-json',
|
|
@@ -766,6 +817,12 @@ class ClaudePersistentExecutor extends events_1.EventEmitter {
|
|
|
766
817
|
'--include-partial-messages',
|
|
767
818
|
'--verbose',
|
|
768
819
|
];
|
|
820
|
+
// Native startup holds before loading the resumed session until our first
|
|
821
|
+
// initialize frame (including admission hooks) is available. Unsupported
|
|
822
|
+
// binaries must fail startup; never retry without this barrier. Restricted
|
|
823
|
+
// hosts use the Cron kill switch instead, preserving SessionStart ordering.
|
|
824
|
+
if (managedScheduling)
|
|
825
|
+
args.push('--await-initialize');
|
|
769
826
|
if (restricted) {
|
|
770
827
|
// Sandboxed mode: OS-enforced Bash isolation; widening requests surface
|
|
771
828
|
// through the permission-prompt MCP tool as approval cards. Skipping
|
|
@@ -790,8 +847,6 @@ class ClaudePersistentExecutor extends events_1.EventEmitter {
|
|
|
790
847
|
permissions.allow = [...(permissions.allow ?? []),
|
|
791
848
|
...(0, tools_1.managedTools)(this.delegation).map(tool => `mcp__remote-cli-delegation__${tool.name}`)];
|
|
792
849
|
}
|
|
793
|
-
if (disableResumedSchedules)
|
|
794
|
-
settings = { ...(settings ?? {}), scheduledTasksEnabled: false };
|
|
795
850
|
if (settings)
|
|
796
851
|
args.push('--settings', JSON.stringify(settings));
|
|
797
852
|
mcpServers['remote-cli-approval'] = {
|
|
@@ -804,8 +859,6 @@ class ClaudePersistentExecutor extends events_1.EventEmitter {
|
|
|
804
859
|
}
|
|
805
860
|
else {
|
|
806
861
|
args.push('--dangerously-skip-permissions');
|
|
807
|
-
if (disableResumedSchedules)
|
|
808
|
-
args.push('--settings', JSON.stringify({ scheduledTasksEnabled: false }));
|
|
809
862
|
}
|
|
810
863
|
if (this.delegation) {
|
|
811
864
|
mcpServers['remote-cli-delegation'] = (0, contract_1.delegationMcpConfig)(this.delegation);
|
|
@@ -888,6 +941,7 @@ class ClaudePersistentExecutor extends events_1.EventEmitter {
|
|
|
888
941
|
env: {
|
|
889
942
|
...process.env,
|
|
890
943
|
FORCE_COLOR: '0',
|
|
944
|
+
...(disableNativeSchedules ? { CLAUDE_CODE_DISABLE_CRON: '1' } : {}),
|
|
891
945
|
// Prevent nested session error
|
|
892
946
|
CLAUDECODE: '',
|
|
893
947
|
CLAUDE_CODE: '',
|
|
@@ -903,7 +957,9 @@ class ClaudePersistentExecutor extends events_1.EventEmitter {
|
|
|
903
957
|
this.turnLedger.changed();
|
|
904
958
|
});
|
|
905
959
|
this.nativeScheduleTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
906
|
-
|
|
960
|
+
// Observe restored lifecycle frames even before managed tools/catalogs exist.
|
|
961
|
+
// Installing the adapter does not adopt or authorize any native definition.
|
|
962
|
+
if (!this.delegationWorker)
|
|
907
963
|
this.schedules();
|
|
908
964
|
if (this.delegationWorker)
|
|
909
965
|
this.workerGroups.track(child);
|
|
@@ -2193,7 +2249,7 @@ class ClaudePersistentExecutor extends events_1.EventEmitter {
|
|
|
2193
2249
|
}
|
|
2194
2250
|
return;
|
|
2195
2251
|
}
|
|
2196
|
-
if (this.
|
|
2252
|
+
if (this.scheduleGuardRequired && !this.scheduleHooksReady && !this.delegationWorker) {
|
|
2197
2253
|
// Initialize callback hooks once per native process before its first model turn.
|
|
2198
2254
|
this.isStarting = true;
|
|
2199
2255
|
try {
|
|
@@ -2333,7 +2389,7 @@ class ClaudePersistentExecutor extends events_1.EventEmitter {
|
|
|
2333
2389
|
if (this.modelChange)
|
|
2334
2390
|
return { success: false, error: 'Native model change is pending or unconfirmed. Retry /model after its reply, or use /clear (session-only schedules will be lost).' };
|
|
2335
2391
|
if (((this.abortOperation || this.retainedAbort) && !(this.cleanupAdmission() && options.nativeScheduleManagement && options.nativeScheduleCurrent?.()))
|
|
2336
|
-
|| this.hasUncertainShutdown() || (this.scheduleCleanupHost && !options.nativeScheduleManagement)) {
|
|
2392
|
+
|| this.hasUncertainShutdown() || ((this.scheduleCleanupHost || this.reviewedCleanupActive) && !options.nativeScheduleManagement)) {
|
|
2337
2393
|
return { success: false, error: 'Native cleanup is still pending. Retry after cleanup.' };
|
|
2338
2394
|
}
|
|
2339
2395
|
try {
|
|
@@ -2812,7 +2868,7 @@ class ClaudePersistentExecutor extends events_1.EventEmitter {
|
|
|
2812
2868
|
this.turnLedger.version = typeof rawResponse.claude_code_version === 'string' ? rawResponse.claude_code_version : undefined;
|
|
2813
2869
|
this.turnLedger.pid = typeof rawResponse.pid === 'number' ? rawResponse.pid : undefined;
|
|
2814
2870
|
const { models, rawEntries } = (0, ClaudeSettings_1.parseClaudeModelsCatalog)(rawResponse.models, this.reportedModel || this.acknowledgedModel || this.model);
|
|
2815
|
-
if (scheduleHooks && this.
|
|
2871
|
+
if (scheduleHooks && this.scheduleGuardRequired) {
|
|
2816
2872
|
await this.readNativeScheduleTimezone();
|
|
2817
2873
|
}
|
|
2818
2874
|
if (scheduleHooks) {
|
|
@@ -3006,10 +3062,10 @@ class ClaudePersistentExecutor extends events_1.EventEmitter {
|
|
|
3006
3062
|
await this.stopProcess();
|
|
3007
3063
|
// Step 2: Run compact as a one-shot process outside the full context
|
|
3008
3064
|
const compactResult = await new Promise((resolve) => {
|
|
3009
|
-
const child = (0, OwnershipRuntime_1.ownedSpawn)(this.claudeCommand, ['--resume', sessionIdBeforeCompact, '--
|
|
3065
|
+
const child = (0, OwnershipRuntime_1.ownedSpawn)(this.claudeCommand, ['--resume', sessionIdBeforeCompact, '--print', '/compact'], {
|
|
3010
3066
|
cwd: this.currentWorkingDirectory,
|
|
3011
3067
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
3012
|
-
env: { ...process.env, FORCE_COLOR: '0', CLAUDECODE: '', CLAUDE_CODE: '' },
|
|
3068
|
+
env: { ...process.env, FORCE_COLOR: '0', CLAUDECODE: '', CLAUDE_CODE: '', CLAUDE_CODE_DISABLE_CRON: '1' },
|
|
3013
3069
|
});
|
|
3014
3070
|
let output = '';
|
|
3015
3071
|
child.stdout?.on('data', (data) => {
|