@lynn123411/dsh-matt-plus 0.13.7 → 0.13.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/README.md CHANGED
@@ -24,7 +24,7 @@ Matt Plus:matt-skills 的 DSH 适配版技能,加上 grilling 轮的逐题
24
24
 
25
25
  **勾选与自填按会话保存**:按会话与 `callId` 存进 `localStorage`,刷新后恢复;用户把某题清空也算一条记录,不会被当成脏数据丢掉。
26
26
 
27
- **随包技能**:启用后,`grilling`、`implement-spec`、`code-review` 和手动调用的 `/retro` 都优先加载插件版本;插件页的「grilling 技能覆盖」开关只摘掉 grilling 那一份。停用插件则四份一起退场,恢复使用工作区里的同名技能。
27
+ **随包技能**:启用后,`grilling`、`implement-spec`、`code-review` 和手动调用的 `/retro` 都优先加载插件版本。关闭「grilling增强」后,`grilling` 回落到工作区或 preset 版本。停用插件则四份随包技能一起退场。
28
28
 
29
29
  与原生 `ask_user_question` 是两件事:原生那条在输入框上方接管作答面板,默认阻塞等答案,留给一次简单确认;本插件只负责 grilling 轮的逐题拷问。
30
30
 
@@ -44,31 +44,25 @@ dsh plugin --profile web add @lynn123411/dsh-matt-plus
44
44
 
45
45
  工具在**根层**:注册进全局层后,profile 里每一个 preset 的 agent 都看得见它(子 scope 继承全局层;preset 自己同名的行会盖过全局那条,所以不需要幂等补丁)。代价是「所有 preset 都看得见」——preset 若要在模型可见目录里没有它,只能自己用 `ctx.tools.restrict` 把工具从本 scope 的可见集合里滤掉(或改成注册时带 `when` 条件),工具本身照旧注册。
46
46
 
47
- 插件页的两个开关可以只关其中一件(工具、或 grilling 技能覆盖);停用整个插件才是工具、表单渲染、配置卡与四份随包技能一起退场。
47
+ 停用整个插件会同时移除工具、表单渲染、配置卡和四份随包技能。
48
48
 
49
49
  从改名前的 `@lynn123411/dsh-grilling-form` 换过来:先在装过它的 profile 里 `dsh plugin --profile <名字> remove @lynn123411/dsh-grilling-form`,再按上面的命令装本包。旧 profile patch 里若还留着当年手写的 `- id: tool-grilling-form` 行,删掉它:`dsh plugin remove` 只摘包与 `dsh.profile.bundles` 条目、不动 profile patch,那行会在卸载后变成悬空行,下次启动报 `failed to import` / `1 entry did not activate`,管理器的 `removeBundle` 还会因它仍活着而拒删(`bundle-in-use`)。浏览器侧记在 `dsh-grilling-form.<sessionId>` 下的勾选与自填仍读得出来,不需要手工搬。
50
50
 
51
51
  ## 配置
52
52
 
53
- 插件页 → 本插件详情页的配置卡有两个开关,拨动立即生效,不重载插件:
53
+ 插件详情页的「grilling增强」默认开启,拨动立即生效。关闭后模型看不到 `grilling_form`,`grilling` 技能回落到工作区或 preset 版本。已投出的表单仍可显示和作答,另外三个随包技能照常可用。
54
54
 
55
- | 字段 | 默认 | 关掉之后 |
56
- | --- | --- | --- |
57
- | `formTool` | 开 | 不再注册 `grilling_form`,模型目录里当场没有它;已经投出的表单照常显示与作答 |
58
- | `grillingSkill` | 开 | 不再覆盖 `grilling` 技能,回落到工作区或 preset 里那份;`implement-spec`、`code-review`、`retro` 三个照旧 |
59
-
60
- 同一对开关也可以写进 profile patch 的那一行;不写就是 schema 的默认 `true`:
55
+ 也可以在 profile patch 里设置 `grillingEnhanced`。
61
56
 
62
57
  ```yaml
63
58
  - insert:
64
59
  - id: dsh-matt-plus
65
60
  name: '@lynn123411/dsh-matt-plus'
66
61
  config:
67
- formTool: false
68
- grillingSkill: true
62
+ grillingEnhanced: false
69
63
  ```
70
64
 
71
- 两个键由本行的 `Config` schema(`src/config.ts`)声明,都是 `.volatile()` 字段;拼错键当场抛(`assertKnownConfig`),不会静默接受一个什么都不做的配置。配置卡注册在宿主插件页的 `plugins.bundle.config`(key 是包名),读写的是本行的命名空间 `dsh-matt-plus`,没有保存按钮。
65
+ 旧配置仍可读取。未设置 `grillingEnhanced` 时,旧的 `formTool` 或 `grillingSkill` 任一为 `false`,合并后的开关就视为关闭。显式设置 `grillingEnhanced` 后,以新值为准。
72
66
 
73
67
  表单本身的「可调项」全在工具入参里,由模型按每次拷问填:`questions` / `questions[].question`(必填)/ `questions[].detail` / `questions[].type` / `questions[].options` / `questions[].options[].label`(必填)/ `questions[].options[].description` / `replace`,输出 `{ ok, message }`。每条描述只说这个字段填什么——默认值、兜底与校验规则由插件自己办,不占模型的注意力。
74
68
 
@@ -82,7 +76,7 @@ dsh plugin --profile web add @lynn123411/dsh-matt-plus
82
76
 
83
77
  ### 配置与热切换
84
78
 
85
- 宿主半边在 `apply` 里读配置引用(`config.formTool.get()` / `config.grillingSkill.get()`),所以拨动开关不用重载插件。`loader/volatile-update` 带来这次变了哪些路径:碰 `formTool` 就注销或重新 `ctx.tools.register` 那条工具;碰 `grillingSkill` 就对每个 agent 那份 provider 调一次 `invalidate()`,技能目录缓存当场失效,下一次读取就是新答案(拨回开也一样)。两个开关的默认值都是 `true`。
79
+ `Config` 将开关声明为 `.volatile()`。收到相关的 `loader/volatile-update` 后,宿主同步工具注册,并对每个 agent 的技能 provider 调用 `invalidate()`,让下一次技能目录读取反映新值。配置卡通过 `configForms` 写入 `dsh-matt-plus` 的 `grillingEnhanced` 字段。
86
80
 
87
81
  `settings.configure({ auto: false })` 让宿主不要按 schema 另生成一页——本插件自己画的配置卡就是唯一的入口。缺 `settings` 服务时这层退化成不声明,配置卡因此不出现,但工具与技能照常按配置值工作。
88
82
 
@@ -142,7 +136,7 @@ dsh plugin --profile web add @lynn123411/dsh-matt-plus
142
136
 
143
137
  预设把工作区技能挂在 preset 层,插件在 `agent/created` 时把四个技能都注册到优先级更高的 agent 层。插件比 agent 晚挂上时,会通过 `agents.list()` 补注册。发送 `/retro` 后,DSH 在 agent 启动后按名称重新查找技能。当工作区也有 `retro` 时,刚打开的会话菜单可先显示工作区的说明,实际调用会加载随包版。
144
138
 
145
- `grillingSkill` 关掉后,那份 provider 不再列出 `grilling`,按名取也取不到它——工作区或 preset 的同名技能照常胜出;另外三个技能不受影响。开关只让目录缓存失效(`invalidate()`),不重建 agent 层那份注册,所以拨回开不需要重新挂载 agent。
139
+ 「grilling增强」关闭后,插件的 provider 从列表和按名查询中隐藏随包的 `grilling`。重新开启时,现有 agent 的技能目录恢复随包版本。
146
140
 
147
141
  缺少 `skills` 服务时,表单工具仍可用。agent 退出或插件停用时会撤销相应的技能注册,工作区版本随即恢复。
148
142
 
@@ -160,7 +154,6 @@ dsh plugin --profile web add @lynn123411/dsh-matt-plus
160
154
 
161
155
  投出后返回的那句说明告诉模型:表单已展示、答案会晚到、别把这次调用当成已回答、也别再把题目写一遍散文。
162
156
 
163
- `formTool` 关掉后这条工具连同它的自述一起从模型可见目录里消失;技能正文不在工具目录里,`grilling` 技能开关只影响技能目录。
164
157
 
165
158
  技能正文只讲方法论与问题措辞,工具用法的机械细节(字段语义、推荐约定、作答块的形态)全部以本工具自述为准——技能正文与工具自述的接缝一起验。「一轮只投一次表单、投出即结束」既是工具的运行时自述、也是技能方法论的一部分。
166
159
 
@@ -168,7 +161,6 @@ dsh plugin --profile web add @lynn123411/dsh-matt-plus
168
161
 
169
162
  - **表能露在过程折叠之外,靠的是 `conversation.chat.turnTail` 这个公开槽位**:核心包一改名单就可能失效。
170
163
  - **工具在全局层**:profile 里每个 preset 的 agent 都看得见它,收窄只能由 preset 自己 `restrict`。
171
- - **关掉工具不等于卸掉界面**:`formTool` 关掉后不再有新表单投出,但已经投出的表单仍按原样显示与作答;要连表单渲染一起停,停用整个插件。工具关掉而 grilling 技能还开着时,技能正文改走普通对话逐题提问(见 `skills/grilling/SKILL.md`)。
172
164
  - **改名不影响旧作答**:浏览器里 `dsh-grilling-form.<会话>` 下的记录只在读时兜底,写永远写新键;旧键不会自动清理。
173
165
  - **平台没有发送前的提交钩子**:导入与否不会被拦下或提示,发送权完全在原生输入框的发送键上。
174
166
  - **历史四位记号存在歧义**:撞号或事件窗口不完整时,四位记号的旧回复不会冻结表单。草稿中有四位记号的旧块时,重新导入会生成新块。
@@ -189,12 +181,12 @@ cd plugins/dsh-matt-plus && pnpm check
189
181
  - `test-form-model.mjs`:共用纯模型(题面取数与题号生成、漏写题型的兜底、题型照画出来的控件报、推荐标记剥掉、入参校验留下的三条与不再拒收的那几条、导入正文与空作答的块、块的就地替换、反解的题号认法与坏块、冻结那份与退回本地那份、推荐默认与单选收敛、按轮次定位本轮那次调用、PTC 子调用的记号取号、取代时搬的两件、闸门折叠与投影单元的收口、按会话持久化与脏数据清理)。
190
182
  - `test-form-session.mjs`:表单作答过程内壳的组合规则——推荐默认只叠在显示层、不落进 storage;勾选写穿;单选覆盖上一个;取消默认后重建会话也不勾回来;拷问作答块的新增与原地替换;空作答照导成空块;草稿状态四种;冻结按实发消息重画;被取代的表一样不可填不可导。
191
183
  - `test-skill-provider.mjs` 检查四个技能的注册、各自的资源目录,以及 `implement-spec` 和 `retro` 的手动调用策略。
192
- - `smoke-host.mjs`:真 cordis `Context`、真 `ToolRuntime`、真会话投影、真技能注册表;假的只有执行上下文与会话。断言导出身份、工具名、字段面只剩八个、十一条描述里没有默认与兜底、执行立即返回 `ok: true` 并标记本轮结束、留下的三条违规各是一条 `ok: false` 且不标记结束、闸门三分支、PTC 模式的两条、转向消息与别的表的记号都不解闸、没挂投影服务时退化成不拦、包内 `cordis.patch.yml` 就是那条装配行且不带 `config`、技能覆盖的四条。配置那组断言两个开关的默认值、关掉后的注册面、拼错键当场抛,以及 `loader/volatile-update` 之后工具当场重新注册、技能目录当场换答案。
193
- - `test-render.mjs`:用真 react 静态渲染构建出来的三个注册项,检查已填题数、历史块不因截断快照误认、无法显示提示、表单与工具行的各态、导入及分叉动作;配置卡那几条断言两个开关反映配置值、拨一下把新值写回去、不可写时禁用、服务不了时只剩一行说明。
184
+ - `smoke-host.mjs`:使用真实宿主服务验证工具、会话投影和技能目录。配置测试覆盖默认行为、旧配置兼容、未知键报错,以及工具和技能覆盖随同一个开关热切换。
185
+ - `test-render.mjs`:用 React 静态渲染构建出来的三个注册项,检查表单各态、导入及分叉动作,以及配置卡的单开关读写、禁用和不可用提示。
194
186
  - `smoke-client.mjs`:按 Web shell 的方式加载构建出来的 `lib/client.js`,用带内核 inject 守卫的假上下文断言 `inject` 表、`conversation.chat.turnTail` 的列表注册、`tool.call.toolview` 的 keyed 注册、`plugins.bundle.config` 的 keyed 注册(key 是包名、`whileServed` 用的是插件命名空间)与字典,并守住 `dsg-*` class 名在 JSX 与 CSS 之间不单边漂移、配置卡颜色只取宿主 token、画出来的控件尺寸与对齐、原生勾选框只是被藏起来而不是被删掉、单选那条圈与 `corner-shape: round` 成对。
195
187
  - `assert-lib-untracked.mjs`:`lib/` 是构建镜像,`git ls-files lib` 必须为空。
196
188
 
197
- 浏览器里验收:打开插件页 → 本插件详情页,配置卡应出现在简介之下、行列表之上,两个开关都能拨、拨完不重载插件;关掉「提问表单工具」后模型目录里不再有 `grilling_form`,关掉「grilling 技能覆盖」后技能目录回到工作区那份,拨回来都当场恢复。再投出一张带三种题型的表单,它应出现在本轮尾部、不被「工作过程」折叠吞掉;推荐项默认勾上,取消后不会被勾回来;点「导入输入框」后原生输入框里出现带记号的作答块、按键变成「已导入」,按发送键后表单冻结、选项区压暗;再让模型带 `replace: true` 投一张新表,旧表应只剩一行「提问表单已被后面那张取代」。
189
+ 浏览器里验收时,打开本插件详情页。配置卡出现在简介与行列表之间。拨动「grilling增强」,检查工具和技能目录同步恢复或回落,并确认已投出的表单仍可作答。再投出一张带三种题型的表单,检查它显示在轮次尾部、推荐项默认勾选且可以取消、作答可以导入输入框。发送后表单冻结,选项区压暗。用 `replace: true` 投出新表时,尚未作答的旧表应显示「提问表单已被后面那张取代」。
198
190
 
199
191
  ## 上游
200
192
 
package/lib/client.js CHANGED
@@ -978,15 +978,20 @@ function OptionRow({ question, option, checked, locked, t, markdownLabels, onTog
978
978
  // src/client/Settings.tsx
979
979
  var import_react2 = require("react");
980
980
  var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
981
+
982
+ // src/grilling-settings.ts
983
+ var GRILLING_FIELD = "grillingEnhanced";
984
+ function grillingEnabled(value) {
985
+ const enhanced = value[GRILLING_FIELD];
986
+ return typeof enhanced === "boolean" ? enhanced : value.formTool !== false && value.grillingSkill !== false;
987
+ }
988
+
989
+ // src/client/Settings.tsx
981
990
  var import_jsx_runtime2 = require("react/jsx-runtime");
982
- var ROWS = [
983
- { key: "formTool", label: "card.tool", hint: "card.toolHint" },
984
- { key: "grillingSkill", label: "card.skill", hint: "card.skillHint" }
985
- ];
986
991
  function MattPlusCard({ t, form }) {
987
992
  const [snapshot, setSnapshot] = (0, import_react2.useState)(() => form.getSnapshot());
988
993
  const [failure, setFailure] = (0, import_react2.useState)(void 0);
989
- const [writing, setWriting] = (0, import_react2.useState)(() => /* @__PURE__ */ new Set());
994
+ const [writing, setWriting] = (0, import_react2.useState)(false);
990
995
  (0, import_react2.useEffect)(() => {
991
996
  const sync = () => {
992
997
  setSnapshot(form.getSnapshot());
@@ -999,43 +1004,37 @@ function MattPlusCard({ t, form }) {
999
1004
  }
1000
1005
  const value = snapshot.value ?? {};
1001
1006
  const readOnly = snapshot.status !== "ready" || snapshot.writable === false;
1002
- const settle = (key, message) => {
1003
- setWriting((current) => {
1004
- const next = new Set(current);
1005
- next.delete(key);
1006
- return next;
1007
- });
1007
+ const settle = (message) => {
1008
+ setWriting(false);
1008
1009
  setFailure(message);
1009
1010
  };
1010
- const write = (key, next) => {
1011
- setWriting((current) => new Set(current).add(key));
1012
- form.set(key, next).then(
1011
+ const write = (next) => {
1012
+ setWriting(true);
1013
+ form.set(GRILLING_FIELD, next).then(
1013
1014
  (saved) => {
1014
- settle(key, saved ? void 0 : t("card.writeFailed"));
1015
+ settle(saved ? void 0 : t("card.writeFailed"));
1015
1016
  },
1016
1017
  () => {
1017
- settle(key, t("card.writeFailed"));
1018
+ settle(t("card.writeFailed"));
1018
1019
  }
1019
1020
  );
1020
1021
  };
1021
1022
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dsg-settings", children: [
1022
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsg-settingsRows", children: ROWS.map((row) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dsg-settingsRow", children: [
1023
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsg-settingsRows", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dsg-settingsRow", children: [
1023
1024
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dsg-settingsInfo", children: [
1024
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsg-settingsTitle", children: t(row.label) }),
1025
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsg-settingsHint", children: t(row.hint) })
1025
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsg-settingsTitle", children: t("card.grilling") }),
1026
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsg-settingsHint", children: t("card.grillingHint") })
1026
1027
  ] }),
1027
1028
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsg-settingsField", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1028
1029
  import_dsh_client_ui_primitives2.Switch,
1029
1030
  {
1030
- label: t(row.label),
1031
- checked: value[row.key] !== false,
1032
- disabled: readOnly || writing.has(row.key),
1033
- onChange: (next) => {
1034
- write(row.key, next);
1035
- }
1031
+ label: t("card.grilling"),
1032
+ checked: grillingEnabled(value),
1033
+ disabled: readOnly || writing,
1034
+ onChange: write
1036
1035
  }
1037
1036
  ) })
1038
- ] }, row.key)) }),
1037
+ ] }) }),
1039
1038
  failure === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "dsg-settingsError", children: failure }),
1040
1039
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "dsg-settingsNote", children: t("card.note") })
1041
1040
  ] });
@@ -1070,10 +1069,8 @@ var zh = {
1070
1069
  "row.copyCode": "\u590D\u5236",
1071
1070
  "row.copiedCode": "\u5DF2\u590D\u5236",
1072
1071
  "row.footnotes": "\u811A\u6CE8",
1073
- "card.tool": "\u63D0\u95EE\u8868\u5355\u5DE5\u5177",
1074
- "card.toolHint": "\u5173\u95ED\u540E\u6A21\u578B\u770B\u4E0D\u5230 grilling_form\uFF1B\u5DF2\u7ECF\u6295\u51FA\u7684\u8868\u5355\u7167\u5E38\u663E\u793A\u4E0E\u4F5C\u7B54\u3002",
1075
- "card.skill": "grilling \u6280\u80FD\u8986\u76D6",
1076
- "card.skillHint": "\u5173\u95ED\u540E\u56DE\u843D\u5230\u5DE5\u4F5C\u533A\u6216 preset \u91CC\u7684 grilling \u6280\u80FD\uFF1Bimplement-spec\u3001code-review\u3001retro \u7167\u65E7\u3002",
1072
+ "card.grilling": "grilling\u589E\u5F3A",
1073
+ "card.grillingHint": "\u5173\u95ED\u540E\u505C\u7528\u63D0\u95EE\u8868\u5355\u5DE5\u5177\uFF0Cgrilling \u6280\u80FD\u56DE\u843D\u5230\u5DE5\u4F5C\u533A\u6216 preset \u7248\u672C\u3002\u5DF2\u6295\u51FA\u7684\u8868\u5355\u4ECD\u53EF\u4F5C\u7B54\u3002",
1077
1074
  "card.unavailable": "\u5F53\u524D profile \u4E0D\u63D0\u4F9B\u8FD9\u7EC4\u914D\u7F6E\u3002",
1078
1075
  "card.writeFailed": "\u6CA1\u6709\u5199\u5165\u8FD9\u4EFD\u914D\u7F6E\uFF0C\u5B83\u53EF\u80FD\u88AB\u66F4\u9AD8\u4E00\u5C42\u8986\u76D6\u4E86\u3002",
1079
1076
  "card.note": "\u62E8\u52A8\u7ACB\u5373\u751F\u6548\uFF0C\u4E0D\u9700\u8981\u91CD\u542F\u3002"
@@ -1099,10 +1096,8 @@ var en = {
1099
1096
  "row.copyCode": "Copy",
1100
1097
  "row.copiedCode": "Copied",
1101
1098
  "row.footnotes": "Footnotes",
1102
- "card.tool": "Question form tool",
1103
- "card.toolHint": "When off, the model no longer sees grilling_form; forms already shown keep displaying and accepting answers.",
1104
- "card.skill": "grilling skill override",
1105
- "card.skillHint": "When off, the grilling skill falls back to the workspace or preset copy; implement-spec, code-review, and retro stay.",
1099
+ "card.grilling": "Grilling enhancements",
1100
+ "card.grillingHint": "Turn off to disable the question form tool and use the workspace or preset grilling skill. Existing forms remain answerable.",
1106
1101
  "card.unavailable": "This profile does not serve this configuration.",
1107
1102
  "card.writeFailed": "The change was not saved; a higher configuration layer may override it.",
1108
1103
  "card.note": "Changes take effect immediately; no restart."