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
@@ -0,0 +1,112 @@
|
||||
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}`;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ComponentType } from "react";
|
||||
|
||||
import type { ChannelPresentation } from "@/components/settings/channels/catalog";
|
||||
import type { ChannelPresentation } from "@/channel-plugins/catalog";
|
||||
import type {
|
||||
NanobotFeatureInfo,
|
||||
NanobotFeaturesPayload,
|
||||
|
||||
Reference in new issue
Block a user