kimiflare 0.48.2 → 0.48.4
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/index.js +71 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3430,7 +3430,7 @@ function runBash(args, ctx) {
|
|
|
3430
3430
|
}, timeout);
|
|
3431
3431
|
const onAbort = () => {
|
|
3432
3432
|
killedByAbort = true;
|
|
3433
|
-
logger.warn("bash:kill_abort", { command: args.command.slice(0, 200) });
|
|
3433
|
+
logger.warn("bash:kill_abort", { command: args.command.slice(0, 200), pid: child.pid });
|
|
3434
3434
|
child.kill("SIGKILL");
|
|
3435
3435
|
};
|
|
3436
3436
|
ctx.signal?.addEventListener("abort", onAbort, { once: true });
|
|
@@ -3443,13 +3443,18 @@ function runBash(args, ctx) {
|
|
|
3443
3443
|
child.on("error", (e) => {
|
|
3444
3444
|
clearTimeout(timer);
|
|
3445
3445
|
ctx.signal?.removeEventListener("abort", onAbort);
|
|
3446
|
-
logger.error("bash:error", { error: e.message });
|
|
3446
|
+
logger.error("bash:error", { error: e.message, pid: child.pid });
|
|
3447
3447
|
reject(e);
|
|
3448
3448
|
});
|
|
3449
|
+
child.on("exit", (code, signal) => {
|
|
3450
|
+
logger.debug("bash:exit", { code, signal, pid: child.pid, killedByTimeout, killedByAbort });
|
|
3451
|
+
child.stdout?.destroy();
|
|
3452
|
+
child.stderr?.destroy();
|
|
3453
|
+
});
|
|
3449
3454
|
child.on("close", (code, signal) => {
|
|
3450
3455
|
clearTimeout(timer);
|
|
3451
3456
|
ctx.signal?.removeEventListener("abort", onAbort);
|
|
3452
|
-
logger.debug("bash:close", { code, signal, killedByTimeout, killedByAbort });
|
|
3457
|
+
logger.debug("bash:close", { code, signal, pid: child.pid, killedByTimeout, killedByAbort });
|
|
3453
3458
|
const header = killedByTimeout ? `(timed out after ${timeout}ms)` : killedByAbort ? `(aborted \u2014 sent SIGKILL)` : `exit=${code ?? "?"}${signal ? ` signal=${signal}` : ""}`;
|
|
3454
3459
|
const parts = [header];
|
|
3455
3460
|
if (stdout) parts.push(`--- stdout ---
|
|
@@ -15994,6 +15999,18 @@ function App({
|
|
|
15994
15999
|
})
|
|
15995
16000
|
);
|
|
15996
16001
|
}, []);
|
|
16002
|
+
useEffect7(() => {
|
|
16003
|
+
const onSigint = () => {
|
|
16004
|
+
logger.info("sigint:fired", {
|
|
16005
|
+
hasHandler: sigintHandlerRef.current !== null
|
|
16006
|
+
});
|
|
16007
|
+
sigintHandlerRef.current?.();
|
|
16008
|
+
};
|
|
16009
|
+
process.on("SIGINT", onSigint);
|
|
16010
|
+
return () => {
|
|
16011
|
+
process.off("SIGINT", onSigint);
|
|
16012
|
+
};
|
|
16013
|
+
}, []);
|
|
15997
16014
|
useEffect7(() => {
|
|
15998
16015
|
let cancelled = false;
|
|
15999
16016
|
loadAndMergeThemes().then(({ errors, wcagWarnings }) => {
|
|
@@ -16049,6 +16066,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
16049
16066
|
const supervisorRef = useRef3(new TurnSupervisor());
|
|
16050
16067
|
const isAbortingRef = useRef3(false);
|
|
16051
16068
|
const lastEscapeAtRef = useRef3(0);
|
|
16069
|
+
const sigintHandlerRef = useRef3(null);
|
|
16052
16070
|
const permResolveRef = useRef3(null);
|
|
16053
16071
|
const limitResolveRef = useRef3(null);
|
|
16054
16072
|
const pendingToolCallsRef = useRef3(/* @__PURE__ */ new Map());
|
|
@@ -16732,6 +16750,13 @@ ${wcagWarnings.join("\n")}` }
|
|
|
16732
16750
|
);
|
|
16733
16751
|
useInput8((inputChar, key) => {
|
|
16734
16752
|
if (key.ctrl && inputChar === "c") {
|
|
16753
|
+
logger.info("input:ctrl+c", {
|
|
16754
|
+
busy: busyRef.current,
|
|
16755
|
+
hasActiveScope: activeScopeRef.current !== null,
|
|
16756
|
+
isAborting: isAbortingRef.current,
|
|
16757
|
+
hasPerm: permResolveRef.current !== null,
|
|
16758
|
+
hasLimit: limitResolveRef.current !== null
|
|
16759
|
+
});
|
|
16735
16760
|
const hadPerm = permResolveRef.current !== null;
|
|
16736
16761
|
const hadLimit = limitResolveRef.current !== null;
|
|
16737
16762
|
if (hadPerm) {
|
|
@@ -16756,6 +16781,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
16756
16781
|
setTasksStartTokens(0);
|
|
16757
16782
|
tasksRef.current = [];
|
|
16758
16783
|
} else if (!hadPerm && !hadLimit) {
|
|
16784
|
+
logger.info("input:ctrl+c:exiting");
|
|
16759
16785
|
void lspManagerRef.current.stopAll().finally(() => exit());
|
|
16760
16786
|
}
|
|
16761
16787
|
return;
|
|
@@ -16800,6 +16826,42 @@ ${wcagWarnings.join("\n")}` }
|
|
|
16800
16826
|
return;
|
|
16801
16827
|
}
|
|
16802
16828
|
});
|
|
16829
|
+
sigintHandlerRef.current = () => {
|
|
16830
|
+
logger.info("sigint:handler", {
|
|
16831
|
+
busy: busyRef.current,
|
|
16832
|
+
hasActiveScope: activeScopeRef.current !== null,
|
|
16833
|
+
isAborting: isAbortingRef.current,
|
|
16834
|
+
hasPerm: permResolveRef.current !== null,
|
|
16835
|
+
hasLimit: limitResolveRef.current !== null
|
|
16836
|
+
});
|
|
16837
|
+
const hadPerm = permResolveRef.current !== null;
|
|
16838
|
+
const hadLimit = limitResolveRef.current !== null;
|
|
16839
|
+
if (hadPerm) {
|
|
16840
|
+
permResolveRef.current("deny");
|
|
16841
|
+
permResolveRef.current = null;
|
|
16842
|
+
setPerm(null);
|
|
16843
|
+
}
|
|
16844
|
+
if (hadLimit) {
|
|
16845
|
+
limitResolveRef.current("stop");
|
|
16846
|
+
limitResolveRef.current = null;
|
|
16847
|
+
setLimitModal(null);
|
|
16848
|
+
}
|
|
16849
|
+
if (busyRef.current && activeScopeRef.current && !isAbortingRef.current) {
|
|
16850
|
+
isAbortingRef.current = true;
|
|
16851
|
+
supervisorRef.current.killTurn();
|
|
16852
|
+
activeScopeRef.current.abort("user_stopped");
|
|
16853
|
+
setQueue([]);
|
|
16854
|
+
setEvents((e) => [...e, { kind: "info", key: mkKey(), text: "(interrupted)" }]);
|
|
16855
|
+
void saveSessionSafe();
|
|
16856
|
+
setTasks([]);
|
|
16857
|
+
setTasksStartedAt(null);
|
|
16858
|
+
setTasksStartTokens(0);
|
|
16859
|
+
tasksRef.current = [];
|
|
16860
|
+
} else if (!hadPerm && !hadLimit) {
|
|
16861
|
+
logger.info("sigint:handler:exiting");
|
|
16862
|
+
void lspManagerRef.current.stopAll().finally(() => exit());
|
|
16863
|
+
}
|
|
16864
|
+
};
|
|
16803
16865
|
const flushAssistantUpdates = useCallback2(() => {
|
|
16804
16866
|
flushTimeoutRef.current = null;
|
|
16805
16867
|
const pending = pendingTextRef.current;
|
|
@@ -16943,6 +17005,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
16943
17005
|
]);
|
|
16944
17006
|
}
|
|
16945
17007
|
} finally {
|
|
17008
|
+
logger.info("runCompact:finally");
|
|
16946
17009
|
setBusy(false);
|
|
16947
17010
|
busyRef.current = false;
|
|
16948
17011
|
setTurnStartedAt(null);
|
|
@@ -16950,6 +17013,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
16950
17013
|
setCurrentToolName(null);
|
|
16951
17014
|
setLastActivityAt(null);
|
|
16952
17015
|
activeScopeRef.current = null;
|
|
17016
|
+
isAbortingRef.current = false;
|
|
16953
17017
|
permResolveRef.current = null;
|
|
16954
17018
|
limitResolveRef.current = null;
|
|
16955
17019
|
pendingToolCallsRef.current.clear();
|
|
@@ -17208,6 +17272,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
17208
17272
|
]);
|
|
17209
17273
|
}
|
|
17210
17274
|
} finally {
|
|
17275
|
+
logger.info("runInit:finally");
|
|
17211
17276
|
setCodeMode(false);
|
|
17212
17277
|
const asstId = activeAsstIdRef.current;
|
|
17213
17278
|
if (asstId !== null) updateAssistant(asstId, () => ({ streaming: false }));
|
|
@@ -17219,6 +17284,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
17219
17284
|
setLastActivityAt(null);
|
|
17220
17285
|
activeAsstIdRef.current = null;
|
|
17221
17286
|
activeScopeRef.current = null;
|
|
17287
|
+
isAbortingRef.current = false;
|
|
17222
17288
|
permResolveRef.current = null;
|
|
17223
17289
|
limitResolveRef.current = null;
|
|
17224
17290
|
pendingToolCallsRef.current.clear();
|
|
@@ -18559,6 +18625,7 @@ ${lines.join("\n")}` }]);
|
|
|
18559
18625
|
}
|
|
18560
18626
|
};
|
|
18561
18627
|
const cleanupTurn = () => {
|
|
18628
|
+
logger.info("cleanupTurn");
|
|
18562
18629
|
setCodeMode(false);
|
|
18563
18630
|
const asstId = activeAsstIdRef.current;
|
|
18564
18631
|
if (asstId !== null) updateAssistant(asstId, () => ({ streaming: false }));
|
|
@@ -19183,6 +19250,7 @@ var init_app = __esm({
|
|
|
19183
19250
|
init_messages();
|
|
19184
19251
|
init_errors();
|
|
19185
19252
|
init_abort_scope();
|
|
19253
|
+
init_logger();
|
|
19186
19254
|
init_chat();
|
|
19187
19255
|
init_status();
|
|
19188
19256
|
init_permission();
|