🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
♻️ refactor(portal): drop the workspace HTML publish business slot (#18478)
Inneidad6f5196773
diff --git a/src/business/client/features/__tests__/WorkspaceHtmlArtifactPublish.test.ts b/src/business/client/features/__tests__/WorkspaceHtmlArtifactPublish.test.tsdeleted file mode 100644index e7d23c789d4..00000000000--- a/src/business/client/features/__tests__/WorkspaceHtmlArtifactPublish.test.ts+++ /dev/null@@ -1,33 +0,0 @@-import { renderHook } from '@testing-library/react';-import { describe, expect, it } from 'vitest';--import { useWorkspaceHtmlArtifactPublish } from '../WorkspaceHtmlArtifactPublish';--describe('useWorkspaceHtmlArtifactPublish (oss stub)', () => {- it('reports the publisher as unavailable', async () => {- const { result } = renderHook(() => useWorkspaceHtmlArtifactPublish());-- expect(result.current.available).toBe(false);- await expect(- result.current.getExisting({ identifier: 'workspace-html-index-html', topicId: 'tpc_1' }),- ).resolves.toBeNull();- await expect(- result.current.publish({- entryPath: 'index.html',- files: [],- identifier: 'workspace-html-index-html',- title: 'Demo',- topicId: 'tpc_1',- }),- ).rejects.toThrow('unavailable');- });-- it('keeps the publisher referentially stable across renders', () => {- const { rerender, result } = renderHook(() => useWorkspaceHtmlArtifactPublish());- const first = result.current;- rerender();-- expect(result.current).toBe(first);- expect(result.current.getExisting).toBe(first.getExisting);- });-});diff --git a/src/features/Conversation/WorkingSidebar/Files/__tests__/index.test.tsx b/src/features/Conversation/WorkingSidebar/Files/__tests__/index.test.tsxindex 9b22c15e44f..a5bddcb0ef8 100644--- a/src/features/Conversation/WorkingSidebar/Files/__tests__/index.test.tsx+++ b/src/features/Conversation/WorkingSidebar/Files/__tests__/index.test.tsx@@ -174,14 +174,6 @@ vi.mock('@/services/projectFile', () => ({},}));-vi.mock('@/business/client/features/WorkspaceHtmlArtifactPublish', () => ({- useWorkspaceHtmlArtifactPublish: () => ({- available: true,- getExisting: async () => null,- publish: async () => ({}),- }),-}));-vi.mock('@/store/chat', () => ({useChatStore: (selector: (s: Record<string, unknown>) => unknown) =>selector({@@ -337,7 +329,7 @@ describe('Files — reveal request integration', () => {);});- it('adds a publish action only for HTML files when artifact deployment is enabled', () => {+ it('does not offer a publish action in the open-source build', () => {const previousLab = useUserStore.getState().preference.lab;useUserStore.setState({preference: {@@ -364,40 +356,6 @@ describe('Files — reveal request integration', () => {id: 'index.html',isFolder: false,}).map((item) => item.key),- ).toEqual([- 'open',- 'publish',- 'divider-reveal',- 'show-in-system',- 'divider-copy',- 'copy-absolute-path',- 'copy-relative-path',- ]);-- expect(- getContextMenuItems({- data: {- isDirectory: false,- name: 'root.ts',- path: '/repo/root.ts',- relativePath: 'root.ts',- },- id: 'root.ts',- isFolder: false,- }).map((item) => item.key),- ).not.toContain('publish');-- expect(- getContextMenuItems({- data: {- isDirectory: true,- name: 'site.html',- path: '/repo/site.html',- relativePath: 'site.html/',- },- id: 'site.html/',- isFolder: true,- }).map((item) => item.key),).not.toContain('publish');} finally {useUserStore.setState({diff --git a/src/features/Portal/LocalFile/Body.tsx b/src/features/Portal/LocalFile/Body.tsxindex 69685d06481..1c76dfc0b23 100644--- a/src/features/Portal/LocalFile/Body.tsx+++ b/src/features/Portal/LocalFile/Body.tsx@@ -10,6 +10,11 @@ import { useTranslation } from 'react-i18next';import CodeEditorPane from '@/components/CodeEditorPane';import { InlineHtmlPreview, isHtmlFile } from '@/components/HtmlPreview';import Loading from '@/components/Loading/CircleLoading';+import {+ PublishHtmlArtifactLiveBar,+ PublishHtmlArtifactProvider,+ PublishHtmlArtifactTrigger,+} from '@/features/Portal/LocalFile/PublishHtmlArtifactButton';import { useClientDataSWR } from '@/libs/swr';import { localFileKeys } from '@/libs/swr/keys';import { cloudSandboxService } from '@/services/cloudSandbox';@@ -25,11 +30,6 @@ import {import { extensionToLanguage, getFileExtension } from './Body.helpers';import MarkdownImage from './MarkdownImage';-import {- PublishHtmlArtifactLiveBar,- PublishHtmlArtifactProvider,- PublishHtmlArtifactTrigger,-} from './PublishHtmlArtifactButton';// Deferred: pulls in react-pdf, only needed once a binary document is opened.const DocumentPreview = lazy(() => import('./DocumentPreview'));diff --git a/src/features/Portal/LocalFile/PublishHtmlArtifactButton.test.ts b/src/features/Portal/LocalFile/PublishHtmlArtifactButton.test.tsdeleted file mode 100644index dee0953a56b..00000000000--- a/src/features/Portal/LocalFile/PublishHtmlArtifactButton.test.ts+++ /dev/null@@ -1,177 +0,0 @@-import { act, renderHook, waitFor } from '@testing-library/react';-import { beforeEach, describe, expect, it, vi } from 'vitest';--import { usePublishHtmlArtifactModel } from './PublishHtmlArtifactButton';-import { createWorkspaceHtmlArtifactIdentifier } from './workspaceHtmlPath';--vi.mock('antd-style', () => ({- createStaticStyles: () => ({ bar: 'bar', url: 'url' }),- cssVar: {- colorBgContainer: 'var(--color-bg-container)',- colorBorderSecondary: 'var(--color-border-secondary)',- fontFamilyCode: 'monospace',- fontSizeSM: 12,- },-}));--vi.mock('react-i18next', () => ({- useTranslation: () => ({ t: (key: string) => key }),-}));--vi.mock('@lobehub/ui', () => ({- ActionIcon: () => null,- CopyButton: () => null,- Flexbox: () => null,- Tag: () => null,- Text: () => null,-}));--vi.mock('@lobehub/ui/base-ui', () => ({- Button: () => null,- toast: { error: vi.fn(), success: vi.fn() },-}));--vi.mock('@/components/HtmlPreview', () => ({- isHtmlFile: ({ path }: { path: string }) => path.endsWith('.html'),-}));--vi.mock('@/store/chat', () => ({- useChatStore: (selector: (state: { activeAgentId: string }) => unknown) =>- selector({ activeAgentId: 'agt_1' }),-}));--vi.mock('@/store/user', () => ({- useUserStore: (selector: (state: unknown) => unknown) => selector({}),-}));--vi.mock('@/store/user/selectors', () => ({- labPreferSelectors: { enableArtifactDeployment: () => true },-}));--const getExisting = vi.hoisted(() => vi.fn());-const publish = vi.hoisted(() => vi.fn());--vi.mock('@/business/client/features/WorkspaceHtmlArtifactPublish', () => ({- useWorkspaceHtmlArtifactPublish: () => ({ available: true, getExisting, publish }),-}));--const prepareWorkspaceHtmlPublish = vi.hoisted(() => vi.fn());--vi.mock('./prepareWorkspaceHtmlPublish', () => ({- notifyWorkspaceHtmlPublishBlocked: vi.fn(),- prepareWorkspaceHtmlPublish,- publishPreparedWorkspaceHtml: async ({- plan,- publish: run,- topicId,- }: {- plan: { gathered: { identifier: string } };- publish: (input: { identifier: string; topicId: string }) => Promise<unknown>;- topicId: string;- }) => {- try {- return await run({ identifier: plan.gathered.identifier, topicId });- } catch {- return undefined;- }- },-}));--vi.mock('./PublishHtmlArtifactConfirm', () => ({- openWorkspaceHtmlPublishConfirm: ({ onOk }: { onOk: () => void }) => onOk(),-}));--const modelProps = (filePath: string, workingDirectory: string) => ({- content: '<html></html>',- filePath,- topicId: 'tpc_1',- workingDirectory,-});--const gatheredFor = (relativePath: string) => ({- entryPath: relativePath,- files: [],- identifier: createWorkspaceHtmlArtifactIdentifier(relativePath),- missing: [],- oversized: [],- remotes: [],- title: 'Demo',- totalBytes: 0,-});--describe('usePublishHtmlArtifactModel', () => {- beforeEach(() => {- getExisting.mockReset().mockResolvedValue(null);- publish.mockReset();- prepareWorkspaceHtmlPublish.mockReset();- });-- it('looks up deployments with the same canonical identifier gathering publishes', async () => {- renderHook(() =>- usePublishHtmlArtifactModel(modelProps('/private/tmp/ws/pages/index.html', '/tmp/ws')),- );-- await waitFor(() => {- expect(getExisting).toHaveBeenCalledWith({- identifier: createWorkspaceHtmlArtifactIdentifier('pages/index.html'),- topicId: 'tpc_1',- });- });- });-- it('marks the current file live once its publish completes', async () => {- prepareWorkspaceHtmlPublish.mockResolvedValue({- gathered: gatheredFor('a.html'),- packed: { html: '', sidecars: [] },- });- publish.mockResolvedValue({ publicUrl: 'https://pub.example.com/a' });-- const { result } = renderHook(() =>- usePublishHtmlArtifactModel(modelProps('/ws/a.html', '/ws')),- );- act(() => {- result.current.handlePublish();- });-- await waitFor(() => {- expect(result.current.publicUrl).toBe('https://pub.example.com/a');- });- expect(result.current.showLiveBar).toBe(true);- });-- it('discards a publish result that finishes after switching to another file', async () => {- prepareWorkspaceHtmlPublish.mockResolvedValue({- gathered: gatheredFor('a.html'),- packed: { html: '', sidecars: [] },- });-- let resolvePublish: (value: { publicUrl: string }) => void = () => {};- publish.mockImplementation(- () =>- new Promise((resolve) => {- resolvePublish = resolve;- }),- );-- const { rerender, result } = renderHook((props) => usePublishHtmlArtifactModel(props), {- initialProps: modelProps('/ws/a.html', '/ws'),- });- act(() => {- result.current.handlePublish();- });- await waitFor(() => {- expect(publish).toHaveBeenCalled();- });-- rerender(modelProps('/ws/b.html', '/ws'));-- act(() => {- resolvePublish({ publicUrl: 'https://pub.example.com/a' });- });- await waitFor(() => {- expect(getExisting).toHaveBeenCalledTimes(2);- });-- expect(result.current.publicUrl).toBeUndefined();- });-});diff --git a/src/features/Portal/LocalFile/PublishHtmlArtifactButton.tsx b/src/features/Portal/LocalFile/PublishHtmlArtifactButton.tsxindex caf4044b863..7f7127884aa 100644--- a/src/features/Portal/LocalFile/PublishHtmlArtifactButton.tsx+++ b/src/features/Portal/LocalFile/PublishHtmlArtifactButton.tsx@@ -1,256 +1,18 @@-import { ActionIcon, CopyButton, Flexbox, Tag, Text } from '@lobehub/ui';-import { Button, toast } from '@lobehub/ui/base-ui';-import { createStaticStyles, cssVar } from 'antd-style';-import { ExternalLinkIcon } from 'lucide-react';import type { ReactNode } from 'react';-import { createContext, use, useCallback, useEffect, useMemo, useRef, useState } from 'react';-import { useTranslation } from 'react-i18next';--import type { WorkspaceHtmlArtifactExisting } from '@/business/client/features/WorkspaceHtmlArtifactPublish';-import { useWorkspaceHtmlArtifactPublish } from '@/business/client/features/WorkspaceHtmlArtifactPublish';-import { isHtmlFile } from '@/components/HtmlPreview';-import { useChatStore } from '@/store/chat';-import { useUserStore } from '@/store/user';-import { labPreferSelectors } from '@/store/user/selectors';--import {- notifyWorkspaceHtmlPublishBlocked,- prepareWorkspaceHtmlPublish,- publishPreparedWorkspaceHtml,- type ReadyWorkspaceHtmlPublishPlan,-} from './prepareWorkspaceHtmlPublish';-import { openWorkspaceHtmlPublishConfirm } from './PublishHtmlArtifactConfirm';-import { workspaceHtmlArtifactIdentifierForFile } from './workspaceHtmlPath';interface PublishHtmlArtifactButtonProps {children?: ReactNode;- content: string;+ content?: string;deviceId?: string;- filePath: string;+ filePath?: string;sandboxTopicId?: string;topicId?: string | null;- workingDirectory: string;+ workingDirectory?: string;}-interface PublishHtmlArtifactModel {- busy: 'publishing' | 'scanning' | null;- handlePublish: () => void;- publicUrl?: string;- showLiveBar: boolean;- showOverlayTrigger: boolean;- topicId?: string | null;-}--const liveBarStyles = createStaticStyles(({ css }) => ({- bar: css`- flex-shrink: 0;-- min-width: 0;- padding-block: 8px;- padding-inline: 12px;- border-block-end: 1px solid ${cssVar.colorBorderSecondary};-- background: ${cssVar.colorBgContainer};- `,- url: css`- min-width: 0;- font-family: ${cssVar.fontFamilyCode};- font-size: ${cssVar.fontSizeSM}px;- `,-}));--const PublishHtmlArtifactContext = createContext<PublishHtmlArtifactModel | null>(null);--export const usePublishHtmlArtifactModel = ({- content,- deviceId,- filePath,- sandboxTopicId,- topicId,- workingDirectory,-}: Omit<PublishHtmlArtifactButtonProps, 'children'>): PublishHtmlArtifactModel => {- const { t } = useTranslation(['chat', 'portal', 'common']);- const enabled = useUserStore(labPreferSelectors.enableArtifactDeployment);- const agentId = useChatStore((s) => s.activeAgentId);- const { available, getExisting, publish } = useWorkspaceHtmlArtifactPublish();- const [busy, setBusy] = useState<'publishing' | 'scanning' | null>(null);- const [existing, setExisting] = useState<WorkspaceHtmlArtifactExisting | null>(null);-- const isHtml = isHtmlFile({ path: filePath });- const identifier = useMemo(- () => workspaceHtmlArtifactIdentifierForFile(filePath, workingDirectory),- [filePath, workingDirectory],- );-- const scopeKey = `${topicId ?? ''}:${identifier}`;- const scopeRef = useRef(scopeKey);- useEffect(() => {- scopeRef.current = scopeKey;- }, [scopeKey]);-- useEffect(() => {- setExisting(null);- if (!available || !enabled || !isHtml || !topicId) return;-- let cancelled = false;- void getExisting({ identifier, topicId }).then((result) => {- if (!cancelled) setExisting(result);- });-- return () => {- cancelled = true;- };- }, [available, enabled, getExisting, identifier, isHtml, topicId]);-- const runPublish = useCallback(- async (plan: ReadyWorkspaceHtmlPublishPlan) => {- if (!topicId) return;-- const requestScope = scopeRef.current;- setBusy('publishing');- try {- const result = await publishPreparedWorkspaceHtml({ agentId, plan, publish, topicId });- // Publishing may outlive a file/topic switch under the same provider;- // a completion for a previous scope must not label the current file.- if (!result || scopeRef.current !== requestScope) return;- setExisting((previous) => ({- identifier: plan.gathered.identifier,- publicUrl: result.publicUrl ?? previous?.publicUrl,- }));- } finally {- setBusy(null);- }- },- [agentId, publish, topicId],- );-- const handlePublish = useCallback(async () => {- if (!topicId || busy) return;-- setBusy('scanning');- try {- const plan = await prepareWorkspaceHtmlPublish({- content,- deviceId,- filePath,- sandboxTopicId,- workingDirectory,- });-- if ('blocked' in plan) {- notifyWorkspaceHtmlPublishBlocked(plan);- return;- }-- openWorkspaceHtmlPublishConfirm({- hasExisting: !!existing,- plan,- onOk: () => {- void runPublish(plan);- },- });- } catch {- toast.error(t('workingPanel.localFile.publish.failed'));- } finally {- setBusy((current) => (current === 'scanning' ? null : current));- }- }, [- busy,- content,- deviceId,- existing,- filePath,- runPublish,- sandboxTopicId,- t,- topicId,- workingDirectory,- ]);-- const publicUrl = existing?.publicUrl;- const visible = available && enabled && isHtml;-- return {- busy,- handlePublish,- publicUrl,- showLiveBar: visible && !!publicUrl,- showOverlayTrigger: visible && !publicUrl,- topicId,- };-};--export const PublishHtmlArtifactProvider = ({- children,- ...input-}: PublishHtmlArtifactButtonProps) => {- const model = usePublishHtmlArtifactModel(input);-- return <PublishHtmlArtifactContext value={model}>{children}</PublishHtmlArtifactContext>;-};--const PublishAction = () => {- const { t } = useTranslation('chat');- const model = use(PublishHtmlArtifactContext);- if (!model) return null;-- return (- <Button- disabled={!model.topicId}- loading={!!model.busy}- size={'small'}- title={model.topicId ? undefined : t('workingPanel.localFile.publish.noTopic')}- onClick={() => {- void model.handlePublish();- }}- >- {t(- model.publicUrl- ? 'workingPanel.localFile.publish.version'- : 'workingPanel.localFile.publish.action',- )}- </Button>- );-};--export const PublishHtmlArtifactLiveBar = () => {- const { t } = useTranslation(['chat', 'portal']);- const model = use(PublishHtmlArtifactContext);- if (!model?.showLiveBar || !model.publicUrl) return null;-- return (- <Flexbox- horizontal- align={'center'}- className={liveBarStyles.bar}- gap={8}- justify={'space-between'}- >- <Flexbox horizontal align={'center'} flex={1} gap={8} style={{ minWidth: 0 }}>- <Tag color={'success'} style={{ marginInlineEnd: 0 }}>- {t('workingPanel.localFile.publish.live')}- </Tag>- <Text ellipsis className={liveBarStyles.url}>- {model.publicUrl}- </Text>- <CopyButton content={model.publicUrl} size={'small'} />- <ActionIcon- icon={ExternalLinkIcon}- size={'small'}- title={t('artifacts.deploy.open', { ns: 'portal' })}- onClick={() => window.open(model.publicUrl, '_blank', 'noopener,noreferrer')}- />- </Flexbox>- <Flexbox flex={'none'}>- <PublishAction />- </Flexbox>- </Flexbox>- );-};+export const PublishHtmlArtifactProvider = ({ children }: PublishHtmlArtifactButtonProps) =>+ children;-export const PublishHtmlArtifactTrigger = () => {- const model = use(PublishHtmlArtifactContext);- if (!model?.showOverlayTrigger) return null;+export const PublishHtmlArtifactLiveBar = () => null;- return <PublishAction />;-};+export const PublishHtmlArtifactTrigger = () => null;diff --git a/src/features/Portal/LocalFile/gatherWorkspaceHtmlArtifact.ts b/src/features/Portal/LocalFile/gatherWorkspaceHtmlArtifact.tsindex b9bc2a055b9..d24517fc0c1 100644--- a/src/features/Portal/LocalFile/gatherWorkspaceHtmlArtifact.ts+++ b/src/features/Portal/LocalFile/gatherWorkspaceHtmlArtifact.ts@@ -1,6 +1,5 @@import { bytesToBase64 } from '@lobechat/utils';-import type { WorkspaceHtmlArtifactFile } from '@/business/client/features/WorkspaceHtmlArtifactPublish';import { extractHtmlTitle } from '@/components/HtmlPreview/htmlTagScanner';import {@@ -14,6 +13,7 @@ import {WORKSPACE_HTML_ARTIFACT_MAX_FILES,WORKSPACE_HTML_ARTIFACT_MAX_TOTAL_BYTES,} from './readWorkspaceAsset';+import type { WorkspaceHtmlArtifactFile } from './workspaceHtmlArtifact';import {lowestCommonAncestorDirectory,parentDirectory,diff --git a/src/features/Portal/LocalFile/packWorkspaceHtmlDocument.ts b/src/features/Portal/LocalFile/packWorkspaceHtmlDocument.tsindex 9000d04e563..494a018a720 100644--- a/src/features/Portal/LocalFile/packWorkspaceHtmlDocument.ts+++ b/src/features/Portal/LocalFile/packWorkspaceHtmlDocument.ts@@ -1,8 +1,6 @@import { decodeFromBase64, encodeToBase64 } from '@lobechat/utils';import { escapeRegExp } from 'es-toolkit';-import type { WorkspaceHtmlArtifactFile } from '@/business/client/features/WorkspaceHtmlArtifactPublish';-import {collectCssResourceHrefs,collectJsResourceHrefs,@@ -14,6 +12,7 @@ import {resolveWorkspaceAssetContentType,WORKSPACE_HTML_ARTIFACT_INLINE_MAX_BYTES,} from './readWorkspaceAsset';+import type { WorkspaceHtmlArtifactFile } from './workspaceHtmlArtifact';import { resolveLocalResourceHref, toWorkspaceRelativePath } from './workspaceHtmlPath';const SITE_ROOT = '/__workspace_html_site__';diff --git a/src/features/Portal/LocalFile/prepareWorkspaceHtmlPublish.ts b/src/features/Portal/LocalFile/prepareWorkspaceHtmlPublish.tsindex 5454dfdbf9a..d37786d831b 100644--- a/src/features/Portal/LocalFile/prepareWorkspaceHtmlPublish.ts+++ b/src/features/Portal/LocalFile/prepareWorkspaceHtmlPublish.ts@@ -1,11 +1,6 @@import { toast } from '@lobehub/ui/base-ui';import { t } from 'i18next';-import type {- WorkspaceHtmlArtifactPublisher,- WorkspaceHtmlArtifactPublishResult,-} from '@/business/client/features/WorkspaceHtmlArtifactPublish';-import {type GatheredWorkspaceHtmlArtifact,gatherWorkspaceHtmlArtifact,@@ -15,6 +10,10 @@ import {packWorkspaceHtmlDocument,} from './packWorkspaceHtmlDocument';import { readWorkspaceAsset } from './readWorkspaceAsset';+import type {+ WorkspaceHtmlArtifactPublisher,+ WorkspaceHtmlArtifactPublishResult,+} from './workspaceHtmlArtifact';export interface ReadyWorkspaceHtmlPublishPlan {gathered: GatheredWorkspaceHtmlArtifact;diff --git a/src/features/Portal/LocalFile/publishWorkspaceHtmlArtifact.ts b/src/features/Portal/LocalFile/publishWorkspaceHtmlArtifact.tsindex eecba3f2437..7319455a098 100644--- a/src/features/Portal/LocalFile/publishWorkspaceHtmlArtifact.ts+++ b/src/features/Portal/LocalFile/publishWorkspaceHtmlArtifact.ts@@ -1,13 +1,12 @@import { ARTIFACT_TAG } from '@lobechat/const';import { escapeXmlAttr } from '@lobechat/prompts';+import { hostedPath, packWorkspaceHtmlDocument } from './packWorkspaceHtmlDocument';import type {WorkspaceHtmlArtifactFile,WorkspaceHtmlArtifactPublishInput,WorkspaceHtmlArtifactPublishResult,-} from '@/business/client/features/WorkspaceHtmlArtifactPublish';--import { hostedPath, packWorkspaceHtmlDocument } from './packWorkspaceHtmlDocument';+} from './workspaceHtmlArtifact';export const wrapWorkspaceHtmlArtifact = ({html,diff --git a/src/features/Portal/LocalFile/usePublishWorkspaceHtmlFromFile.ts b/src/features/Portal/LocalFile/usePublishWorkspaceHtmlFromFile.tsindex ea309ab4ef2..f5865e226fd 100644--- a/src/features/Portal/LocalFile/usePublishWorkspaceHtmlFromFile.ts+++ b/src/features/Portal/LocalFile/usePublishWorkspaceHtmlFromFile.ts@@ -1,83 +1,9 @@-import { toast } from '@lobehub/ui/base-ui';-import { useCallback } from 'react';-import { useTranslation } from 'react-i18next';--import { useWorkspaceHtmlArtifactPublish } from '@/business/client/features/WorkspaceHtmlArtifactPublish';-import { isHtmlFile } from '@/components/HtmlPreview';-import { useChatStore } from '@/store/chat';-import { useUserStore } from '@/store/user';-import { labPreferSelectors } from '@/store/user/selectors';--import {- notifyWorkspaceHtmlPublishBlocked,- prepareWorkspaceHtmlPublish,- publishPreparedWorkspaceHtml,-} from './prepareWorkspaceHtmlPublish';-import { openWorkspaceHtmlPublishConfirm } from './PublishHtmlArtifactConfirm';-interface UsePublishWorkspaceHtmlFromFileInput {deviceId?: string;workingDirectory: string;}-export const usePublishWorkspaceHtmlFromFile = ({- deviceId,- workingDirectory,-}: UsePublishWorkspaceHtmlFromFileInput) => {- const { t } = useTranslation('chat');- const enabled = useUserStore(labPreferSelectors.enableArtifactDeployment);- const { available, getExisting, publish } = useWorkspaceHtmlArtifactPublish();- const agentId = useChatStore((s) => s.activeAgentId);- const topicId = useChatStore((s) => s.activeTopicId);- const openLocalFile = useChatStore((s) => s.openLocalFile);-- const canOfferFile = useCallback(- (path: string, isFolder: boolean) => enabled && available && !isFolder && isHtmlFile({ path }),- [available, enabled],- );-- const publishFile = useCallback(- async (filePath: string) => {- if (!topicId) {- toast.error(t('workingPanel.localFile.publish.noTopic'));- return;- }-- const loadingToast = toast.loading(t('workingPanel.localFile.publish.scanning'));- try {- const plan = await prepareWorkspaceHtmlPublish({- deviceId,- filePath,- workingDirectory,- });-- loadingToast.close();-- if ('blocked' in plan) {- notifyWorkspaceHtmlPublishBlocked(plan);- return;- }-- const existing = await getExisting({ identifier: plan.gathered.identifier, topicId });-- openWorkspaceHtmlPublishConfirm({- hasExisting: !!existing,- plan,- onOk: () => {- void publishPreparedWorkspaceHtml({ agentId, plan, publish, topicId }).then(- (result) => {- if (result) openLocalFile({ deviceId, filePath, workingDirectory });- },- );- },- });- } catch {- loadingToast.close();- toast.error(t('workingPanel.localFile.publish.failed'));- }- },- [agentId, deviceId, getExisting, openLocalFile, publish, t, topicId, workingDirectory],- );-- return { canOfferFile, publishFile };-};+export const usePublishWorkspaceHtmlFromFile = (_input: UsePublishWorkspaceHtmlFromFileInput) => ({+ canOfferFile: (_path: string, _isFolder: boolean) => false,+ publishFile: async (_filePath: string) => {},+});diff --git a/src/business/client/features/WorkspaceHtmlArtifactPublish.ts b/src/features/Portal/LocalFile/workspaceHtmlArtifact.tssimilarity index 60%rename from src/business/client/features/WorkspaceHtmlArtifactPublish.tsrename to src/features/Portal/LocalFile/workspaceHtmlArtifact.tsindex 71f21450359..9de53e8a3f9 100644--- a/src/business/client/features/WorkspaceHtmlArtifactPublish.ts+++ b/src/features/Portal/LocalFile/workspaceHtmlArtifact.ts@@ -37,21 +37,3 @@ export interface WorkspaceHtmlArtifactPublisher {input: WorkspaceHtmlArtifactPublishInput,) => Promise<WorkspaceHtmlArtifactPublishResult>;}--/**- * The open-source build has no market deployment backend, so this slot reports- * the publisher as unavailable; downstream builds override the module via their- * own `@/business/...` mapping. Keep the returned object referentially stable —- * consumers put `getExisting` in effect dependencies.- */-const unavailablePublisher: WorkspaceHtmlArtifactPublisher = {- available: false,- getExisting: async () => null,- publish: async () => {- throw new Error('unavailable');- },-};--export function useWorkspaceHtmlArtifactPublish(): WorkspaceHtmlArtifactPublisher {- return unavailablePublisher;-}