Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [0.8.5] - 2026-08-16
### 发布
- **发布规范对齐 `plugin_check`(issue #15)**:
- 新增 bundle 源码入口 `src/index.ts`(`import type {}` 先引入 dsh client runtime 的 cordis Context 增广再重导出 `src/plugin/index`,规避 TS 5.9 从根入口进入时全局增广顺序不稳定的类型错误);tsdown node 入口改为命名入口 `{ index: 'src/index.ts', invariant: 'src/plugin/invariant.ts' }` 并固定 `entryFileNames`,保持发布布局 `lib/index.js` + `lib/invariant.js` 不变;
- `tsconfig`:`outDir` 改为 `lib`(与 `main` 的 `lib/` 前缀对齐)、新增 `declarationDir: "lib/types"`(类型输出布局不变)、显式 `types: ["node"]`(devDependencies 同步补 `@types/node`,消除隐式 Node 类型依赖);
- `files` 增补 `lib`、`src` 目录声明;新增 `scripts.prepack = pnpm run build`,发布 tarball 前强制重建 lib,clean checkout 可复现发布产物。
- 已知非本仓库可修项:`plugin_check` 的 org-name 政策目前只放行 `@deepseek-ai/*`/`@dsh-external/*`/`dsh-*`,`@omdsh-dev/dsh-genui` 为社区组织公开发布名,保持不变;其 `missing-peer: cordis` 提示基于旧 cordis 键名,本包实际依赖 `@deepseek-ai/cordis@^4.0.1`,不添加幻影 peer。
### 测试
- 全量 373 项(271 passed / 102 skipped)0 失败;`plugin_check` 从 3 errors / 4 warnings 收敛为 1 error / 1 warning(仅剩上述命名政策与旧 peer 键提示)。

## [0.8.4] - 2026-08-16
### 修复
- **genui 与普通代码块共存时整条消息被吞(issue #13)**:同一消息容器里 `dsh-ui` 围栏和 python/ts/bash 等普通代码块共存时,DOM 通道的结构兜底从普通代码块的 `<pre>` 向上回溯,越过它自己的 `.md-code-block` 把共享的 `.markdown` 根容器误判为「dsh-ui 围栏」→ 整条消息 `display:none`、只剩 GenUI,普通代码块丢失。修复两层:① 兜底循环跳过已由已知表面选择器命中的 `<pre>`(这些块已处理,不再向上回溯);② 标签判定不认领「属于嵌套已知代码块」的 banner(`owner !== block` 即跳过),共享容器不能再通过嵌套围栏的标签自证。未知类名表面的结构兜底能力保持不变(回归测试覆盖:未知表面 + 已知 python 块并存时仍照常渲染)
Expand Down
1 change: 1 addition & 0 deletions lib/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './plugin/index';
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@omdsh-dev/dsh-genui",
"description": "GenUI for DeepSeek Harness: interactive UI components rendered inline in assistant replies via the ```dsh-ui fence — layout, charts, plots, forms, quizzes, mermaid, 3D scenes, and an action event loop back to the model. Ships the fence-teaching host plugin, the browser renderer (client half), and the genui skill.",
"version": "0.8.4",
"version": "0.8.5",
"type": "module",
"main": "lib/index.js",
"types": "lib/types/plugin/index.d.ts",
Expand Down Expand Up @@ -34,7 +34,11 @@
"README.zh-CN.md",
"CHANGELOG.md",
"demo-prompts.md",
"cordis.patch.yml"
"cordis.patch.yml",
"lib",
"src",
"tsconfig.json",
"tsdown.config.ts"
],
"publishConfig": {
"access": "public"
Expand Down Expand Up @@ -73,6 +77,7 @@
"devDependencies": {
"@testing-library/dom": "^10.4.1",
"@testing-library/react": "^16.0.0",
"@types/node": "^22.19.0",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@types/three": "^0.185.4",
Expand All @@ -90,7 +95,8 @@
"scripts": {
"build": "rm -rf lib && tsc -p tsconfig.json && tsdown",
"test": "vitest run",
"check": "rm -rf lib && tsc -p tsconfig.json && vitest run && tsdown"
"check": "rm -rf lib && tsc -p tsconfig.json && vitest run && tsdown",
"prepack": "node scripts/prepack.mjs"
},
"dsh": {
"bundle": {
Expand Down
39 changes: 28 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions scripts/prepack.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node
/**
* Cross-platform `prepack` wrapper: rebuild lib before packing, but keep the
* build's stdout OFF the process stdout. `npm pack --json` parses stdout as
* JSON, so any tsdown banner leaking to stdout corrupts the pack gate and
* tooling that drives npm pack programmatically. Build progress is forwarded
* to stderr instead.
*/
import { spawnSync } from 'node:child_process'

const pm = process.platform === 'win32' ? 'pnpm.cmd' : 'pnpm'
const result = spawnSync(pm, ['run', 'build'], {
env: process.env,
stdio: ['ignore', 'pipe', 'pipe'],
})

if (result.stdout !== null && result.stdout.length > 0) process.stderr.write(result.stdout)
if (result.stderr !== null && result.stderr.length > 0) process.stderr.write(result.stderr)
if (result.error !== undefined) throw result.error
if (result.status !== 0) process.exit(result.status ?? 1)
6 changes: 4 additions & 2 deletions scripts/verify-pack.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ for (const entry of Object.values(pkgJson.exports)) {
const required = [
'package.json', 'LICENSE', 'SKILL.md', 'README.md', 'CHANGELOG.md', 'demo-prompts.md', 'cordis.patch.yml',
'lib/assets/mermaid.js', 'lib/assets/three.js',
// plugin_check 发布规范(issue #15):tarball 必须携带可复现构建所需的
// 源码入口与构建配置,prepack 已在打包前重建 lib。
'src/index.ts', 'tsconfig.json', 'tsdown.config.ts',
...exportTargets,
]

Expand All @@ -53,8 +56,7 @@ try {
}

const forbidden = [...paths].filter(p =>
p.startsWith('src/')
|| p.endsWith('.map')
p.endsWith('.map')
|| p.includes('.tsbuildinfo')
|| /^lib\/types\/.*\.js$/.test(p),
)
Expand Down
12 changes: 12 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Bundle source entry (plugin_check tool-bundle contract): the node-half
* surface the host loader resolves through `package.json#main`.
*
* The `import type {}` line is NOT decorative: importing the dsh client
* runtime's cordis Context augmentation BEFORE re-exporting the plugin keeps
* TypeScript's global-augmentation ordering deterministic — without it,
* TS 5.9 mis-resolves `ctx.sessions` in the client half when the plugin
* module is first reached through this root entry.
*/
import type {} from '@deepseek-ai/dsh-client-runtime/client'
export * from './plugin/index'
9 changes: 6 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"DOM",
"DOM.Iterable"
],
"types": [],
"types": [
"node"
],
"declaration": true,
"skipLibCheck": true,
"esModuleInterop": true,
Expand All @@ -23,7 +25,7 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"rootDir": "src",
"outDir": "lib/types",
"outDir": "lib",
"baseUrl": ".",
"paths": {
"@deepseek-ai/dsh-client-ui-primitives": [
Expand Down Expand Up @@ -111,7 +113,8 @@
"../../.dsh/source/current/vendor/cosmokit/lib/types/*"
]
},
"emitDeclarationOnly": true
"emitDeclarationOnly": true,
"declarationDir": "lib/types"
},
"include": [
"src"
Expand Down
9 changes: 8 additions & 1 deletion tsdown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,20 @@ function assetConfig(name: 'mermaid' | 'three', entry: string): UserConfig {

const libConfig: UserConfig = {
name: ID,
entry: ['src/plugin/index.ts', 'src/plugin/invariant.ts'],
// Named entries keep the published layout stable (lib/index.js +
// lib/invariant.js) while src/index.ts becomes the canonical bundle
// source entry that plugin_check's tool-bundle contract expects.
entry: { index: 'src/index.ts', invariant: 'src/plugin/invariant.ts' },
outDir: 'lib',
format: ['esm'],
platform: 'node',
target: 'es2024',
fixedExtension: false,
dts: false,
// Flatten entry outputs to lib/<basename>.js so package exports keep the
// stable paths lib/index.js + lib/invariant.js (a directory-mirroring
// default would emit lib/plugin/invariant.js).
outputOptions: { entryFileNames: '[name].js' },
// Cleanup happens in the build script (`rm -rf lib` before tsc): tsdown
// must never wipe lib/types (tsc's declaration output) mid-pipeline.
clean: false,
Expand Down
Loading