@ethisyscore/plugin-ui

中文文档
1.167.0发布于 2026/10/25SEE LICENSE IN LICENSETypeScriptESM + CJS近 30 天下载 8212

Plugin-UI umbrella SDK: client bridge + a11y/l10n primitives + brokered-MCP client (WI 4858).

此软件包已被标记为弃用

This package has moved to the Ethisys Core package feed. In Ethisys Core, open the Developers page and follow the setup steps (cc login connects npm to the feed).

原始使用文档
文档目录4 节
  1. Export surface
  2. Typical usage
  3. Uploading a browser file
  4. Build and test

@ethisyscore/plugin-ui

The PlatformReact frontend foundation for EthisysCore plugins. It gives a plugin everything it needs to lift a monolith React feature onto a plugin surface: page and overlay factories, a static useView adapter, an MCP-over-hooks service layer, react-query / react-router shims, scoped styles, the nexture icon set, and the shared MUI component surface externalised to the host's instances.

MUI 7 or newer. The optional @mui/material peer is >=7, matching the host and the sandbox theme kit (which uses MUI 7-only APIs).

PlatformReact is the high-trust render tier (RFC 0003), restricted to first-party PlatformPlugin builds. See the top-level render-mode overview and the PlatformReact author guide.

Export surface

SubpathKey exportsPurpose
.createPortBridgeClient, BridgeClientContext / useBridgeClient, useBridgeTheme / useBridgeLocale, ExtensionRuntimeProvider, useMcpResource / useMcpTool / useMcpQuery / unwrapItems, useHostIdentity / useCurrentUser, definePlatformReactPage / emitNavigation / PlatformReactPagePropsBridge client + theme/locale context, brokered-MCP data hooks, host identity, and the base PlatformReact page contract
./platform-reactdefinePlatformReactPluginPage / createPluginPageDefiner, definePlatformReactPluginOverlay / useOverlayHost, useView / createUseView / ViewComponent / isComponent, BaseMcpService / useToolInvoker / useToolInvokerMap, useAuthenticatedQuery / useAuthenticatedQueries, injectPluginStyles / PluginStyleScope, createReactRouterShim, usePluginRealtime, useBackgroundOperation / useOperationsByParent / useLatestTerminalOperationByParent / hasKind, useUploadToStorage / PluginStorageUploadError / isPluginStorageUploadError / validatePluginStoragePrefix, useMcpUpload (legacy CORE storage), useManagedLifecycleThe plugin authoring layer: page/overlay wrappers (react-query + manifest + style root), the static useView adapter pattern, the MCP service base + tool invokers, pre-authenticated react-query wrappers, scoped-style injection, router shim, realtime, following the plugin's own background operations, and file upload
./iconsNextureIcons, IconMap, 470+ Ni* icon components, sizeHelper / strokeSizeHelper, IconName / IconSize / IconVariantThe gogo-ui "nexture" SVG icon set with props types and size/stroke helpers
./components/uiButton, Card, Dialog, Table, TextField, Select, Tabs, Typography, Grid, Stack, Menu, DebouncedSearchInput, cn, useDebounce, …MUI component re-exports plus the Dialog scroll-lock wrapper, cn and useDebounce (all three from @ethisyscore/foundation-ui) and the debounced search field. These are host externals — never bundled; production builds bind them to the host's MUI instance
./components/layoutPageHeader / usePageHeader / withPageHeader, FillGrid / FillGridItem / FillGap / FillSpan, sidebar-action context (SidebarActionProvider, useSidebarAction / useSidebarActions / useTriggerSidebarAction), RouteMeta / RouteMetaEntry; header actions take an optional attributes bag, restricted to data-* (e.g. onboardingTarget("x"))Layout primitives (the flex-wrap grid, from @ethisyscore/foundation-ui), the page-header layer + breadcrumb builder, and the sidebar-action context/provider
./components/sharedConfirmActionDialog, ConfirmDeleteDialog, useConfirmDialog / useTargetDialog / useReasonDialog (from @ethisyscore/foundation-ui), useToast, showSuccessToast / showErrorToast / showWarningToastComposite confirmation dialogs and toast notifications
./components/data-gridPersistentDataGrid (with a typed toolbar / toolbarProps), setGridUserId / getGridUserId, buildDataGridPaginationProps, buildDataGridSlots, DataGridPaginationFullPage, usePaginationSlot, grid-state persistence helpersThe shared list-page grid with per-user state persistence, the house slot set and pagination slots. Needs the optional peer @mui/x-data-grid
./components/dateDateInput / DateInputProps, toIsoString / parseIsoValue, DATE_INPUT_MIN / DATE_INPUT_MAX, DateInputTypeThe shared date / datetime field over MUI X pickers, speaking ISO strings. Needs the optional peers @mui/x-date-pickers and dayjs
./components/connectorsConnectorMappingView, MappingCompletenessBanner, ConnectorMappingTranslationEditorView, selectRequiredIncompleteOperations / selectOptionalIncompleteOperations / selectIncompleteOperations / selectMappingReadiness, connectorMappingsQueryKey / connectorMappingCompletenessQueryKey, MappingCompletenessItem / MappingCompletenessResult, ConnectorCanonicalField / TestToolMappingRequest / TestToolMappingResult / ConnectorMappingSuggestionResultThe PRESENTATIONAL half of the shared Tool Mappings surface, for any module that reaches an external system through a connector — the mapping table, the completeness banner and the per-mapping field-translation editor. Needs the optional peer @mui/material. Carries four fixes a copy loses: the banner says FIELDS rather than tools, the completeness query key is nested under the mappings key so one invalidation covers both, the editor's "Test mapping" button is gated on onTestMapping (an ungated copy renders a dead control for a caller wiring only auto-configure) with ?? [] tolerance on both canonical field lists, and the view's unmapped-required warning is NOT gated on aiAvailable (a keyword-only auto-match always reports false, which made the one warning an operator must act on unreachable)
./connector-mappingsConnectorMappingService / CONNECTOR_MAPPING_TOOLS, useConnectorToolMappings, useConnectorMappings / useConnectorMappingCompleteness, useConnectorMappingMutations, useMappingTranslationEditor, useAutoMatchOnConnectorSwitch, useMappingBannerDismissal, useSuggestMappingTranslation / useTestMapping, mapConnectorsToOptions / mapConnectorToolsToOptions, ConnectorMappingItem / AutoMatchResponse / ConnectorMappingWriteArgsThe DATA half of the same surface: the connectors:mappings:* MCP service plus every react-query hook a Tool Mappings page needs, composed by useConnectorToolMappings into the three prop bundles the components take. Needs the optional peer @tanstack/react-query, and nothing else — identity, routing, connector enumeration and selection are all injected. Promoted from three plugins that had ~3,300 duplicated lines between them and had to fix the same two production defects once per repo; see docs/adopting-shared-tool-mappings.md
./org-formatformatDate / formatDateTime / formatTime / formatDateOrPresent / formatRelativeTime, getOrgDateInputFormat / getOrgDateTimeInputFormat, formatMoney / formatCompactMoney / getCurrencySymbol, setOrgFormats / getOrgDateFormat / getOrgTimeFormat / resolveOrgDateFormat / resolveOrgTimeFormat, setOrgReportingCurrency / getOrgReportingCurrency / resolveOrgReportingCurrencyCode, ORG_DATE_FALLBACK_FORMAT / ORG_TIME_FALLBACK_FORMAT / MONEY_FALLBACK_CURRENCYThe organisation's date/time formats and reporting currency, stamped by useOrgFormatSync / useReportingCurrencySync, and argument-free formatters that read them (UK dd/MM/yyyy, HH:mm, GBP when nothing is stamped). Money renders with the en-GB symbol display, so USD, CAD and AUD read "US$", "CA$" and "A$" rather than a bare "$" (foundation-utils' own money formatters still use narrowSymbol). The pure date formatting lives in @ethisyscore/foundation-utils; plugin-ui imports this entry by its package specifier so the whole bundle shares one copy of the state
./a11yuseA11yAnnounceAccessible live-region announcement hook
./l10nusePluginLocale / PluginLocaleLocale + direction/RTL helper
./tokenuseFrontendSessionToken, useAuth, decodeJwtPayloadFrontend session token + JWT auth utilities
./tailwind-presetehxTailwindPresetTailwind preset carrying the gogo-ui theme scales (screens, fonts, sizes, colours, shadows)
./plugin-base.css(CSS asset)Static base stylesheet for plugin surfaces

Typical usage

// A PlatformReact page module the host dynamic-imports at surface mount.
import { definePlatformReactPluginPage } from "@ethisyscore/plugin-ui/platform-react";
import { useView } from "@ethisyscore/plugin-ui/platform-react";

function MyFeaturePage() {
  const View = useView("my-feature/list");
  return <View />;
}

export default definePlatformReactPluginPage(MyFeaturePage);

Handlers do not call MCP tools directly — wrap each callee domain in a typed service extending BaseMcpService and consume it through useToolInvoker. See the top-level README §"services over MCP" and the FE migration playbook.

Uploading a browser file

Browser uploads go through useUploadToStorage into the app's own plugin storage. Never base64 a file through a tool call.

import { useUploadToStorage, isPluginStorageUploadError } from "@ethisyscore/plugin-ui/platform-react";

const { upload, loading, error } = useUploadToStorage();

async function onFile(file: File) {
  try {
    const { path } = await upload(file, { pathPrefix: "cvs" });
    await recordCv({ path }); // the app's own command; the backend reads `path` via IPluginStorage
  } catch (err) {
    if (isPluginStorageUploadError(err) && err.reason === "quota_exceeded") { /* ... */ }
  }
}

The prefix is one or more /-separated [A-Za-z0-9_-] segments, at most 84 characters, with no leading or trailing /. It is refused, never repaired. Files are capped at 30 MB, and only allow-listed passive types (PLUGIN_STORAGE_UPLOAD_CONTENT_TYPES) are accepted. See CAPABILITIES.md for the full rules and the error reasons.

Build and test

npm ci && npm run build && npm test

Last Updated: 2026-07-10

版本与发布记录

@ethisyscore/plugin-ui 共发布 232 个版本,首次发布于 2026/06/11;过去 12 个月发布了 232 个版本。

版本发布日期距今
1.167.0latest2026/10/2520 天前
1.166.02026/10/2420 天前
1.165.02026/10/2420 天前
1.164.02026/10/2321 天前
1.163.32026/10/2321 天前
1.163.22026/10/2321 天前

关于 @ethisyscore/plugin-ui 的常见问题

@ethisyscore/plugin-ui 是什么?

Plugin-UI umbrella SDK: client bridge + a11y/l10n primitives + brokered-MCP client (WI 4858).注意:该包已被作者标记为弃用——This package has moved to the Ethisys Core package feed. In Ethisys Core, open the Developers page and follow the setup steps (cc login connects npm to the feed).

如何安装 @ethisyscore/plugin-ui?

在项目目录运行 npm install @ethisyscore/plugin-ui,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=18)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@ethisyscore/plugin-ui 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@ethisyscore/plugin-ui 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@ethisyscore/plugin-ui 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@ethisyscore/plugin-ui 可以商用吗?

@ethisyscore/plugin-ui 使用 SEE LICENSE IN LICENSE 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@ethisyscore/plugin-ui 的下载量有多少?

根据 npm 官方下载统计,@ethisyscore/plugin-ui 在 2026/10/14 – 2026/11/12 这 30 天内被下载 8,212 次,日均约 274 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ethisyscore/plugin-ui 还在维护吗?

最新版本 1.167.0 发布于 2026/10/25(20 天前);至今共发布 232 个版本,其中过去 12 个月发布了 232 个;首次发布于 2026/06/11。作者已将其标记为弃用,新项目建议寻找替代方案。