fix: restore cli workspace thread id visibility
This commit is contained in:
@@ -1761,6 +1761,7 @@ async function saveAcceptedAgentWorkspaceState(context: any, acceptedBody: any,
|
||||
revision: numberOption(acceptedBody?.workspaceRevision) ?? existing.revision,
|
||||
selectedConversationId: text(fallback.conversationId) || text(existing.selectedConversationId),
|
||||
selectedAgentSessionId: text(fallback.sessionId) || text(existing.selectedAgentSessionId),
|
||||
threadId: text(acceptedBody?.threadId ?? acceptedBody?.session?.threadId ?? acceptedBody?.providerTrace?.threadId) || text(fallback.threadId) || text(existing.threadId),
|
||||
activeTraceId: text(acceptedBody?.traceId) || text(fallback.traceId),
|
||||
providerProfile: text(fallback.providerProfile) || text(existing.providerProfile),
|
||||
updatedByClient: "hwlab-cli",
|
||||
@@ -1820,7 +1821,7 @@ function normalizeWorkbenchWorkspace(workspace: any) {
|
||||
activeTraceId: text(workspace.activeTraceId ?? workspaceJson.activeTraceId),
|
||||
providerProfile: text(workspace.providerProfile ?? workspaceJson.providerProfile),
|
||||
sessionStatus: text(workspaceJson.sessionStatus),
|
||||
threadId: text(workspaceJson.threadId),
|
||||
threadId: workbenchThreadId(workspace, workspaceJson),
|
||||
updatedAt: text(workspace.updatedAt),
|
||||
updatedByClient: text(workspace.updatedByClient),
|
||||
messages: Array.isArray(workspaceJson.messages) ? workspaceJson.messages : undefined,
|
||||
@@ -1830,6 +1831,19 @@ function normalizeWorkbenchWorkspace(workspace: any) {
|
||||
});
|
||||
}
|
||||
|
||||
function workbenchThreadId(workspace: any, workspaceJson: any) {
|
||||
const selectedConversation = workspace?.selectedConversation && typeof workspace.selectedConversation === "object" ? workspace.selectedConversation : {};
|
||||
const selectedAgentSession = workspace?.selectedAgentSession && typeof workspace.selectedAgentSession === "object" ? workspace.selectedAgentSession : {};
|
||||
const selectedConversationJson = workspaceJson?.selectedConversation && typeof workspaceJson.selectedConversation === "object" ? workspaceJson.selectedConversation : {};
|
||||
const selectedAgentSessionJson = workspaceJson?.selectedAgentSession && typeof workspaceJson.selectedAgentSession === "object" ? workspaceJson.selectedAgentSession : {};
|
||||
return text(workspaceJson?.threadId)
|
||||
|| text(workspace?.threadId)
|
||||
|| text(selectedConversation.threadId)
|
||||
|| text(selectedAgentSession.threadId)
|
||||
|| text(selectedConversationJson.threadId)
|
||||
|| text(selectedAgentSessionJson.threadId);
|
||||
}
|
||||
|
||||
function workspaceSummaryFromSession(session: any) {
|
||||
return normalizeWorkbenchWorkspace(session?.workspace);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user