refactor: isolate runtime contracts and enforce import boundaries (#6166)
* test: enforce Python import ownership boundaries * test: protect client import boundaries and rehome shared UI contracts * refactor: remove gateway and client dependency inversions * fix: detect dynamic imports in conditional expressions * refactor(tools): keep configuration contracts with their owners * docs: keep design guidance focused on ownership and checks * fix: preserve default threaded turn delivery
This commit is contained in:
1 parent
cd2a863710
commit
328e933d36
162 files changed
+3449
-1888
No files matched your search
@@ -4,7 +4,7 @@ import type {
|
||||
ChannelConfigField,
|
||||
ChannelFieldSection,
|
||||
ChannelSetupRequirement,
|
||||
} from "@/components/settings/channels/catalog";
|
||||
} from "@/channel-plugins/catalog";
|
||||
import {
|
||||
CredentialForm,
|
||||
channelFieldInputId,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { channelUiContribution } from "@/channel-plugins/registry";
|
||||
import { CircleHelp, ExternalLink } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { channelSetup } from "@/components/settings/channels/ChannelIdentity";
|
||||
import { docsUrlWithBase } from "@/components/settings/channels/catalog";
|
||||
import { docsUrlWithBase } from "@/channel-plugins/catalog";
|
||||
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from "@/components/ui/dropdown-menu";
|
||||
import { Tooltip, TooltipProvider, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip";
|
||||
import type { NanobotFeatureInfo } from "@/lib/types";
|
||||
|
||||
@@ -15,7 +15,7 @@ import type {
|
||||
ChannelConfigField,
|
||||
ChannelFieldPresentation,
|
||||
ChannelSetupPresentation,
|
||||
} from "@/components/settings/channels/catalog";
|
||||
} from "@/channel-plugins/catalog";
|
||||
import { channelValidationMessage } from "@/components/settings/channels/validationMessages";
|
||||
import { useLogoFallback } from "@/hooks/useLogoFallback";
|
||||
import { normalizeLocale } from "@/i18n/config";
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useTranslation } from "react-i18next";
|
||||
|
||||
import { channelUiPresentation } from "@/channel-plugins/registry";
|
||||
import { ToggleButton } from "@/components/settings/ToggleButton";
|
||||
import type { ChannelConfigField } from "@/components/settings/channels/catalog";
|
||||
import type { ChannelConfigField } from "@/channel-plugins/catalog";
|
||||
import {
|
||||
CredentialForm,
|
||||
channelValuesForSave,
|
||||
|
||||
@@ -29,7 +29,7 @@ import { useAutoSave } from "@/components/settings/shared/useAutoSave";
|
||||
import {
|
||||
type ChannelProviderPreset,
|
||||
type ChannelSetupPresentation,
|
||||
} from "@/components/settings/channels/catalog";
|
||||
} from "@/channel-plugins/catalog";
|
||||
import {
|
||||
ChannelFieldGroups,
|
||||
channelRequirementErrors,
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
type ChannelProviderPreset,
|
||||
type ChannelSetupPresentation,
|
||||
} from "@/components/settings/channels/catalog";
|
||||
} from "@/channel-plugins/catalog";
|
||||
import { copyTextToClipboard } from "@/lib/clipboard";
|
||||
import type { NanobotFeatureInfo } from "@/lib/types";
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
|
||||
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import type { ChannelConfigField } from "@/components/settings/channels/catalog";
|
||||
import type { ChannelConfigField } from "@/channel-plugins/catalog";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
function channelFieldValue(field: ChannelConfigField, values: Record<string, string>): string {
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
import type { ComponentType } from "react";
|
||||
|
||||
export type ChannelPresentation = {
|
||||
displayName: string;
|
||||
initials: string;
|
||||
color: string;
|
||||
icon?: ComponentType<{ className?: string; strokeWidth?: string | number }>;
|
||||
logoUrl?: string;
|
||||
/** Official site favicon to use when the primary asset is hosted on a CDN. */
|
||||
logoFallbackUrl?: string;
|
||||
/** The primary asset already includes its own background and safe area. */
|
||||
logoLayout?: "tile";
|
||||
setup?: ChannelCatalogSetupPresentation;
|
||||
};
|
||||
|
||||
export type ChannelSetupPresentation = {
|
||||
mode?: "webui" | "credentials" | "connect";
|
||||
primaryActionLabel?: string;
|
||||
command?: string;
|
||||
docsUrl?: string;
|
||||
docsLabel?: string;
|
||||
officialUrl?: string;
|
||||
officialLabel?: string;
|
||||
presetLabel?: string;
|
||||
sectionLabels?: Record<string, string>;
|
||||
fields?: ChannelConfigField[];
|
||||
manualFields?: ChannelConfigField[];
|
||||
requirements?: ChannelSetupRequirement[];
|
||||
actions?: ChannelSetupAction[];
|
||||
presets?: ChannelProviderPreset[];
|
||||
};
|
||||
|
||||
type ChannelCatalogSetupPresentation = {
|
||||
mode?: "webui" | "credentials" | "connect";
|
||||
command?: string;
|
||||
docsUrl?: string;
|
||||
fields?: ChannelFieldPresentation[];
|
||||
manualFields?: ChannelFieldPresentation[];
|
||||
actions?: ChannelSetupActionDefinition[];
|
||||
presets?: ChannelProviderPresetDefinition[];
|
||||
};
|
||||
|
||||
export type ChannelFieldPresentation = {
|
||||
key: string;
|
||||
section?: string;
|
||||
};
|
||||
|
||||
export type ChannelFieldSection =
|
||||
| "account"
|
||||
| "credentials"
|
||||
| "connection"
|
||||
| "access"
|
||||
| "behavior"
|
||||
| "security"
|
||||
| "advanced";
|
||||
|
||||
export type ChannelSetupRequirement = {
|
||||
alternatives: string[][];
|
||||
};
|
||||
|
||||
type ChannelSetupActionDefinition = Omit<ChannelSetupAction, "label">;
|
||||
|
||||
export type ChannelProviderPresetDefinition = Omit<ChannelProviderPreset, "label">;
|
||||
|
||||
type ChannelSetupAction = {
|
||||
id: string;
|
||||
label: string;
|
||||
url?: string;
|
||||
copyText?: string;
|
||||
logoUrl?: string;
|
||||
};
|
||||
|
||||
export type ChannelProviderPreset = {
|
||||
id: string;
|
||||
label: string;
|
||||
values: Record<string, string>;
|
||||
};
|
||||
|
||||
export type ChannelConfigField = {
|
||||
key: string;
|
||||
label: string;
|
||||
placeholder?: string;
|
||||
secret?: boolean;
|
||||
optional?: boolean;
|
||||
inputType?: "text" | "number" | "url" | "email" | "tel";
|
||||
kind?: "string" | "secret" | "int" | "bool" | "list" | "enum" | string;
|
||||
section?: string;
|
||||
defaultValue?: string;
|
||||
options?: ChannelConfigOption[];
|
||||
};
|
||||
|
||||
type ChannelConfigOption = {
|
||||
value: string;
|
||||
label: string;
|
||||
};
|
||||
|
||||
const NANOBOT_DOCS_URL = "https://nanobot.wiki/docs/latest";
|
||||
const CHAT_APPS_DOCS_URL = `${NANOBOT_DOCS_URL}/getting-started/chat-apps`;
|
||||
|
||||
export function chatAppGuideUrl(sectionId: string): string {
|
||||
return `${CHAT_APPS_DOCS_URL}#${sectionId}`;
|
||||
}
|
||||
|
||||
export function docsUrlWithBase(
|
||||
url: string | undefined,
|
||||
chatAppsDocsUrl?: string,
|
||||
): string | undefined {
|
||||
if (!url || !chatAppsDocsUrl) return url;
|
||||
if (!url.startsWith(CHAT_APPS_DOCS_URL)) return url;
|
||||
const anchor = url.includes("#") ? `#${url.split("#").pop()}` : "";
|
||||
return `${chatAppsDocsUrl.replace(/\/$/, "")}${anchor}`;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ import { SegmentedControl } from "@/components/ui/segmented-control";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { displayTitle } from "@/lib/chat-groups";
|
||||
import { copyTextToClipboard } from "@/lib/clipboard";
|
||||
import { fmtDateTime, relativeTime } from "@/lib/format";
|
||||
import { fmtDateTime, relativeTime } from "@/lib/format-time";
|
||||
import type { SendAttachment, SendOptions } from "@/hooks/useNanobotStream";
|
||||
import type {
|
||||
AutomationsPayload,
|
||||
|
||||
Reference in new issue
Block a user