@genispace/geniapp

中文文档
0.7.17发布于 2026/11/10MITTypeScriptES Module构建来源已验证近 30 天下载 1981

Public runtime, UI, Shell protocol and build contracts for GeniSpace applications

原始使用文档
文档目录10 节
  1. Ownership boundary
  2. Install
  3. Public entries
  4. Application setup
  5. Tailwind
  6. Workbench export runtime
  7. Vite
  8. Installed releases and datasource versions
  9. Local quality gates
  10. Release policy

@genispace/geniapp

Public, versioned developer contract for building a GeniApp. This package is intentionally independent from the private GeniSpace frontend monorepo.

Ownership boundary

frontend/                         geniapp/                         applications/
├── apps/*                        └── @genispace/geniapp           └── apps/*
└── packages/shared-* (private)      ├── ui + kit                      ├── @genispace/sdk
                                      ├── Shell bridge                  └── @genispace/geniapp
                                      ├── hooks + runtime
                                      ├── theme + i18n contract
                                      └── Vite bundle plugin
  • frontend/packages/shared-* belongs only to the platform frontend and is never a GeniApp dependency.
  • @genispace/geniapp is the public UI/runtime/build contract used by built-in, custom and Workbench-exported GeniApps.
  • @genispace/sdk is the public platform API SDK. This package does not duplicate its HTTP/SSE clients.
  • @genispace/[email protected] requires exactly @genispace/[email protected]. The SDK version is part of the GeniApp runtime contract and is checked before packing or publishing.

Install

Install both public packages from npm. GeniApp releases pin their supported SDK version exactly, so applications should use the matching SDK version shown below.

pnpm add @genispace/[email protected] @genispace/[email protected] react react-dom react-router-dom i18next react-i18next

Public entries

EntryStabilityPurpose
@genispace/geniappstableApp layout, hooks and Shell bridge
@genispace/geniapp/uistableApp sidebar/page/state/form primitives
@genispace/geniapp/kitstableCurated shadcn-style component kit
@genispace/geniapp/hooksstableRBAC, routing, locale and platform-client helpers
@genispace/geniapp/shellstableSecure iframe context, theme, locale and route synchronization
@genispace/geniapp/vitestableManifest/data bundle copying and versioned base-path helpers
@genispace/geniapp/aistableManaged datasource and AI-assisted application patterns
@genispace/geniapp/storagestableAuthenticated platform storage UI/helpers
@genispace/geniapp/dashboardstableDashboard filters, KPI and chart patterns
@genispace/geniapp/case-workspacestableCase workspace contract
@genispace/geniapp/task-workspacestableTask workspace contract
@genispace/geniapp/componentsstableExact Workbench view renderer and runtime providers for every GeniApp
@genispace/geniapp/components/renderers/*stableDeveloper-facing component-family entry points such as table, form and chart
@genispace/geniapp/components/styles.cssstableShared component, layout, mobile and appearance styles

Only symbols exported by these entries are public. Files below src/ and dist/ are implementation details and cannot be imported through package exports.

Build tooling that creates a separately hosted shared font bundle may resolve @genispace/geniapp/fonts.css; applications should continue importing @genispace/geniapp/styles.css.

Application setup

import { AppPage, AppSidebar } from '@genispace/geniapp/ui';
import { Button, Card } from '@genispace/geniapp/kit';
import { GeniAppShellBridge } from '@genispace/geniapp/shell';
import '@genispace/geniapp/styles.css';

export function App() {
  return (
    <>
      <GeniAppShellBridge
        identifier="customer-operations"
        allowedShellOrigins={['https://app.genispace.ai']}
      />
      <AppSidebar groups={[]} />
      <AppPage title="Customer operations">
        <Card><Button>New customer</Button></Card>
      </AppPage>
    </>
  );
}

allowedShellOrigins should list production Shell origins. The bridge also accepts the iframe document referrer and falls back to the local Shell origins only when no production origin is available. A message cannot grant trust to its own sender.

Tailwind

// tailwind.config.js
import geniappPreset from '@genispace/geniapp/tailwind-preset';

export default {
  presets: [geniappPreset],
  content: [
    './index.html',
    './src/**/*.{js,ts,jsx,tsx}',
    './node_modules/@genispace/geniapp/dist/**/*.{js,mjs}',
  ],
};

The stylesheet contains the platform light/dark semantic tokens, local fonts, responsive application layout rules and component CSS. Locale text remains owned by each application; shared components accept labels or use the host react-i18next provider.

Workbench export runtime

Workbench exports pin an exact GeniApp version and keep each page and component in a separate React/TypeScript module. The public component runtime is the same implementation used by Workbench view mode and does not import the private editor:

import { createRoot } from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import {
  GeniAppComponentProvider,
  GeniAppWorkbench,
  createPlatformHostAdapters,
} from '@genispace/geniapp/components';
import '@genispace/geniapp/components/styles.css';
import workbenchConfig from './config/workbench.config';

createRoot(document.getElementById('root')!).render(
  <BrowserRouter>
    <GeniAppComponentProvider
      applicationId="customer-operations"
      adapters={createPlatformHostAdapters({
        applicationIdentifier: 'customer-operations',
        datasourceIdentifiers: workbenchConfig.geniappRuntime?.datasourceIdentifiers,
      })}
      locale={localStorage.getItem('i18nextLng') || navigator.language}
      localeMetadata={workbenchConfig.metadata}
      themeId={workbenchConfig.themeId}
    >
      <GeniAppWorkbench
        identifier="customer-operations"
        config={workbenchConfig}
      />
    </GeniAppComponentProvider>
  </BrowserRouter>,
);

The runtime owns the exact component behavior, layout, mobile adaptation, platform adapters, theme bridge and locale bridge. Exported component modules own application-specific props, data and custom styles, so developers can edit or replace one component without reading a monolithic snapshot. There is no legacy workbench package entry: the export feature was not released before the components contract became official.

Release lifecycle presentation is available from @genispace/geniapp/components/release. These components are intentionally host-controlled and side-effect free: the platform remains responsible for authorization, effective-version resolution, preview membership and release-note acknowledgement. Runtime platform adapters can resolve portable Datasource, Dataset, Agent, Task, Workflow, Operator, Knowledge Base and Skill references through the installed Application version without embedding source-space UUIDs.

Vite

Installed releases and datasource versions

Deploying an application version executes its migrations and installs its platform resources. After installation, the application owner chooses to publish it or make it visible to selected preview members. Preview does not isolate the shared database schema: developers must keep schema and shared resource changes forward-compatible with the serving application.

Use GeniAppShellBridge and createPlatformHostAdapters for exported component requests. The bridge supplies the application identity and effective version; the adapter sends that context and the logical datasource identifier for every read, write and schema request. The server authorizes the audience and maps an optional source version number to the immutable execution revision installed for that application version. Do not substitute a physical revision returned by a previous request, or globally change a datasource default while a candidate version is being tested.

The queryManagedDatasourceRows and executeManagedDatasourceOperation helpers from @genispace/geniapp/ai use the same binding when called for the application injected by the Shell. Cross-application helpers retain their existing shared-resource behavior. Custom SDK/fetch integrations must carry X-Application-Id and X-GeniApp-Resource-Identifier on datasource requests; an optional X-GeniApp-Release-Channel: stable can opt out of preview but cannot grant preview access. Allow these headers in API CORS configuration.

Already deployed bundles are not rewritten by a platform upgrade. Rebuild a candidate that changes datasource execution with this runtime (or the equivalent request context contract). Unchanged datasource contracts can reuse their installed execution revisions.

import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import {
  copyGeniAppBundle,
  geniappBasePath,
  geniappManualChunks,
  geniappOptimizeDeps,
} from '@genispace/geniapp/vite';

const appRoot = path.dirname(fileURLToPath(import.meta.url));
const pkg = JSON.parse(fs.readFileSync(path.join(appRoot, 'package.json'), 'utf8'));

export default defineConfig(({ command, mode }) => ({
  base: geniappBasePath({ command, mode, identifier: 'customer-operations', version: pkg.version }),
  plugins: [react(), copyGeniAppBundle({ appRoot })],
  optimizeDeps: geniappOptimizeDeps,
  build: { rollupOptions: { output: { manualChunks: geniappManualChunks } } },
}));

The plugin copies manifest.json and the entire data/ contract into dist/, and serves the same files during local development. It does not create aliases to any GeniSpace source repository.

Local quality gates

pnpm install
pnpm check:sdk-version
pnpm type-check
pnpm test
pnpm pack:check

pack:check builds the actual npm artifact into .pack/. Consumer acceptance tests must install that tarball, rather than importing this repository's source, to catch missing exports and undeclared dependencies.

Release policy

  • Follow semantic versioning. Removing or changing an exported symbol, Shell message, CSS token or manifest/build behavior is a breaking change.
  • Applications pin an exact version in release lockfiles. Renovation is explicit and tested.
  • Each GeniApp package release pins one exact @genispace/sdk peer version. Supporting another SDK version requires a reviewed GeniApp release, even when the SDK change is otherwise backward compatible.
  • Publish from a clean Git tag with npm provenance after CI, package-name ownership and the MIT license are approved.
  • The old frontend-packages repository is retired and retained only as a read-only historical checkout. No active application or platform frontend resolves code from it.
  • The complete ownership decision, cutover procedure and acceptance evidence are documented in docs/ARCHITECTURE_AND_MIGRATION.md.

版本与发布记录

@genispace/geniapp 共发布 32 个版本,首次发布于 2026/09/01;过去 12 个月发布了 32 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.7.17latest2026/11/106 天前
0.7.162026/11/0511 天前
0.7.152026/10/2720 天前
0.7.142026/10/2323 天前
0.7.132026/10/2125 天前
0.7.122026/10/1630 天前

关于 @genispace/geniapp 的常见问题

@genispace/geniapp 是什么?

Public runtime, UI, Shell protocol and build contracts for GeniSpace applications

如何安装 @genispace/geniapp?

在项目目录运行 npm install @genispace/geniapp,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=18.3 <20)、i18next(>=23 <26)、react-dom(>=18.3 <20)、react-i18next(>=14 <17)、@genispace/sdk(3.1.0)、react-router-dom(>=6.22 <8)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@genispace/geniapp 支持 TypeScript 吗?

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

@genispace/geniapp 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@genispace/geniapp 需要什么版本的 Node.js?

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

@genispace/geniapp 可以商用吗?

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

@genispace/geniapp 的下载量有多少?

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

@genispace/geniapp 还在维护吗?

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