Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/desktop/src/platform/useDesktopWorkbenchModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
export function useDesktopWorkbenchModel(
selectedConversationId?: string,
t?: (key: string) => string,
tApp?: (key: string, options?: any) => string,

Check failure on line 167 in app/desktop/src/platform/useDesktopWorkbenchModel.ts

View workflow job for this annotation

GitHub Actions / frontend-desktop (1)

Unexpected any. Specify a different type

Check failure on line 167 in app/desktop/src/platform/useDesktopWorkbenchModel.ts

View workflow job for this annotation

GitHub Actions / frontend-desktop (2)

Unexpected any. Specify a different type
): DesktopWorkbenchModel {
const dataModeOverride = useSyncExternalStore(
subscribeWorkbenchDataModeOverride,
Expand Down Expand Up @@ -320,7 +320,7 @@
activeConversationId: selectedDemoConversation,
agents: demoWorkbenchAgents,
conversations: edgeConversations,
dataMode: dataModeContract.statusLabel,
dataMode: dataModeContract.mode,
edgeDemoData: true as const,
isDemo: true,
transcript: edgeTranscript.length > 0 ? edgeTranscript : EMPTY_TRANSCRIPT,
Expand All @@ -342,7 +342,7 @@
activeConversationId: selectedDemoConversation,
agents: demoWorkbenchAgents,
conversations: demoSnapshot.conversations,
dataMode: dataModeContract.statusLabel,
dataMode: dataModeContract.mode,
isDemo: true,
transcript: workbenchDemoRuntimeStore.resolveTranscript(selectedDemoConversation),
agentActivity,
Expand All @@ -351,7 +351,7 @@
...(threadsQuery.error ? { threadsError: errorMessage(threadsQuery.error, tApp?.('threads.loadFailed') ?? 'Threads 加载失败') } : {}),
...(threadItemsQuery.error ? { itemsError: errorMessage(threadItemsQuery.error, tApp?.('items.loadFailed') ?? '消息加载失败') } : {}),
};
}, [dataModeContract.statusLabel, demoSnapshot, selectedConversationId, useEdgeDemoData, threads, activeThread, threadPins, threadItems, threadItemsQuery.error, threadItemsQuery.isLoading, threadsQuery.error, threadsQuery.isLoading, agentActivity]);
}, [dataModeContract.mode, demoSnapshot, selectedConversationId, useEdgeDemoData, threads, activeThread, threadPins, threadItems, threadItemsQuery.error, threadItemsQuery.isLoading, threadsQuery.error, threadsQuery.isLoading, agentActivity]);

Check warning on line 354 in app/desktop/src/platform/useDesktopWorkbenchModel.ts

View workflow job for this annotation

GitHub Actions / frontend-desktop (1)

React Hook useMemo has missing dependencies: 't' and 'tApp'. Either include them or remove the dependency array. If 'tApp' changes too often, find the parent component that defines it and wrap that definition in useCallback

Check warning on line 354 in app/desktop/src/platform/useDesktopWorkbenchModel.ts

View workflow job for this annotation

GitHub Actions / frontend-desktop (2)

React Hook useMemo has missing dependencies: 't' and 'tApp'. Either include them or remove the dependency array. If 'tApp' changes too often, find the parent component that defines it and wrap that definition in useCallback

const conversations = useMemo(() => {
// Merge Hub sessions + Edge threads into a unified conversation list.
Expand All @@ -368,7 +368,7 @@
// Hub sessions first (IM/social), then Edge threads (execution).
if (hubConversationList.length === 0 && edgeConversationList.length === 0) return [];
return [...hubConversationList, ...edgeConversationList];
}, [activeThread?.threadId, hubSessions, threadPins, threads, useHubConversations]);

Check warning on line 371 in app/desktop/src/platform/useDesktopWorkbenchModel.ts

View workflow job for this annotation

GitHub Actions / frontend-desktop (1)

React Hook useMemo has a missing dependency: 'tApp'. Either include it or remove the dependency array

Check warning on line 371 in app/desktop/src/platform/useDesktopWorkbenchModel.ts

View workflow job for this annotation

GitHub Actions / frontend-desktop (2)

React Hook useMemo has a missing dependency: 'tApp'. Either include it or remove the dependency array

const transcript = useMemo(() => {
// If a Hub session is active, use Hub messages for the transcript.
Expand Down Expand Up @@ -499,7 +499,7 @@
...(resolvedContactsActions != null ? { contactsActions: resolvedContactsActions } : {}),
...(resolvedChatActions != null ? { chatActions: resolvedChatActions } : {}),
conversations,
dataMode: dataModeContract.statusLabel,
dataMode: dataModeContract.mode,
isDemo: false,
...(resolvedProjects != null ? { projects: resolvedProjects } : {}),
...(resolvedProjectsStatus != null ? { projectsStatus: resolvedProjectsStatus } : {}),
Expand Down Expand Up @@ -535,7 +535,7 @@
return resolveWorkbenchDataMode(import.meta.env.VITE_AGENTHUB_DATA_MODE, override);
}

function threadToConversation(thread: ThreadInfo, pins?: ThreadPinInfo[], tApp?: (key: string, options?: any) => string): WorkbenchConversation {

Check failure on line 538 in app/desktop/src/platform/useDesktopWorkbenchModel.ts

View workflow job for this annotation

GitHub Actions / frontend-desktop (1)

Unexpected any. Specify a different type

Check failure on line 538 in app/desktop/src/platform/useDesktopWorkbenchModel.ts

View workflow job for this annotation

GitHub Actions / frontend-desktop (2)

Unexpected any. Specify a different type
const updatedLabel = thread.updatedAt ? formatTimestamp(thread.updatedAt) : undefined;

const conversation: WorkbenchConversation = {
Expand Down Expand Up @@ -598,7 +598,7 @@

function workspaceProjectToProjectInfo(
project: { id: string; name?: string; description?: string; created_at?: string; updated_at?: string },
tApp?: (key: string, options?: any) => string,

Check failure on line 601 in app/desktop/src/platform/useDesktopWorkbenchModel.ts

View workflow job for this annotation

GitHub Actions / frontend-desktop (1)

Unexpected any. Specify a different type

Check failure on line 601 in app/desktop/src/platform/useDesktopWorkbenchModel.ts

View workflow job for this annotation

GitHub Actions / frontend-desktop (2)

Unexpected any. Specify a different type
): ProjectInfo {
const description = project.description?.trim() || 'Hub workspace project';
return {
Expand Down
11 changes: 3 additions & 8 deletions app/shared/src/demo/dataMode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
normalizeWorkbenchDataMode,
readWorkbenchDataModeOverride,
resolveWorkbenchDataMode,
workbenchDataModeLabel,
writeWorkbenchDataModeOverride,
} from './dataMode';

Expand Down Expand Up @@ -48,13 +47,11 @@ describe('normalizeWorkbenchDataMode', () => {
expect(isWorkbenchRealDataMode('observed')).toBe(true);
expect(isWorkbenchRealDataMode('approved-real')).toBe(true);
expect(isWorkbenchRealDataMode('auto')).toBe(false);
expect(workbenchDataModeLabel('approved-real')).toBe('approved-real');
});

it('exposes a single shared contract for runtime and evidence boundaries', () => {
expect(getWorkbenchDataModeContract('mock')).toMatchObject({
mode: 'mock',
statusLabel: 'mock',
allowsMockData: true,
allowsFixtureData: false,
allowsDemoRuntimeFallback: true,
Expand All @@ -66,7 +63,6 @@ describe('normalizeWorkbenchDataMode', () => {

expect(getWorkbenchDataModeContract('fixture')).toMatchObject({
mode: 'fixture',
statusLabel: 'fixture',
allowsMockData: false,
allowsFixtureData: true,
allowsDemoRuntimeFallback: true,
Expand All @@ -78,7 +74,6 @@ describe('normalizeWorkbenchDataMode', () => {

expect(getWorkbenchDataModeContract('approved-real')).toMatchObject({
mode: 'approved-real',
statusLabel: 'approved-real',
allowsMockData: false,
allowsFixtureData: false,
allowsDemoRuntimeFallback: false,
Expand All @@ -90,8 +85,8 @@ describe('normalizeWorkbenchDataMode', () => {
});

it('keeps transient runtime states out of canonical data-mode labels', () => {
expect(workbenchDataModeLabel('auto')).toBe('auto');
expect(workbenchDataModeLabel('demo+edge')).toBe('auto');
expect(workbenchDataModeLabel('mock (auto fallback)')).toBe('auto');
expect(normalizeWorkbenchDataMode('auto')).toBe('auto');
expect(normalizeWorkbenchDataMode('demo+edge')).toBe('auto');
expect(normalizeWorkbenchDataMode('mock (auto fallback)')).toBe('auto');
});
});
10 changes: 0 additions & 10 deletions app/shared/src/demo/dataMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export type WorkbenchDataMode =

export interface WorkbenchDataModeContract {
mode: WorkbenchDataMode;
statusLabel: WorkbenchDataMode;
allowsMockData: boolean;
allowsFixtureData: boolean;
allowsDemoRuntimeFallback: boolean;
Expand All @@ -33,7 +32,6 @@ const WORKBENCH_DATA_MODE_EVENT = 'agenthub:workbench-data-mode';
export const WORKBENCH_DATA_MODE_CONTRACTS: Record<WorkbenchDataMode, WorkbenchDataModeContract> = {
auto: {
mode: 'auto',
statusLabel: 'auto',
allowsMockData: true,
allowsFixtureData: true,
allowsDemoRuntimeFallback: false,
Expand All @@ -44,7 +42,6 @@ export const WORKBENCH_DATA_MODE_CONTRACTS: Record<WorkbenchDataMode, WorkbenchD
},
mock: {
mode: 'mock',
statusLabel: 'mock',
allowsMockData: true,
allowsFixtureData: false,
allowsDemoRuntimeFallback: true,
Expand All @@ -55,7 +52,6 @@ export const WORKBENCH_DATA_MODE_CONTRACTS: Record<WorkbenchDataMode, WorkbenchD
},
fixture: {
mode: 'fixture',
statusLabel: 'fixture',
allowsMockData: false,
allowsFixtureData: true,
allowsDemoRuntimeFallback: true,
Expand All @@ -66,7 +62,6 @@ export const WORKBENCH_DATA_MODE_CONTRACTS: Record<WorkbenchDataMode, WorkbenchD
},
observed: {
mode: 'observed',
statusLabel: 'observed',
allowsMockData: false,
allowsFixtureData: false,
allowsDemoRuntimeFallback: false,
Expand All @@ -77,7 +72,6 @@ export const WORKBENCH_DATA_MODE_CONTRACTS: Record<WorkbenchDataMode, WorkbenchD
},
'approved-real': {
mode: 'approved-real',
statusLabel: 'approved-real',
allowsMockData: false,
allowsFixtureData: false,
allowsDemoRuntimeFallback: false,
Expand Down Expand Up @@ -129,10 +123,6 @@ export function isWorkbenchRealDataMode(mode: string | undefined): boolean {
return getWorkbenchDataModeContract(mode).isRealDataMode;
}

export function workbenchDataModeLabel(mode: string | undefined): string {
return getWorkbenchDataModeContract(mode).statusLabel;
}

export function readWorkbenchDataModeOverride(): WorkbenchDataMode | undefined {
if (typeof window === 'undefined') return undefined;
try {
Expand Down
1 change: 0 additions & 1 deletion app/shared/src/demo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export {
readWorkbenchDataModeOverride,
resolveWorkbenchDataMode,
subscribeWorkbenchDataModeOverride,
workbenchDataModeLabel,
writeWorkbenchDataModeOverride,
} from './dataMode';
export type {
Expand Down
2 changes: 1 addition & 1 deletion app/web/src/platform/useWebWorkbenchModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ export function useWebWorkbenchModel(selectedConversationId?: string, selectedPr

const workbenchStatus = useMemo(
() => ({
dataMode: dataModeContract.statusLabel,
dataMode: dataModeContract.mode,
targetState: executionTargetStatus.state,
targetLabel: executionTargetStatus.selectedTarget
? executionTargetLabel(executionTargetStatus.selectedTarget)
Expand Down
Loading