feat(usage): v0.7.6 — OpenCode Go 套餐用量查询(5h/7天/30天三窗口)+ 插件市场入口暂时隐藏(功能保留)
Release / Version consistency (push) Canceled after 0s
Release / Build (macos-latest) (push) Canceled after 0s
Release / Build (ubuntu-latest) (push) Canceled after 0s
Release / Build (windows-latest) (push) Canceled after 0s
Release / Attach macOS install script (push) Canceled after 0s
Release / Version consistency (push) Canceled after 0s
Release / Build (macos-latest) (push) Canceled after 0s
Release / Build (ubuntu-latest) (push) Canceled after 0s
Release / Build (windows-latest) (push) Canceled after 0s
Release / Attach macOS install script (push) Canceled after 0s
This commit is contained in:
1 parent
9a3875d990
commit
6b761251bc
24 files changed
+3353
-77
No files matched your search
+15
-2
@@ -8,6 +8,7 @@ import { ProviderEdit } from "./components/ProviderEdit";
|
||||
import { SubagentSettingsPage } from "./components/SubagentSettingsPage";
|
||||
import { DashboardPage } from "./components/dashboard/DashboardPage";
|
||||
import { SessionsPage } from "./components/sessions/SessionsPage";
|
||||
import { PluginMarketplacePage } from "./components/plugins/PluginMarketplacePage";
|
||||
import { SettingsModal } from "./components/SettingsModal";
|
||||
import { UsageConfigModal } from "./components/UsageConfigModal";
|
||||
import { PresetPickerModal } from "./components/PresetPickerModal";
|
||||
@@ -71,7 +72,9 @@ export default function App() {
|
||||
updateConfig,
|
||||
} = useConfig(agent);
|
||||
|
||||
const [view, setView] = useState<"list" | "edit" | "subagent" | "dashboard" | "sessions">("list");
|
||||
const [view, setView] = useState<
|
||||
"list" | "edit" | "subagent" | "dashboard" | "sessions" | "plugins"
|
||||
>("list");
|
||||
const [editingProvider, setEditingProvider] = useState<string>("");
|
||||
const [loadTimeout, setLoadTimeout] = useState(false);
|
||||
const [switchMessage, setSwitchMessage] = useState<string | null>(null);
|
||||
@@ -603,6 +606,14 @@ export default function App() {
|
||||
>
|
||||
{t("sessions")}
|
||||
</button>
|
||||
{/* 插件市场功能尚未成熟,导航入口暂时隐藏;页面代码保留,
|
||||
恢复时把下面的按钮加回即可(view/渲染分支均未移除)。
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setView("plugins")}
|
||||
...
|
||||
</button>
|
||||
*/}
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
{/* Language */}
|
||||
@@ -650,6 +661,8 @@ export default function App() {
|
||||
<DashboardPage />
|
||||
) : view === "sessions" ? (
|
||||
<SessionsPage />
|
||||
) : view === "plugins" ? (
|
||||
<PluginMarketplacePage />
|
||||
) : view === "subagent" ? (
|
||||
<SubagentSettingsPage
|
||||
rawOther={config.raw_other}
|
||||
@@ -777,7 +790,7 @@ export default function App() {
|
||||
)}
|
||||
</main>
|
||||
|
||||
{view !== "dashboard" && view !== "sessions" && (
|
||||
{view !== "dashboard" && view !== "sessions" && view !== "plugins" && (
|
||||
<footer className="flex items-center justify-between px-4 py-2 border-t border-border bg-panel text-sm">
|
||||
<div className="flex items-center gap-2 min-w-0">
|
||||
{dirty && (
|
||||
|
||||
@@ -0,0 +1,578 @@
|
||||
import { useMemo, useState } from "react";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { useTranslation } from "../../i18n";
|
||||
import type { TranslationKey } from "../../i18n/zh";
|
||||
import { fmtTime } from "../../lib/dashboard-format";
|
||||
import type { InstalledPluginInfo } from "../../types";
|
||||
import { usePlugins } from "./usePlugins";
|
||||
|
||||
/**
|
||||
* Plugin marketplace page. Sections:
|
||||
* 已安装 (installed, incl. non-marketplace "自定义安装" entries),
|
||||
* 官方 (tier === "official"), 社区 (any other tier).
|
||||
* Catalog failures fall back to the local installed list; cached catalog
|
||||
* responses surface a yellow banner (fromCache + fetchedAt).
|
||||
*/
|
||||
export function PluginMarketplacePage() {
|
||||
const { t, lang } = useTranslation();
|
||||
const locale = lang === "zh" ? "zh" : "en";
|
||||
const {
|
||||
catalog,
|
||||
installed,
|
||||
catalogLoading,
|
||||
installedLoading,
|
||||
catalogError,
|
||||
installedError,
|
||||
loadCatalog,
|
||||
loadInstalled,
|
||||
installPlugin,
|
||||
setPluginEnabled,
|
||||
removePlugin,
|
||||
} = usePlugins();
|
||||
|
||||
const [query, setQuery] = useState("");
|
||||
const [busy, setBusy] = useState<{ id: string; action: PluginAction } | null>(null);
|
||||
const [actionError, setActionError] = useState<string | null>(null);
|
||||
const [notice, setNotice] = useState<{ kind: PluginNoticeKind; name: string } | null>(null);
|
||||
const [copiedReload, setCopiedReload] = useState(false);
|
||||
const [trustEntry, setTrustEntry] = useState<PluginCard | null>(null);
|
||||
const [removeEntry, setRemoveEntry] = useState<PluginCard | null>(null);
|
||||
const [confirmBusy, setConfirmBusy] = useState(false);
|
||||
|
||||
// Fresh installed state wins over the (possibly stale) catalog snapshot.
|
||||
const installedById = useMemo(
|
||||
() => new Map(installed.map((i) => [i.id, i])),
|
||||
[installed]
|
||||
);
|
||||
|
||||
const catalogCards = useMemo<PluginCard[]>(() => {
|
||||
return (catalog?.entries ?? []).map((e) => {
|
||||
const fresh = installedById.get(e.id) ?? null;
|
||||
return {
|
||||
id: e.id,
|
||||
displayName: e.displayName,
|
||||
version: (fresh ?? e.installed)?.version ?? e.version,
|
||||
description: e.description,
|
||||
keywords: e.keywords,
|
||||
homepage: e.homepage,
|
||||
tier: e.tier,
|
||||
source: e.source,
|
||||
capabilityId: e.capabilityId,
|
||||
updateAvailable: e.updateAvailable,
|
||||
installed: fresh ?? e.installed,
|
||||
customInstall: false,
|
||||
};
|
||||
});
|
||||
}, [catalog, installedById]);
|
||||
|
||||
// Installed plugins with no catalog entry (catalog failed, or a manual
|
||||
// install) are shown in the installed section from the local list.
|
||||
const fallbackCards = useMemo<PluginCard[]>(
|
||||
() =>
|
||||
installed
|
||||
.filter((i) => !catalogCards.some((c) => c.id === i.id))
|
||||
.map((i) => ({
|
||||
id: i.id,
|
||||
displayName: i.id,
|
||||
version: i.version,
|
||||
description: null,
|
||||
keywords: [],
|
||||
homepage: null,
|
||||
tier: i.isMarketplace ? "unknown" : "custom",
|
||||
source: i.source,
|
||||
capabilityId: null,
|
||||
updateAvailable: false,
|
||||
installed: i,
|
||||
customInstall: !i.isMarketplace,
|
||||
})),
|
||||
[installed, catalogCards]
|
||||
);
|
||||
|
||||
const q = query.trim().toLowerCase();
|
||||
const matchesQuery = (c: PluginCard) =>
|
||||
q === "" ||
|
||||
c.displayName.toLowerCase().includes(q) ||
|
||||
c.id.toLowerCase().includes(q) ||
|
||||
(c.description ?? "").toLowerCase().includes(q) ||
|
||||
c.keywords.some((k) => k.toLowerCase().includes(q));
|
||||
|
||||
const installedCards = useMemo(
|
||||
() => [...catalogCards.filter((c) => c.installed), ...fallbackCards].filter(matchesQuery),
|
||||
[catalogCards, fallbackCards, q]
|
||||
);
|
||||
const officialCards = useMemo(
|
||||
() => catalogCards.filter((c) => !c.installed && c.tier === "official" && matchesQuery(c)),
|
||||
[catalogCards, q]
|
||||
);
|
||||
const communityCards = useMemo(
|
||||
() => catalogCards.filter((c) => !c.installed && c.tier !== "official" && matchesQuery(c)),
|
||||
[catalogCards, q]
|
||||
);
|
||||
|
||||
const initialLoading =
|
||||
(catalogLoading || installedLoading) && !catalog && installed.length === 0;
|
||||
|
||||
const copyReload = async () => {
|
||||
try {
|
||||
await navigator.clipboard.writeText("/reload");
|
||||
setCopiedReload(true);
|
||||
setTimeout(() => setCopiedReload(false), 2000);
|
||||
} catch {
|
||||
// Clipboard may be unavailable; ignore silently.
|
||||
}
|
||||
};
|
||||
|
||||
/** Shared post-mutation refresh: local list is cheap, catalog force-fetch
|
||||
* brings fresh updateAvailable / installed flags. */
|
||||
const afterMutation = async () => {
|
||||
await loadInstalled();
|
||||
await loadCatalog(true);
|
||||
};
|
||||
|
||||
const doInstall = async (card: PluginCard) => {
|
||||
const isUpdate = card.updateAvailable;
|
||||
setBusy({ id: card.id, action: isUpdate ? "update" : "install" });
|
||||
setActionError(null);
|
||||
try {
|
||||
await installPlugin(card.source, card.id);
|
||||
setNotice({ kind: isUpdate ? "updated" : "installed", name: card.displayName });
|
||||
await afterMutation();
|
||||
} catch (err) {
|
||||
setActionError(err instanceof Error ? err.message : String(err));
|
||||
} finally {
|
||||
setBusy(null);
|
||||
}
|
||||
};
|
||||
|
||||
const handleInstall = (card: PluginCard) => {
|
||||
if (card.capabilityId) return;
|
||||
if (card.tier !== "official") {
|
||||
// Third-party plugin: require explicit trust confirmation first.
|
||||
setTrustEntry(card);
|
||||
return;
|
||||
}
|
||||
void doInstall(card);
|
||||
};
|
||||
|
||||
const confirmTrust = async () => {
|
||||
if (!trustEntry) return;
|
||||
setConfirmBusy(true);
|
||||
try {
|
||||
await doInstall(trustEntry);
|
||||
setTrustEntry(null);
|
||||
} finally {
|
||||
setConfirmBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleToggle = async (card: PluginCard) => {
|
||||
if (!card.installed) return;
|
||||
const enabled = !card.installed.enabled;
|
||||
setBusy({ id: card.id, action: enabled ? "enable" : "disable" });
|
||||
setActionError(null);
|
||||
try {
|
||||
await setPluginEnabled(card.id, enabled);
|
||||
setNotice({ kind: enabled ? "enabled" : "disabled", name: card.displayName });
|
||||
await afterMutation();
|
||||
} catch (err) {
|
||||
setActionError(err instanceof Error ? err.message : String(err));
|
||||
} finally {
|
||||
setBusy(null);
|
||||
}
|
||||
};
|
||||
|
||||
const confirmRemove = async () => {
|
||||
if (!removeEntry) return;
|
||||
setConfirmBusy(true);
|
||||
try {
|
||||
await removePlugin(removeEntry.id);
|
||||
setNotice({ kind: "removed", name: removeEntry.displayName });
|
||||
setRemoveEntry(null);
|
||||
await afterMutation();
|
||||
} catch (err) {
|
||||
setActionError(err instanceof Error ? err.message : String(err));
|
||||
setRemoveEntry(null);
|
||||
} finally {
|
||||
setConfirmBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
const sectionData = [
|
||||
{ key: "installed", title: t("pluginSectionInstalled"), cards: installedCards },
|
||||
{ key: "official", title: t("pluginSectionOfficial"), cards: officialCards },
|
||||
{ key: "community", title: t("pluginSectionCommunity"), cards: communityCards },
|
||||
].filter((s) => s.cards.length > 0);
|
||||
|
||||
const showEmpty =
|
||||
!initialLoading && !catalogError && !installedError && sectionData.length === 0;
|
||||
|
||||
return (
|
||||
<div className="flex h-full flex-col overflow-hidden p-4 space-y-3">
|
||||
<div className="flex shrink-0 flex-col gap-3 sm:flex-row sm:items-end sm:justify-between">
|
||||
<div>
|
||||
<h2 className="text-lg font-semibold text-content-primary">{t("pluginMarketplace")}</h2>
|
||||
<p className="mt-1 max-w-[60ch] text-sm text-content-muted">{t("pluginMarketplaceSubtitle")}</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<input
|
||||
type="search"
|
||||
value={query}
|
||||
onChange={(e) => setQuery(e.target.value)}
|
||||
placeholder={t("pluginSearchPlaceholder")}
|
||||
aria-label={t("pluginSearchPlaceholder")}
|
||||
className="w-56 bg-input border border-border rounded px-2.5 py-1.5 text-sm focus:ring-2 focus:ring-blue-500 focus:outline-none sm:w-64"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => void loadCatalog(true)}
|
||||
disabled={catalogLoading}
|
||||
className="px-3 py-1.5 text-sm rounded border border-border hover:bg-hover-2 disabled:opacity-50"
|
||||
>
|
||||
{catalogLoading ? t("refreshing") : t("refresh")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{catalogError && (
|
||||
<div className="shrink-0 rounded-lg border border-red-500/40 bg-red-900/20 px-4 py-3 text-sm text-red-300">
|
||||
<div className="font-semibold">{t("pluginCatalogFailed")}</div>
|
||||
<div className="mt-0.5 break-all opacity-90">{catalogError}</div>
|
||||
</div>
|
||||
)}
|
||||
{installedError && (
|
||||
<div className="shrink-0 rounded-lg border border-red-500/40 bg-red-900/20 px-4 py-3 text-sm text-red-300">
|
||||
<div className="font-semibold">{t("pluginInstalledListFailed")}</div>
|
||||
<div className="mt-0.5 break-all opacity-90">{installedError}</div>
|
||||
</div>
|
||||
)}
|
||||
{actionError && (
|
||||
<div className="shrink-0 rounded-lg border border-red-500/40 bg-red-900/20 px-4 py-3 text-sm text-red-300">
|
||||
<div className="break-all">{actionError}</div>
|
||||
</div>
|
||||
)}
|
||||
{catalog?.fromCache && (
|
||||
<div className="shrink-0 rounded-lg border border-amber-500/40 bg-amber-900/20 px-4 py-2.5 text-sm text-amber-300">
|
||||
{t("pluginCacheNotice", { time: fmtTime(parseTime(catalog.fetchedAt), locale) })}
|
||||
</div>
|
||||
)}
|
||||
{notice && (
|
||||
<div className="flex shrink-0 items-center justify-between gap-3 rounded-lg border border-green-300 dark:border-green-500/20 bg-green-100 dark:bg-green-900/20 px-4 py-2.5 text-sm text-green-600 dark:text-green-400">
|
||||
<span>{t(NOTICE_KEYS[notice.kind], { name: notice.name })}</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={copyReload}
|
||||
className="shrink-0 px-2.5 py-1 text-xs rounded border border-green-400/50 hover:bg-green-900/20"
|
||||
>
|
||||
{copiedReload ? t("pluginReloadCopied") : t("pluginCopyReload")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{initialLoading ? (
|
||||
<div className="flex min-h-0 flex-1 items-center justify-center">
|
||||
<div className="animate-spin h-8 w-8 border-2 border-blue-500 border-t-transparent rounded-full" />
|
||||
</div>
|
||||
) : (
|
||||
<div className="min-h-0 flex-1 space-y-5 overflow-y-auto">
|
||||
{sectionData.map((section) => (
|
||||
<section key={section.key}>
|
||||
<h3 className="mb-2 flex items-center gap-2 text-sm font-medium text-content-primary">
|
||||
{section.title}
|
||||
<span className="rounded border border-border bg-input px-1.5 py-0 text-[10px] text-content-muted tabular-nums">
|
||||
{section.cards.length}
|
||||
</span>
|
||||
</h3>
|
||||
<div className="grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3">
|
||||
{section.cards.map((card) => (
|
||||
<PluginCardView
|
||||
key={`${section.key}:${card.id}`}
|
||||
card={card}
|
||||
busy={busy?.id === card.id ? busy.action : null}
|
||||
onInstall={handleInstall}
|
||||
onUpdate={doInstall}
|
||||
onToggle={(c) => void handleToggle(c)}
|
||||
onRemove={setRemoveEntry}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
))}
|
||||
{showEmpty && (
|
||||
<div className="py-16 text-center text-sm text-content-muted">
|
||||
{q ? t("pluginEmptyResults") : t("pluginNoPlugins")}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Third-party trust confirm */}
|
||||
{trustEntry && (
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4">
|
||||
<div className="w-full max-w-md rounded-xl border border-border bg-panel shadow-xl">
|
||||
<div className="space-y-3 p-5">
|
||||
<h3 className="text-base font-semibold text-content-primary">{t("pluginTrustTitle")}</h3>
|
||||
<p className="text-sm text-content-muted">
|
||||
{t("pluginTrustDesc", { source: trustEntry.source })}
|
||||
</p>
|
||||
<div className="rounded-md border border-border bg-input px-3 py-2.5">
|
||||
<div className="truncate text-sm font-medium">{trustEntry.displayName}</div>
|
||||
<div className="mt-1 break-all font-mono text-[11px] text-content-muted">
|
||||
{trustEntry.source}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex justify-end gap-2 border-t border-border bg-footer px-5 py-3">
|
||||
<button
|
||||
type="button"
|
||||
disabled={confirmBusy}
|
||||
onClick={() => setTrustEntry(null)}
|
||||
className="px-3 py-1.5 text-sm rounded border border-border hover:bg-hover-2 disabled:opacity-50"
|
||||
>
|
||||
{t("cancel")}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
disabled={confirmBusy}
|
||||
onClick={() => void confirmTrust()}
|
||||
className="px-3 py-1.5 text-sm rounded bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50"
|
||||
>
|
||||
{confirmBusy ? t("pluginInstalling") : t("pluginTrustInstall")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Remove confirm */}
|
||||
{removeEntry && (
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4">
|
||||
<div className="w-full max-w-md rounded-xl border border-border bg-panel shadow-xl">
|
||||
<div className="space-y-3 p-5">
|
||||
<h3 className="text-base font-semibold text-content-primary">{t("pluginRemoveTitle")}</h3>
|
||||
<p className="text-sm text-content-muted">
|
||||
{t("pluginRemoveConfirm", { name: removeEntry.displayName })}
|
||||
</p>
|
||||
<div className="rounded-md border border-border bg-input px-3 py-2.5">
|
||||
<div className="truncate text-sm font-medium">{removeEntry.displayName}</div>
|
||||
<div className="mt-1 break-all font-mono text-[11px] text-content-muted">
|
||||
{removeEntry.id}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex justify-end gap-2 border-t border-border bg-footer px-5 py-3">
|
||||
<button
|
||||
type="button"
|
||||
disabled={confirmBusy}
|
||||
onClick={() => setRemoveEntry(null)}
|
||||
className="px-3 py-1.5 text-sm rounded border border-border hover:bg-hover-2 disabled:opacity-50"
|
||||
>
|
||||
{t("cancel")}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
disabled={confirmBusy}
|
||||
onClick={() => void confirmRemove()}
|
||||
className="px-3 py-1.5 text-sm rounded bg-red-600 text-white hover:bg-red-500 disabled:opacity-50"
|
||||
>
|
||||
{confirmBusy ? t("pluginRemoving") : t("pluginRemove")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
type PluginAction = "install" | "update" | "enable" | "disable" | "remove";
|
||||
type PluginNoticeKind = "installed" | "updated" | "enabled" | "disabled" | "removed";
|
||||
|
||||
const NOTICE_KEYS: Record<PluginNoticeKind, TranslationKey> = {
|
||||
installed: "pluginInstalledMsg",
|
||||
updated: "pluginUpdatedMsg",
|
||||
enabled: "pluginEnabledMsg",
|
||||
disabled: "pluginDisabledMsg",
|
||||
removed: "pluginRemovedMsg",
|
||||
};
|
||||
|
||||
/** Normalized card data: catalog metadata merged with fresh installed state. */
|
||||
interface PluginCard {
|
||||
id: string;
|
||||
displayName: string;
|
||||
version: string | null;
|
||||
description: string | null;
|
||||
keywords: string[];
|
||||
homepage: string | null;
|
||||
tier: string;
|
||||
source: string;
|
||||
capabilityId: string | null;
|
||||
updateAvailable: boolean;
|
||||
installed: InstalledPluginInfo | null;
|
||||
/** Card synthesized from the local installed list (not in the catalog). */
|
||||
customInstall: boolean;
|
||||
}
|
||||
|
||||
function parseTime(value: string | null | undefined): number {
|
||||
if (value == null || value === "") return 0;
|
||||
const ms = Date.parse(value);
|
||||
return Number.isFinite(ms) ? ms : 0;
|
||||
}
|
||||
|
||||
function PluginCardView({
|
||||
card,
|
||||
busy,
|
||||
onInstall,
|
||||
onUpdate,
|
||||
onToggle,
|
||||
onRemove,
|
||||
}: {
|
||||
card: PluginCard;
|
||||
busy: PluginAction | null;
|
||||
onInstall: (card: PluginCard) => void;
|
||||
onUpdate: (card: PluginCard) => void;
|
||||
onToggle: (card: PluginCard) => void;
|
||||
onRemove: (card: PluginCard) => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const { installed } = card;
|
||||
const busyLabel =
|
||||
busy === "install"
|
||||
? t("pluginInstalling")
|
||||
: busy === "update"
|
||||
? t("pluginUpdating")
|
||||
: busy === "enable" || busy === "disable"
|
||||
? t("pluginToggling")
|
||||
: busy === "remove"
|
||||
? t("pluginRemoving")
|
||||
: null;
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-2.5 rounded-xl border border-border bg-panel p-4">
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
<div className="min-w-0">
|
||||
<div className="flex flex-wrap items-center gap-1.5">
|
||||
<h4 className="truncate text-sm font-semibold text-content-primary" title={card.displayName}>
|
||||
{card.displayName}
|
||||
</h4>
|
||||
{card.updateAvailable && (
|
||||
<span className="rounded-md bg-amber-100 dark:bg-amber-900/30 px-2 py-0.5 text-[10px] text-amber-700 dark:text-amber-300">
|
||||
{t("pluginUpdateAvailable")}
|
||||
</span>
|
||||
)}
|
||||
{card.customInstall && (
|
||||
<span className="rounded-md bg-blue-100 dark:bg-blue-900/30 px-2 py-0.5 text-[10px] text-blue-700 dark:text-blue-300">
|
||||
{t("pluginCustomInstall")}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="mt-0.5 flex items-center gap-2 text-[11px] text-content-muted">
|
||||
<span className="truncate font-mono">{card.id}</span>
|
||||
{card.version && <span className="shrink-0">v{card.version}</span>}
|
||||
</div>
|
||||
</div>
|
||||
{installed && (
|
||||
<span
|
||||
className={`shrink-0 rounded-md px-2 py-0.5 text-xs ${
|
||||
installed.enabled
|
||||
? "bg-emerald-100 dark:bg-emerald-900/30 text-emerald-700 dark:text-emerald-300"
|
||||
: "bg-zinc-200 dark:bg-zinc-700/40 text-zinc-600 dark:text-zinc-300"
|
||||
}`}
|
||||
>
|
||||
{installed.enabled ? t("activated") : t("disabled")}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{card.description && (
|
||||
<p className="line-clamp-2 text-sm leading-relaxed text-content-muted">{card.description}</p>
|
||||
)}
|
||||
{card.keywords.length > 0 && (
|
||||
<div className="flex flex-wrap gap-1">
|
||||
{card.keywords.slice(0, 6).map((k) => (
|
||||
<span
|
||||
key={k}
|
||||
className="rounded border border-border bg-input px-1.5 py-0.5 text-[10px] text-content-muted"
|
||||
>
|
||||
{k}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="mt-auto flex items-center justify-between gap-2 border-t border-border/50 pt-2.5">
|
||||
<div className="flex min-w-0 items-center gap-2">
|
||||
{card.homepage && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => openUrl(card.homepage!)}
|
||||
title={card.homepage}
|
||||
className="shrink-0 text-xs text-blue-600 hover:underline dark:text-blue-400"
|
||||
>
|
||||
{t("pluginHomepage")}
|
||||
</button>
|
||||
)}
|
||||
{card.source && !card.customInstall && (
|
||||
<span className="truncate font-mono text-[10px] text-content-muted" title={card.source}>
|
||||
{card.source}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex shrink-0 items-center gap-1.5">
|
||||
{installed ? (
|
||||
<>
|
||||
{card.updateAvailable && (
|
||||
<button
|
||||
type="button"
|
||||
disabled={busy != null || !!card.capabilityId}
|
||||
onClick={() => onUpdate(card)}
|
||||
title={card.capabilityId ? t("pluginCapabilityRequired") : undefined}
|
||||
className="px-2.5 py-1 text-xs rounded bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50"
|
||||
>
|
||||
{busy === "update" ? busyLabel : t("pluginUpdate")}
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
disabled={busy != null}
|
||||
onClick={() => onToggle(card)}
|
||||
className="px-2.5 py-1 text-xs rounded border border-border hover:bg-hover-2 disabled:opacity-50"
|
||||
>
|
||||
{busy === "enable" || busy === "disable"
|
||||
? busyLabel
|
||||
: installed.enabled
|
||||
? t("pluginDisable")
|
||||
: t("pluginEnable")}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
disabled={busy != null}
|
||||
onClick={() => onRemove(card)}
|
||||
className="px-2.5 py-1 text-xs rounded border border-red-500/30 text-red-300 hover:bg-red-900/20 disabled:opacity-50"
|
||||
>
|
||||
{busy === "remove" ? busyLabel : t("pluginRemove")}
|
||||
</button>
|
||||
</>
|
||||
) : (
|
||||
<span title={card.capabilityId ? t("pluginCapabilityRequired") : undefined}>
|
||||
<button
|
||||
type="button"
|
||||
disabled={busy != null || !!card.capabilityId}
|
||||
onClick={() => onInstall(card)}
|
||||
className="px-2.5 py-1 text-xs rounded bg-blue-600 text-white hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-50"
|
||||
>
|
||||
{busy === "install" ? busyLabel : t("pluginInstall")}
|
||||
</button>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function openUrl(url: string) {
|
||||
invoke("open_external_url", { url }).catch(() => {
|
||||
const w = window.open(url, "_blank");
|
||||
if (!w) console.error(`failed to open ${url}`);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import type {
|
||||
InstalledPluginInfo,
|
||||
PluginMarketplaceResult,
|
||||
} from "../../types";
|
||||
|
||||
/**
|
||||
* Plugin marketplace data + mutations. All backend IPC for the plugin
|
||||
* marketplace is concentrated here so the page stays thin and the switch
|
||||
* to a live backend is a drop-in change.
|
||||
*
|
||||
* IPC contract (Rust, camelCase args):
|
||||
* get_plugin_marketplace(homeOverride?, refresh?) → PluginMarketplaceResult
|
||||
* list_installed_plugins(homeOverride?) → InstalledPluginInfo[]
|
||||
* install_plugin(homeOverride?, source, expectedId?) → InstalledPluginInfo
|
||||
* set_plugin_enabled(homeOverride?, id, enabled) → void
|
||||
* remove_plugin(homeOverride?, id) → void
|
||||
* Like the existing pages, homeOverride is never passed (Rust side defaults).
|
||||
*/
|
||||
export function usePlugins() {
|
||||
const [catalog, setCatalog] = useState<PluginMarketplaceResult | null>(null);
|
||||
const [installed, setInstalled] = useState<InstalledPluginInfo[]>([]);
|
||||
const [catalogLoading, setCatalogLoading] = useState(false);
|
||||
const [installedLoading, setInstalledLoading] = useState(false);
|
||||
const [catalogError, setCatalogError] = useState<string | null>(null);
|
||||
const [installedError, setInstalledError] = useState<string | null>(null);
|
||||
|
||||
const loadCatalog = useCallback(async (refresh = false) => {
|
||||
setCatalogLoading(true);
|
||||
setCatalogError(null);
|
||||
try {
|
||||
const result = await invoke<PluginMarketplaceResult>(
|
||||
"get_plugin_marketplace",
|
||||
{ refresh }
|
||||
);
|
||||
setCatalog(result);
|
||||
return result;
|
||||
} catch (err) {
|
||||
const msg = err instanceof Error ? err.message : String(err);
|
||||
setCatalogError(msg);
|
||||
return null;
|
||||
} finally {
|
||||
setCatalogLoading(false);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const loadInstalled = useCallback(async () => {
|
||||
setInstalledLoading(true);
|
||||
setInstalledError(null);
|
||||
try {
|
||||
const result = await invoke<InstalledPluginInfo[]>(
|
||||
"list_installed_plugins",
|
||||
{}
|
||||
);
|
||||
setInstalled(result);
|
||||
return result;
|
||||
} catch (err) {
|
||||
const msg = err instanceof Error ? err.message : String(err);
|
||||
setInstalledError(msg);
|
||||
return null;
|
||||
} finally {
|
||||
setInstalledLoading(false);
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
void loadCatalog(false);
|
||||
void loadInstalled();
|
||||
}, [loadCatalog, loadInstalled]);
|
||||
|
||||
const installPlugin = useCallback(
|
||||
async (source: string, expectedId?: string) => {
|
||||
return invoke<InstalledPluginInfo>("install_plugin", {
|
||||
source,
|
||||
expectedId,
|
||||
});
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
const setPluginEnabled = useCallback(
|
||||
async (id: string, enabled: boolean) => {
|
||||
await invoke("set_plugin_enabled", { id, enabled });
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
const removePlugin = useCallback(async (id: string) => {
|
||||
await invoke("remove_plugin", { id });
|
||||
}, []);
|
||||
|
||||
return {
|
||||
catalog,
|
||||
installed,
|
||||
catalogLoading,
|
||||
installedLoading,
|
||||
catalogError,
|
||||
installedError,
|
||||
loadCatalog,
|
||||
loadInstalled,
|
||||
installPlugin,
|
||||
setPluginEnabled,
|
||||
removePlugin,
|
||||
};
|
||||
}
|
||||
@@ -16,7 +16,8 @@ export type UsageKind =
|
||||
| "balance:kimi"
|
||||
| "plan:kimi_coding"
|
||||
| "plan:zhipu"
|
||||
| "plan:minimax";
|
||||
| "plan:minimax"
|
||||
| "plan:opencode_go";
|
||||
|
||||
/** Billing model for a preset. Drives the tab filter in PresetPickerModal. */
|
||||
export type BillingMode = "subscription" | "pay_as_you_go";
|
||||
@@ -32,6 +33,7 @@ export const SUPPORTED_USAGE_KINDS: ReadonlySet<string> = new Set<UsageKind>([
|
||||
"plan:kimi_coding",
|
||||
"plan:zhipu",
|
||||
"plan:minimax",
|
||||
"plan:opencode_go",
|
||||
]);
|
||||
|
||||
export type PresetCategory =
|
||||
@@ -469,6 +471,8 @@ export const providerPresets: ProviderPreset[] = [
|
||||
{ model: "deepseek-v4-flash", displayName: "DeepSeek V4 Flash" },
|
||||
],
|
||||
billingMode: "subscription",
|
||||
// Go 套餐额度查询:GET https://opencode.ai/zen/go/v1/usage(Bearer)。
|
||||
usageKinds: ["plan:opencode_go"],
|
||||
},
|
||||
{
|
||||
id: "opencode-zen",
|
||||
|
||||
@@ -422,6 +422,7 @@ export const enTranslations: Record<TranslationKey, string> = {
|
||||
usageUnsupportedProvider: "This provider is not supported by auto query",
|
||||
usageTier5h: "5-hour",
|
||||
usageTierWeekly: "Weekly",
|
||||
usageTierMonthly: "Monthly",
|
||||
usageErrNoKey: "No API key configured",
|
||||
usageErrDisabled: "Usage query is disabled in the config panel",
|
||||
usageErrLoginExpired: "Kimi Code login expired and auto-refresh failed; run `kimi login` again",
|
||||
@@ -514,4 +515,51 @@ export const enTranslations: Record<TranslationKey, string> = {
|
||||
"Open the new Web UI in an independent in-app window, or in your system browser (built into kimi-code 0.33+). Requires the kimi CLI on PATH.",
|
||||
openWebUIEmbedded: "Open in App",
|
||||
openWebUIBrowser: "Open in Browser",
|
||||
|
||||
// Plugin marketplace
|
||||
pluginMarketplace: "Plugin Marketplace",
|
||||
pluginMarketplaceSubtitle:
|
||||
"Browse and install Kimi Code plugins — official and community, with install, update, and enable/disable management.",
|
||||
pluginSearchPlaceholder: "Search by name, description, keyword, or ID…",
|
||||
pluginSectionInstalled: "Installed",
|
||||
pluginSectionOfficial: "Official",
|
||||
pluginSectionCommunity: "Community",
|
||||
pluginCustomInstall: "Custom",
|
||||
pluginUpdateAvailable: "Update available",
|
||||
pluginCapabilityRequired: "Install inside kimi-code (/plugins)",
|
||||
pluginInstall: "Install",
|
||||
pluginUpdate: "Update",
|
||||
pluginEnable: "Enable",
|
||||
pluginDisable: "Disable",
|
||||
pluginRemove: "Remove",
|
||||
pluginInstalling: "Installing…",
|
||||
pluginUpdating: "Updating…",
|
||||
pluginToggling: "Switching…",
|
||||
pluginRemoving: "Removing…",
|
||||
pluginTrustTitle: "Install third-party plugin?",
|
||||
pluginTrustDesc:
|
||||
"This plugin comes from {source}. Plugins can contribute MCP tools, hooks, and commands, and may access your sessions and files. Only install from sources you trust.",
|
||||
pluginTrustInstall: "Trust & install",
|
||||
pluginRemoveTitle: "Remove plugin?",
|
||||
pluginRemoveConfirm:
|
||||
"Remove \"{name}\"? Run /reload in kimi-code or start a new session afterwards to apply.",
|
||||
pluginInstalledMsg:
|
||||
"\"{name}\" installed. Run /reload in kimi-code or start a new session to apply.",
|
||||
pluginUpdatedMsg:
|
||||
"\"{name}\" updated. Run /reload in kimi-code or start a new session to apply.",
|
||||
pluginEnabledMsg:
|
||||
"\"{name}\" enabled. Run /reload in kimi-code or start a new session to apply.",
|
||||
pluginDisabledMsg:
|
||||
"\"{name}\" disabled. Run /reload in kimi-code or start a new session to apply.",
|
||||
pluginRemovedMsg:
|
||||
"\"{name}\" removed. Run /reload in kimi-code or start a new session to apply.",
|
||||
pluginCopyReload: "Copy /reload",
|
||||
pluginReloadCopied: "Copied",
|
||||
pluginCacheNotice: "Showing cached data (fetched {time})",
|
||||
pluginCatalogFailed:
|
||||
"Failed to load the plugin catalog; showing locally installed plugins",
|
||||
pluginInstalledListFailed: "Failed to load the installed plugin list",
|
||||
pluginEmptyResults: "No matching plugins",
|
||||
pluginNoPlugins: "No plugins available",
|
||||
pluginHomepage: "Homepage",
|
||||
};
|
||||
@@ -417,6 +417,7 @@ export const zhTranslations = {
|
||||
usageUnsupportedProvider: "此供应商暂不支持自动查询",
|
||||
usageTier5h: "5小时",
|
||||
usageTierWeekly: "7天",
|
||||
usageTierMonthly: "30天",
|
||||
usageErrNoKey: "未配置 API Key",
|
||||
usageErrDisabled: "用量查询已在配置面板中停用",
|
||||
usageErrLoginExpired: "Kimi Code 登录已过期且自动续期失败,请重新运行 `kimi login`",
|
||||
@@ -506,6 +507,46 @@ export const zhTranslations = {
|
||||
"以独立窗口在应用内打开新版 Web 界面,也可以选择在系统浏览器打开(kimi-code 0.33+ 内置 code-app;需要 kimi 命令在 PATH 中)。",
|
||||
openWebUIEmbedded: "在应用内打开",
|
||||
openWebUIBrowser: "在浏览器打开",
|
||||
|
||||
// Plugin marketplace
|
||||
pluginMarketplace: "插件市场",
|
||||
pluginMarketplaceSubtitle:
|
||||
"浏览并安装 Kimi Code 插件:官方、社区插件均可安装,支持更新与启用/禁用管理。",
|
||||
pluginSearchPlaceholder: "搜索插件名称、描述、关键词或 ID…",
|
||||
pluginSectionInstalled: "已安装",
|
||||
pluginSectionOfficial: "官方",
|
||||
pluginSectionCommunity: "社区",
|
||||
pluginCustomInstall: "自定义安装",
|
||||
pluginUpdateAvailable: "有更新",
|
||||
pluginCapabilityRequired: "需在 kimi-code 内安装(/plugins)",
|
||||
pluginInstall: "安装",
|
||||
pluginUpdate: "更新",
|
||||
pluginEnable: "启用",
|
||||
pluginDisable: "禁用",
|
||||
pluginRemove: "移除",
|
||||
pluginInstalling: "安装中…",
|
||||
pluginUpdating: "更新中…",
|
||||
pluginToggling: "切换中…",
|
||||
pluginRemoving: "移除中…",
|
||||
pluginTrustTitle: "安装第三方插件?",
|
||||
pluginTrustDesc:
|
||||
"该插件来自 {source}。插件可贡献 MCP 工具、hooks 与命令,并可能访问你的会话和文件。请仅安装你信任的来源。",
|
||||
pluginTrustInstall: "信任并安装",
|
||||
pluginRemoveTitle: "移除插件?",
|
||||
pluginRemoveConfirm: "确定移除「{name}」?移除后请在 kimi-code 中 /reload 或开新会话生效。",
|
||||
pluginInstalledMsg: "「{name}」已安装。请在 kimi-code 中 /reload 或开新会话生效。",
|
||||
pluginUpdatedMsg: "「{name}」已更新。请在 kimi-code 中 /reload 或开新会话生效。",
|
||||
pluginEnabledMsg: "「{name}」已启用。请在 kimi-code 中 /reload 或开新会话生效。",
|
||||
pluginDisabledMsg: "「{name}」已禁用。请在 kimi-code 中 /reload 或开新会话生效。",
|
||||
pluginRemovedMsg: "「{name}」已移除。请在 kimi-code 中 /reload 或开新会话生效。",
|
||||
pluginCopyReload: "复制 /reload",
|
||||
pluginReloadCopied: "已复制",
|
||||
pluginCacheNotice: "显示缓存数据(获取于 {time})",
|
||||
pluginCatalogFailed: "插件目录加载失败,已改用本地已安装列表",
|
||||
pluginInstalledListFailed: "已安装插件列表加载失败",
|
||||
pluginEmptyResults: "没有匹配的插件",
|
||||
pluginNoPlugins: "暂无插件",
|
||||
pluginHomepage: "主页",
|
||||
} as const;
|
||||
|
||||
export type TranslationKey = keyof typeof zhTranslations;
|
||||
@@ -13005,6 +13005,21 @@
|
||||
"input_limit": 16384,
|
||||
"output_limit": 8192
|
||||
},
|
||||
{
|
||||
"id": "zai-org/glm-5.3:thinking",
|
||||
"name": "GLM 5.3 Preview Thinking",
|
||||
"cost": {
|
||||
"input": 1.4,
|
||||
"output": 4.4,
|
||||
"cache_read": 0.26
|
||||
},
|
||||
"context": 1048576,
|
||||
"input_limit": 1048576,
|
||||
"output_limit": 131072,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true
|
||||
},
|
||||
{
|
||||
"id": "zai-org/glm-5-original:thinking",
|
||||
"name": "GLM 5 Original Thinking",
|
||||
@@ -13206,6 +13221,21 @@
|
||||
"tool_call": true,
|
||||
"structured_output": true
|
||||
},
|
||||
{
|
||||
"id": "zai-org/glm-5.3",
|
||||
"name": "GLM 5.3 Preview",
|
||||
"cost": {
|
||||
"input": 1.4,
|
||||
"output": 4.4,
|
||||
"cache_read": 0.26
|
||||
},
|
||||
"context": 1048576,
|
||||
"input_limit": 1048576,
|
||||
"output_limit": 131072,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true
|
||||
},
|
||||
{
|
||||
"id": "zai-org/glm-4.7-flash-original:thinking",
|
||||
"name": "GLM 4.7 Flash Original Thinking",
|
||||
@@ -24348,9 +24378,8 @@
|
||||
"id": "qwen/qwen-plus-2025-07-28:thinking",
|
||||
"name": "Qwen Plus 0728 (thinking)",
|
||||
"cost": {
|
||||
"input": 0.4,
|
||||
"output": 1.2,
|
||||
"cache_write": 0.5
|
||||
"input": 0.26,
|
||||
"output": 0.78
|
||||
},
|
||||
"context": 1000000,
|
||||
"output_limit": 32768,
|
||||
@@ -56152,10 +56181,10 @@
|
||||
"id": "gemini-3.1-flash-lite@eu",
|
||||
"name": "Gemini 3.1 Flash Lite (EU)",
|
||||
"cost": {
|
||||
"input": 0.25,
|
||||
"output": 1.5,
|
||||
"cache_read": 0.025,
|
||||
"cache_write": 0.08333
|
||||
"input": 0.275,
|
||||
"output": 1.65,
|
||||
"cache_read": 0.0275,
|
||||
"cache_write": 0.091663
|
||||
},
|
||||
"context": 1048576,
|
||||
"output_limit": 65535,
|
||||
@@ -56357,10 +56386,10 @@
|
||||
"id": "gemini-3.5-flash@eu",
|
||||
"name": "Gemini 3.5 Flash (EU)",
|
||||
"cost": {
|
||||
"input": 1.5,
|
||||
"output": 9,
|
||||
"cache_read": 0.15,
|
||||
"cache_write": 1.583
|
||||
"input": 1.65,
|
||||
"output": 9.9,
|
||||
"cache_read": 0.165,
|
||||
"cache_write": 1.7413
|
||||
},
|
||||
"context": 1048576,
|
||||
"output_limit": 65535,
|
||||
@@ -56409,7 +56438,7 @@
|
||||
"input": 5.5,
|
||||
"output": 27.5,
|
||||
"cache_read": 0.55,
|
||||
"cache_write": 6.88
|
||||
"cache_write": 6.875
|
||||
},
|
||||
"context": 1000000,
|
||||
"output_limit": 128000,
|
||||
@@ -56590,9 +56619,9 @@
|
||||
"id": "gemini-3.7-flash@eu",
|
||||
"name": "Gemini 3.7 Flash (EU)",
|
||||
"cost": {
|
||||
"input": 0.75,
|
||||
"output": 3.75,
|
||||
"cache_read": 0.075
|
||||
"input": 0.825,
|
||||
"output": 4.125,
|
||||
"cache_read": 0.0825
|
||||
},
|
||||
"context": 1048576,
|
||||
"output_limit": 65535,
|
||||
@@ -81769,9 +81798,8 @@
|
||||
"id": "qwen/qwen-plus-2025-07-28:thinking",
|
||||
"name": "Qwen: Qwen Plus 0728 (thinking)",
|
||||
"cost": {
|
||||
"input": 0.4,
|
||||
"output": 1.2,
|
||||
"cache_write": 0.5
|
||||
"input": 0.26,
|
||||
"output": 0.78
|
||||
},
|
||||
"context": 1000000,
|
||||
"output_limit": 32768,
|
||||
|
||||
+40
-18
@@ -10428,6 +10428,18 @@
|
||||
"cache_read": 0.2465
|
||||
}
|
||||
},
|
||||
"nano-gpt/zai-org/glm-5.3:thinking": {
|
||||
"name": "GLM 5.3 Preview Thinking",
|
||||
"context": 1048576,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 1.4,
|
||||
"output": 4.4,
|
||||
"cache_read": 0.26
|
||||
}
|
||||
},
|
||||
"nano-gpt/zai-org/glm-5-original:thinking": {
|
||||
"name": "GLM 5 Original Thinking",
|
||||
"context": 200000,
|
||||
@@ -10587,6 +10599,18 @@
|
||||
"cache_read": 0.078
|
||||
}
|
||||
},
|
||||
"nano-gpt/zai-org/glm-5.3": {
|
||||
"name": "GLM 5.3 Preview",
|
||||
"context": 1048576,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 1.4,
|
||||
"output": 4.4,
|
||||
"cache_read": 0.26
|
||||
}
|
||||
},
|
||||
"nano-gpt/zai-org/glm-4.7-flash-original:thinking": {
|
||||
"name": "GLM 4.7 Flash Original Thinking",
|
||||
"context": 200000,
|
||||
@@ -19817,9 +19841,8 @@
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 0.4,
|
||||
"output": 1.2,
|
||||
"cache_write": 0.5
|
||||
"input": 0.26,
|
||||
"output": 0.78
|
||||
}
|
||||
},
|
||||
"openrouter/qwen/qwen3-235b-a22b-thinking-2507": {
|
||||
@@ -46199,10 +46222,10 @@
|
||||
"image": true,
|
||||
"video": true,
|
||||
"cost": {
|
||||
"input": 0.25,
|
||||
"output": 1.5,
|
||||
"cache_read": 0.025,
|
||||
"cache_write": 0.08333
|
||||
"input": 0.275,
|
||||
"output": 1.65,
|
||||
"cache_read": 0.0275,
|
||||
"cache_write": 0.091663
|
||||
}
|
||||
},
|
||||
"requesty/gpt-5@eu": {
|
||||
@@ -46375,10 +46398,10 @@
|
||||
"image": true,
|
||||
"video": true,
|
||||
"cost": {
|
||||
"input": 1.5,
|
||||
"output": 9,
|
||||
"cache_read": 0.15,
|
||||
"cache_write": 1.583
|
||||
"input": 1.65,
|
||||
"output": 9.9,
|
||||
"cache_read": 0.165,
|
||||
"cache_write": 1.7413
|
||||
}
|
||||
},
|
||||
"requesty/claude-sonnet-5@eu": {
|
||||
@@ -46420,7 +46443,7 @@
|
||||
"input": 5.5,
|
||||
"output": 27.5,
|
||||
"cache_read": 0.55,
|
||||
"cache_write": 6.88
|
||||
"cache_write": 6.875
|
||||
}
|
||||
},
|
||||
"requesty/claude-opus-4-7@eu": {
|
||||
@@ -46578,9 +46601,9 @@
|
||||
"image": true,
|
||||
"video": true,
|
||||
"cost": {
|
||||
"input": 0.75,
|
||||
"output": 3.75,
|
||||
"cache_read": 0.075
|
||||
"input": 0.825,
|
||||
"output": 4.125,
|
||||
"cache_read": 0.0825
|
||||
}
|
||||
},
|
||||
"requesty/gpt-5.4@eu": {
|
||||
@@ -67604,9 +67627,8 @@
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 0.4,
|
||||
"output": 1.2,
|
||||
"cache_write": 0.5
|
||||
"input": 0.26,
|
||||
"output": 0.78
|
||||
}
|
||||
},
|
||||
"kilo/qwen/qwen3-235b-a22b-thinking-2507": {
|
||||
|
||||
@@ -11,9 +11,9 @@ type TranslateFn = (
|
||||
*
|
||||
* Coverage note: ALL plan-type (套餐) queries flow through
|
||||
* src-tauri/src/services/coding_plan.rs::percent_tier, whose names come only
|
||||
* from TIER_FIVE_HOUR / TIER_WEEKLY_LIMIT — so this mapping covers every
|
||||
* current and future plan provider automatically. If a new tier id is ever
|
||||
* added there, add a case here too.
|
||||
* from TIER_FIVE_HOUR / TIER_WEEKLY_LIMIT / TIER_MONTHLY_LIMIT — so this
|
||||
* mapping covers every current and future plan provider automatically. If a
|
||||
* new tier id is ever added there, add a case here too.
|
||||
*/
|
||||
export function planLabel(name: string, t: TranslateFn): string {
|
||||
switch (name) {
|
||||
@@ -21,6 +21,8 @@ export function planLabel(name: string, t: TranslateFn): string {
|
||||
return t("usageTier5h");
|
||||
case "weekly_limit":
|
||||
return t("usageTierWeekly");
|
||||
case "monthly_limit":
|
||||
return t("usageTierMonthly");
|
||||
default:
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -163,3 +163,44 @@ export interface SecondaryModelConfig {
|
||||
|
||||
/** Values of experimental env vars that are currently set (non-empty). */
|
||||
export type ExperimentalEnvStatus = Record<string, string>;
|
||||
|
||||
/**
|
||||
* A plugin installed under the kimi-code plugin directory
|
||||
* (mirrors the Rust `InstalledPluginInfo`, camelCase via serde).
|
||||
*/
|
||||
export interface InstalledPluginInfo {
|
||||
id: string;
|
||||
root: string;
|
||||
source: string;
|
||||
enabled: boolean;
|
||||
version: string | null;
|
||||
installedAt: string | null;
|
||||
updatedAt: string | null;
|
||||
/** Whether the plugin came from the marketplace catalog (vs. manual install). */
|
||||
isMarketplace: boolean;
|
||||
}
|
||||
|
||||
/** One entry of the plugin marketplace catalog (mirrors Rust `MarketplaceEntry`). */
|
||||
export interface MarketplaceEntry {
|
||||
id: string;
|
||||
displayName: string;
|
||||
version: string | null;
|
||||
description: string | null;
|
||||
keywords: string[];
|
||||
homepage: string | null;
|
||||
/** "official" | "curated" | anything else → community. */
|
||||
tier: string;
|
||||
/** Install source (URL / path) passed to `install_plugin`. */
|
||||
source: string;
|
||||
/** Non-null → must be installed inside kimi-code via /plugins, not here. */
|
||||
capabilityId: string | null;
|
||||
installed: InstalledPluginInfo | null;
|
||||
updateAvailable: boolean;
|
||||
}
|
||||
|
||||
/** Result of `get_plugin_marketplace` (mirrors Rust `PluginMarketplaceResult`). */
|
||||
export interface PluginMarketplaceResult {
|
||||
fetchedAt: string;
|
||||
fromCache: boolean;
|
||||
entries: MarketplaceEntry[];
|
||||
}
|
||||
Reference in new issue
Block a user