@yu_robotics/remote-cli 1.6.247 → 1.6.251

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.
Files changed (90) hide show
  1. package/dist/client/MessageHandler.d.ts +6 -2
  2. package/dist/client/MessageHandler.d.ts.map +1 -1
  3. package/dist/client/MessageHandler.js +99 -29
  4. package/dist/client/MessageHandler.js.map +1 -1
  5. package/dist/client/WebSocketClient.d.ts +3 -0
  6. package/dist/client/WebSocketClient.d.ts.map +1 -1
  7. package/dist/client/WebSocketClient.js +3 -1
  8. package/dist/client/WebSocketClient.js.map +1 -1
  9. package/dist/commands/start.d.ts +5 -0
  10. package/dist/commands/start.d.ts.map +1 -1
  11. package/dist/commands/start.js +37 -0
  12. package/dist/commands/start.js.map +1 -1
  13. package/dist/executor/ClaudePersistentExecutor.d.ts.map +1 -1
  14. package/dist/executor/ClaudePersistentExecutor.js +7 -1
  15. package/dist/executor/ClaudePersistentExecutor.js.map +1 -1
  16. package/dist/files/FileInbox.d.ts +1 -0
  17. package/dist/files/FileInbox.d.ts.map +1 -1
  18. package/dist/files/FileInbox.js +49 -4
  19. package/dist/files/FileInbox.js.map +1 -1
  20. package/dist/index.js +2 -0
  21. package/dist/index.js.map +1 -1
  22. package/dist/maintenance/release-notes.json +1 -1
  23. package/dist/scheduling/ScheduleService.d.ts +20 -1
  24. package/dist/scheduling/ScheduleService.d.ts.map +1 -1
  25. package/dist/scheduling/ScheduleService.js +137 -36
  26. package/dist/scheduling/ScheduleService.js.map +1 -1
  27. package/dist/scheduling/ScheduleToolScope.d.ts.map +1 -1
  28. package/dist/scheduling/ScheduleToolScope.js +7 -0
  29. package/dist/scheduling/ScheduleToolScope.js.map +1 -1
  30. package/dist/scheduling/claude/ClaudeSessionSchedules.d.ts +7 -0
  31. package/dist/scheduling/claude/ClaudeSessionSchedules.d.ts.map +1 -1
  32. package/dist/scheduling/claude/ClaudeSessionSchedules.js +121 -38
  33. package/dist/scheduling/claude/ClaudeSessionSchedules.js.map +1 -1
  34. package/dist/service/SessionHostSupervisor.d.ts +63 -0
  35. package/dist/service/SessionHostSupervisor.d.ts.map +1 -0
  36. package/dist/service/SessionHostSupervisor.js +323 -0
  37. package/dist/service/SessionHostSupervisor.js.map +1 -0
  38. package/dist/sessionHost/HostClient.d.ts +49 -0
  39. package/dist/sessionHost/HostClient.d.ts.map +1 -0
  40. package/dist/sessionHost/HostClient.js +101 -0
  41. package/dist/sessionHost/HostClient.js.map +1 -0
  42. package/dist/sessionHost/HostProtocol.d.ts +65 -0
  43. package/dist/sessionHost/HostProtocol.d.ts.map +1 -0
  44. package/dist/sessionHost/HostProtocol.js +78 -0
  45. package/dist/sessionHost/HostProtocol.js.map +1 -0
  46. package/dist/sessionHost/HostServer.d.ts +52 -0
  47. package/dist/sessionHost/HostServer.d.ts.map +1 -0
  48. package/dist/sessionHost/HostServer.js +413 -0
  49. package/dist/sessionHost/HostServer.js.map +1 -0
  50. package/dist/sessionHost/HostStore.d.ts +43 -0
  51. package/dist/sessionHost/HostStore.d.ts.map +1 -0
  52. package/dist/sessionHost/HostStore.js +206 -0
  53. package/dist/sessionHost/HostStore.js.map +1 -0
  54. package/dist/sessionHost/RetainedFrontend.d.ts +63 -0
  55. package/dist/sessionHost/RetainedFrontend.d.ts.map +1 -0
  56. package/dist/sessionHost/RetainedFrontend.js +244 -0
  57. package/dist/sessionHost/RetainedFrontend.js.map +1 -0
  58. package/dist/sessionHost/RetainedHostLauncher.d.ts +25 -0
  59. package/dist/sessionHost/RetainedHostLauncher.d.ts.map +1 -0
  60. package/dist/sessionHost/RetainedHostLauncher.js +132 -0
  61. package/dist/sessionHost/RetainedHostLauncher.js.map +1 -0
  62. package/dist/sessionHost/RetainedRuntime.d.ts +62 -0
  63. package/dist/sessionHost/RetainedRuntime.d.ts.map +1 -0
  64. package/dist/sessionHost/RetainedRuntime.js +478 -0
  65. package/dist/sessionHost/RetainedRuntime.js.map +1 -0
  66. package/dist/sessionHost/RuntimeJournal.d.ts +47 -0
  67. package/dist/sessionHost/RuntimeJournal.d.ts.map +1 -0
  68. package/dist/sessionHost/RuntimeJournal.js +103 -0
  69. package/dist/sessionHost/RuntimeJournal.js.map +1 -0
  70. package/dist/sessionHost/entry.d.ts +13 -0
  71. package/dist/sessionHost/entry.d.ts.map +1 -0
  72. package/dist/sessionHost/entry.js +107 -0
  73. package/dist/sessionHost/entry.js.map +1 -0
  74. package/dist/update/AutomaticUpdater.d.ts +2 -1
  75. package/dist/update/AutomaticUpdater.d.ts.map +1 -1
  76. package/dist/update/AutomaticUpdater.js +26 -12
  77. package/dist/update/AutomaticUpdater.js.map +1 -1
  78. package/dist/update/PinnedHostBundle.d.ts +49 -0
  79. package/dist/update/PinnedHostBundle.d.ts.map +1 -0
  80. package/dist/update/PinnedHostBundle.js +309 -0
  81. package/dist/update/PinnedHostBundle.js.map +1 -0
  82. package/native/prebuilds/darwin-arm64/managed_native.node +0 -0
  83. package/native/prebuilds/darwin-arm64/manifest.json +1 -1
  84. package/native/prebuilds/darwin-x64/managed_native.node +0 -0
  85. package/native/prebuilds/darwin-x64/manifest.json +1 -1
  86. package/native/prebuilds/win32-arm64/managed_native.node +0 -0
  87. package/native/prebuilds/win32-arm64/manifest.json +1 -1
  88. package/native/prebuilds/win32-x64/managed_native.node +0 -0
  89. package/native/prebuilds/win32-x64/manifest.json +1 -1
  90. package/package.json +1 -1
@@ -46,6 +46,8 @@ export interface ScheduleServiceOptions {
46
46
  provider: NativeScheduleProvider;
47
47
  /** Reject when disconnected or not delivered. Success is not an exactly-once receipt. */
48
48
  deliver: (delivery: ScheduleDelivery) => Promise<void>;
49
+ /** Retained hosts acknowledge native acceptance after persistence, not Router latency. */
50
+ deferDelivery?: boolean;
49
51
  isOwnerCurrent: (owner: ScheduleOwner) => boolean;
50
52
  /** Framework observation of late native mutations, never model-supplied proof. */
51
53
  isNativeMutationPending?: (owner: ScheduleOwner) => boolean;
@@ -106,6 +108,8 @@ export declare class ScheduleService {
106
108
  private suspending;
107
109
  private handoffUnresolved;
108
110
  private suspension?;
111
+ private hostRetirement?;
112
+ private hostsRetired;
109
113
  constructor(options: ScheduleServiceOptions);
110
114
  initialize(): Promise<void>;
111
115
  /** Sequential startup/reconnect reconciliation. Never drives the native schedule clock. */
@@ -136,8 +140,23 @@ export declare class ScheduleService {
136
140
  private forgetCleanup;
137
141
  private retryCleanup;
138
142
  private purgeRecord;
143
+ /** Durable outputs still awaiting their external delivery receipt. */
144
+ hasPendingResults(): boolean;
139
145
  /** Includes terminal jobs whose native process exit is still unconfirmed. */
140
146
  hasActiveSchedules(threadId?: string): boolean;
147
+ /** Admission to explicit process retirement, NOT proof of native exit or queue
148
+ * reconstruction. Only the original live handles can supply deletion receipts.
149
+ */
150
+ canRetireDrainedHosts(): boolean;
151
+ /** Synchronous fence: no asynchronous gap between checking and revoking new
152
+ * schedule operations. Retain exact pre-exit deletion receipts for finalization.
153
+ */
154
+ beginDrainedHostRetirement(): void;
155
+ /** Called only after the owner joined its original executor groups and drained
156
+ * native callback ingestion. Never calls stop/cancel/releaseForRestart on a
157
+ * provider. Failure preserves the same retirement fence, handles and catalog.
158
+ */
159
+ finishDrainedHostRetirement(): Promise<void>;
141
160
  /** Card eligibility includes retryable cleanup even for a terminal catalog record. */
142
161
  canCancel(owner: ScheduleOwner, id: string): boolean;
143
162
  /** Newly observed cleanup facts never supply historical recovery proof. The optional
@@ -145,7 +164,7 @@ export declare class ScheduleService {
145
164
  recordReviewedCleanup(owner: ScheduleOwner, ids: string[], absent: boolean, retirementConfirmed?: () => boolean): Promise<void>;
146
165
  /** Keep admitted native work visible when cleanup cannot safely acquire its host. */
147
166
  retainCleanupError(owner: ScheduleOwner, id: string, error: unknown): Promise<void>;
148
- /** User-requested native reconciliation only; no background polling is installed. */
167
+ /** Observe native inventory without deleting definitions or retiring native work. */
149
168
  refresh(owner: ScheduleOwner): Promise<void>;
150
169
  private refreshNative;
151
170
  cancel(owner: ScheduleOwner, id: string): Promise<ScheduleRec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OAAO,CAAC,KAAK;IASb,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,KAAK;IAMb,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,MAAM;YAMA,WAAW;IAgCzB,OAAO,CAAC,IAAI;YA8GE,OAAO;CA4BtB"}
@@ -143,6 +143,8 @@ class ScheduleService {
143
143
  suspending = false;
144
144
  handoffUnresolved = false;
145
145
  suspension;
146
+ hostRetirement;
147
+ hostsRetired = false;
146
148
  constructor(options) {
147
149
  this.options = { ...options };
148
150
  this.now = options.now ?? Date.now;
@@ -858,11 +860,87 @@ class ScheduleService {
858
860
  return erase(evidence);
859
861
  });
860
862
  }
863
+ /** Durable outputs still awaiting their external delivery receipt. */
864
+ hasPendingResults() { return this.pending.size > 0; }
861
865
  /** Includes terminal jobs whose native process exit is still unconfirmed. */
862
866
  hasActiveSchedules(threadId) {
863
867
  return [...this.records.values()].some(record => (!threadId || record.threadId === threadId)
864
868
  && (LIVE.has(record.state) || recoveryOwnsWork(record) || (this.runtimes.has(record.id) && !this.runtimes.get(record.id).stopped)));
865
869
  }
870
+ /** Admission to explicit process retirement, NOT proof of native exit or queue
871
+ * reconstruction. Only the original live handles can supply deletion receipts.
872
+ */
873
+ canRetireDrainedHosts() {
874
+ if (!this.initialized || this.closing || this.fault || this.hostRetirement || this.suspending
875
+ || this.handoffUnresolved || this.recoveryRun || this.operations.size || this.tasks.size
876
+ || this.recordOperations.size || this.pending.size || this.delivering.size || this.refreshes
877
+ || this.retainedCancellations.size || this.purges.size || this.cleanup.size)
878
+ return false;
879
+ try {
880
+ this.catalogGate?.verify();
881
+ return [...this.records.values()].every(record => {
882
+ if (record.error || record.recovery || !this.current(record) || this.options.isNativeMutationPending?.(ownerOf(record)))
883
+ return false;
884
+ const runtime = this.runtimes.get(record.id);
885
+ if (!runtime)
886
+ return record.state === 'cancelled' && record.cancelRequested === true && record.cleanupConfirmed === true;
887
+ if (!runtime.handle || runtime.running.size || runtime.heldDeliveries.size || runtime.cancelling || runtime.releasing)
888
+ return false;
889
+ if (record.state === 'completed')
890
+ return record.rule.kind === 'once' && runtime.completed.size > 0;
891
+ return record.state === 'cancelled' && record.cancelRequested === true && runtime.removalConfirmed === true
892
+ && (runtime.handle.nativeDefinitionAbsent === true || runtime.stopped && record.cleanupConfirmed === true);
893
+ });
894
+ }
895
+ catch {
896
+ return false;
897
+ }
898
+ }
899
+ /** Synchronous fence: no asynchronous gap between checking and revoking new
900
+ * schedule operations. Retain exact pre-exit deletion receipts for finalization.
901
+ */
902
+ beginDrainedHostRetirement() {
903
+ if (this.hostRetirement)
904
+ return;
905
+ if (!this.canRetireDrainedHosts())
906
+ throw new Error('Native schedules are not drained for explicit host retirement.');
907
+ this.hostRetirement = new Map([...this.runtimes].map(([id, runtime]) => [id,
908
+ { runtime, cancelled: this.records.get(id)?.cancelRequested === true && runtime.removalConfirmed === true }]));
909
+ }
910
+ /** Called only after the owner joined its original executor groups and drained
911
+ * native callback ingestion. Never calls stop/cancel/releaseForRestart on a
912
+ * provider. Failure preserves the same retirement fence, handles and catalog.
913
+ */
914
+ async finishDrainedHostRetirement() {
915
+ if (!this.hostRetirement)
916
+ throw new Error('Explicit host retirement was not admitted.');
917
+ while (this.tasks.size)
918
+ await Promise.allSettled([...this.tasks]);
919
+ await this.deliveryTail;
920
+ await this.serial(async () => {
921
+ if (this.fault)
922
+ throw this.fault;
923
+ if (this.pending.size || this.operations.size || this.recordOperations.size || this.delivering.size)
924
+ throw new Error('Native retirement still owns pending work or output.');
925
+ for (const [id, proof] of this.hostRetirement) {
926
+ const runtime = this.runtimes.get(id), record = this.records.get(id);
927
+ if (runtime !== proof.runtime || !record || runtime.running.size || runtime.heldDeliveries.size
928
+ || !(runtime.stopped || runtime.handle?.retirementConfirmed === true))
929
+ throw new Error('Exact native host retirement is unconfirmed.');
930
+ }
931
+ for (const [id, proof] of this.hostRetirement) {
932
+ proof.runtime.stopped = true;
933
+ proof.runtime.releaseAdmission?.();
934
+ proof.runtime.releaseAdmission = undefined;
935
+ // AGY invalidates its inventory view after exit. Preserve the exact
936
+ // deletion receipt captured BEFORE exit rather than querying a new host.
937
+ if (proof.cancelled)
938
+ this.records.get(id).cleanupConfirmed = true;
939
+ }
940
+ await this.persist();
941
+ this.hostsRetired = true;
942
+ });
943
+ }
866
944
  /** Card eligibility includes retryable cleanup even for a terminal catalog record. */
867
945
  canCancel(owner, id) {
868
946
  this.checkReady();
@@ -923,50 +1001,60 @@ class ScheduleService {
923
1001
  await this.persist();
924
1002
  });
925
1003
  }
926
- /** User-requested native reconciliation only; no background polling is installed. */
1004
+ /** Observe native inventory without deleting definitions or retiring native work. */
927
1005
  refresh(owner) {
928
1006
  this.refreshes++;
929
- return this.operation(this.refreshNative(owner).finally(() => { this.refreshes--; }));
1007
+ return this.operation(this.refreshNative(structuredClone(owner)).finally(() => { this.refreshes--; }));
930
1008
  }
931
1009
  async refreshNative(owner) {
932
1010
  this.checkReady();
933
1011
  validateOwner(owner);
934
1012
  const candidates = await this.serial(async () => [...this.records.values()]
935
1013
  .filter(record => sameOwner(record, owner)).map(record => record.id));
1014
+ let failure;
936
1015
  for (const id of candidates) {
1016
+ const record = this.records.get(id);
937
1017
  const runtime = this.runtimes.get(id);
938
- if (!runtime?.handle || runtime.stopped || runtime.cancelling || runtime.running.size || !this.current(owner))
1018
+ const handle = runtime?.handle;
1019
+ if (!record || !runtime || !handle)
939
1020
  continue;
940
- if (!LIVE.has(this.records.get(id).state)) {
941
- await this.stop(id, runtime);
1021
+ const nativeId = record.nativeId;
1022
+ const completed = runtime.completed.size;
1023
+ // Recheck after every read: cancellation, execution or rebound may have
1024
+ // advanced while inventory was awaiting its native receipt.
1025
+ const readable = () => !this.closing && !this.fault && !this.suspending && this.current(owner)
1026
+ && this.records.get(id) === record && record.nativeId === nativeId && record.state === 'active' && !record.cancelRequested
1027
+ && this.runtimes.get(id) === runtime && runtime.handle === handle && !runtime.stopped && !runtime.cancelling
1028
+ && !runtime.running.size && runtime.completed.size === completed && !runtime.stopPromise && !runtime.releaseAdmission
1029
+ && !this.recordOperations.has(id) && !this.retainedCancellations.has(id);
1030
+ if (!readable())
942
1031
  continue;
943
- }
1032
+ let present;
944
1033
  try {
945
- const present = await runtime.handle.list();
946
- if (present)
947
- continue;
948
- await this.serial(async () => {
949
- const record = this.records.get(id);
950
- if (LIVE.has(record.state)) {
951
- record.state = 'interrupted';
952
- record.error = 'Native schedule is no longer listed; execution completion is not confirmed.';
953
- await this.persist();
954
- }
955
- });
956
- await this.stop(id, runtime);
1034
+ present = await handle.list();
1035
+ if (typeof present !== 'boolean')
1036
+ throw new Error('Native inventory returned no verified presence or absence.');
957
1037
  }
958
1038
  catch (error) {
959
- await this.serial(async () => {
960
- const record = this.records.get(id);
961
- if (LIVE.has(record.state))
962
- record.state = 'interrupted';
963
- record.error = errorText(error);
964
- if (!this.fault)
965
- await this.persist();
966
- });
967
- await this.stop(id, runtime);
1039
+ // Read uncertainty is not absence or cancellation authority. Leave the
1040
+ // durable record, recovery fences and future occurrence admission intact.
1041
+ if (readable())
1042
+ failure ??= new Error(`Native inventory could not be verified for ${id}: ${errorText(error)}`);
1043
+ continue;
968
1044
  }
1045
+ if (present)
1046
+ continue;
1047
+ await this.serial(async () => {
1048
+ if (!readable())
1049
+ return;
1050
+ record.state = 'interrupted';
1051
+ const detail = 'Native schedule is no longer listed; execution completion and cleanup are not confirmed.';
1052
+ record.error = record.error ? `${bounded(record.error, ERROR_BYTES - Buffer.byteLength(detail) - 1)}\n${detail}` : detail;
1053
+ await this.persist();
1054
+ });
969
1055
  }
1056
+ if (failure)
1057
+ throw failure;
970
1058
  }
971
1059
  cancel(owner, id) {
972
1060
  return this.operation(this.recordOperation(id, this.cancelSchedule(owner, id)));
@@ -1086,7 +1174,7 @@ class ScheduleService {
1086
1174
  }
1087
1175
  /** Snapshot eligibility is only admission to a handoff, never permission to install. */
1088
1176
  canSuspendForRestart() {
1089
- if (!this.initialized || this.closing || this.fault || this.suspending || this.recoveryRun || this.operations.size || this.pending.size)
1177
+ if (!this.initialized || this.closing || this.hostRetirement || this.fault || this.suspending || this.recoveryRun || this.operations.size || this.pending.size)
1090
1178
  return false;
1091
1179
  return [...this.records.values()].filter(record => LIVE.has(record.state) || recoveryOwnsWork(record)
1092
1180
  || !!this.runtimes.get(record.id) && !this.runtimes.get(record.id).stopped).every(record => {
@@ -1228,6 +1316,8 @@ class ScheduleService {
1228
1316
  return [...this.records.values()].some(record => !!record.recovery);
1229
1317
  }
1230
1318
  destroy() {
1319
+ if (this.hostRetirement && !this.hostsRetired)
1320
+ return Promise.reject(new Error('Explicit native host retirement remains unresolved.'));
1231
1321
  if (this.destruction)
1232
1322
  return this.destruction;
1233
1323
  const preserve = !this.closing && this.hasActiveSchedules() && this.canSuspendForRestart();
@@ -1370,6 +1460,10 @@ class ScheduleService {
1370
1460
  if (this.fault)
1371
1461
  throw this.fault;
1372
1462
  const record = this.records.get(id);
1463
+ if (this.hostRetirement && (event.type === 'started' || event.type === 'rebound'
1464
+ || (event.type === 'completed' || event.type === 'skipped') && !runtime.completed.has(event.occurrenceId))) {
1465
+ throw new Error('Unexpected native work during explicit retirement; retain the native event journal.');
1466
+ }
1373
1467
  if (this.suspending && event.type === 'stopped') {
1374
1468
  if (event.exitConfirmed === false)
1375
1469
  throw new Error('Native handoff exit unconfirmed.');
@@ -1502,8 +1596,13 @@ class ScheduleService {
1502
1596
  // Persistence failures still set the service fault inside persist().
1503
1597
  if (cleanup && !runtime.cancelling)
1504
1598
  this.track(this.stop(id, runtime).catch(() => { }));
1505
- if (delivery)
1506
- await this.attemptDeliveries([delivery], true);
1599
+ if (delivery) {
1600
+ const delivering = this.attemptDeliveries([delivery], true);
1601
+ if (this.options.deferDelivery)
1602
+ this.track(delivering);
1603
+ else
1604
+ await delivering;
1605
+ }
1507
1606
  }
1508
1607
  attemptDeliveries(ids, firstAttempt = false) {
1509
1608
  const run = this.deliveryTail.then(async () => {
@@ -1627,7 +1726,7 @@ class ScheduleService {
1627
1726
  }
1628
1727
  canAdmitOccurrence(id, runtime) {
1629
1728
  const record = this.records.get(id);
1630
- return !!record && this.runtimes.get(id) === runtime && !this.closing && !this.fault
1729
+ return !!record && this.runtimes.get(id) === runtime && !this.closing && !this.hostRetirement && !this.fault
1631
1730
  && !runtime.stopped && !runtime.cancelling && !record.cancelRequested
1632
1731
  && LIVE.has(record.state) && this.current(record);
1633
1732
  }
@@ -1641,8 +1740,9 @@ class ScheduleService {
1641
1740
  void task.catch(error => {
1642
1741
  // Persistence/protocol failures fail closed and stop native producers.
1643
1742
  this.fault ??= error instanceof Error ? error : new Error('Schedule service failed.');
1644
- for (const [id, runtime] of this.runtimes)
1645
- void this.stop(id, runtime).catch(() => { });
1743
+ if (!this.hostRetirement)
1744
+ for (const [id, runtime] of this.runtimes)
1745
+ void this.stop(id, runtime).catch(() => { });
1646
1746
  }).finally(() => this.tasks.delete(task));
1647
1747
  }
1648
1748
  operation(task) {
@@ -1682,7 +1782,7 @@ class ScheduleService {
1682
1782
  checkReady() {
1683
1783
  if (this.fault)
1684
1784
  throw this.fault;
1685
- if (!this.initialized || this.closing || this.suspending)
1785
+ if (!this.initialized || this.closing || this.hostRetirement || this.suspending)
1686
1786
  throw new Error('Schedule service is not initialized or is closed.');
1687
1787
  }
1688
1788
  serial(operation) {
@@ -1914,8 +2014,9 @@ class ScheduleService {
1914
2014
  }
1915
2015
  catch (error) {
1916
2016
  this.fault = error instanceof Error ? error : new Error('Schedule catalog write failed.');
1917
- for (const [id, runtime] of this.runtimes)
1918
- void this.stop(id, runtime).catch(() => { });
2017
+ if (!this.hostRetirement)
2018
+ for (const [id, runtime] of this.runtimes)
2019
+ void this.stop(id, runtime).catch(() => { });
1919
2020
  throw this.fault;
1920
2021
  }
1921
2022
  finally {