clearai-dsh 0.2.7 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  All notable changes to this project are recorded here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4
4
 
5
+ ## [0.2.8] — 2026-09-28
6
+
7
+ **四个面板消失的那条 bug:客户端半读了一个已经不存在的字段。** 客户端拿「当前会话」用的是 `sessions.list.getSnapshot().current`;宿主的 `SessionListState` 现在只有 `{ ids, byId, phase, projectionsBySession }` —— **没有 `current`**。读到 `undefined`,`isCurrentPreset()` 就恒为 `false`,`occupy()` / `syncRail()` **一个座位都不注册**。失效形态与症状完全一致:模式在、宿主半一切正常,中栏只剩「对话 / 轨迹」、右栏只剩宿主自带的页签,**而且不报错**(0.1.7-rc.2 与 0.2.0-rc.1 的宿主都是这个形状)。
8
+
9
+ ### Fixed
10
+
11
+ - **客户端:当前会话的取法改成宿主自己的那一套** —— 在 `byId` 里找 `retainedBy.mainView > 0` 的那一行(`dsh-client-ui-open-in-app`、`dsh-client-ui-agent-preset` 都这么写);老宿主若还留着 `current`,照旧认它。`isCurrentPreset()` 与 `sessionIdFor()` 两处共用一个 `currentSessionRow()`。
12
+
13
+ ### Changed
14
+
15
+ - **测试桩与宿主同形**(`test/client.test.mjs`):旧桩自己造了 `current: 's1'`,于是 240 条检查全绿,而真宿主上四个面板静默消失 —— 桩和宿主不一样,测的就是桩。现在桩用宿主的真实形状(`ids / byId / phase / projectionsBySession` + `retainedBy.mainView`),这条路径从此有断言看着。
16
+ - 版本 0.2.8。
17
+
18
+ ### Verified on DSH 0.2.0-rc.1
19
+
20
+ - **会话格式仍是 v4**(没有 v4→v5),0.2.5 那次的消息署名改动不用再动;
21
+ - **预设声明行照旧**:名册读到 `standard, ptc, minimal, cordis, clearai`,且 clearai **没有 broken** —— `verify-clean-install` 指向 0.2.0-rc.1 是 22 通过 / 0 失败;
22
+ - **真会话**:`node tools/e2e-run.mjs --installed` 在 0.2.0-rc.1 上 35 通过 / 0 失败(工具、`goal/set`、`plan/created`、投影、跨机制不变量);
23
+ - **真浏览器**(隔离 DSH_HOME + 真 Chrome + 一轮真模型):中栏 `对话 | 轨迹 | 产物 | 本体`,右栏「新标签页」里有 `世界树` 与 `技能 · 记忆`;
24
+ - 0.2 **没有删掉**我们预设用到的官方包;客户端插座与服务名(`conversation.view`、`conversation.input.*`、`sidebarRightTabs`、`sidebarRight`、`sidebar.right.pane.tab(.title)`、`layout`)在 0.2 源码里都还在。
25
+
5
26
  ## [0.2.7] — 2026-09-28
6
27
 
7
28
  **装完显示「成功」,装到的却是上一版——原因不在我们,但句子在我们这边。** pnpm ≥ 11 起 `minimumReleaseAge` 默认 **1440 分钟(一天)**,而这条内置默认是**非严格**的:一天内发布的版本不会被选中,但**不报错**——它静默回退到**一天以前的最新版**。于是刚发完 `0.2.6`,三条路装到的都是 **`0.2.2`**(2026-09-18):`dsh plugin --profile web add clearai-dsh`(裸包名)、`@latest`、以及**设置 → 插件列表**里填包名。一台 Mac 上实测如此,本机也用 pnpm 12.4.1 在干净工作区复现过(裸名 → 0.2.2;`clearai-dsh@0.2.6` → 0.2.6)。
package/README.md CHANGED
@@ -7,6 +7,10 @@
7
7
 
8
8
  <p align="center"><b>English</b> · <a href="README.zh-CN.md">中文</a></p>
9
9
 
10
+ <p align="center">
11
+ <a href="https://trendshift.io/repositories/248415?utm_source=trendshift-badge&amp;utm_medium=badge&amp;utm_campaign=badge-trendshift-248415" target="_blank" rel="noopener noreferrer"><img src="https://trendshift.io/api/badge/trendshift/repositories/248415/weekly?language=JavaScript" alt="Clearailhc%2Fclearai-dsh | Trendshift" width="250" height="55"/></a>
12
+ </p>
13
+
10
14
  **Your research, grown into an ontology.**
11
15
 
12
16
  ClearAI is an **ontology discovery and exploration platform**, built on two core concepts:
@@ -18,7 +22,8 @@ ClearAI is an **ontology discovery and exploration platform**, built on two core
18
22
 
19
23
  ```bash
20
24
  # Install (npm package, prebuilt — no build step, no allowBuilds prompt)
21
- dsh plugin --profile web add clearai-dsh@0.2.7
25
+ dsh plugin --profile web add clearai-dsh@0.2.8
26
+ # or in the app: Plugins → Add plugin → clearai-dsh@0.2.8
22
27
  ```
23
28
 
24
29
  Restart `dsh web`, then pick **ClearAI** in the preset picker at the top of a new session. That is the whole setup. [Full install notes ↓](#install-and-use)
@@ -69,22 +74,29 @@ ClearAI does **not** claim recursive self-improvement. It provides the epistemic
69
74
 
70
75
  ## Install and use
71
76
 
72
- **Recommended — install from npm, with the version pinned:**
77
+ **Requirements:** DSH ≥ `0.1.7-alpha.1` — that generation introduced the composition declaration line this preset rides on. Verified against the host's `0.1.7-rc.2` and `0.2.0-rc.1`.
78
+
79
+ **Recommended — install it in the app, with the version pinned:**
80
+
81
+ In the sidebar open **Plugins → Add plugin**, enter `clearai-dsh@0.2.8`, and install. That is DSH's own plugin manager: it hands what you type to pnpm, checks that the package declares a bundle and is compatible with this host, and applies it live. (The Settings page **插件列表 / Plugins** is the read-only inventory — installing happens on the sidebar's Plugins page.)
82
+
83
+ **Or from a terminal — the same install:**
73
84
 
74
85
  ```bash
75
- dsh plugin --profile web add clearai-dsh@0.2.7
86
+ dsh plugin --profile web add clearai-dsh@0.2.8
76
87
  ```
77
88
 
78
89
  This installs the prebuilt package from the npm registry. Nothing is compiled on your machine, so there is no `allowBuilds` grant to approve — the plugin is ready the moment the command returns.
79
90
 
80
- > **Why the version is pinned.** pnpm ≥ 11 holds back newly published versions: `minimumReleaseAge` defaults to 1440 minutes, and because that built-in default is non-strict, a bare package name (or `@latest`) **silently falls back to the newest version older than a day**. Right after a release that is the *previous* release, so a bare name can install something a version or two old and look like it worked. Pin the version — pnpm then records the exclusion itself — or exempt the package once in your profile's `pnpm-workspace.yaml`:
91
+ > **Why the version is pinned.** pnpm ≥ 11 holds back newly published versions: `minimumReleaseAge` defaults to 1440 minutes, and because that built-in default is non-strict, a bare package name (or `@latest`) **silently falls back to the newest version older than a day** — right after a release, the *previous* release. DSH's plugin manager forwards your spec to pnpm unchanged and does **not** compare what landed against what you asked for, so this downgrade is reported as a success. Its preview card is no help either: it reads the package with `pnpm view`, which ignores the age policy, so it can show the newest release while pnpm installs the one before it. Two ways to be exact:
81
92
  >
82
- > ```yaml
83
- > minimumReleaseAgeExclude:
84
- > - clearai-dsh
85
- > ```
86
-
87
- **No terminal needed:** open **Settings → Plugins** and enter `clearai-dsh@0.2.7` (the same reason as above: a bare name is held back); that is the host's own install path. Once the package is listed in the [awesome-dsh-plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin) catalog it also appears in **[dsh-market](https://github.com/dsh-market/dsh-market)**'s search, where it installs in one click — that market installs only what the catalog lists.
93
+ > - **Pin the version**, as both commands above do — pnpm then records the exception itself.
94
+ > - **Or exempt the package once** in the profile's `pnpm-workspace.yaml`; a bare name works from then on:
95
+ >
96
+ > ```yaml
97
+ > minimumReleaseAgeExclude:
98
+ > - clearai-dsh
99
+ > ```
88
100
 
89
101
  **Also available — one-command installer** (it resolves the current release and pins that version for you, so it is immune to the delay):
90
102
 
@@ -94,6 +106,8 @@ npx clearai-dsh install
94
106
 
95
107
  Same install underneath; it resolves the DSH CLI from your PATH (or through npx), installs into the `web` profile, and reads the composed config back so you are not taking "success" on faith. Use this if you prefer a guided path, or `--lang zh|en` to force the installer's output language.
96
108
 
109
+ **Community market (third-party):** [dsh-market](https://github.com/dsh-market/dsh-market) lists whatever the curated [awesome-dsh-plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin) catalog carries and installs a pinned version for you; ClearAI's catalog entry is in review there. It is not part of DSH, and it is not needed to install this plugin.
110
+
97
111
  **Install from source (for development, not the normal path):**
98
112
 
99
113
  ```bash
package/README.zh-CN.md CHANGED
@@ -7,6 +7,10 @@
7
7
 
8
8
  <p align="center"><a href="README.md">English</a> · <b>中文</b></p>
9
9
 
10
+ <p align="center">
11
+ <a href="https://trendshift.io/repositories/248415?utm_source=trendshift-badge&amp;utm_medium=badge&amp;utm_campaign=badge-trendshift-248415" target="_blank" rel="noopener noreferrer"><img src="https://trendshift.io/api/badge/trendshift/repositories/248415/weekly?language=JavaScript" alt="Clearailhc%2Fclearai-dsh | Trendshift" width="250" height="55"/></a>
12
+ </p>
13
+
10
14
  **你的研究,长成一个本体。**
11
15
 
12
16
  ClearAI 是一个**本体发现与探索平台**,核心由两个概念支撑:
@@ -18,7 +22,8 @@ ClearAI 是一个**本体发现与探索平台**,核心由两个概念支撑
18
22
 
19
23
  ```bash
20
24
  # 安装(npm 包,预构建——无需构建步骤,不会触发 allowBuilds 授权)
21
- dsh plugin --profile web add clearai-dsh@0.2.7
25
+ dsh plugin --profile web add clearai-dsh@0.2.8
26
+ # 或在应用里:侧栏「插件」→ 添加插件 → clearai-dsh@0.2.8
22
27
  ```
23
28
 
24
29
  重启 `dsh web`,在新建会话顶部的模式选择器里选 **ClearAI** 即可。这就是全部步骤。[完整安装说明 ↓](#安装与使用)
@@ -69,22 +74,29 @@ ClearAI **不**声称递归自我改进。它提供的是自我改进系统所
69
74
 
70
75
  ## 安装与使用
71
76
 
72
- **推荐——从 npm 安装,并把版本钉住:**
77
+ **要求:** DSH ≥ `0.1.7-alpha.1`——预设靠的是那一代引入的组合声明行。已在宿主的 `0.1.7-rc.2` 与 `0.2.0-rc.1` 上验过。
78
+
79
+ **推荐——在应用里装,并把版本钉住:**
80
+
81
+ 侧栏打开**「插件」→ 添加插件**,填 `clearai-dsh@0.2.8`,安装。这就是 DSH 自己的插件管理器:它把你填的东西交给 pnpm,校验这个包声明了组合包、与当前宿主兼容,然后当场生效。(设置里的**插件列表**是**只读清单**;安装入口在侧栏那个「插件」页。)
82
+
83
+ **或者开终端——同一次安装:**
73
84
 
74
85
  ```bash
75
- dsh plugin --profile web add clearai-dsh@0.2.7
86
+ dsh plugin --profile web add clearai-dsh@0.2.8
76
87
  ```
77
88
 
78
89
  从 npm registry 装预构建产物。本机不跑任何编译,因此不需要批准 `allowBuilds` 授权——命令返回时插件就已经可用。
79
90
 
80
- > **为什么要钉版本。** pnpm ≥ 11 会**压住刚发布的版本**:`minimumReleaseAge` 默认 1440 分钟,而这条内置默认是**非严格**的,于是裸包名(或 `@latest`)会**静默回退到一天以前的最新版**——刚发完新版时,那就是**上一版**,装完还显示成功。钉版本(pnpm 会自己记下例外),或者在 profile 的 `pnpm-workspace.yaml` 里一次性豁免这个包:
91
+ > **为什么要钉版本。** pnpm ≥ 11 会**压住刚发布的版本**:`minimumReleaseAge` 默认 1440 分钟,而这条内置默认是**非严格**的,于是裸包名(或 `@latest`)会**静默回退到一天以前的最新版**——刚发完新版时,那就是**上一版**。DSH 的插件管理器把你填的 spec **原样**转给 pnpm,而且**不比对**装到的是不是你要求的,所以这次降级会显示成安装成功;它的预览卡也帮不上忙:预览走 `pnpm view`,**不受**这条策略过滤,于是可能出现「预览显示最新版、装下去是上一版」。两种写确切版本的办法:
81
92
  >
82
- > ```yaml
83
- > minimumReleaseAgeExclude:
84
- > - clearai-dsh
85
- > ```
86
-
87
- **不想开终端**:打开**设置 → 插件列表**,填 `clearai-dsh@0.2.7`(原因同上:裸包名会被压住),走的是宿主自己那条安装路径。等它进了 [awesome-dsh-plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin) 目录,也能在 **[dsh-market](https://github.com/dsh-market/dsh-market)** 里搜到并一键安装——那个市场只装目录里有的东西。
93
+ > - **把版本钉住**(上面两条命令都是)——pnpm 会自己记下例外。
94
+ > - **或者一次性豁免这个包**,写在 profile 的 `pnpm-workspace.yaml` 里;之后裸包名也能装:
95
+ >
96
+ > ```yaml
97
+ > minimumReleaseAgeExclude:
98
+ > - clearai-dsh
99
+ > ```
88
100
 
89
101
  **也提供——一条命令的安装器**(它自己解析当前版本并钉住,因此不受这条延迟影响):
90
102
 
@@ -94,6 +106,8 @@ npx clearai-dsh install
94
106
 
95
107
  底层是同一个安装;它会从 PATH(或经 npx)解析出 DSH CLI,装进 `web` profile,再把合成后的配置读回来验证,所以「成功」不是靠信。想走引导式流程就用它,`--lang zh|en` 可指定安装器输出语言。
96
108
 
109
+ **社区市场(第三方)**:[dsh-market](https://github.com/dsh-market/dsh-market) 只列 [awesome-dsh-plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin) 目录里的条目,并且会替你钉住版本;ClearAI 的条目正在那边评审。它不属于 DSH,也不是装本插件的必要步骤。
110
+
97
111
  **从源码安装(开发用,不是常规路径):**
98
112
 
99
113
  ```bash
package/lib/client.js CHANGED
@@ -3705,11 +3705,32 @@ window.__ModuleLoader__.load({
3705
3705
  // 面板的 CSS(原生那套药丸按钮与主题令牌):带 data-plugin 标记,插件卸载时一起收掉。
3706
3706
  ctx.effect(installStyles, 'clearai: panel css')
3707
3707
 
3708
- const isCurrentPreset = () => {
3708
+ /**
3709
+ * **当前主视图里的那个会话**。
3710
+ *
3711
+ * 这里原来是 `sessions.list.getSnapshot().current`(照抄当年的原生 chat)。宿主的
3712
+ * `SessionListState` 现在只有 `{ ids, byId, phase, projectionsBySession }` —— **没有
3713
+ * `current`**:读到的永远是 `undefined`,于是 `isCurrentPreset()` 恒为 false,
3714
+ * `occupy()` / `syncRail()` **一个座位都不注册**。失效形态:模式在、宿主半一切正常、
3715
+ * 右栏只剩宿主自带的页签、中栏没有「产物」——而且不报错。
3716
+ *
3717
+ * 宿主自己的取法(两处都用它):在 `byId` 里找 `retainedBy.mainView > 0` 的那一行
3718
+ * (`dsh-client-ui-open-in-app`、`dsh-client-ui-agent-preset`)。老宿主若还留着
3719
+ * `current`,照旧认它——那一份更精确。
3720
+ */
3721
+ const currentSessionRow = () => {
3709
3722
  try {
3710
3723
  const state = sessions.list.getSnapshot()
3711
- const session = state === undefined || state.current === undefined ? undefined : state.byId[state.current]
3712
- const preset = session === undefined || session === null ? undefined : session.projectionValues?.agentPreset
3724
+ if (state === undefined || state === null) return undefined
3725
+ if (typeof state.current === 'string' && state.current !== '') return state.byId?.[state.current]
3726
+ return Object.values(state.byId ?? {}).find((row) => (row?.retainedBy?.mainView ?? 0) > 0)
3727
+ } catch {
3728
+ return undefined
3729
+ }
3730
+ }
3731
+ const isCurrentPreset = () => {
3732
+ try {
3733
+ const preset = currentSessionRow()?.projectionValues?.agentPreset
3713
3734
  return typeof preset === 'string' && preset === PRESET_ID
3714
3735
  } catch {
3715
3736
  return false
@@ -3883,19 +3904,15 @@ window.__ModuleLoader__.load({
3883
3904
  * 三处入口(产物 / 技能 / 记忆文件)共用这一个闭包,所以是一处坏、三处全坏。
3884
3905
  *
3885
3906
  * 取法:座位自己的 `props.sessionId` 优先(更精确);props 没有时兜底读当前会话
3886
- * (原生 chat 同款:`sessions.list.getSnapshot().current`)。兜底在这里成立,是因为
3887
- * 面板**只在当前会话的预设是 clearai 时挂载**(`isCurrentPreset`,见上),会话切走
3888
- * 时面板先注销 —— 不存在「面板还挂着、行的会话已经换了」的窗口。
3907
+ * (`currentSessionRow`,见上)。兜底在这里成立,是因为面板**只在当前会话的预设是
3908
+ * clearai 时挂载**(`isCurrentPreset`,见上),会话切走时面板先注销 ——
3909
+ * 不存在「面板还挂着、行的会话已经换了」的窗口。
3889
3910
  */
3890
3911
  const sessionIdFor = (props) => {
3891
3912
  const fromProps = props === null || props === undefined ? undefined : props.sessionId
3892
3913
  if (typeof fromProps === 'string' && fromProps !== '') return fromProps
3893
- try {
3894
- const current = sessions.list.getSnapshot()?.current
3895
- return typeof current === 'string' && current !== '' ? current : undefined
3896
- } catch {
3897
- return undefined
3898
- }
3914
+ const id = currentSessionRow()?.id
3915
+ return typeof id === 'string' && id !== '' ? id : undefined
3899
3916
  }
3900
3917
  /** 每个座位按自己的 props 造一个打开器:共用一个「反正差不多」的闭包就是上面那个 bug。 */
3901
3918
  const openPreviewFor = (props) => (path) => openNativePreview(sidebarRight, sessionIdFor(props), path)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clearai-dsh",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "ClearAI: an ontology-first DSH agent preset — evidence-checked research that grows into a domain ontology.",
5
5
  "type": "module",
6
6
  "private": false,