Files
tutti/packages/agent/gui/agent-gui/agentGuiNode/view/AgentGUIReferencePickerSurface.tsx
agent-radar 2ed3415fb7
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
2026-09-01 20:17:27 +08:00

93 lines
2.9 KiB
TypeScript

import type { ReactNode } from "react";
import {
ReferenceSourcePicker,
WorkspaceFileReferencePicker,
type ReferenceSourcePickerProps
} from "@tutti-os/workspace-file-reference/ui";
import type {
WorkspaceFileReferenceAdapter,
WorkspaceFileReferenceCopy
} from "@tutti-os/workspace-file-reference/contracts";
import type { WorkspaceFileManagerI18nRuntime } from "@tutti-os/workspace-file-manager";
export interface AgentGUIReferencePickerSurfaceProps {
aggregator: ReferenceSourcePickerProps["aggregator"] | null;
copy: WorkspaceFileReferenceCopy;
fileAdapter: WorkspaceFileReferenceAdapter | null;
fileManagerCopy: WorkspaceFileManagerI18nRuntime | null;
initialPath: string | null | undefined;
initialTarget: ReferenceSourcePickerProps["initialTarget"];
isNodeSelectable: ReferenceSourcePickerProps["isNodeSelectable"];
open: boolean;
purpose: "directory" | "reference";
renderDirectoryHeaderActions?: ReferenceSourcePickerProps["renderHeaderActions"];
renderSidebarActions?: (
context: Parameters<
NonNullable<ReferenceSourcePickerProps["renderSidebarActions"]>
>[0] & { purpose: "directory" | "reference" }
) => ReactNode;
resolveContentErrorAction: ReferenceSourcePickerProps["resolveContentErrorAction"];
resolveEntryIconUrl: ReferenceSourcePickerProps["resolveEntryIconUrl"];
workspaceId: string;
onClose: ReferenceSourcePickerProps["onClose"];
onConfirm: ReferenceSourcePickerProps["onConfirm"];
onConfirmBundles: ReferenceSourcePickerProps["onConfirmBundles"];
}
export function AgentGUIReferencePickerSurface({
aggregator,
copy,
fileAdapter,
fileManagerCopy,
initialPath,
initialTarget,
isNodeSelectable,
open,
purpose,
renderDirectoryHeaderActions,
renderSidebarActions,
resolveContentErrorAction,
resolveEntryIconUrl,
workspaceId,
onClose,
onConfirm,
onConfirmBundles
}: AgentGUIReferencePickerSurfaceProps): React.JSX.Element {
return aggregator ? (
<ReferenceSourcePicker
aggregator={aggregator}
copy={copy}
initialTarget={initialTarget}
isNodeSelectable={isNodeSelectable}
fileManagerCopy={fileManagerCopy ?? undefined}
open={open}
purpose={purpose}
renderHeaderActions={
purpose === "directory" ? renderDirectoryHeaderActions : undefined
}
renderSidebarActions={
renderSidebarActions
? (context) => renderSidebarActions({ ...context, purpose })
: undefined
}
resolveContentErrorAction={resolveContentErrorAction}
resolveEntryIconUrl={resolveEntryIconUrl}
workspaceId={workspaceId}
onClose={onClose}
onConfirm={onConfirm}
onConfirmBundles={onConfirmBundles}
/>
) : (
<WorkspaceFileReferencePicker
copy={copy}
fileAdapter={fileAdapter ?? undefined}
initialPath={initialPath}
open={open}
scoped
workspaceId={workspaceId}
onClose={onClose}
onConfirm={onConfirm}
/>
);
}