@agent-native/core 0.101.12 → 0.101.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +1 -1
- package/corpus/core/CHANGELOG.md +15 -0
- package/corpus/core/package.json +4 -2
- package/corpus/core/src/cli/create.ts +76 -17
- package/corpus/core/src/client/AgentPanel.tsx +61 -48
- package/corpus/core/src/client/assistant-ui-recovery.tsx +9 -3
- package/corpus/core/src/client/chat/message-components.tsx +26 -2
- package/corpus/core/src/client/chat/tool-call-display.tsx +18 -11
- package/corpus/core/src/mcp/server.ts +10 -1
- package/corpus/core/src/server/agent-chat/framework-prompts.ts +0 -3
- package/corpus/core/src/server/agent-chat-plugin.ts +2 -58
- package/corpus/core/src/server/prompts/framework-core-compact.ts +0 -1
- package/corpus/core/src/server/prompts/framework-core.ts +0 -30
- package/corpus/core/src/server/prompts/index.ts +1 -4
- package/corpus/templates/chat/app/components/layout/Sidebar.tsx +0 -14
- package/corpus/templates/chat/changelog/2026-07-15-chat-navigation-focuses-on-chat-and-agent.md +6 -0
- package/corpus/templates/clips/app/components/player/share-dialog.tsx +1 -1
- package/corpus/templates/clips/app/i18n/ar-SA.ts +1 -0
- package/corpus/templates/clips/app/i18n/de-DE.ts +1 -0
- package/corpus/templates/clips/app/i18n/en-US.ts +1 -0
- package/corpus/templates/clips/app/i18n/es-ES.ts +1 -0
- package/corpus/templates/clips/app/i18n/fr-FR.ts +1 -0
- package/corpus/templates/clips/app/i18n/hi-IN.ts +1 -0
- package/corpus/templates/clips/app/i18n/ja-JP.ts +1 -0
- package/corpus/templates/clips/app/i18n/ko-KR.ts +1 -0
- package/corpus/templates/clips/app/i18n/pt-BR.ts +1 -0
- package/corpus/templates/clips/app/i18n/zh-CN.ts +1 -0
- package/corpus/templates/clips/app/i18n/zh-TW.ts +1 -0
- package/corpus/templates/clips/changelog/2026-07-15-public-clip-links-are-labeled-share-with-humans-for-clarity.md +6 -0
- package/corpus/templates/forms/actions/delete-form.ts +4 -0
- package/corpus/templates/forms/actions/patch-form-fields.ts +3 -0
- package/corpus/templates/forms/actions/restore-form.ts +3 -0
- package/corpus/templates/forms/actions/update-form.ts +3 -0
- package/corpus/templates/forms/app/pages/FormBuilderPage.tsx +2 -2
- package/corpus/templates/forms/app/pages/ResponsesPage.tsx +2 -2
- package/corpus/templates/forms/changelog/2026-07-15-published-forms-now-reflect-field-updates-immediately-at-the.md +6 -0
- package/corpus/templates/forms/changelog/2026-07-15-response-rows-now-keep-every-column-aligned-to-the-top-for-c.md +6 -0
- package/corpus/templates/forms/server/handlers/forms.ts +1 -0
- package/corpus/templates/forms/server/lib/public-form-ssr.ts +47 -4
- package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +189 -82
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +1 -1
- package/dist/cli/create.d.ts +5 -2
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +52 -17
- package/dist/cli/create.js.map +1 -1
- package/dist/client/AgentPanel.d.ts +2 -0
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +24 -13
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/assistant-ui-recovery.d.ts +2 -0
- package/dist/client/assistant-ui-recovery.d.ts.map +1 -1
- package/dist/client/assistant-ui-recovery.js +5 -2
- package/dist/client/assistant-ui-recovery.js.map +1 -1
- package/dist/client/chat/message-components.d.ts +6 -0
- package/dist/client/chat/message-components.d.ts.map +1 -1
- package/dist/client/chat/message-components.js +15 -2
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/chat/tool-call-display.d.ts +4 -2
- package/dist/client/chat/tool-call-display.d.ts.map +1 -1
- package/dist/client/chat/tool-call-display.js +11 -13
- package/dist/client/chat/tool-call-display.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +10 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/notifications/routes.d.ts +2 -2
- package/dist/resources/handlers.d.ts +3 -3
- package/dist/server/agent-chat/framework-prompts.d.ts.map +1 -1
- package/dist/server/agent-chat/framework-prompts.js +0 -3
- package/dist/server/agent-chat/framework-prompts.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts +0 -22
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +2 -51
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/prompts/framework-core-compact.d.ts +0 -1
- package/dist/server/prompts/framework-core-compact.d.ts.map +1 -1
- package/dist/server/prompts/framework-core-compact.js +0 -1
- package/dist/server/prompts/framework-core-compact.js.map +1 -1
- package/dist/server/prompts/framework-core.d.ts +0 -9
- package/dist/server/prompts/framework-core.d.ts.map +1 -1
- package/dist/server/prompts/framework-core.js +0 -29
- package/dist/server/prompts/framework-core.js.map +1 -1
- package/dist/server/prompts/index.d.ts +1 -1
- package/dist/server/prompts/index.d.ts.map +1 -1
- package/dist/server/prompts/index.js +1 -1
- package/dist/server/prompts/index.js.map +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/templates/chat/.agents/skills/actions/SKILL.md +492 -0
- package/dist/templates/chat/.agents/skills/adding-a-feature/SKILL.md +189 -0
- package/dist/templates/chat/.agents/skills/agent-native-docs/SKILL.md +76 -0
- package/dist/templates/chat/.agents/skills/capture-learnings/SKILL.md +89 -0
- package/dist/templates/chat/.agents/skills/create-skill/SKILL.md +221 -0
- package/dist/templates/chat/.agents/skills/delegate-to-agent/SKILL.md +263 -0
- package/dist/templates/chat/.agents/skills/frontend-design/SKILL.md +112 -0
- package/dist/templates/chat/.agents/skills/real-time-sync/SKILL.md +232 -0
- package/dist/templates/chat/.agents/skills/security/SKILL.md +280 -0
- package/dist/templates/chat/.agents/skills/self-modifying-code/SKILL.md +106 -0
- package/dist/templates/chat/.agents/skills/shadcn-ui/SKILL.md +95 -0
- package/dist/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/dist/templates/chat/.env.example +5 -0
- package/dist/templates/chat/.ignore +0 -0
- package/dist/templates/chat/.oxfmtrc.json +8 -0
- package/dist/templates/chat/.react-router/types/+server-build.d.ts +18 -0
- package/dist/templates/chat/.react-router/types/app/+types/root.ts +68 -0
- package/dist/templates/chat/AGENTS.md +62 -0
- package/dist/templates/chat/CHANGELOG.md +10 -0
- package/dist/templates/chat/DEVELOPING.md +185 -0
- package/dist/templates/chat/README.md +32 -0
- package/dist/templates/chat/_gitignore +43 -0
- package/dist/templates/chat/actions/hello.ts +13 -0
- package/dist/templates/chat/actions/navigate.ts +41 -0
- package/dist/templates/chat/actions/run.ts +2 -0
- package/dist/templates/chat/actions/view-screen.ts +31 -0
- package/dist/templates/chat/app/components/layout/Header.tsx +59 -0
- package/dist/templates/chat/app/components/layout/Layout.tsx +184 -0
- package/dist/templates/chat/app/components/layout/Sidebar.tsx +580 -0
- package/dist/templates/chat/app/components/ui/button.tsx +1 -0
- package/dist/templates/chat/app/components/ui/card.tsx +1 -0
- package/dist/templates/chat/app/components/ui/dropdown-menu.tsx +1 -0
- package/dist/templates/chat/app/components/ui/input.tsx +1 -0
- package/dist/templates/chat/app/components/ui/label.tsx +1 -0
- package/dist/templates/chat/app/components/ui/sheet.tsx +1 -0
- package/dist/templates/chat/app/components/ui/toolkit-provider.tsx +12 -0
- package/dist/templates/chat/app/components/ui/tooltip.tsx +1 -0
- package/dist/templates/chat/app/entry.client.tsx +19 -0
- package/dist/templates/chat/app/entry.server.tsx +10 -0
- package/dist/templates/chat/app/global.css +93 -0
- package/dist/templates/chat/app/hooks/use-navigation-state.ts +111 -0
- package/dist/templates/chat/app/i18n/ar-SA.ts +68 -0
- package/dist/templates/chat/app/i18n/de-DE.ts +71 -0
- package/dist/templates/chat/app/i18n/en-US.ts +70 -0
- package/dist/templates/chat/app/i18n/es-ES.ts +71 -0
- package/dist/templates/chat/app/i18n/fr-FR.ts +71 -0
- package/dist/templates/chat/app/i18n/hi-IN.ts +69 -0
- package/dist/templates/chat/app/i18n/index.ts +34 -0
- package/dist/templates/chat/app/i18n/ja-JP.ts +70 -0
- package/dist/templates/chat/app/i18n/ko-KR.ts +70 -0
- package/dist/templates/chat/app/i18n/pt-BR.ts +71 -0
- package/dist/templates/chat/app/i18n/zh-CN.ts +67 -0
- package/dist/templates/chat/app/i18n/zh-TW.ts +67 -0
- package/dist/templates/chat/app/i18n-data.ts +556 -0
- package/dist/templates/chat/app/lib/agent-page.tsx +40 -0
- package/dist/templates/chat/app/lib/app-config.ts +11 -0
- package/dist/templates/chat/app/lib/tab-id.ts +1 -0
- package/dist/templates/chat/app/lib/utils.ts +1 -0
- package/dist/templates/chat/app/root.tsx +172 -0
- package/dist/templates/chat/app/routes/_index.tsx +91 -0
- package/dist/templates/chat/app/routes/agent.tsx +17 -0
- package/dist/templates/chat/app/routes/chat.$threadId.tsx +1 -0
- package/dist/templates/chat/app/routes/database.tsx +17 -0
- package/dist/templates/chat/app/routes/extensions.$id.$slug.tsx +2 -0
- package/dist/templates/chat/app/routes/extensions.$id.tsx +11 -0
- package/dist/templates/chat/app/routes/extensions._index.tsx +11 -0
- package/dist/templates/chat/app/routes/extensions.tsx +5 -0
- package/dist/templates/chat/app/routes/observability.tsx +18 -0
- package/dist/templates/chat/app/routes/settings.tsx +88 -0
- package/dist/templates/chat/app/routes/team.tsx +11 -0
- package/dist/templates/chat/app/routes.ts +4 -0
- package/dist/templates/chat/app/vite-env.d.ts +6 -0
- package/dist/templates/chat/changelog/2026-06-24-a-new-settings-page-gives-quick-access-to-language-workspace.md +6 -0
- package/dist/templates/chat/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/dist/templates/chat/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/dist/templates/chat/changelog/2026-06-28-left-sidebar-collapse-motion-and-footer-chrome-are-quieter.md +6 -0
- package/dist/templates/chat/changelog/2026-06-29-chat-layouts-adapt-when-the-agent-sidebar-is-open.md +6 -0
- package/dist/templates/chat/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/dist/templates/chat/changelog/2026-07-10-chat-now-makes-ai-connection-setup-clear-without-shifting-th.md +6 -0
- package/dist/templates/chat/changelog/2026-07-13-a-full-agent-page-now-brings-context-files-connections-jobs-.md +6 -0
- package/dist/templates/chat/changelog/2026-07-14-chat-opens-reliably-on-hosted-deployments-instead-of-failing.md +6 -0
- package/dist/templates/chat/changelog/2026-07-14-fixed-chat-template-startup-with-older-core-versions.md +6 -0
- package/dist/templates/chat/changelog/2026-07-15-chat-navigation-focuses-on-chat-and-agent.md +6 -0
- package/dist/templates/chat/components.json +20 -0
- package/dist/templates/chat/data/.gitkeep +0 -0
- package/dist/templates/chat/data/sync-config.json +1 -0
- package/dist/templates/chat/learnings.defaults.md +5 -0
- package/dist/templates/chat/netlify.toml +10 -0
- package/dist/templates/chat/package.json +92 -0
- package/dist/templates/chat/public/agent-native-icon-dark.svg +10 -0
- package/dist/templates/chat/public/agent-native-icon-light.svg +10 -0
- package/dist/templates/chat/public/agent-native-logo-dark.svg +21 -0
- package/dist/templates/chat/public/agent-native-logo-light.svg +21 -0
- package/dist/templates/chat/public/favicon.svg +1 -0
- package/dist/templates/chat/public/icon-180.svg +1 -0
- package/dist/templates/chat/public/icon-192.svg +1 -0
- package/dist/templates/chat/public/icon-512.svg +1 -0
- package/dist/templates/chat/public/manifest.json +21 -0
- package/dist/templates/chat/react-router.config.ts +7 -0
- package/dist/templates/chat/server/middleware/auth.ts +15 -0
- package/dist/templates/chat/server/plugins/agent-chat.ts +21 -0
- package/dist/templates/chat/server/plugins/auth.ts +17 -0
- package/dist/templates/chat/server/routes/[...page].get.ts +5 -0
- package/dist/templates/chat/ssr-entry.ts +15 -0
- package/dist/templates/chat/tsconfig.json +21 -0
- package/dist/templates/chat/vite.config.ts +19 -0
- package/package.json +2 -1
- package/src/templates/chat/.agents/skills/actions/SKILL.md +492 -0
- package/src/templates/chat/.agents/skills/adding-a-feature/SKILL.md +189 -0
- package/src/templates/chat/.agents/skills/agent-native-docs/SKILL.md +76 -0
- package/src/templates/chat/.agents/skills/capture-learnings/SKILL.md +89 -0
- package/src/templates/chat/.agents/skills/create-skill/SKILL.md +221 -0
- package/src/templates/chat/.agents/skills/delegate-to-agent/SKILL.md +263 -0
- package/src/templates/chat/.agents/skills/frontend-design/SKILL.md +112 -0
- package/src/templates/chat/.agents/skills/real-time-sync/SKILL.md +232 -0
- package/src/templates/chat/.agents/skills/security/SKILL.md +280 -0
- package/src/templates/chat/.agents/skills/self-modifying-code/SKILL.md +106 -0
- package/src/templates/chat/.agents/skills/shadcn-ui/SKILL.md +95 -0
- package/src/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/src/templates/chat/.env.example +5 -0
- package/src/templates/chat/.ignore +0 -0
- package/src/templates/chat/.oxfmtrc.json +8 -0
- package/src/templates/chat/.react-router/types/+server-build.d.ts +18 -0
- package/src/templates/chat/.react-router/types/app/+types/root.ts +68 -0
- package/src/templates/chat/AGENTS.md +62 -0
- package/src/templates/chat/CHANGELOG.md +10 -0
- package/src/templates/chat/DEVELOPING.md +185 -0
- package/src/templates/chat/README.md +32 -0
- package/src/templates/chat/_gitignore +43 -0
- package/src/templates/chat/actions/hello.spec.ts +23 -0
- package/src/templates/chat/actions/hello.ts +13 -0
- package/src/templates/chat/actions/navigate.spec.ts +68 -0
- package/src/templates/chat/actions/navigate.ts +41 -0
- package/src/templates/chat/actions/run.ts +2 -0
- package/src/templates/chat/actions/view-screen.spec.ts +40 -0
- package/src/templates/chat/actions/view-screen.ts +31 -0
- package/src/templates/chat/app/components/layout/Header.tsx +59 -0
- package/src/templates/chat/app/components/layout/Layout.tsx +184 -0
- package/src/templates/chat/app/components/layout/Sidebar.tsx +580 -0
- package/src/templates/chat/app/components/ui/button.tsx +1 -0
- package/src/templates/chat/app/components/ui/card.tsx +1 -0
- package/src/templates/chat/app/components/ui/dropdown-menu.tsx +1 -0
- package/src/templates/chat/app/components/ui/input.tsx +1 -0
- package/src/templates/chat/app/components/ui/label.tsx +1 -0
- package/src/templates/chat/app/components/ui/sheet.tsx +1 -0
- package/src/templates/chat/app/components/ui/toolkit-provider.tsx +12 -0
- package/src/templates/chat/app/components/ui/tooltip.tsx +1 -0
- package/src/templates/chat/app/entry.client.tsx +19 -0
- package/src/templates/chat/app/entry.server.tsx +10 -0
- package/src/templates/chat/app/global.css +93 -0
- package/src/templates/chat/app/hooks/use-navigation-state.ts +111 -0
- package/src/templates/chat/app/i18n/ar-SA.ts +68 -0
- package/src/templates/chat/app/i18n/de-DE.ts +71 -0
- package/src/templates/chat/app/i18n/en-US.ts +70 -0
- package/src/templates/chat/app/i18n/es-ES.ts +71 -0
- package/src/templates/chat/app/i18n/fr-FR.ts +71 -0
- package/src/templates/chat/app/i18n/hi-IN.ts +69 -0
- package/src/templates/chat/app/i18n/index.ts +34 -0
- package/src/templates/chat/app/i18n/ja-JP.ts +70 -0
- package/src/templates/chat/app/i18n/ko-KR.ts +70 -0
- package/src/templates/chat/app/i18n/pt-BR.ts +71 -0
- package/src/templates/chat/app/i18n/zh-CN.ts +67 -0
- package/src/templates/chat/app/i18n/zh-TW.ts +67 -0
- package/src/templates/chat/app/i18n-data.ts +556 -0
- package/src/templates/chat/app/lib/agent-page.spec.tsx +52 -0
- package/src/templates/chat/app/lib/agent-page.tsx +40 -0
- package/src/templates/chat/app/lib/app-config.ts +11 -0
- package/src/templates/chat/app/lib/tab-id.ts +1 -0
- package/src/templates/chat/app/lib/utils.ts +1 -0
- package/src/templates/chat/app/root.tsx +172 -0
- package/src/templates/chat/app/routes/_index.tsx +91 -0
- package/src/templates/chat/app/routes/agent.tsx +17 -0
- package/src/templates/chat/app/routes/chat.$threadId.tsx +1 -0
- package/src/templates/chat/app/routes/database.tsx +17 -0
- package/src/templates/chat/app/routes/extensions.$id.$slug.tsx +2 -0
- package/src/templates/chat/app/routes/extensions.$id.tsx +11 -0
- package/src/templates/chat/app/routes/extensions._index.tsx +11 -0
- package/src/templates/chat/app/routes/extensions.tsx +5 -0
- package/src/templates/chat/app/routes/observability.tsx +18 -0
- package/src/templates/chat/app/routes/settings.tsx +88 -0
- package/src/templates/chat/app/routes/team.tsx +11 -0
- package/src/templates/chat/app/routes.ts +4 -0
- package/src/templates/chat/app/vite-env.d.ts +6 -0
- package/src/templates/chat/changelog/2026-06-24-a-new-settings-page-gives-quick-access-to-language-workspace.md +6 -0
- package/src/templates/chat/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/src/templates/chat/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/src/templates/chat/changelog/2026-06-28-left-sidebar-collapse-motion-and-footer-chrome-are-quieter.md +6 -0
- package/src/templates/chat/changelog/2026-06-29-chat-layouts-adapt-when-the-agent-sidebar-is-open.md +6 -0
- package/src/templates/chat/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/src/templates/chat/changelog/2026-07-10-chat-now-makes-ai-connection-setup-clear-without-shifting-th.md +6 -0
- package/src/templates/chat/changelog/2026-07-13-a-full-agent-page-now-brings-context-files-connections-jobs-.md +6 -0
- package/src/templates/chat/changelog/2026-07-14-chat-opens-reliably-on-hosted-deployments-instead-of-failing.md +6 -0
- package/src/templates/chat/changelog/2026-07-14-fixed-chat-template-startup-with-older-core-versions.md +6 -0
- package/src/templates/chat/changelog/2026-07-15-chat-navigation-focuses-on-chat-and-agent.md +6 -0
- package/src/templates/chat/components.json +20 -0
- package/src/templates/chat/data/.gitkeep +0 -0
- package/src/templates/chat/data/sync-config.json +1 -0
- package/src/templates/chat/learnings.defaults.md +5 -0
- package/src/templates/chat/netlify.toml +10 -0
- package/src/templates/chat/package.json +92 -0
- package/src/templates/chat/public/agent-native-icon-dark.svg +10 -0
- package/src/templates/chat/public/agent-native-icon-light.svg +10 -0
- package/src/templates/chat/public/agent-native-logo-dark.svg +21 -0
- package/src/templates/chat/public/agent-native-logo-light.svg +21 -0
- package/src/templates/chat/public/favicon.svg +1 -0
- package/src/templates/chat/public/icon-180.svg +1 -0
- package/src/templates/chat/public/icon-192.svg +1 -0
- package/src/templates/chat/public/icon-512.svg +1 -0
- package/src/templates/chat/public/manifest.json +21 -0
- package/src/templates/chat/react-router.config.ts +7 -0
- package/src/templates/chat/server/middleware/auth.ts +15 -0
- package/src/templates/chat/server/plugins/agent-chat.ts +21 -0
- package/src/templates/chat/server/plugins/auth.ts +17 -0
- package/src/templates/chat/server/routes/[...page].get.ts +5 -0
- package/src/templates/chat/ssr-entry.ts +15 -0
- package/src/templates/chat/tsconfig.json +21 -0
- package/src/templates/chat/vite.config.ts +19 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { AgentToggleButton, useT } from "@agent-native/core/client";
|
|
2
|
+
import {
|
|
3
|
+
useHeaderTitle,
|
|
4
|
+
useHeaderActions,
|
|
5
|
+
} from "@agent-native/toolkit/app-shell";
|
|
6
|
+
import { IconMenu2 } from "@tabler/icons-react";
|
|
7
|
+
import { useLocation } from "react-router";
|
|
8
|
+
|
|
9
|
+
import { APP_TITLE } from "@/lib/app-config";
|
|
10
|
+
|
|
11
|
+
const pageTitleKeys: Record<string, string> = {
|
|
12
|
+
"/": "navigation.chat",
|
|
13
|
+
"/observability": "navigation.observability",
|
|
14
|
+
"/agent": "settings.agentTitle",
|
|
15
|
+
"/settings": "navigation.settings",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
function resolveTitle(pathname: string, t: (key: string) => string): string {
|
|
19
|
+
if (pageTitleKeys[pathname]) return t(pageTitleKeys[pathname]);
|
|
20
|
+
if (pathname.startsWith("/extensions")) return t("navigation.extensions");
|
|
21
|
+
return APP_TITLE;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface HeaderProps {
|
|
25
|
+
onOpenMobileSidebar?: () => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function Header({ onOpenMobileSidebar }: HeaderProps) {
|
|
29
|
+
const location = useLocation();
|
|
30
|
+
const t = useT();
|
|
31
|
+
const title = useHeaderTitle();
|
|
32
|
+
const actions = useHeaderActions();
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<header className="flex h-12 items-center gap-3 border-b border-border bg-background px-4 lg:px-6 shrink-0">
|
|
36
|
+
{onOpenMobileSidebar && (
|
|
37
|
+
<button
|
|
38
|
+
type="button"
|
|
39
|
+
onClick={onOpenMobileSidebar}
|
|
40
|
+
aria-label={t("navigation.openNavigation")}
|
|
41
|
+
className="flex h-9 w-9 cursor-pointer items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-accent md:hidden"
|
|
42
|
+
>
|
|
43
|
+
<IconMenu2 className="h-4 w-4" />
|
|
44
|
+
</button>
|
|
45
|
+
)}
|
|
46
|
+
<div className="flex items-center gap-3 flex-1 min-w-0">
|
|
47
|
+
{title ?? (
|
|
48
|
+
<h1 className="text-lg font-semibold tracking-tight truncate">
|
|
49
|
+
{resolveTitle(location.pathname, t)}
|
|
50
|
+
</h1>
|
|
51
|
+
)}
|
|
52
|
+
</div>
|
|
53
|
+
<div className="flex items-center gap-2 shrink-0">
|
|
54
|
+
{actions}
|
|
55
|
+
<AgentToggleButton />
|
|
56
|
+
</div>
|
|
57
|
+
</header>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgentSidebar,
|
|
3
|
+
focusAgentChat,
|
|
4
|
+
navigateWithAgentChatViewTransition,
|
|
5
|
+
useAgentChatHomeHandoff,
|
|
6
|
+
useAgentChatHomeHandoffLinks,
|
|
7
|
+
useT,
|
|
8
|
+
} from "@agent-native/core/client";
|
|
9
|
+
import { HeaderActionsProvider } from "@agent-native/toolkit/app-shell";
|
|
10
|
+
import { IconMenu2 } from "@tabler/icons-react";
|
|
11
|
+
import { useState, useEffect } from "react";
|
|
12
|
+
import { useLocation, useNavigate } from "react-router";
|
|
13
|
+
|
|
14
|
+
import { Button } from "@/components/ui/button";
|
|
15
|
+
import {
|
|
16
|
+
Sheet,
|
|
17
|
+
SheetContent,
|
|
18
|
+
SheetDescription,
|
|
19
|
+
SheetTitle,
|
|
20
|
+
} from "@/components/ui/sheet";
|
|
21
|
+
import { APP_TITLE } from "@/lib/app-config";
|
|
22
|
+
import { TAB_ID } from "@/lib/tab-id";
|
|
23
|
+
|
|
24
|
+
import { Header } from "./Header";
|
|
25
|
+
import { Sidebar } from "./Sidebar";
|
|
26
|
+
|
|
27
|
+
interface LayoutProps {
|
|
28
|
+
children: React.ReactNode;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const SIDEBAR_COLLAPSE_KEY = "chat.sidebar.collapsed";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Routes whose page renders its own toolbar. Layout still wraps these with the
|
|
35
|
+
* left Sidebar and agent surfaces but skips the global Header so they don't
|
|
36
|
+
* double-stack chrome.
|
|
37
|
+
*/
|
|
38
|
+
function routeOwnsToolbar(pathname: string): boolean {
|
|
39
|
+
return (
|
|
40
|
+
pathname === "/" ||
|
|
41
|
+
pathname.startsWith("/chat/") ||
|
|
42
|
+
pathname === "/database" ||
|
|
43
|
+
pathname.startsWith("/extensions")
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function Layout({ children }: LayoutProps) {
|
|
48
|
+
const location = useLocation();
|
|
49
|
+
const navigate = useNavigate();
|
|
50
|
+
const t = useT();
|
|
51
|
+
const [mobileSidebarOpen, setMobileSidebarOpen] = useState(false);
|
|
52
|
+
const [sidebarCollapsed, setSidebarCollapsed] = useState(true);
|
|
53
|
+
const isChatRoute =
|
|
54
|
+
location.pathname === "/" || location.pathname.startsWith("/chat/");
|
|
55
|
+
const chatHomeHandoffActive = useAgentChatHomeHandoff({
|
|
56
|
+
storageKey: "chat",
|
|
57
|
+
activePath: location.pathname,
|
|
58
|
+
enabled: !isChatRoute,
|
|
59
|
+
});
|
|
60
|
+
useAgentChatHomeHandoffLinks({
|
|
61
|
+
storageKey: "chat",
|
|
62
|
+
isChatPath: (pathname) => pathname === "/" || pathname.startsWith("/chat/"),
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
setMobileSidebarOpen(false);
|
|
67
|
+
}, [location.pathname]);
|
|
68
|
+
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
const closeMobileSidebar = () => setMobileSidebarOpen(false);
|
|
71
|
+
window.addEventListener("agent-chat:open-thread", closeMobileSidebar);
|
|
72
|
+
return () => {
|
|
73
|
+
window.removeEventListener("agent-chat:open-thread", closeMobileSidebar);
|
|
74
|
+
};
|
|
75
|
+
}, []);
|
|
76
|
+
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
try {
|
|
79
|
+
const stored = window.localStorage.getItem(SIDEBAR_COLLAPSE_KEY);
|
|
80
|
+
if (stored !== null) setSidebarCollapsed(stored === "1");
|
|
81
|
+
} catch {
|
|
82
|
+
// Ignore storage access errors; the default collapsed state still works.
|
|
83
|
+
}
|
|
84
|
+
}, []);
|
|
85
|
+
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
try {
|
|
88
|
+
window.localStorage.setItem(
|
|
89
|
+
SIDEBAR_COLLAPSE_KEY,
|
|
90
|
+
sidebarCollapsed ? "1" : "0",
|
|
91
|
+
);
|
|
92
|
+
} catch {
|
|
93
|
+
// Ignore storage access errors.
|
|
94
|
+
}
|
|
95
|
+
}, [sidebarCollapsed]);
|
|
96
|
+
|
|
97
|
+
const ownsToolbar = routeOwnsToolbar(location.pathname);
|
|
98
|
+
function openAskAgentFullscreen() {
|
|
99
|
+
focusAgentChat();
|
|
100
|
+
navigateWithAgentChatViewTransition(navigate, "/");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const contentFrame = (
|
|
104
|
+
<div className="flex h-full min-w-0 flex-1 flex-col overflow-hidden">
|
|
105
|
+
{isChatRoute ? (
|
|
106
|
+
<div className="flex h-12 shrink-0 items-center gap-3 border-b border-border bg-card px-3 md:hidden">
|
|
107
|
+
<Button
|
|
108
|
+
type="button"
|
|
109
|
+
variant="ghost"
|
|
110
|
+
size="icon"
|
|
111
|
+
onClick={() => setMobileSidebarOpen(true)}
|
|
112
|
+
aria-label={t("navigation.openNavigation")}
|
|
113
|
+
>
|
|
114
|
+
<IconMenu2 className="size-4" />
|
|
115
|
+
</Button>
|
|
116
|
+
<span className="truncate text-sm font-semibold">{APP_TITLE}</span>
|
|
117
|
+
</div>
|
|
118
|
+
) : ownsToolbar ? (
|
|
119
|
+
<div className="flex h-12 shrink-0 items-center border-b border-border px-4 md:hidden">
|
|
120
|
+
<button
|
|
121
|
+
type="button"
|
|
122
|
+
onClick={() => setMobileSidebarOpen(true)}
|
|
123
|
+
aria-label={t("navigation.openNavigation")}
|
|
124
|
+
className="flex h-9 w-9 cursor-pointer items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground"
|
|
125
|
+
>
|
|
126
|
+
<IconMenu2 className="h-4 w-4" />
|
|
127
|
+
</button>
|
|
128
|
+
</div>
|
|
129
|
+
) : (
|
|
130
|
+
<Header onOpenMobileSidebar={() => setMobileSidebarOpen(true)} />
|
|
131
|
+
)}
|
|
132
|
+
<main className="agent-native-app-main min-w-0 flex-1 overflow-y-auto overscroll-contain">
|
|
133
|
+
{children}
|
|
134
|
+
</main>
|
|
135
|
+
</div>
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
return (
|
|
139
|
+
<HeaderActionsProvider>
|
|
140
|
+
<div className="agent-layout-shell flex h-screen w-full overflow-hidden bg-background text-foreground">
|
|
141
|
+
<div className="agent-layout-left-drawer hidden md:block">
|
|
142
|
+
<Sidebar
|
|
143
|
+
collapsed={sidebarCollapsed}
|
|
144
|
+
onCollapsedChange={setSidebarCollapsed}
|
|
145
|
+
/>
|
|
146
|
+
</div>
|
|
147
|
+
<Sheet open={mobileSidebarOpen} onOpenChange={setMobileSidebarOpen}>
|
|
148
|
+
<SheetContent side="left" className="p-0 w-[260px]">
|
|
149
|
+
<SheetTitle className="sr-only">
|
|
150
|
+
{t("navigation.navigation")}
|
|
151
|
+
</SheetTitle>
|
|
152
|
+
<SheetDescription className="sr-only">
|
|
153
|
+
{t("navigation.navigationDescription")}
|
|
154
|
+
</SheetDescription>
|
|
155
|
+
<Sidebar collapsed={false} collapsible={false} />
|
|
156
|
+
</SheetContent>
|
|
157
|
+
</Sheet>
|
|
158
|
+
{isChatRoute ? (
|
|
159
|
+
<div className="agent-layout-main-surface flex min-w-0 flex-1 overflow-hidden">
|
|
160
|
+
{contentFrame}
|
|
161
|
+
</div>
|
|
162
|
+
) : (
|
|
163
|
+
<AgentSidebar
|
|
164
|
+
position="right"
|
|
165
|
+
chatViewTransition
|
|
166
|
+
storageKey="chat"
|
|
167
|
+
browserTabId={TAB_ID}
|
|
168
|
+
openOnChatRunning={chatHomeHandoffActive}
|
|
169
|
+
onFullscreenRequest={openAskAgentFullscreen}
|
|
170
|
+
emptyStateText={t("chat.inspectEmptyState")}
|
|
171
|
+
agentPageHref="/agent"
|
|
172
|
+
suggestions={[
|
|
173
|
+
t("chat.inspectSuggestionCapabilities"),
|
|
174
|
+
t("chat.inspectSuggestionHello"),
|
|
175
|
+
t("chat.inspectSuggestionAction"),
|
|
176
|
+
]}
|
|
177
|
+
>
|
|
178
|
+
{contentFrame}
|
|
179
|
+
</AgentSidebar>
|
|
180
|
+
)}
|
|
181
|
+
</div>
|
|
182
|
+
</HeaderActionsProvider>
|
|
183
|
+
);
|
|
184
|
+
}
|