feat: add ArtifactSlice and integrate artifact preview into skill editor tabs

Introduce a dedicated Zustand ArtifactSlice to manage artifact selection
state with mutual exclusion against the main file tree. Artifact files
from the sandbox can now be opened as tabs in the skill editor, rendered
via a lightweight ArtifactContentPanel that reuses ReadOnlyFilePreview.
This commit is contained in:
yyh
2026-01-29 17:52:41 +08:00
parent 9d99675a1d
commit 92731bffba
10 changed files with 148 additions and 8 deletions

View File

@ -28,6 +28,20 @@ export const NODE_MENU_TYPE = {
export type NodeMenuType = (typeof NODE_MENU_TYPE)[keyof typeof NODE_MENU_TYPE]
export const ARTIFACT_TAB_PREFIX = 'artifact:' as const
export function isArtifactTab(tabId: string | null): boolean {
return tabId?.startsWith(ARTIFACT_TAB_PREFIX) ?? false
}
export function getArtifactPath(tabId: string): string {
return tabId.slice(ARTIFACT_TAB_PREFIX.length)
}
export function makeArtifactTabId(path: string): string {
return `${ARTIFACT_TAB_PREFIX}${path}`
}
export const SIDEBAR_MIN_WIDTH = 240
export const SIDEBAR_MAX_WIDTH = 480
export const SIDEBAR_DEFAULT_WIDTH = 320