@yu_robotics/remote-cli 1.6.176 → 1.6.183
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/README.md +66 -2
- package/dist/client/MessageHandler.d.ts +1 -0
- package/dist/client/MessageHandler.d.ts.map +1 -1
- package/dist/client/MessageHandler.js +54 -15
- package/dist/client/MessageHandler.js.map +1 -1
- package/dist/delegation/DelegatedWorkerSessionStore.d.ts +11 -1
- package/dist/delegation/DelegatedWorkerSessionStore.d.ts.map +1 -1
- package/dist/delegation/DelegatedWorkerSessionStore.js +98 -51
- package/dist/delegation/DelegatedWorkerSessionStore.js.map +1 -1
- package/dist/delegation/DelegationManager.d.ts +2 -0
- package/dist/delegation/DelegationManager.d.ts.map +1 -1
- package/dist/delegation/DelegationManager.js +11 -0
- package/dist/delegation/DelegationManager.js.map +1 -1
- package/dist/executor/CodexAppServerClient.d.ts +2 -1
- package/dist/executor/CodexAppServerClient.d.ts.map +1 -1
- package/dist/executor/CodexAppServerClient.js +15 -11
- package/dist/executor/CodexAppServerClient.js.map +1 -1
- package/dist/executor/PiExecutor.d.ts.map +1 -1
- package/dist/executor/PiExecutor.js +2 -1
- package/dist/executor/PiExecutor.js.map +1 -1
- package/dist/maintenance/release-notes.json +1 -1
- package/dist/thread/ThreadContextReset.d.ts +12 -0
- package/dist/thread/ThreadContextReset.d.ts.map +1 -0
- package/dist/thread/ThreadContextReset.js +59 -0
- package/dist/thread/ThreadContextReset.js.map +1 -0
- package/dist/thread/ThreadExecutorPool.d.ts +8 -1
- package/dist/thread/ThreadExecutorPool.d.ts.map +1 -1
- package/dist/thread/ThreadExecutorPool.js +84 -1
- package/dist/thread/ThreadExecutorPool.js.map +1 -1
- package/dist/thread/ThreadManager.d.ts +2 -0
- package/dist/thread/ThreadManager.d.ts.map +1 -1
- package/dist/thread/ThreadManager.js +3 -0
- package/dist/thread/ThreadManager.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Remote control Claude Code, AGY CLI, Codex CLI, OpenCode CLI, Kimi Code CLI, ZCode, or Pi from anywhere using your mobile phone through Feishu (Lark) messaging.
|
|
4
4
|
|
|
5
|
+

|
|
6
|
+
|
|
5
7
|
## Features
|
|
6
8
|
|
|
7
9
|
- **Remote Control**: Control your local development environment from anywhere via mobile
|
|
8
10
|
- **Access Controls**: Working-directory allowlist and user-device binding
|
|
9
11
|
- **Mobile-Optimized**: Simplified commands and rich text formatting for Feishu
|
|
12
|
+
- **Illustrated Tips**: Browse Router-owned tutorials with `/tips`; copyable examples appear directly below usage instructions, with only Next, Mastered, and Settings controls. See [Illustrated Tips](../../README.md#illustrated-tips).
|
|
10
13
|
- **Readable Code Changes**: Edit operations show collapsible, line-aware diff previews inside the existing progress card
|
|
11
14
|
- **Multi-Backend Support**: Supports Claude Code, AGY CLI (Antigravity), Codex CLI (OpenAI), OpenCode CLI, Kimi Code CLI, ZCode, and Pi
|
|
12
15
|
- **Image Input and Output**: Forward Feishu images to supported backends and return Codex native image output. All backends can return local images through file paths or Markdown image links; files must be inside an allowed directory and no larger than 2 MiB. AGY does not accept image input.
|
|
@@ -179,8 +182,8 @@ Linux users upgrading from version 1.6.23 or earlier should run `remote-cli serv
|
|
|
179
182
|
| `/skills` | List available skills for the active backend |
|
|
180
183
|
| `/abort` | Abort executing task in current thread |
|
|
181
184
|
| `/queue` | Inspect or manage confirmed messages waiting in thread queues |
|
|
182
|
-
| `/clear` |
|
|
183
|
-
| `/new` | Alias for `/clear`; start
|
|
185
|
+
| `/clear` | Reset all direct backend and managed worker conversations for this thread |
|
|
186
|
+
| `/new` | Alias for `/clear`; start fresh across this thread's backends and workers |
|
|
184
187
|
| `/compact` | Compress history to save tokens |
|
|
185
188
|
| `/cd [dir]` | Browse directories as a card, or change directory directly with a path |
|
|
186
189
|
| `/model [name]` | Open native model settings, or set the active backend model with a text argument |
|
|
@@ -205,6 +208,52 @@ From CLI and Router 1.6.156, bare `/delegation` opens a thread-only On/Off card
|
|
|
205
208
|
|
|
206
209
|
Backend availability uses colored status badges: blue for the coordinator, green for installed workers, orange for blocked workers, red for unavailable backends and gray for unknown worker availability. Text labels and version or restriction details remain visible; these badges do not prove authentication or quota.
|
|
207
210
|
|
|
211
|
+
### Illustrated Tips
|
|
212
|
+
|
|
213
|
+
Use `/tips` to browse 27 short Chinese scenario cards, each with its own bundled
|
|
214
|
+
illustration based on the actual settings panels or task cards, a benefit, and a copyable example. Examples are educational text;
|
|
215
|
+
card buttons never execute them or change backend, model, effort, device, or thread.
|
|
216
|
+
Browsing works for bound users even while their CLI is offline.
|
|
217
|
+
Copyable examples appear directly below the usage instructions, followed by usage
|
|
218
|
+
notes. Cards offer only Next, Mastered, and Settings controls.
|
|
219
|
+
|
|
220
|
+
The library includes directory browsing, named project threads, tool-row details,
|
|
221
|
+
managed delegation controls and worker resets, Codex speed and goals, and native
|
|
222
|
+
command sandbox settings. Backend-specific tutorials explain their prerequisites;
|
|
223
|
+
examples and illustrations never activate those features themselves.
|
|
224
|
+
Two Easter-egg tutorials explain the Codex weekly-quota and banked-reset-credit
|
|
225
|
+
notifications. These are passive status snapshots: remote-cli does not grant,
|
|
226
|
+
claim, or consume reset credits, and reading a tip never starts a model task.
|
|
227
|
+
|
|
228
|
+
| Command | Result |
|
|
229
|
+
| --- | --- |
|
|
230
|
+
| `/tips next` / `/tips list` | Read another tip or browse the library |
|
|
231
|
+
| `/tips settings` | View subscription, mute, and timezone settings |
|
|
232
|
+
| `/tips daily` / `/tips weekly` | Explicitly subscribe daily or on Tuesday and Thursday |
|
|
233
|
+
| `/tips mute 7` | Pause automatic tips for seven days (1-365 supported) |
|
|
234
|
+
| `/tips unmute` | Remove the pause without enabling a disabled subscription |
|
|
235
|
+
| `/tips off` | Disable automatic tips permanently until explicitly subscribed again |
|
|
236
|
+
| `/tips timezone Asia/Shanghai` | Select the IANA timezone for this user's schedule |
|
|
237
|
+
|
|
238
|
+
Automatic delivery is **daily by default**. Tips are due at 10:30 in the
|
|
239
|
+
user's timezone (default `Asia/Shanghai`), within 10:30-19:00 only, at most once per
|
|
240
|
+
local day and at least 20 hours apart. Delivery requires a bound online device,
|
|
241
|
+
bot activity within seven days, two minutes of quiet, and no task currently visible
|
|
242
|
+
to the Router. This check cannot observe every backend-local operation or queue.
|
|
243
|
+
Offline periods create no backlog; device registration never triggers tips.
|
|
244
|
+
Settings cards offer 1/3/7/14-day mute controls. Seen or mastered tips are skipped.
|
|
245
|
+
Existing default-off records adopt daily delivery; explicit opt-outs, mute deadlines,
|
|
246
|
+
chosen frequencies, reading progress, and delivery cooldowns are preserved.
|
|
247
|
+
|
|
248
|
+
The Router stores private per-user preferences and delivery intent beside its
|
|
249
|
+
configuration. A send with an uncertain result is suppressed rather than replayed.
|
|
250
|
+
Run one Router process per storage directory; this is not multi-replica delivery.
|
|
251
|
+
Optional Router configuration `tips.enabled: false` disables automatic delivery
|
|
252
|
+
globally while retaining browsing; `tips.timezone` sets the default IANA timezone.
|
|
253
|
+
Tips use reviewed bundled content and static PNGs, with no model calls or catalog
|
|
254
|
+
probes. Some examples require a compatible CLI; the backend tip includes the text
|
|
255
|
+
command alternative for clients without settings cards.
|
|
256
|
+
|
|
208
257
|
### Threads & Machines
|
|
209
258
|
|
|
210
259
|
From CLI 1.6.121, new and existing threads without a saved preference enable
|
|
@@ -490,6 +539,21 @@ Claude Code also supports opt-in `/sandbox` policies. Workspace-write mode autom
|
|
|
490
539
|
- **Device authentication**: Each device has a unique hardware-based ID
|
|
491
540
|
- **Binding codes**: Expire after 5 minutes
|
|
492
541
|
|
|
542
|
+
From CLI 1.6.177, `/clear` and its `/new` alias reset the entire current
|
|
543
|
+
thread's conversation context: all direct backend session bindings and every
|
|
544
|
+
managed worker conversation, across backends and parallel worker lanes. The
|
|
545
|
+
working directory, files, Git artifacts, archived native transcripts, login,
|
|
546
|
+
backend/model/effort selections, delegation preference, and sandbox grants are
|
|
547
|
+
preserved. Other threads are unaffected. A later backend switch starts fresh
|
|
548
|
+
instead of restoring a pre-clear binding. Busy tasks, queued work, and workers
|
|
549
|
+
with unconfirmed shutdowns must settle before clearing. Reset intent is saved
|
|
550
|
+
before any session binding changes. A persisted reset intent blocks old
|
|
551
|
+
conversations until clearing succeeds, including after a CLI restart. If
|
|
552
|
+
clearing fails, resolve the reported problem and retry `/clear` or `/new`.
|
|
553
|
+
Service shutdown waits for retained cleanup and reports unconfirmed native exits
|
|
554
|
+
before acknowledging completion.
|
|
555
|
+
Single-worker **Clear context** controls still reset only the selected worker.
|
|
556
|
+
|
|
493
557
|
## Session Resume
|
|
494
558
|
|
|
495
559
|
CLI 1.6.164 supports confirmed Pi native session connections and read-only Pi/Codex/Claude Code discovery. Adopted Pi history reloads before every remote turn; `/session detach` preserves it and `/session release` is removed. Foreground Pi `/new` and `/clear` also preserve old history and start independent IDs; new default names use native session IDs and persisted names are not overwritten on reopen. Worker/metadata cleanup is unchanged. Resume drafts keep ordinary messages in the current conversation until confirmation succeeds. Use only one side at a time. Local Pi windows may stay open but must use native `/resume` before their next local turn; automatic local refresh and writer locking are not provided. Existing Router command/response envelopes support the text workflow without a new wire capability. See the [session resume specification](../../SESSION_RESUME_SPEC.md).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageHandler.d.ts","sourceRoot":"","sources":["../../src/client/MessageHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAQpD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAgK,MAAM,UAAU,CAAC;AACzM,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAOxD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"MessageHandler.d.ts","sourceRoot":"","sources":["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e;IAiBvB,OAAO,CAAC,WAAW;IAgBnB,OAAO,CAAC,cAAc;IAgBtB,OAAO,CAAC,sBAAsB;IAyB9B,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,oBAAoB;IAe5B,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,SAAS;IAiBjB,OAAO,CAAC,qBAAqB;IAmB7B,OAAO,CAAC,YAAY;IAsDpB,OAAO,CAAC,qBAAqB;IAI7B,8EAA8E;YAChE,sBAAsB;IAgBpC,OAAO,CAAC,aAAa;IAerB,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;CAuB/B"}
|
|
@@ -29,6 +29,7 @@ const uuid_1 = require("uuid");
|
|
|
29
29
|
const ZCodeCommand_1 = require("../executor/zcode/ZCodeCommand");
|
|
30
30
|
const DelegationManager_1 = require("../delegation/DelegationManager");
|
|
31
31
|
const DelegationBridge_1 = require("../delegation/DelegationBridge");
|
|
32
|
+
const DelegatedWorkerSessionStore_1 = require("../delegation/DelegatedWorkerSessionStore");
|
|
32
33
|
const contract_1 = require("../delegation/contract");
|
|
33
34
|
const DelegationStatusFormatter_1 = require("../delegation/DelegationStatusFormatter");
|
|
34
35
|
const WorkerPolicy_1 = require("../delegation/WorkerPolicy");
|
|
@@ -205,7 +206,7 @@ class MessageHandler {
|
|
|
205
206
|
for (const delivery of this.imageDeliveries.values())
|
|
206
207
|
delivery.invalidatePending();
|
|
207
208
|
});
|
|
208
|
-
this.delegation = new DelegationManager_1.DelegationManager(directoryGuard);
|
|
209
|
+
this.delegation = new DelegationManager_1.DelegationManager(directoryGuard, undefined, undefined, undefined, undefined, undefined, new DelegatedWorkerSessionStore_1.DelegatedWorkerSessionStore(undefined, threadManager.contextResets));
|
|
209
210
|
this.settingsCatalogReader = new SettingsCatalog_1.SettingsCatalogReader(directoryGuard);
|
|
210
211
|
this.settingsService = new SettingsService_1.SettingsService({
|
|
211
212
|
state: id => this.settingsState(id),
|
|
@@ -410,7 +411,12 @@ class MessageHandler {
|
|
|
410
411
|
async handleCommandMessage(message, fileOrder) {
|
|
411
412
|
const threadId = message.threadId ?? this.threadManager.getDefaultThread().id;
|
|
412
413
|
const content = message.content?.trim() ?? '';
|
|
413
|
-
const
|
|
414
|
+
const clearing = content === '/clear' || content === '/new';
|
|
415
|
+
const body = () => {
|
|
416
|
+
if (!clearing)
|
|
417
|
+
this.threadManager.contextResets.assertReady(threadId);
|
|
418
|
+
return this.handleAdmittedCommandMessage(message, fileOrder);
|
|
419
|
+
};
|
|
414
420
|
this.messageOpenIds.set(message.messageId, message.openId);
|
|
415
421
|
if ((0, SessionResumeService_1.isSessionControl)(content)) {
|
|
416
422
|
if (!this.threadManager.getThread(threadId)) {
|
|
@@ -419,11 +425,13 @@ class MessageHandler {
|
|
|
419
425
|
}
|
|
420
426
|
let response;
|
|
421
427
|
try {
|
|
428
|
+
this.threadManager.contextResets.assertReady(threadId);
|
|
422
429
|
const control = () => this.sessionControl.handle(content, { openId: message.openId, threadId });
|
|
423
430
|
// Only Pi confirmations mutate native context. Other catalogs remain read-only.
|
|
424
431
|
if (this.threadPool.getBackendKey(threadId) === 'pi' && /^\/(?:resume|r|session)\s+confirm(?:\s|$)/i.test(content)) {
|
|
425
432
|
try {
|
|
426
433
|
response = await this.settingsAdmission.mutation(threadId, async () => {
|
|
434
|
+
this.threadManager.contextResets.assertReady(threadId);
|
|
427
435
|
this.settingsService.invalidate(threadId);
|
|
428
436
|
try {
|
|
429
437
|
return await control();
|
|
@@ -451,7 +459,7 @@ class MessageHandler {
|
|
|
451
459
|
// Abort and addressed human replies must remain available during native work.
|
|
452
460
|
if (content === '/abort' || /^(?:yes|no)(?:\s|$)/.test(content) || content.startsWith('/input '))
|
|
453
461
|
return await body();
|
|
454
|
-
if (/^\/(?:backend|model|effort|cd)\s+\S/.test(content)) {
|
|
462
|
+
if (clearing || /^\/(?:backend|model|effort|cd)\s+\S/.test(content)) {
|
|
455
463
|
const global = /^\/backend\s/.test(content) && !/\s@$/.test(content);
|
|
456
464
|
await this.settingsAdmission.mutation(global ? '*' : threadId, async () => {
|
|
457
465
|
this.settingsService.invalidate(global ? undefined : threadId);
|
|
@@ -469,7 +477,7 @@ class MessageHandler {
|
|
|
469
477
|
}
|
|
470
478
|
}
|
|
471
479
|
catch (error) {
|
|
472
|
-
this.sendResponse(message.messageId, threadId, { success: false, error: error instanceof Error ? error.message : 'Command admission failed.' });
|
|
480
|
+
this.sendResponse(message.messageId, threadId, { success: false, error: error instanceof Error ? error.message : 'Command admission failed.' }, clearing);
|
|
473
481
|
}
|
|
474
482
|
}
|
|
475
483
|
async handleAdmittedCommandMessage(message, fileOrder) {
|
|
@@ -497,6 +505,10 @@ class MessageHandler {
|
|
|
497
505
|
return;
|
|
498
506
|
}
|
|
499
507
|
const settingsCommand = content?.trim() ?? '';
|
|
508
|
+
if (settingsCommand === '/clear' || settingsCommand === '/new') {
|
|
509
|
+
await this.clearThreadConversation(messageId, resolvedThreadId);
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
500
512
|
if (this.directoryCardsSupported && openId && settingsCommand === '/cd') {
|
|
501
513
|
try {
|
|
502
514
|
const menu = await this.directoryBrowser.open(resolvedThreadId, openId, messageId);
|
|
@@ -932,6 +944,30 @@ class MessageHandler {
|
|
|
932
944
|
this.wsClient.send({ type: 'worker_context_reset_result', messageId: request.messageId,
|
|
933
945
|
success: !error, ...(error ? { error } : {}), timestamp: Date.now() });
|
|
934
946
|
}
|
|
947
|
+
async clearThreadConversation(messageId, threadId) {
|
|
948
|
+
if (this.threadPool.isThreadBusy(threadId) || this.hasThreadQueueState(threadId)
|
|
949
|
+
|| this.abortOperations.has(threadId) || this.activeThreadOperations.has(threadId)) {
|
|
950
|
+
throw new Error('This thread is busy or has queued messages. Wait for it to finish and clear its queue before retrying /clear.');
|
|
951
|
+
}
|
|
952
|
+
this.threadPool.assertContextResettable(threadId);
|
|
953
|
+
const token = this.beginThreadOperation(threadId);
|
|
954
|
+
try {
|
|
955
|
+
await this.delegation.assertThreadContextResettable(threadId);
|
|
956
|
+
await this.threadManager.contextResets.begin(threadId);
|
|
957
|
+
await this.threadPool.clearThreadContext(threadId);
|
|
958
|
+
await this.delegation.clearThreadContexts(threadId);
|
|
959
|
+
await this.threadManager.contextResets.complete(threadId);
|
|
960
|
+
this.sendResponse(messageId, threadId, { success: true,
|
|
961
|
+
output: 'Conversation context cleared for all direct backends and managed workers in this thread.' }, true);
|
|
962
|
+
}
|
|
963
|
+
catch (error) {
|
|
964
|
+
const detail = error instanceof Error ? error.message : 'Local context storage is unavailable';
|
|
965
|
+
throw new Error(`Could not clear thread conversation: ${detail}. Check local CLI storage and retry /clear or /new.`);
|
|
966
|
+
}
|
|
967
|
+
finally {
|
|
968
|
+
this.finishThreadOperation(threadId, token);
|
|
969
|
+
}
|
|
970
|
+
}
|
|
935
971
|
/**
|
|
936
972
|
* Handle built-in commands (thread-scoped).
|
|
937
973
|
* Returns true if handled.
|
|
@@ -1165,14 +1201,6 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
1165
1201
|
});
|
|
1166
1202
|
return true;
|
|
1167
1203
|
}
|
|
1168
|
-
if (trimmed === '/clear' || trimmed === '/new') {
|
|
1169
|
-
executor.resetContext();
|
|
1170
|
-
this.sendResponse(messageId, threadId, {
|
|
1171
|
-
success: true,
|
|
1172
|
-
output: '✅ Conversation context cleared',
|
|
1173
|
-
});
|
|
1174
|
-
return true;
|
|
1175
|
-
}
|
|
1176
1204
|
if (trimmed === '/compact') {
|
|
1177
1205
|
if (!('compactWhenFull' in executor && typeof executor.compactWhenFull === 'function')) {
|
|
1178
1206
|
this.sendResponse(messageId, threadId, {
|
|
@@ -2837,6 +2865,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
2837
2865
|
return { success: true, output: `✅ Changed working directory to: ${cwd}${changed ? '\nConversation context cleared for all direct and delegated backends in this thread.' : ''}${cleanup.failed ? `\n⚠️ ${cleanup.failed} delegated worker lane(s) could not be cleaned up. Retry with /delegation reset after checking filesystem permissions.` : ''}` };
|
|
2838
2866
|
}
|
|
2839
2867
|
settingsState(threadId) {
|
|
2868
|
+
this.threadManager.contextResets.assertReady(threadId);
|
|
2840
2869
|
const thread = this.threadManager.getThread(threadId);
|
|
2841
2870
|
if (!thread)
|
|
2842
2871
|
return undefined;
|
|
@@ -2902,6 +2931,7 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
2902
2931
|
}
|
|
2903
2932
|
/** Shared native/persistent mutation for cards and parameterized text commands. */
|
|
2904
2933
|
async applyPreference(threadId, backend, kind, value, onStream) {
|
|
2934
|
+
this.threadManager.contextResets.assertReady(threadId);
|
|
2905
2935
|
const thread = this.threadManager.getThread(threadId);
|
|
2906
2936
|
if (!thread)
|
|
2907
2937
|
return { success: false, error: 'This thread no longer exists.' };
|
|
@@ -2975,6 +3005,9 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
2975
3005
|
}
|
|
2976
3006
|
async applyBackendSetting(threadId, backend, scope, followGlobal = false) {
|
|
2977
3007
|
try {
|
|
3008
|
+
for (const thread of scope === 'all' ? this.threadManager.listThreads() : [{ id: threadId }]) {
|
|
3009
|
+
this.threadManager.contextResets.assertReady(thread.id);
|
|
3010
|
+
}
|
|
2978
3011
|
if (followGlobal) {
|
|
2979
3012
|
await this.threadPool.destroyThread(threadId, { deleteData: false });
|
|
2980
3013
|
await this.threadManager.updateThread(threadId, { backend: undefined });
|
|
@@ -3140,14 +3173,20 @@ You can also use natural language commands to control Claude Code CLI.`,
|
|
|
3140
3173
|
await this.fileInbox?.destroy();
|
|
3141
3174
|
this.notificationAdapter.unregister();
|
|
3142
3175
|
try {
|
|
3143
|
-
await
|
|
3144
|
-
|
|
3176
|
+
const results = await Promise.allSettled([
|
|
3177
|
+
this.delegation.destroy(),
|
|
3178
|
+
...[...this.delegationBridges.values()].map(bridge => bridge.close()),
|
|
3179
|
+
this.threadPool.destroyAll({ deleteData: false, shutdown: true }),
|
|
3180
|
+
]);
|
|
3181
|
+
const failure = results.find((result) => result.status === 'rejected');
|
|
3182
|
+
if (failure)
|
|
3183
|
+
throw failure.reason;
|
|
3145
3184
|
this.delegationBridges.clear();
|
|
3146
|
-
await this.threadPool.destroyAll({ deleteData: false });
|
|
3147
3185
|
this.pendingApprovalCards.clear();
|
|
3148
3186
|
}
|
|
3149
3187
|
catch (err) {
|
|
3150
3188
|
console.error('Error destroying thread executors:', err);
|
|
3189
|
+
throw err;
|
|
3151
3190
|
}
|
|
3152
3191
|
}
|
|
3153
3192
|
}
|