@nastechai/agent 0.16.0 → 0.17.0
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/eslint.config.js +23 -0
- package/index.html +24 -0
- package/package.json +54 -26
- package/package.json.bak +89 -0
- package/package.json.pub +88 -0
- package/src/App.tsx +1173 -0
- package/src/components/AuthWidget.tsx +150 -0
- package/src/components/AutoField.tsx +206 -0
- package/src/components/Backdrop.tsx +93 -0
- package/src/components/ChatSidebar.tsx +394 -0
- package/src/components/DeleteConfirmDialog.tsx +40 -0
- package/src/components/LanguageSwitcher.tsx +186 -0
- package/src/components/Markdown.tsx +383 -0
- package/src/components/ModelInfoCard.tsx +112 -0
- package/src/components/ModelPickerDialog.tsx +470 -0
- package/src/components/OAuthLoginModal.tsx +374 -0
- package/src/components/OAuthProvidersCard.tsx +287 -0
- package/src/components/PlatformsCard.tsx +97 -0
- package/src/components/ScheduleBuilder.tsx +273 -0
- package/src/components/SidebarFooter.tsx +42 -0
- package/src/components/SidebarStatusStrip.tsx +72 -0
- package/src/components/SlashPopover.tsx +171 -0
- package/src/components/ThemeSwitcher.tsx +243 -0
- package/src/components/ToolCall.tsx +228 -0
- package/src/components/ToolsetConfigDrawer.tsx +448 -0
- package/src/contexts/PageHeaderProvider.tsx +139 -0
- package/src/contexts/SystemActions.tsx +120 -0
- package/src/contexts/page-header-context.ts +12 -0
- package/src/contexts/system-actions-context.ts +18 -0
- package/src/contexts/usePageHeader.ts +10 -0
- package/src/contexts/useSystemActions.ts +15 -0
- package/src/hooks/useModalBehavior.ts +44 -0
- package/src/hooks/useSidebarStatus.ts +27 -0
- package/src/i18n/af.ts +702 -0
- package/src/i18n/context.tsx +123 -0
- package/src/i18n/de.ts +701 -0
- package/src/i18n/en.ts +708 -0
- package/src/i18n/es.ts +701 -0
- package/src/i18n/fr.ts +701 -0
- package/src/i18n/ga.ts +702 -0
- package/src/i18n/hu.ts +702 -0
- package/src/i18n/index.ts +2 -0
- package/src/i18n/it.ts +701 -0
- package/src/i18n/ja.ts +702 -0
- package/src/i18n/ko.ts +702 -0
- package/src/i18n/pt.ts +702 -0
- package/src/i18n/ru.ts +702 -0
- package/src/i18n/tr.ts +702 -0
- package/src/i18n/types.ts +710 -0
- package/src/i18n/uk.ts +702 -0
- package/src/i18n/zh-hant.ts +702 -0
- package/src/i18n/zh.ts +698 -0
- package/src/index.css +274 -0
- package/src/lib/api.ts +1585 -0
- package/src/lib/dashboard-flags.ts +15 -0
- package/src/lib/format.ts +9 -0
- package/src/lib/fuzzy.ts +192 -0
- package/src/lib/gatewayClient.ts +253 -0
- package/src/lib/nested.ts +23 -0
- package/src/lib/resolve-page-title.ts +41 -0
- package/src/lib/schedule.ts +382 -0
- package/src/lib/slashExec.ts +163 -0
- package/src/lib/utils.ts +35 -0
- package/src/main.tsx +25 -0
- package/src/pages/AnalyticsPage.tsx +601 -0
- package/src/pages/ChannelsPage.tsx +772 -0
- package/src/pages/ChatPage.tsx +889 -0
- package/src/pages/ConfigPage.tsx +660 -0
- package/src/pages/CronPage.tsx +524 -0
- package/src/pages/DocsPage.tsx +69 -0
- package/src/pages/EnvPage.tsx +918 -0
- package/src/pages/LogsPage.tsx +246 -0
- package/src/pages/McpPage.tsx +757 -0
- package/src/pages/ModelsPage.tsx +994 -0
- package/src/pages/PairingPage.tsx +276 -0
- package/src/pages/PluginsPage.tsx +580 -0
- package/src/pages/ProfilesPage.tsx +559 -0
- package/src/pages/SessionsPage.tsx +936 -0
- package/src/pages/SkillsPage.tsx +557 -0
- package/src/pages/SystemPage.tsx +1259 -0
- package/src/pages/WebhooksPage.tsx +483 -0
- package/src/plugins/PluginPage.tsx +64 -0
- package/src/plugins/index.ts +6 -0
- package/src/plugins/registry.ts +151 -0
- package/src/plugins/sdk.d.ts +160 -0
- package/src/plugins/slots.ts +199 -0
- package/src/plugins/types.ts +37 -0
- package/src/plugins/usePlugins.ts +133 -0
- package/src/themes/context.tsx +443 -0
- package/src/themes/fonts.ts +160 -0
- package/src/themes/index.ts +3 -0
- package/src/themes/presets.ts +477 -0
- package/src/themes/types.ts +187 -0
- package/tsconfig.app.json +34 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node.json +26 -0
- package/vite.config.ts +124 -0
- package/vite.config.ts.timestamp-1780999102396-af6b77b30ebd8.mjs +105 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { createContext, useContext, useState, useCallback, type ReactNode } from "react";
|
|
2
|
+
import type { Locale, Translations } from "./types";
|
|
3
|
+
import { en } from "./en";
|
|
4
|
+
import { zh } from "./zh";
|
|
5
|
+
import { zhHant } from "./zh-hant";
|
|
6
|
+
import { ja } from "./ja";
|
|
7
|
+
import { de } from "./de";
|
|
8
|
+
import { es } from "./es";
|
|
9
|
+
import { fr } from "./fr";
|
|
10
|
+
import { tr } from "./tr";
|
|
11
|
+
import { uk } from "./uk";
|
|
12
|
+
import { af } from "./af";
|
|
13
|
+
import { ko } from "./ko";
|
|
14
|
+
import { it } from "./it";
|
|
15
|
+
import { ga } from "./ga";
|
|
16
|
+
import { pt } from "./pt";
|
|
17
|
+
import { ru } from "./ru";
|
|
18
|
+
import { hu } from "./hu";
|
|
19
|
+
|
|
20
|
+
const TRANSLATIONS: Record<Locale, Translations> = {
|
|
21
|
+
en,
|
|
22
|
+
zh,
|
|
23
|
+
"zh-hant": zhHant,
|
|
24
|
+
ja,
|
|
25
|
+
de,
|
|
26
|
+
es,
|
|
27
|
+
fr,
|
|
28
|
+
tr,
|
|
29
|
+
uk,
|
|
30
|
+
af,
|
|
31
|
+
ko,
|
|
32
|
+
it,
|
|
33
|
+
ga,
|
|
34
|
+
pt,
|
|
35
|
+
ru,
|
|
36
|
+
hu,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// Display metadata for the language picker — endonym (native name) so users
|
|
40
|
+
// recognize their language even if they don't speak the current UI language.
|
|
41
|
+
// Exposed as a constant so the LanguageSwitcher and any future settings page
|
|
42
|
+
// can share the same list.
|
|
43
|
+
//
|
|
44
|
+
// We intentionally do NOT pair locales with country flags. Languages are not
|
|
45
|
+
// countries (English ≠ GB, Portuguese ≠ PT, Spanish ≠ ES, Chinese variants ≠
|
|
46
|
+
// any single jurisdiction). Endonyms are unambiguous and avoid the political
|
|
47
|
+
// mismapping that flag pairings inevitably create.
|
|
48
|
+
export const LOCALE_META: Record<Locale, { name: string }> = {
|
|
49
|
+
en: { name: "English" },
|
|
50
|
+
zh: { name: "简体中文" },
|
|
51
|
+
"zh-hant": { name: "繁體中文" },
|
|
52
|
+
ja: { name: "日本語" },
|
|
53
|
+
de: { name: "Deutsch" },
|
|
54
|
+
es: { name: "Español" },
|
|
55
|
+
fr: { name: "Français" },
|
|
56
|
+
tr: { name: "Türkçe" },
|
|
57
|
+
uk: { name: "Українська" },
|
|
58
|
+
af: { name: "Afrikaans" },
|
|
59
|
+
ko: { name: "한국어" },
|
|
60
|
+
it: { name: "Italiano" },
|
|
61
|
+
ga: { name: "Gaeilge" },
|
|
62
|
+
pt: { name: "Português" },
|
|
63
|
+
ru: { name: "Русский" },
|
|
64
|
+
hu: { name: "Magyar" },
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const SUPPORTED_LOCALES = Object.keys(TRANSLATIONS) as Locale[];
|
|
68
|
+
const STORAGE_KEY = "nastech-locale";
|
|
69
|
+
|
|
70
|
+
function isLocale(value: string): value is Locale {
|
|
71
|
+
return (SUPPORTED_LOCALES as string[]).includes(value);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function getInitialLocale(): Locale {
|
|
75
|
+
try {
|
|
76
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
77
|
+
if (stored && isLocale(stored)) return stored;
|
|
78
|
+
} catch {
|
|
79
|
+
// SSR or privacy mode
|
|
80
|
+
}
|
|
81
|
+
return "en";
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface I18nContextValue {
|
|
85
|
+
locale: Locale;
|
|
86
|
+
setLocale: (l: Locale) => void;
|
|
87
|
+
t: Translations;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const I18nContext = createContext<I18nContextValue>({
|
|
91
|
+
locale: "en",
|
|
92
|
+
setLocale: () => {},
|
|
93
|
+
t: en,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export function I18nProvider({ children }: { children: ReactNode }) {
|
|
97
|
+
const [locale, setLocaleState] = useState<Locale>(getInitialLocale);
|
|
98
|
+
|
|
99
|
+
const setLocale = useCallback((l: Locale) => {
|
|
100
|
+
setLocaleState(l);
|
|
101
|
+
try {
|
|
102
|
+
localStorage.setItem(STORAGE_KEY, l);
|
|
103
|
+
} catch {
|
|
104
|
+
// ignore
|
|
105
|
+
}
|
|
106
|
+
}, []);
|
|
107
|
+
|
|
108
|
+
const value: I18nContextValue = {
|
|
109
|
+
locale,
|
|
110
|
+
setLocale,
|
|
111
|
+
t: TRANSLATIONS[locale],
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<I18nContext.Provider value={value}>
|
|
116
|
+
{children}
|
|
117
|
+
</I18nContext.Provider>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function useI18n() {
|
|
122
|
+
return useContext(I18nContext);
|
|
123
|
+
}
|