Initial commit from agent-native create

This commit is contained in:
agent-native
2026-07-25 17:10:38 +00:00
commit ffea2aeff7
120 changed files with 6804 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
import type { ComponentType } from "react";
export type AgentPageProps = {
appName?: string;
};
type AgentClientModule = {
AgentChatSurface: ComponentType<{
mode?: "panel" | "page";
className?: string;
showHeader?: boolean;
showTabBar?: boolean;
}>;
AgentTabsPage?: ComponentType<AgentPageProps>;
};
const legacyAgentPages = new WeakMap<
AgentClientModule,
ComponentType<AgentPageProps>
>();
/**
* Keep the chat scaffold runnable when its template and core package are
* briefly out of sync during a release. Older core versions do not export
* AgentTabsPage, but they do expose the page-level chat surface.
*/
export function resolveAgentPageComponent(
client: AgentClientModule,
): ComponentType<AgentPageProps> {
if (typeof client.AgentTabsPage === "function") {
return client.AgentTabsPage;
}
const existing = legacyAgentPages.get(client);
if (existing) return existing;
const legacyAgentPage = function LegacyAgentPage() {
return (
<client.AgentChatSurface
mode="page"
className="h-full"
showHeader={false}
showTabBar={false}
/>
);
};
legacyAgentPages.set(client, legacyAgentPage);
return legacyAgentPage;
}
+11
View File
@@ -0,0 +1,11 @@
const rawAppName = "app";
const rawAppTitle = "App";
const APP_NAME_PLACEHOLDER = "{" + "{APP_NAME}}";
const APP_TITLE_PLACEHOLDER = "{" + "{APP_TITLE}}";
export const APP_NAME =
rawAppName === APP_NAME_PLACEHOLDER ? "chat" : rawAppName;
export const APP_TITLE =
rawAppTitle === APP_TITLE_PLACEHOLDER ? "Chat" : rawAppTitle;
+1
View File
@@ -0,0 +1 @@
export const TAB_ID = Math.random().toString(36).slice(2, 10);
+1
View File
@@ -0,0 +1 @@
export { cn } from "@agent-native/toolkit/utils";