ReMe/reme_studio/app/workspace-persistence.ts
jinliyl ef3f99f019
refactor(packaging): reorganize published packages (#495)
* refactor(packaging): reorganize published packages

* fix(packaging): install AgentScope extra in wheel smoke

* docs: align package guides and documentation site

* ci(workflow): add core dependency verification step in Python package build

- Add a workflow step to verify released core dependencies by installing the wheel with core extras
- Assert the presence of the static index.html file to ensure proper package contents
- Create and use a temporary virtual environment for isolation during verification
- Keep existing artifacts upload step intact and conditional on inputs.upload_artifacts flag

* fix(ci): update package installation dependencies in Windows workflow

- Change pip install from editable reme_studio and core to only dev and as extras
- Remove installation of reme_studio and core to streamline dependency setup
- Ensure Windows CI uses the correct extras for testing environment

* fix(tests): add missing commas in toml file reads in package version tests

- Added trailing commas in the tomllib.loads calls for auto-fin and daily_paper configs
- Ensured consistent syntax to prevent potential tuple misinterpretation
- Improved readability and correctness of the test setup code

* fix(packaging): protect qwenpaw releases and test Studio health
2026-08-27 14:02:09 +08:00

56 lines
1.5 KiB
TypeScript

import type { ChatBlock, ChatMessage, WorkspaceTab } from "./types";
export interface PersistedWorkspaceState {
tabs: WorkspaceTab[];
activeTabId?: string;
}
function finishInterruptedMessage(message: ChatMessage): ChatMessage {
const blocks = (message.blocks || []).map((block): ChatBlock => {
if (block.type === "content" || block.type === "error") return block;
return {
...block,
status: block.status === "error" ? "error" : "done",
expanded: false,
};
});
return { ...message, blocks };
}
/** Keep reopenable UI state without making cached files the workspace source of truth. */
export function prepareWorkspaceSnapshot(
tabs: WorkspaceTab[],
activeTabId?: string,
): PersistedWorkspaceState {
const persistedTabs = tabs.map((tab): WorkspaceTab => {
if (tab.type === "agent") {
return {
...tab,
streaming: false,
messages: tab.messages.map((message) =>
message.role === "assistant"
? finishInterruptedMessage(message)
: message,
),
};
}
if (tab.type === "graph") return tab;
const dirty = tab.content !== tab.savedContent;
if (dirty) return { ...tab, loading: false, error: undefined };
return {
...tab,
content: "",
savedContent: "",
loading: true,
error: undefined,
};
});
return {
tabs: persistedTabs,
activeTabId: persistedTabs.some((tab) => tab.id === activeTabId)
? activeTabId
: persistedTabs.at(-1)?.id,
};
}