fix kiro fresh auto-run state reset

This commit is contained in:
QLHazyCoder
2026-05-22 07:57:36 +08:00
parent 5610262f7d
commit 25c6b8b4a7
6 changed files with 308 additions and 5 deletions
+9 -1
View File
@@ -437,6 +437,13 @@
await chrome.tabs.update(tabId, { active: true });
}
async function isSpecificTabAlive(tabId) {
if (!Number.isInteger(tabId) || !chrome?.tabs?.get) {
return false;
}
return Boolean(await chrome.tabs.get(tabId).catch(() => null));
}
async function getExecutionState(state = {}) {
if (state && typeof state === 'object' && !Array.isArray(state) && Object.keys(state).length) {
return state;
@@ -509,7 +516,8 @@
: await getTabId(KIRO_REGISTER_PAGE_SOURCE_ID);
const loginUrl = cleanString(runtimeState.register?.loginUrl);
if (Number.isInteger(tabId) && await isTabAlive(KIRO_REGISTER_PAGE_SOURCE_ID)) {
if (Number.isInteger(tabId) && await isSpecificTabAlive(tabId)) {
await registerTab(KIRO_REGISTER_PAGE_SOURCE_ID, tabId);
return tabId;
}
+11
View File
@@ -204,6 +204,17 @@
const baseRuntimeState = isPlainObject(state?.runtimeState)
? cloneValue(state.runtimeState)
: {};
delete baseRuntimeState.flowId;
delete baseRuntimeState.runId;
delete baseRuntimeState.activeFlowId;
delete baseRuntimeState.activeRunId;
delete baseRuntimeState.currentNodeId;
delete baseRuntimeState.nodeStatuses;
if (isPlainObject(baseRuntimeState.sharedState)) {
delete baseRuntimeState.sharedState.tabRegistry;
delete baseRuntimeState.sharedState.sourceLastUrls;
delete baseRuntimeState.sharedState.flowStartTime;
}
const baseFlowState = isPlainObject(baseRuntimeState.flowState)
? cloneValue(baseRuntimeState.flowState)
: {};