dsh-as-aistudio 0.1.0 → 0.1.1

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/README.md CHANGED
@@ -68,6 +68,7 @@ dsh plugin --profile web add dsh-delete-turn
68
68
 
69
69
  ### 已修复 / 版本
70
70
 
71
+ - 0.1.1 —— 契约补 §9「热重载纪律」(2026-10-01「点不动」事故:client bundle 单独热重载 + 宿主未重启 = 混合态);新增 AGENTS.md 与三处版本号一致性测试。
71
72
  - 0.1.0 —— 首个版本:组合四个组件、固化互操作契约、报告组件状态。
72
73
 
73
74
  ### 已知限制
@@ -150,6 +151,7 @@ The action strip lives on the message rows:
150
151
 
151
152
  ### Fixes / versions
152
153
 
154
+ - 0.1.1 — contract gains §9 "hot reload discipline" (the 2026-10-01 dead-button incident: a client bundle hot-reloaded alone while the host kept running is a mixed state); adds AGENTS.md and a three-place version check.
153
155
  - 0.1.0 — first release: composes the four components, pins the interop contract, reports component status.
154
156
 
155
157
  ### Known limitations
package/docs/INTEROP.md CHANGED
@@ -132,3 +132,51 @@ function foreignHideOn(row, own) {
132
132
  1. 每个包:`npm test`(+ `verify:*`)全绿;
133
133
  2. 组合矩阵:把 4 个 client bundle 以 2^4 种组合装载进同一个 DOM stub,断言:无异常、slot 注册 id 唯一、无重复按钮、隐藏归因正确;
134
134
  3. 真机:web profile 装载 `dsh-as-aistudio` + 任意子集,页面加载无 `error` 级别日志。
135
+ ## 9. 热重载纪律(HMR)—— 2026-10-01「点不动」事故后新增
136
+
137
+ **改任何组件的 `client.js` 之后,必须重启宿主进程 + 让页面硬刷新,不要把 HMR 混合态交付给用户。**
138
+
139
+ 事故形态(dsh-rerun-turn,2026-10-01 13:5x):用户点回答行 / 用户行的 ↻ 没有任何反应,宿主 `/debug` 也收不到 `apply` 请求;直取 `/plugins/<id>/client.js` 返回空。
140
+ 根因不是代码缺陷,而是**混合态**:client bundle 被 HMR 单独重载(0.1.21 / 0.1.22 的改动触发了多次),而宿主进程没有重启 —— 页面里是「新 bundle 实例 + 旧实例已 dispose 的控制器 / 旧按钮上已死的监听」。
141
+ 恢复动作:**重启宿主 + 硬刷新页面**(重启后 host 0.1.22、bundle 200 非空、两处 ↻ 点击均正常触发 `apply`)。
142
+
143
+ 配套约定:
144
+
145
+ - 交付前检查三件事:宿主版本 == bundle 版本;`/plugins/<entry>/client.js` 返回 200 且非空;行上的动作按钮真的点得动。
146
+ - 组件在 `dispose` 之后会主动早退(不唤醒已退休的控制器),所以混合态表现为**静默无响应**而不是报错 —— 这是刻意的设计,不是 Bug;遇到它先重启宿主再判断。
147
+ - 跨端(host / client)不兼容改动必须 bump 三处版本号(`package.json` + 宿主半侧 + 浏览器半侧)并跑该仓库的全部门禁。
148
+ - 本契约的 §2(slot order 分配)与 §4(隐藏归因)属于三个注入型组件的**共享面**:改其中一侧,必须同时检查另外两侧不受影响;组合矩阵(`dsh-as-aistudio/test/combination.test.js`)是这条规则的回归网。
149
+ ## 10. 跨插件运行时契约:dsh-edit-turn → dsh-rerun-turn
150
+
151
+ 这是**唯一一条两个组件之间真实存在的运行时依赖**,也是唯一一条不走 DOM、只走回环 HTTP 的依赖。写在契约里,
152
+ 是因为它跨越两个仓库、两个维护者,任何一侧单独改动都不会让另一侧的测试变红。
153
+
154
+ 流程(`dsh-edit-turn` 0.2.12+ 的提示词编辑器「重跑」按钮):
155
+
156
+ 1. 按钮**只在探测到 rerun-turn 挂载时**出现:不带 `sessionId` 请求 `GET /dsh-rerun-turn/state`,
157
+ 按 **400 / 405 = 装着、404 = 没装** 判定;
158
+ 2. 点击后先 `POST /dsh-edit-turn/apply` 就地保存改写(不调模型),
159
+ 3. 紧接着链式 `POST /dsh-rerun-turn/apply { sessionId, seq }`,其中 `seq` 取自 rerun-turn `/state` 的
160
+ `replies[]`(匹配被编辑那一轮的 `turn`、取 `seq` 最大者);
161
+ 4. rerun-turn 侧的 `planRerun` 沿 `source.kind = plugin:dsh-edit-turn` 的就地替换链读**活节点**,
162
+ 于是重跑用改后的措辞生成。
163
+
164
+ 双向边界:
165
+
166
+ - edit-turn **只**走 rerun-turn 的公开回环路由,不碰对方的 client 半侧或 DOM;
167
+ - 反过来,**纯 dsh-edit-turn(没装 rerun-turn)没有任何重跑入口** —— 编辑器只有「取消 / 保存」。
168
+
169
+ 不许改的形状(回归测试:`dsh-rerun-turn/test/contract.test.js`,16 例,已做变异验证):
170
+
171
+ | 形状 | 约束 |
172
+ | --- | --- |
173
+ | 挂载探测 | 不带 `sessionId` 的 `GET /state` 必须仍答 400;改成 404 按钮会静默消失 |
174
+ | 目标列表 | `/state` 持续返回完整的 `replies[{seq, turn}]` |
175
+ | 调用形状 | `POST /apply` 只要求 `sessionId` + (`seq` \| `messageId`),**不得新增必填参数** |
176
+ | 载荷 | edit-turn 不传文本;未知字段必须被忽略而不是 400 |
177
+ | 错误码 | `not-rerunnable` / `already-retired` / `busy` / `rerunning` / `stale` / `session-not-found` / `session-not-active` / `invalid` 机读且稳定(edit-turn 原样提示给用户) |
178
+ | 链式解析 | `planRerun` 继续跟随就地替换链取活文本 |
179
+
180
+ **给改这两个包的 agent**:动路由、`planRerun` 或错误码之前,先在 `dsh-rerun-turn` 跑
181
+ `node --test test/contract.test.js`;把探测状态的 400 改成 404 会让 2 例转红,给 `/apply` 加一个必填
182
+ `confirmToken` 会让 5 例转红 —— 破坏契约会在本地就暴露,而不是等用户发现按钮点不动。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-as-aistudio",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Google-AI-Studio-style turn controls for DeepSeek Harness, in one install: edit a prompt and re-run it, re-run a reply in place, delete a turn from the model context, and render sent prompts as Markdown. Each of the four components is an independent plugin that also works alone, and any subset of them coexists; this package composes them, enables the rows that mount them, and reports which ones are live in Settings -> Plugins -> AI Studio.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/client.js CHANGED
@@ -36,7 +36,7 @@ window.__ModuleLoader__.load({
36
36
  const NS = 'dsh-as-aistudio'
37
37
 
38
38
  /** Keep in sync with package.json and src/components.js. */
39
- const PLUGIN_VERSION = '0.1.0'
39
+ const PLUGIN_VERSION = '0.1.1'
40
40
 
41
41
  /** Presence marker the live verifier reads. */
42
42
  const DEBUG_KEY = '__DSH_AS_AISTUDIO__'
package/src/components.js CHANGED
@@ -19,7 +19,7 @@
19
19
  export const STUDIO_ID = 'dsh-as-aistudio'
20
20
 
21
21
  /** Keep in sync with package.json and src/client.js. */
22
- export const STUDIO_VERSION = '0.1.0'
22
+ export const STUDIO_VERSION = '0.1.1'
23
23
 
24
24
  /**
25
25
  * The AI Studio action strip this studio composes, in the order the user meets