@shgroup/dsh-serenity-hooks 1.20.2 → 1.20.4

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/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-serenity-hooks",
3
- "version": "1.20.2",
3
+ "version": "1.20.4",
4
4
  "main": "lib/index.js",
5
5
  "description": "宁静号 ACC harness(Native Cordis 插件):真实 DSH 工具 cc_fs/session/acc_msm/eap/neat/cce/loop + 拦截缝机械约束(safe-mode/路径守卫)。适配 DSH 公开版(0.1.0-rc,deepseek-ai/deepseek-harness)。私有(dsh-external 组织)。",
6
6
  "engines": {
package/lib/client.js CHANGED
@@ -250,13 +250,14 @@ window.__ModuleLoader__.load({
250
250
  }
251
251
  //#endregion
252
252
  //#region src/client/ImageFallbackDock.tsx
253
- /** input.dock 条目:图片发送失败自动落盘 + 文本重发 */
253
+ /** input.dock 条目:图片发送失败自动落盘 + 文本重发(补救后自动清空输入框 rail 图片) */
254
254
  function ImageFallbackDock(props) {
255
255
  const zone = props;
256
256
  const session = zone.session;
257
257
  const input = zone.input;
258
258
  const sessionId = props.sessionId;
259
259
  const { uploadImage, getDraftFiles, resendText } = props;
260
+ const inputActions = props.inputActions;
260
261
  const [state, setState] = (0, react.useState)("idle");
261
262
  const [paths, setPaths] = (0, react.useState)([]);
262
263
  const [errorText, setErrorText] = (0, react.useState)(null);
@@ -278,7 +279,11 @@ window.__ModuleLoader__.load({
278
279
  const note = saved.map((p) => `用户提供了图片在 ${p}`).join("\n");
279
280
  const draft = input?.draft ?? "";
280
281
  const text = draft === "" ? note : `${draft}\n${note}`;
281
- await resendText(String(sessionId), text);
282
+ if (inputActions?.removeImage !== void 0 && inputActions.setDraft !== void 0 && inputActions.submit !== void 0) {
283
+ for (const id of imageIds) inputActions.removeImage(String(id));
284
+ inputActions.setDraft(text);
285
+ inputActions.submit();
286
+ } else await resendText(String(sessionId), text);
282
287
  setPaths(saved);
283
288
  setState("done");
284
289
  } catch (err) {
@@ -297,7 +302,8 @@ window.__ModuleLoader__.load({
297
302
  uploadImage,
298
303
  getDraftFiles,
299
304
  resendText,
300
- input?.draft
305
+ input?.draft,
306
+ inputActions
301
307
  ]);
302
308
  if (state === "idle") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
303
309
  className: "serenity-image-fallback",
@@ -368,11 +374,15 @@ window.__ModuleLoader__.load({
368
374
  if (conversation?.draftImages === void 0) return [];
369
375
  return (conversation.draftImages(ids) ?? []).map((a) => a.file);
370
376
  }
371
- /** 纯文本重发(绕过图片门禁——不含 image part,模型永不触发 MODEL_DOES_NOT_SUPPORT_IMAGES) */
377
+ /**
378
+ * 纯文本重发(绕过图片门禁——不含 image part,模型永不触发 MODEL_DOES_NOT_SUPPORT_IMAGES)。
379
+ * ⚠️ 必须作为方法调用(session.prompt(...)):解构取出再调会丢失 this
380
+ * (prompt 内部读 this.promptError → "Cannot set properties of undefined (setting 'promptError')")。
381
+ */
372
382
  async function resendText(ctx, sessionId, text) {
373
- const prompt = ctx.sessions.binding(sessionId)?.session?.prompt;
374
- if (prompt === void 0) throw new Error("serenity image fallback: session unavailable");
375
- const result = await prompt([{
383
+ const session = ctx.sessions.binding(sessionId)?.session;
384
+ if (session?.prompt === void 0) throw new Error("serenity image fallback: session unavailable");
385
+ const result = await session.prompt([{
376
386
  type: "text",
377
387
  text
378
388
  }], "queue");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shgroup/dsh-serenity-hooks",
3
- "version": "1.20.2",
3
+ "version": "1.20.4",
4
4
  "description": "宁静号 ACC harness — Native Cordis 插件(DeepSeek Harness 运行时)。真实 DSH 工具注册(cc_fs/session/acc_msm 等 9 工具)+ 拦截缝机械约束(safe-mode/路径守卫/会话落盘)+ 系统提示词注入(ACC/CCE/Constraints/SKILL/Session 五块)。适配 DSH 公开版(deepseek-ai/deepseek-harness 0.1.0-rc)。",
5
5
  "license": "MIT",
6
6
  "repository": {