fix: refresh TUI session info after runs
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
- Tools: add tmux-style `process send-keys` and bracketed paste helpers for PTY sessions.
|
- Tools: add tmux-style `process send-keys` and bracketed paste helpers for PTY sessions.
|
||||||
- Tools: add `process submit` helper to send CR for PTY sessions.
|
- Tools: add `process submit` helper to send CR for PTY sessions.
|
||||||
- Tools: respond to PTY cursor position queries to unblock interactive TUIs.
|
- Tools: respond to PTY cursor position queries to unblock interactive TUIs.
|
||||||
|
- TUI: refresh session token counts after runs complete or fail. (#1079) — thanks @d-ploutarchos.
|
||||||
- Status: trim `/status` to current-provider usage only and drop the OAuth/token block.
|
- Status: trim `/status` to current-provider usage only and drop the OAuth/token block.
|
||||||
- Directory: unify `clawdbot directory` across channels and plugin channels.
|
- Directory: unify `clawdbot directory` across channels and plugin channels.
|
||||||
- UI: allow deleting sessions from the Control UI.
|
- UI: allow deleting sessions from the Control UI.
|
||||||
|
|||||||
@@ -72,11 +72,13 @@ export function createEventHandlers(context: EventHandlerContext) {
|
|||||||
chatLog.addSystem("run aborted");
|
chatLog.addSystem("run aborted");
|
||||||
state.activeChatRunId = null;
|
state.activeChatRunId = null;
|
||||||
setActivityStatus("aborted");
|
setActivityStatus("aborted");
|
||||||
|
void refreshSessionInfo?.();
|
||||||
}
|
}
|
||||||
if (evt.state === "error") {
|
if (evt.state === "error") {
|
||||||
chatLog.addSystem(`run error: ${evt.errorMessage ?? "unknown"}`);
|
chatLog.addSystem(`run error: ${evt.errorMessage ?? "unknown"}`);
|
||||||
state.activeChatRunId = null;
|
state.activeChatRunId = null;
|
||||||
setActivityStatus("error");
|
setActivityStatus("error");
|
||||||
|
void refreshSessionInfo?.();
|
||||||
}
|
}
|
||||||
tui.requestRender();
|
tui.requestRender();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ export function createSessionActions(context: SessionActionContext) {
|
|||||||
updateAutocompleteProvider,
|
updateAutocompleteProvider,
|
||||||
setActivityStatus,
|
setActivityStatus,
|
||||||
} = context;
|
} = context;
|
||||||
|
let refreshSessionInfoPromise: Promise<void> | null = null;
|
||||||
|
|
||||||
const applyAgentsResult = (result: GatewayAgentsList) => {
|
const applyAgentsResult = (result: GatewayAgentsList) => {
|
||||||
state.agentDefaultId = normalizeAgentId(result.defaultId);
|
state.agentDefaultId = normalizeAgentId(result.defaultId);
|
||||||
@@ -95,6 +96,8 @@ export function createSessionActions(context: SessionActionContext) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const refreshSessionInfo = async () => {
|
const refreshSessionInfo = async () => {
|
||||||
|
if (refreshSessionInfoPromise) return refreshSessionInfoPromise;
|
||||||
|
refreshSessionInfoPromise = (async () => {
|
||||||
try {
|
try {
|
||||||
const listAgentId =
|
const listAgentId =
|
||||||
state.currentSessionKey === "global" || state.currentSessionKey === "unknown"
|
state.currentSessionKey === "global" || state.currentSessionKey === "unknown"
|
||||||
@@ -132,6 +135,12 @@ export function createSessionActions(context: SessionActionContext) {
|
|||||||
updateAutocompleteProvider();
|
updateAutocompleteProvider();
|
||||||
updateFooter();
|
updateFooter();
|
||||||
tui.requestRender();
|
tui.requestRender();
|
||||||
|
})();
|
||||||
|
try {
|
||||||
|
await refreshSessionInfoPromise;
|
||||||
|
} finally {
|
||||||
|
refreshSessionInfoPromise = null;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadHistory = async () => {
|
const loadHistory = async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user