dsh-recall-plugin 2.4.15 → 2.5.0

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/lib/config.js CHANGED
@@ -45,6 +45,9 @@ const Config = Schema.object({
45
45
  refillDraft: withVolatile(Schema.boolean().default(true).description("\u64A4\u56DE\u540E\u628A\u88AB\u64A4\u56DE\u7684\u6D88\u606F\uFF08\u6587\u672C\u4E0E\u9644\u4EF6\uFF09\u56DE\u586B\u5230\u8F93\u5165\u6846")),
46
46
  snapshotEnabled: withVolatile(Schema.boolean().default(true).description("\u542F\u7528\u6D88\u606F\u5FEB\u7167\uFF08\u5173\u95ED\u540E\u4E0D\u518D\u65B0\u5EFA\uFF0C\u5DF2\u6709\u5FEB\u7167\u4ECD\u53EF\u64A4\u56DE\uFF09")),
47
47
  archiveOriginal: withVolatile(Schema.boolean().default(true).description("\u64A4\u56DE\u540E\u5F52\u6863\u539F\u4F1A\u8BDD\uFF08\u5173\u95ED\u540E\u539F\u4F1A\u8BDD\u4FDD\u7559\u5728\u5217\u8868\u4E2D\uFF09")),
48
+ // issue #26:编辑提交后自动发出改后的文本。关闭则退化为「只回填输入框」,
49
+ // 给「只想改稿、不立刻发」的用户留一条与撤回回填一致的出口
50
+ editSubmitsImmediately: withVolatile(Schema.boolean().default(true).description("\u300C\u7F16\u8F91\u5E76\u91CD\u53D1\u300D\u63D0\u4EA4\u540E\u81EA\u52A8\u53D1\u51FA\u6539\u540E\u7684\u6D88\u606F\uFF08\u5173\u95ED\u5219\u53EA\u56DE\u586B\u8F93\u5165\u6846\uFF09")),
48
51
  retentionDays: withVolatile(Schema.number().default(0).description("\u6309\u5929\u6570\u4FDD\u7559\u5FEB\u7167\uFF0C\u8D85\u671F\u81EA\u52A8\u5220\u9664\uFF1B0 \u8868\u793A\u4E0D\u542F\u7528")),
49
52
  // A4:界面语言。union 三值而不是自由字符串——非法配置在加载时响亮失败
50
53
  //(合规清单 #3);description 保持中文是 v1 明示限制:它由宿主官方设置
@@ -131,6 +134,7 @@ const DEFAULTS = {
131
134
  refillDraft: true,
132
135
  snapshotEnabled: true,
133
136
  archiveOriginal: true,
137
+ editSubmitsImmediately: true,
134
138
  retentionDays: 0,
135
139
  locale: "auto"
136
140
  };
@@ -152,10 +156,11 @@ function createConfig(raw) {
152
156
  const refillDraft = typeof cfg.refillDraft === "boolean" ? cfg.refillDraft : true;
153
157
  const snapshotEnabled = typeof cfg.snapshotEnabled === "boolean" ? cfg.snapshotEnabled : true;
154
158
  const archiveOriginal = typeof cfg.archiveOriginal === "boolean" ? cfg.archiveOriginal : true;
159
+ const editSubmitsImmediately = cfg.editSubmitsImmediately !== false;
155
160
  const rawDays = typeof cfg.retentionDays === "number" ? cfg.retentionDays : parseInt(String(cfg.retentionDays == null ? "" : cfg.retentionDays), 10);
156
161
  const retentionDays = Number.isFinite(rawDays) ? Math.max(0, rawDays) : 0;
157
162
  const locale = cfg.locale === "zh" || cfg.locale === "en" ? cfg.locale : "auto";
158
- return { gcSnaps, gcHours, maxFileBytes, maxWorkspaceBytes, scanBudgetMs, maxSnapshotsPerWorkspace, baseExcludes, refillDraft, snapshotEnabled, archiveOriginal, retentionDays, locale };
163
+ return { gcSnaps, gcHours, maxFileBytes, maxWorkspaceBytes, scanBudgetMs, maxSnapshotsPerWorkspace, baseExcludes, refillDraft, snapshotEnabled, archiveOriginal, editSubmitsImmediately, retentionDays, locale };
159
164
  }
160
165
  export {
161
166
  Config,
@@ -25,7 +25,7 @@ function createRoutesCore(deps) {
25
25
  notice.buildRootNotice = buildRootNotice(artifactSeg);
26
26
  }
27
27
  }
28
- return { ok: Boolean(root), root: root || null, notice, config: { refillDraft: cfg.refillDraft, archiveOriginal: cfg.archiveOriginal, locale: cfg.locale } };
28
+ return { ok: Boolean(root), root: root || null, notice, config: { refillDraft: cfg.refillDraft, archiveOriginal: cfg.archiveOriginal, editSubmitsImmediately: cfg.editSubmitsImmediately, locale: cfg.locale } };
29
29
  },
30
30
  "snapshot-info": async (args) => {
31
31
  const id = args && args.messageId ? String(args.messageId) : "";
@@ -287,6 +287,7 @@ function createRoutesManage(deps) {
287
287
  refillDraft: cfg.refillDraft,
288
288
  snapshotEnabled: cfg.snapshotEnabled,
289
289
  archiveOriginal: cfg.archiveOriginal,
290
+ editSubmitsImmediately: cfg.editSubmitsImmediately,
290
291
  retentionDays: cfg.retentionDays,
291
292
  // A4:界面语言偏好随 values 下发(设置卡片据此渲染下拉并即时切语言)
292
293
  locale: cfg.locale
@@ -325,6 +326,7 @@ function createRoutesManage(deps) {
325
326
  if (patch.refillDraft !== void 0) clean.refillDraft = Boolean(patch.refillDraft);
326
327
  if (patch.snapshotEnabled !== void 0) clean.snapshotEnabled = Boolean(patch.snapshotEnabled);
327
328
  if (patch.archiveOriginal !== void 0) clean.archiveOriginal = Boolean(patch.archiveOriginal);
329
+ if (patch.editSubmitsImmediately !== void 0) clean.editSubmitsImmediately = Boolean(patch.editSubmitsImmediately);
328
330
  if (patch.retentionDays !== void 0) {
329
331
  const n = Number(patch.retentionDays);
330
332
  if (!Number.isFinite(n) || n < 0) return { ok: false, code: E.RECALL_BAD_TYPE, message: "\u4FDD\u7559\u5929\u6570\u5FC5\u987B\u662F >= 0 \u7684\u6570\u5B57\uFF080 \u8868\u793A\u4E0D\u542F\u7528\uFF09" };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-recall-plugin",
3
- "version": "2.4.15",
3
+ "version": "2.5.0",
4
4
  "description": "在 DSH 中撤回自己发过的消息:工作区文件与对话历史一起回到那条消息发出之前,消息的文本与附件自动放回输入框,改完即可重发。文件走独立影子 git 快照(不碰项目自身的 git),对话走官方 sessions.fork,原会话归档可找回。",
5
5
  "icon": "assets/icon.svg",
6
6
  "type": "module",