@vibe-lark/larkpal 0.1.65 → 0.1.66
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/main.mjs +23 -1
- package/package.json +1 -1
package/dist/main.mjs
CHANGED
|
@@ -3927,6 +3927,27 @@ async function reconcileRunWithAdapter(run, messageStore, processManager) {
|
|
|
3927
3927
|
if (!adapterBusy) staleReason = processInfo ? `runtime process is ${processInfo.status}` : "runtime adapter reports session is not busy";
|
|
3928
3928
|
else if (idleMs >= getStaleRunIdleMs()) staleReason = `run idle for ${Math.floor(idleMs / 1e3)}s`;
|
|
3929
3929
|
if (!staleReason) return;
|
|
3930
|
+
let cleanupRequired = false;
|
|
3931
|
+
if (!adapterBusy && (processInfo?.status === "running" || processInfo?.status === "starting")) {
|
|
3932
|
+
cleanupRequired = true;
|
|
3933
|
+
try {
|
|
3934
|
+
await processManager.stopProcess(run.sessionId);
|
|
3935
|
+
log$30.warn("[stream] stale run 已触发 runtime process 清理", {
|
|
3936
|
+
sessionId: run.sessionId,
|
|
3937
|
+
runId: run.runId,
|
|
3938
|
+
staleReason,
|
|
3939
|
+
processStatus: processInfo.status
|
|
3940
|
+
});
|
|
3941
|
+
} catch (err) {
|
|
3942
|
+
log$30.error("[stream] stale run 清理 runtime process 失败", {
|
|
3943
|
+
sessionId: run.sessionId,
|
|
3944
|
+
runId: run.runId,
|
|
3945
|
+
staleReason,
|
|
3946
|
+
processStatus: processInfo.status,
|
|
3947
|
+
error: err instanceof Error ? err.message : String(err)
|
|
3948
|
+
});
|
|
3949
|
+
}
|
|
3950
|
+
}
|
|
3930
3951
|
const error = `Chat run became stale: ${staleReason}`;
|
|
3931
3952
|
log$30.warn("[stream] activeRun 与 runtime 状态不一致,标记为 stale", {
|
|
3932
3953
|
sessionId: run.sessionId,
|
|
@@ -3934,7 +3955,8 @@ async function reconcileRunWithAdapter(run, messageStore, processManager) {
|
|
|
3934
3955
|
staleReason,
|
|
3935
3956
|
idleMs,
|
|
3936
3957
|
adapterBusy,
|
|
3937
|
-
processStatus: processInfo?.status
|
|
3958
|
+
processStatus: processInfo?.status,
|
|
3959
|
+
cleanupRequired
|
|
3938
3960
|
});
|
|
3939
3961
|
if (await markRunTerminal(run, messageStore, "failed", {
|
|
3940
3962
|
finalStatus: "stale",
|