@ai-matrx/sharing

中文文档
0.1.27发布于 2026/10/30MITTypeScriptESM + CJS近 30 天下载 1.4万

Sharing for every AI Matrx entity: the permission doors, share links, and the share dialog.

原始使用文档

@ai-matrx/sharing

Sharing for every AI Matrx entity: the permission doors, share links, and the share dialog.

Status: shipping and adopted by matrx-frontend. /core is the data half (configureSharing: the permission service, share links, registry, "shown to" reads); /react is THE share sheet (ShareModal, the link panels, the permission hooks; host UI through configureShareSheetUi); /access/react is the access gate screens (moved from @ai-matrx/data). Versions are cut by the daily npm publish batch or an explicit targeted release (highest served + patch). A source push does not start an npm release. package.json's version is not the release state; npm view @ai-matrx/sharing version is.

Sections

  • @ai-matrx/sharing/core - the data half: configureSharing, permission service, share links, registry
  • @ai-matrx/sharing/react - the share sheet and its hooks; every host-only part has an announcing default
  • @ai-matrx/sharing/access/react — "use client": request access, access denied, governed actions, hidden-by-me

@ai-matrx/sharing/access/react — the access gate screens

"use client" entry. Every screen and hook of the access gate: AccessGate, AccessDenied / AccessDeniedView, SlugAccessGate, SettingAccessGate, ForbiddenSurfaceView, RequestAccess, RequestAccessPanel, BlindAccessAsk, UnresolvedEntityRef, ServerReadRecheck, GovernedActionDialog, HiddenByMeButton, HiddenFilter, ResourceActionRequestButtons, SettingRequestActionButtons, AccessRequestsSurface; hooks useAccessGate, useAccessStates, useHiddenByMe (+ useHiddenItems, useHideForMe, useRemovalRights), useRequestAccess; and the "can't remove it" opener (ensureRemovable, offerOwnerChoices, cantRemoveOpener, CantRemoveDialogHostBody). Built on @ai-matrx/design-system and lucide-react; no next/*, no app imports.

RequestAccessPanel renders its view/edit choices with design-system buttons. The selected choice has pressed state, and each choice label stays on one line while the row may wrap between choices. Hosts configure access services as below; the panel owns these choice controls.

configureAccessUi(env) (module-level, merges; <AccessUiProvider env> overrides a subtree; useAccessUi() reads the merged result). The pure half's Supabase client / ensureOrgId / CMS tokens come from configureAccess in @ai-matrx/data/access — call both once at boot; the screens read the same @ai-matrx/data/access module the app configures.

FieldKindDefault when absent
useLoginHref(), useCurrentUser() {id, displayName, email}, toast {success, error, warning, info?}REQUIREDreading one throws an error naming configureAccessUi({ field })
Link, router {push, back, refresh}, searchParam(name), confirm(options), Textarea, renderUserIdentity, renderEntityRef, renderErrorMenu, navItemClasses, manualRequestActionKeyoptional, working defaultplain <a>, browser history/reload, kit confirm(), design-system Textarea, avatar + name, plain name (not a door), no error menu, app-shell nav CSS variables, request_access.manual
entityRegistry.tryGetEntityInfo, trash.restore, recordUnavailableCapture.resolve, settingRequestActions.get, resourceActionRequests.get, cms.createAccessRequest, settingDoorHref, reportFeedback, presentOrganizationRefusal, overlaysoptional app featureowners/records render as plain names; Restore, CMS asks, setting asks and platform-team asks FAIL VISIBLY naming the missing field; unknown request actions render without the primary action button; the rest are no-ops

Hook-valued fields are called inside components: set them once at boot. ForbiddenSurface (async, reads headers() and the session verdict) cannot live in a client entry, so the package ships ForbiddenSurfaceView; the app keeps a ~10-line server wrapper in forbidden.tsx that reads the verdict and request path and renders it.

版本与发布记录

@ai-matrx/sharing 共发布 30 个版本,首次发布于 2026/10/22;过去 12 个月发布了 30 个版本。

版本发布日期距今
0.1.27latest2026/10/306 天前
0.1.262026/10/297 天前
0.1.252026/10/288 天前
0.1.242026/10/2610 天前
0.1.232026/10/2611 天前
0.1.222026/10/2611 天前

其他发布通道:bootstrap → 0.0.0。

关于 @ai-matrx/sharing 的常见问题

@ai-matrx/sharing 是什么?

Sharing for every AI Matrx entity: the permission doors, share links, and the share dialog.

如何安装 @ai-matrx/sharing?

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

@ai-matrx/sharing 支持 TypeScript 吗?

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

@ai-matrx/sharing 支持 ESM 还是 CommonJS?

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

@ai-matrx/sharing 需要什么版本的 Node.js?

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

@ai-matrx/sharing 可以商用吗?

@ai-matrx/sharing 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@ai-matrx/sharing 的下载量有多少?

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

@ai-matrx/sharing 还在维护吗?

最新版本 0.1.27 发布于 2026/10/30(6 天前);至今共发布 30 个版本,其中过去 12 个月发布了 30 个;首次发布于 2026/10/22。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。