@godspeedai/cognate-ui-astryx

中文文档
0.10.0发布于 2026/11/16Apache-2.0ES Module构建来源已验证近 30 天下载 3299

Reference Astryx surfaces over @godspeedai/cognate-react: shell, chat, approvals, artifacts, run and state inspection, themes (spec §25.3). A renderer, not the ontology.

原始使用文档
文档目录7 节
  1. Installation
  2. Quick start
  3. Surfaces
  4. Serving the stylesheets
  5. Limitations
  6. Related packages
  7. License

@godspeedai/cognate-ui-astryx

Reference chat-application surfaces for Cognate, built with the Astryx design system: an application shell, chat panel, approval cards, artifact viewer, and run/state inspectors, with light/dark theming included.

When to use this package: you want a working, accessible Cognate UI out of the box, or a concrete reference while composing your own. It is a renderer, not the ontology — everything here composes @godspeedai/cognate-react hooks and Cognate types only, so swapping the design system means replacing this package and nothing else. For bindings without components, use @godspeedai/cognate-react directly.

Installation

bun add @godspeedai/cognate-ui-astryx

Requires Bun >= 1.4.0 and React 19.3.0 with react-dom 19.3.0 (both declared as peer dependencies). Astryx itself (@astryxdesign/core, @astryxdesign/theme-neutral) is a regular dependency. The packages ship Bun-native TypeScript source; if you type-check outside Bun, add @types/bun and @types/node.

Quick start

import { useState } from "react";
import { createClient } from "@godspeedai/cognate-client";
import { CognateProvider } from "@godspeedai/cognate-react";
import { Approvals, ChatPanel, CognateShell, RunInspector } from "@godspeedai/cognate-ui-astryx";

const client = createClient({ service: runtime.service, caller }); // runtime from @godspeedai/cognate-runtime-bun

function App() {
  const [runId, setRunId] = useState<string>();
  return (
    <CognateProvider client={client}>
      <CognateShell title="Support copilot">
        <ChatPanel agent="agent.support" placeholder="Ask about a refund" onRunStarted={setRunId} />
        <Approvals runId={runId} />
        <RunInspector runId={runId} />
      </CognateShell>
    </CognateProvider>
  );
}

Type a message and the panel starts a run of the agent; streamed assistant text appears as it is emitted; approval-style continuations render as Approve/Reject cards that resolve through the client; the inspector follows status, open continuations, and artifacts. The shell works under server-side rendering (renderToString produces the accessible markup in light and dark modes) and hydrates against a live runtime.

Surfaces

ComponentPurpose
CognateShell({ title, mode?, onModeChange?, children })Astryx theme wrapper with a header (title, light/dark toggle) and main region; stamps data-cognate-theme on its root
ChatPanel({ agent, placeholder?, onRunStarted? })message form that starts runs via useAgent; shows the streamed reply
ApprovalCard({ continuation, onResolve })one continuation's type and payload with Approve/Reject buttons
Approvals({ runId })all open approval-style continuations of a run as cards, resolved through useContinuations
ArtifactViewer({ artifactId })text/* as text, JSON objects as an accessible key/value table, anything else as a download link
RunInspector({ runId })status, error, open-continuation and artifact counts
StateInspector({ runId })the run's derived shared state as formatted JSON

Serving the stylesheets

Astryx ships pre-compiled CSS (no style build step). stylesheetPaths() from the ./styles subpath resolves the absolute paths of the two stylesheets a host page must link or serve:

import { stylesheetPaths } from "@godspeedai/cognate-ui-astryx/styles";

for (const path of stylesheetPaths()) registerStylesheet(path); // host-app specific

Without those stylesheets the components render and function, but not with Astryx's intended look.

Limitations

  • These are reference surfaces, not a component framework: there is no public theming API beyond Astryx's own Theme/mode mechanism surfaced by CognateShell.
  • The chat panel covers one agent and the latest run's text; multi-run conversation views are yours to compose with @godspeedai/cognate-react hooks.
  • Only text, JSON-object, and download-link artifact rendering is provided.

License

Apache-2.0

版本与发布记录

@godspeedai/cognate-ui-astryx 共发布 20 个版本,首次发布于 2026/10/09;过去 12 个月发布了 20 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.10.0latest2026/11/16今天
0.9.22026/11/152 天前
0.9.12026/11/143 天前
0.9.02026/11/0610 天前
0.8.02026/10/2720 天前
0.7.12026/10/2523 天前

关于 @godspeedai/cognate-ui-astryx 的常见问题

@godspeedai/cognate-ui-astryx 是什么?

Reference Astryx surfaces over @godspeedai/cognate-react: shell, chat, approvals, artifacts, run and state inspection, themes (spec §25.3). A renderer, not the ontology.

如何安装 @godspeedai/cognate-ui-astryx?

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

@godspeedai/cognate-ui-astryx 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/godspeedai__cognate-ui-astryx 是否存在。

@godspeedai/cognate-ui-astryx 支持 ESM 还是 CommonJS?

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

@godspeedai/cognate-ui-astryx 可以商用吗?

@godspeedai/cognate-ui-astryx 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@godspeedai/cognate-ui-astryx 的下载量有多少?

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

@godspeedai/cognate-ui-astryx 还在维护吗?

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