fix: reload TUI history after reconnect
This commit is contained in:
@@ -19,6 +19,7 @@ Docs: https://docs.clawd.bot
|
|||||||
- BlueBubbles: keep part-index GUIDs in reply tags when short IDs are missing.
|
- BlueBubbles: keep part-index GUIDs in reply tags when short IDs are missing.
|
||||||
- Web UI: hide internal `message_id` hints in chat bubbles.
|
- Web UI: hide internal `message_id` hints in chat bubbles.
|
||||||
- Heartbeat: normalize target identifiers for consistent routing.
|
- Heartbeat: normalize target identifiers for consistent routing.
|
||||||
|
- TUI: reload history after gateway reconnect to restore session state. (#1663)
|
||||||
- Telegram: use wrapped fetch for long-polling on Node to normalize AbortSignal handling. (#1639)
|
- Telegram: use wrapped fetch for long-polling on Node to normalize AbortSignal handling. (#1639)
|
||||||
- Exec: keep approvals for elevated ask unless full mode. (#1616) Thanks @ivancasco.
|
- Exec: keep approvals for elevated ask unless full mode. (#1616) Thanks @ivancasco.
|
||||||
- Agents: auto-compact on context overflow prompt errors before failing. (#1627) Thanks @rodrigouroz.
|
- Agents: auto-compact on context overflow prompt errors before failing. (#1627) Thanks @rodrigouroz.
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ export async function runTui(opts: TuiOptions) {
|
|||||||
let activeChatRunId: string | null = null;
|
let activeChatRunId: string | null = null;
|
||||||
let historyLoaded = false;
|
let historyLoaded = false;
|
||||||
let isConnected = false;
|
let isConnected = false;
|
||||||
|
let wasDisconnected = false;
|
||||||
let toolsExpanded = false;
|
let toolsExpanded = false;
|
||||||
let showThinking = false;
|
let showThinking = false;
|
||||||
|
|
||||||
@@ -584,21 +585,19 @@ export async function runTui(opts: TuiOptions) {
|
|||||||
|
|
||||||
client.onConnected = () => {
|
client.onConnected = () => {
|
||||||
isConnected = true;
|
isConnected = true;
|
||||||
|
const reconnected = wasDisconnected;
|
||||||
|
wasDisconnected = false;
|
||||||
setConnectionStatus("connected");
|
setConnectionStatus("connected");
|
||||||
void (async () => {
|
void (async () => {
|
||||||
await refreshAgents();
|
await refreshAgents();
|
||||||
updateHeader();
|
updateHeader();
|
||||||
if (!historyLoaded) {
|
|
||||||
await loadHistory();
|
await loadHistory();
|
||||||
setConnectionStatus("gateway connected", 4000);
|
setConnectionStatus(reconnected ? "gateway reconnected" : "gateway connected", 4000);
|
||||||
tui.requestRender();
|
tui.requestRender();
|
||||||
if (!autoMessageSent && autoMessage) {
|
if (!autoMessageSent && autoMessage) {
|
||||||
autoMessageSent = true;
|
autoMessageSent = true;
|
||||||
await sendMessage(autoMessage);
|
await sendMessage(autoMessage);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
setConnectionStatus("gateway reconnected", 4000);
|
|
||||||
}
|
|
||||||
updateFooter();
|
updateFooter();
|
||||||
tui.requestRender();
|
tui.requestRender();
|
||||||
})();
|
})();
|
||||||
@@ -606,6 +605,8 @@ export async function runTui(opts: TuiOptions) {
|
|||||||
|
|
||||||
client.onDisconnected = (reason) => {
|
client.onDisconnected = (reason) => {
|
||||||
isConnected = false;
|
isConnected = false;
|
||||||
|
wasDisconnected = true;
|
||||||
|
historyLoaded = false;
|
||||||
const reasonLabel = reason?.trim() ? reason.trim() : "closed";
|
const reasonLabel = reason?.trim() ? reason.trim() : "closed";
|
||||||
setConnectionStatus(`gateway disconnected: ${reasonLabel}`, 5000);
|
setConnectionStatus(`gateway disconnected: ${reasonLabel}`, 5000);
|
||||||
setActivityStatus("idle");
|
setActivityStatus("idle");
|
||||||
|
|||||||
Reference in New Issue
Block a user