@botlearn-course/daemon 0.0.26-beta.1 → 0.0.26-v2
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/runtimes/deepseek-tui.js +47 -30
- package/package.json +1 -1
|
@@ -408,19 +408,23 @@ export class DeepseekTuiAdapter {
|
|
|
408
408
|
};
|
|
409
409
|
}
|
|
410
410
|
finally {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
if (
|
|
416
|
-
PROCESS_POOL.
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
411
|
+
try {
|
|
412
|
+
opts.signal.removeEventListener("abort", onAbort);
|
|
413
|
+
if (handle && countedInFlight) {
|
|
414
|
+
handle.inFlight = Math.max(0, handle.inFlight - 1);
|
|
415
|
+
if (managedActivationId && !this.explicitServerUrl && handle.inFlight === 0) {
|
|
416
|
+
if (PROCESS_POOL.get(POOL_KEY) === handle)
|
|
417
|
+
PROCESS_POOL.delete(POOL_KEY);
|
|
418
|
+
shutdownHandle(handle, "managed-activation-finished");
|
|
419
|
+
}
|
|
420
|
+
else if (!this.explicitServerUrl) {
|
|
421
|
+
resetIdle(handle, POOL_KEY);
|
|
422
|
+
}
|
|
421
423
|
}
|
|
422
424
|
}
|
|
423
|
-
|
|
425
|
+
finally {
|
|
426
|
+
releaseTurn?.();
|
|
427
|
+
}
|
|
424
428
|
}
|
|
425
429
|
}
|
|
426
430
|
resolveBinary() {
|
|
@@ -492,8 +496,7 @@ export class DeepseekTuiAdapter {
|
|
|
492
496
|
visionConfigPath = createManagedVisionConfig(opts, progressMcpConfig);
|
|
493
497
|
}
|
|
494
498
|
catch (error) {
|
|
495
|
-
|
|
496
|
-
await courseSkillsMcpServer?.close();
|
|
499
|
+
cleanupDeepseekResources({ progressMcpConfig, courseSkillsMcpServer });
|
|
497
500
|
throw error;
|
|
498
501
|
}
|
|
499
502
|
const binary = this.resolveBinary();
|
|
@@ -523,8 +526,7 @@ export class DeepseekTuiAdapter {
|
|
|
523
526
|
});
|
|
524
527
|
}
|
|
525
528
|
catch (error) {
|
|
526
|
-
|
|
527
|
-
await courseSkillsMcpServer?.close();
|
|
529
|
+
cleanupDeepseekResources({ progressMcpConfig, courseSkillsMcpServer });
|
|
528
530
|
throw error;
|
|
529
531
|
}
|
|
530
532
|
installExitCleanupHook();
|
|
@@ -547,19 +549,14 @@ export class DeepseekTuiAdapter {
|
|
|
547
549
|
handle.closed = true;
|
|
548
550
|
if (PROCESS_POOL.get(POOL_KEY) === handle)
|
|
549
551
|
PROCESS_POOL.delete(POOL_KEY);
|
|
550
|
-
|
|
551
|
-
handle.progressMcpConfig = undefined;
|
|
552
|
-
void handle.courseSkillsMcpServer?.close();
|
|
553
|
-
handle.courseSkillsMcpServer = undefined;
|
|
552
|
+
cleanupDeepseekResources(handle);
|
|
554
553
|
});
|
|
555
554
|
child.on("error", () => {
|
|
556
555
|
handle.closed = true;
|
|
557
556
|
if (PROCESS_POOL.get(POOL_KEY) === handle)
|
|
558
557
|
PROCESS_POOL.delete(POOL_KEY);
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
void handle.courseSkillsMcpServer?.close();
|
|
562
|
-
handle.courseSkillsMcpServer = undefined;
|
|
558
|
+
// Node emits close after a spawn error too. An error alone (for example a
|
|
559
|
+
// failed kill) does not prove the process has stopped writing its profile.
|
|
563
560
|
});
|
|
564
561
|
try {
|
|
565
562
|
await waitForHealth(baseUrl, this.fetchFn, handle, STARTUP_TIMEOUT_MS, signal);
|
|
@@ -1588,16 +1585,37 @@ function resetIdle(handle, key) {
|
|
|
1588
1585
|
}, DEEPSEEK_IDLE_TIMEOUT_MS);
|
|
1589
1586
|
handle.idleTimer.unref?.();
|
|
1590
1587
|
}
|
|
1588
|
+
function cleanupDeepseekResources(handle) {
|
|
1589
|
+
const config = handle.progressMcpConfig;
|
|
1590
|
+
const server = handle.courseSkillsMcpServer;
|
|
1591
|
+
handle.progressMcpConfig = undefined;
|
|
1592
|
+
handle.courseSkillsMcpServer = undefined;
|
|
1593
|
+
try {
|
|
1594
|
+
cleanupProgressMcpConfig(config);
|
|
1595
|
+
}
|
|
1596
|
+
catch (error) {
|
|
1597
|
+
log.warn("deepseek-tui.profile-cleanup-failed", {
|
|
1598
|
+
error: sanitizeRuntimeFailureText(error instanceof Error ? error.message : String(error), 1024),
|
|
1599
|
+
});
|
|
1600
|
+
}
|
|
1601
|
+
finally {
|
|
1602
|
+
if (server) {
|
|
1603
|
+
void Promise.resolve().then(() => server.close()).catch((error) => {
|
|
1604
|
+
log.warn("deepseek-tui.skills-server-close-failed", {
|
|
1605
|
+
error: sanitizeRuntimeFailureText(error instanceof Error ? error.message : String(error), 1024),
|
|
1606
|
+
});
|
|
1607
|
+
});
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1591
1611
|
function shutdownHandle(handle, reason) {
|
|
1592
1612
|
if (handle.closed)
|
|
1593
1613
|
return;
|
|
1594
1614
|
handle.closed = true;
|
|
1595
1615
|
if (handle.idleTimer)
|
|
1596
1616
|
clearTimeout(handle.idleTimer);
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
void handle.courseSkillsMcpServer?.close();
|
|
1600
|
-
handle.courseSkillsMcpServer = undefined;
|
|
1617
|
+
// The close listener owns cleanup. The process (or its dispatcher child) may
|
|
1618
|
+
// still be writing HOME/.deepseek/snapshots after SIGTERM is sent.
|
|
1601
1619
|
try {
|
|
1602
1620
|
const pid = handle.child.pid;
|
|
1603
1621
|
if (typeof pid === "number" && pid > 0) {
|
|
@@ -1618,9 +1636,8 @@ function shutdownHandle(handle, reason) {
|
|
|
1618
1636
|
}
|
|
1619
1637
|
}
|
|
1620
1638
|
try {
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
handle.child.stdin?.destroy();
|
|
1639
|
+
// Keep the pipes open until close confirms both process exit and closed
|
|
1640
|
+
// stdio; destroying them here would discard that ordering guarantee.
|
|
1624
1641
|
handle.child.unref();
|
|
1625
1642
|
}
|
|
1626
1643
|
catch {
|
package/package.json
CHANGED