@classic-homes/agent-chat

中文文档
0.11.0发布于 2026/11/06UNLICENSEDTypeScriptES Module近 30 天下载 3101

Svelte 5 chat UI for Classic Agent: session state, message list, composer, tool timeline, artifacts and MCP-UI sandbox frames. Consumed by the Classic App.

原始使用文档
文档目录3 节
  1. Requirements
  2. Usage
  3. Components

@classic-homes/agent-chat

Svelte 5 chat UI for Classic Agent: session state, message list, composer, tool timeline, artifacts and MCP-UI sandbox frames. The Classic App's /agent page and agent panel use it.

Requirements

  • svelte 5 and @classic-homes/theme-svelte 1.39 or later (peer dependencies).

  • Tailwind with @classic-homes/theme-tailwind-preset. The components are styled with Tailwind utility classes and theme tokens, so the consumer's Tailwind build has to scan this package:

    // tailwind.config.js
    export default {
      content: [
        './src/**/*.{html,js,svelte,ts}',
        './node_modules/@classic-homes/theme-svelte/**/*.{html,js,svelte,ts}',
        './node_modules/@classic-homes/agent-chat/**/*.{js,svelte}',
      ],
      presets: [require('@classic-homes/theme-tailwind-preset')],
    };
    

    Without that entry the chat renders unstyled. Markdown prose (rendered from model text) uses arbitrary-variant utilities on its container ([&_ul]:list-disc), not a stylesheet: the Classic App's cascade-layers polyfill outranks plain component CSS.

Usage

<script lang="ts">
  import { AgentChat } from '@classic-homes/agent-chat';
</script>

<AgentChat {client} sandboxOrigin={AGENT_SANDBOX_ORIGIN} {conversationId} mode={me.mode} />

client is an AgentApiClient from @classic-homes/agent-client. sandboxOrigin is the agent-api origin that serves /frame; artifacts and MCP-UI resources only ever render there.

Components

AgentChat composes the rest; each is also exported for other layouts:

  • ChatHeader, ConversationSidebar: title and conversation actions; the history rail. ChatHeader's menu opens ShortcutsDialog (the chat's CHAT_SHORTCUTS plus the host's shortcuts, e.g. a panel toggle). Hosts implement their own app-level shortcuts.
  • MessageList: transcript with day separators and a jump-to-latest button.
  • MessageItem → UserMessage / AssistantMessage, with MessageActions (copy, time, MessageFeedback thumbs up/down with an optional note, Regenerate and Edit on the latest turn), ArtifactChip, MessageFiles (image lightbox, downloads) and ProposalCard (read-only document edits; applying stays in the Office add-in).
  • Composer: attach by button, drop or paste; prompts turns on the / saved-prompt menu (ComposerPrompt.text may be a loader, e.g. fetching the template).
  • ToolTimeline: tool calls with status and duration, delegations nested; toolLabels maps tool names to readable ones (AgentChat passes both through).
  • Agent picker: pass agents (from /api/agents); with more than one, a new conversation offers a picker in the composer until its first message. The conversation keeps that agent; header receives { agent, agentName } and onagentchange reports it.
  • Welcome: the empty conversation, with a greeting (userName), a capability line and up to four suggestions that send when chosen. AgentChat shows it unless the host passes an empty snippet, a loading skeleton while an existing conversation's transcript arrives, and an error with Try again when that load fails.
  • ArtifactPanel, UiFrame, ModeBanner.

Publishing: docs/operations/package-publishing.md.

版本与发布记录

@classic-homes/agent-chat 共发布 17 个版本,首次发布于 2026/10/31;过去 12 个月发布了 17 个版本。

版本发布日期距今
0.11.0latest2026/11/064 天前
0.10.02026/11/054 天前
0.9.02026/11/055 天前
0.8.02026/11/055 天前
0.7.02026/11/055 天前
0.6.02026/11/055 天前

关于 @classic-homes/agent-chat 的常见问题

@classic-homes/agent-chat 是什么?

Svelte 5 chat UI for Classic Agent: session state, message list, composer, tool timeline, artifacts and MCP-UI sandbox frames. Consumed by the Classic App.

如何安装 @classic-homes/agent-chat?

在项目目录运行 npm install @classic-homes/agent-chat,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:svelte(^5.31.0)、@classic-homes/theme-svelte(^1.42.2)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@classic-homes/agent-chat 支持 TypeScript 吗?

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

@classic-homes/agent-chat 支持 ESM 还是 CommonJS?

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

@classic-homes/agent-chat 可以商用吗?

@classic-homes/agent-chat 使用 UNLICENSED 许可。作者声明为 UNLICENSED,即不授予公开使用许可(与公共领域的 Unlicense 不同)。使用前需获得作者授权。以上为概括,不构成法律意见,请以许可原文为准。

@classic-homes/agent-chat 的下载量有多少?

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

@classic-homes/agent-chat 还在维护吗?

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