@michengai/dsh-archive-manager 1.0.5 → 1.0.7

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.
@@ -29,6 +29,26 @@ function decodeRepairLog(bytes, compressed) {
29
29
  if (!text.endsWith("\n")) throw new Error("\u65E5\u5FD7\u672B\u5C3E\u4E0D\u5B8C\u6574\uFF0C\u4E0D\u80FD\u81EA\u52A8\u4FEE\u590D");
30
30
  return text.trimEnd().split("\n").map((line) => record(JSON.parse(line)));
31
31
  }
32
+ function pluginSource(plugin, extra = {}) {
33
+ return { kind: "plugin", plugin, ...extra };
34
+ }
35
+ function assertKnownHintShape(source, kind) {
36
+ if (Object.keys(source).some((key) => !["kind", "form"].includes(key)) || source.form !== "hint") throw new Error("\u65E7\u7248\u63D0\u793A\u6765\u6E90 " + kind + " \u5F62\u72B6\u672A\u77E5\uFF0C\u9700\u4EBA\u5DE5\u68C0\u67E5");
37
+ }
38
+ const LEGACY_SOURCE_RULES = [
39
+ { kind: "automation", convert: (source) => pluginSource("dsh-automation", { form: "notice", summary: JSON.stringify(source) }) },
40
+ // 早期工作区参考文档提示,现由 dsh-agent-instructions 承担。不保留 form:hint,v0 插件来源不接受该值。
41
+ { kind: "instruction-hint", convert: (source) => {
42
+ assertKnownHintShape(source, "instruction-hint");
43
+ return pluginSource("agent-instructions");
44
+ } },
45
+ // 早期会话工作约定已被宿主移除,只保留归属,正文不动。
46
+ { kind: "delivery-contract", convert: (source) => {
47
+ assertKnownHintShape(source, "delivery-contract");
48
+ return pluginSource("delivery-contract");
49
+ } }
50
+ ];
51
+ const LEGACY_SOURCE_RULES_BY_KIND = new Map(LEGACY_SOURCE_RULES.map((rule) => [rule.kind, rule]));
32
52
  function normalizeAutomationSources(input) {
33
53
  const rows = structuredClone(input);
34
54
  let count = 0;
@@ -38,11 +58,12 @@ function normalizeAutomationSources(input) {
38
58
  const candidate = message.source;
39
59
  if (!candidate || typeof candidate !== "object") return;
40
60
  const source = record(candidate);
41
- if (source?.kind !== "automation") return;
42
- if (Object.keys(source).some((key) => !["kind", "automationId", "runId", "scheduledFor"].includes(key)) || !["automationId", "runId", "scheduledFor"].every((key) => typeof source[key] === "string" && source[key].length > 0 && source[key].length < 512) || !Number.isFinite(Date.parse(String(source.scheduledFor)))) {
61
+ const rule = typeof source.kind === "string" ? LEGACY_SOURCE_RULES_BY_KIND.get(source.kind) : void 0;
62
+ if (!rule) return;
63
+ if (rule.kind === "automation" && (Object.keys(source).some((key) => !["kind", "automationId", "runId", "scheduledFor"].includes(key)) || !["automationId", "runId", "scheduledFor"].every((key) => typeof source[key] === "string" && source[key].length > 0 && source[key].length < 512) || !Number.isFinite(Date.parse(String(source.scheduledFor))))) {
43
64
  throw new Error("\u81EA\u52A8\u5316\u5F52\u5C5E\u4FE1\u606F\u4E0D\u5B8C\u6574\u6216\u5B58\u5728\u672A\u77E5\u5B57\u6BB5\uFF0C\u9700\u4EBA\u5DE5\u68C0\u67E5");
44
65
  }
45
- message.source = { kind: "plugin", plugin: "dsh-automation", form: "notice", summary: JSON.stringify(source) };
66
+ message.source = rule.convert(source);
46
67
  count++;
47
68
  };
48
69
  for (const row of rows.slice(1)) {
@@ -88,7 +109,7 @@ async function prepareAutomationRepair({ directory, target, sessionId, format })
88
109
  const rows = decodeRepairLog(bytes, source.endsWith(".zstd"));
89
110
  if (rows[0]?.type !== "session" || rows[0]?.version !== 0 || rows[0]?.id !== sessionId) throw new Error("\u65E5\u5FD7\u8EAB\u4EFD\u6216\u7248\u672C\u4E0D\u5339\u914D\uFF0C\u4E0D\u80FD\u81EA\u52A8\u4FEE\u590D");
90
111
  const normalized = normalizeAutomationSources(rows);
91
- if (!normalized.count) throw new Error("\u672A\u627E\u5230\u7B26\u5408\u4FEE\u590D\u89C4\u5219\u7684\u81EA\u52A8\u5316\u6765\u6E90");
112
+ if (!normalized.count) throw new Error("\u672A\u627E\u5230\u7B26\u5408\u4FEE\u590D\u89C4\u5219\u7684\u65E7\u7248\u6765\u6E90");
92
113
  const restore = format.createRestore(normalized.rows[0]);
93
114
  normalized.rows.slice(1).forEach((row) => restore.decodeRow(row));
94
115
  const artifact = restore.finish();
package/lib/workspace.js CHANGED
@@ -413,8 +413,8 @@ var ArchiveWorkspaceRegistry = class extends WorkspaceRegistry {
413
413
  repairable: true,
414
414
  token: plan.token,
415
415
  count: plan.count,
416
- reason: plan.correctingFrame ? "\u53D1\u73B0\u65E7\u7248\u4FEE\u590D\u7684\u538B\u7F29\u5E27\u95EE\u9898\uFF0C\u5DF2\u901A\u8FC7\u5BBF\u4E3B\u8BFB\u53D6\u6821\u9A8C" : `\u53D1\u73B0 ${plan.count} \u5904\u65E7\u81EA\u52A8\u5316\u6765\u6E90\uFF0C\u5DF2\u901A\u8FC7\u5BBF\u4E3B\u683C\u5F0F\u8F6C\u6362\u6821\u9A8C`,
417
- advice: "\u5C06\u6765\u6E90\u8F6C\u6362\u4E3A dsh-automation \u63D2\u4EF6\u5F52\u5C5E\uFF0C\u4FDD\u7559\u4EFB\u52A1\u4FE1\u606F\u4E0E\u6B63\u6587\uFF0C\u751F\u6210\u65B0\u7248\u65E5\u5FD7\uFF1B\u65E7\u65E5\u5FD7\u539F\u6837\u4FDD\u7559\u3002\u8BF7\u786E\u4FDD\u5176\u4ED6 DSH \u8FDB\u7A0B\u672A\u6253\u5F00\u8BE5\u4F1A\u8BDD\u3002"
416
+ reason: plan.correctingFrame ? "\u53D1\u73B0\u65E7\u7248\u4FEE\u590D\u7684\u538B\u7F29\u5E27\u95EE\u9898\uFF0C\u5DF2\u901A\u8FC7\u5BBF\u4E3B\u8BFB\u53D6\u6821\u9A8C" : `\u53D1\u73B0 ${plan.count} \u5904\u65E7\u7248\u6765\u6E90\uFF0C\u5DF2\u901A\u8FC7\u5BBF\u4E3B\u683C\u5F0F\u8F6C\u6362\u6821\u9A8C`,
417
+ advice: "\u5C06\u6765\u6E90\u6539\u5199\u4E3A\u5BBF\u4E3B\u652F\u6301\u7684\u63D2\u4EF6\u5F52\u5C5E\uFF0C\u4FDD\u7559\u6B63\u6587\uFF0C\u751F\u6210\u65B0\u7248\u65E5\u5FD7\uFF1B\u65E7\u65E5\u5FD7\u539F\u6837\u4FDD\u7559\u3002\u8BF7\u786E\u4FDD\u5176\u4ED6 DSH \u8FDB\u7A0B\u672A\u6253\u5F00\u8BE5\u4F1A\u8BDD\u3002"
418
418
  };
419
419
  } catch (error) {
420
420
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michengai/dsh-archive-manager",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "NPM-installable DSH Web plugin for managing archived sessions.",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@11.22.0",
@@ -40,23 +40,23 @@
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@deepseek-ai/cordis": "^4.0.1",
43
- "@deepseek-ai/dsh-client-connection": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
44
- "@deepseek-ai/dsh-client-locale": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
45
- "@deepseek-ai/dsh-client-runtime": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
46
- "@deepseek-ai/dsh-client-store": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
47
- "@deepseek-ai/dsh-client-ui-conversation": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
48
- "@deepseek-ai/dsh-client-ui-primitives": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
49
- "@deepseek-ai/dsh-client-ui-sidebar": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
50
- "@deepseek-ai/dsh-client-ui-workspace": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
51
- "@deepseek-ai/dsh-host-webserver": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
52
- "@deepseek-ai/dsh-session": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
53
- "@deepseek-ai/dsh-session-format-catalog": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
54
- "@deepseek-ai/dsh-session-projection-cache": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
55
- "@deepseek-ai/dsh-spill-local": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
56
- "@deepseek-ai/dsh-storage-domain": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
57
- "@deepseek-ai/dsh-typert-protocol": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
58
- "@deepseek-ai/dsh-typert-registry": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
59
- "@deepseek-ai/dsh-workspace": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2"
43
+ "@deepseek-ai/dsh-client-connection": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1",
44
+ "@deepseek-ai/dsh-client-locale": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1",
45
+ "@deepseek-ai/dsh-client-runtime": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1",
46
+ "@deepseek-ai/dsh-client-store": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1",
47
+ "@deepseek-ai/dsh-client-ui-conversation": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1",
48
+ "@deepseek-ai/dsh-client-ui-primitives": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1",
49
+ "@deepseek-ai/dsh-client-ui-sidebar": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1",
50
+ "@deepseek-ai/dsh-client-ui-workspace": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1",
51
+ "@deepseek-ai/dsh-host-webserver": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1",
52
+ "@deepseek-ai/dsh-session": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1",
53
+ "@deepseek-ai/dsh-session-format-catalog": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1",
54
+ "@deepseek-ai/dsh-session-projection-cache": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1",
55
+ "@deepseek-ai/dsh-spill-local": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1",
56
+ "@deepseek-ai/dsh-storage-domain": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1",
57
+ "@deepseek-ai/dsh-typert-protocol": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1",
58
+ "@deepseek-ai/dsh-typert-registry": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1",
59
+ "@deepseek-ai/dsh-workspace": "0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1"
60
60
  },
61
61
  "peerDependenciesMeta": {
62
62
  "@deepseek-ai/dsh-client-runtime": {
@@ -71,31 +71,31 @@
71
71
  },
72
72
  "devDependencies": {
73
73
  "@deepseek-ai/cordis": "4.0.4",
74
- "@deepseek-ai/dsh-api-gateway": "0.1.7-rc.2",
75
- "@deepseek-ai/dsh-client-connection": "0.1.7-rc.2",
76
- "@deepseek-ai/dsh-client-locale": "0.1.7-rc.2",
77
- "@deepseek-ai/dsh-client-store": "0.1.7-rc.2",
78
- "@deepseek-ai/dsh-client-ui-conversation": "0.1.7-rc.2",
79
- "@deepseek-ai/dsh-client-ui-primitives": "0.1.7-rc.2",
80
- "@deepseek-ai/dsh-client-ui-renderer": "0.1.7-rc.2",
81
- "@deepseek-ai/dsh-client-ui-sidebar": "0.1.7-rc.2",
82
- "@deepseek-ai/dsh-client-ui-slots": "0.1.7-rc.2",
83
- "@deepseek-ai/dsh-client-ui-workspace": "0.1.7-rc.2",
84
- "@deepseek-ai/dsh-host-webserver": "0.1.7-rc.2",
85
- "@deepseek-ai/dsh-invariants": "0.1.7-rc.2",
86
- "@deepseek-ai/dsh-scope": "0.1.7-rc.2",
87
- "@deepseek-ai/dsh-session": "0.1.7-rc.2",
88
- "@deepseek-ai/dsh-session-format-catalog": "0.1.7-rc.2",
89
- "@deepseek-ai/dsh-session-persistence": "0.1.7-rc.2",
90
- "@deepseek-ai/dsh-session-projection": "0.1.7-rc.2",
91
- "@deepseek-ai/dsh-session-projection-cache": "0.1.7-rc.2",
92
- "@deepseek-ai/dsh-spill": "0.1.7-rc.2",
93
- "@deepseek-ai/dsh-spill-local": "0.1.7-rc.2",
94
- "@deepseek-ai/dsh-storage": "0.1.7-rc.2",
95
- "@deepseek-ai/dsh-storage-domain": "0.1.7-rc.2",
96
- "@deepseek-ai/dsh-typert-protocol": "0.1.7-rc.2",
97
- "@deepseek-ai/dsh-typert-registry": "0.1.7-rc.2",
98
- "@deepseek-ai/dsh-workspace": "0.1.7-rc.2",
74
+ "@deepseek-ai/dsh-api-gateway": "0.2.0-rc.1",
75
+ "@deepseek-ai/dsh-client-connection": "0.2.0-rc.1",
76
+ "@deepseek-ai/dsh-client-locale": "0.2.0-rc.1",
77
+ "@deepseek-ai/dsh-client-store": "0.2.0-rc.1",
78
+ "@deepseek-ai/dsh-client-ui-conversation": "0.2.0-rc.1",
79
+ "@deepseek-ai/dsh-client-ui-primitives": "0.2.0-rc.1",
80
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.0-rc.1",
81
+ "@deepseek-ai/dsh-client-ui-sidebar": "0.2.0-rc.1",
82
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.1",
83
+ "@deepseek-ai/dsh-client-ui-workspace": "0.2.0-rc.1",
84
+ "@deepseek-ai/dsh-host-webserver": "0.2.0-rc.1",
85
+ "@deepseek-ai/dsh-invariants": "0.2.0-rc.1",
86
+ "@deepseek-ai/dsh-scope": "0.2.0-rc.1",
87
+ "@deepseek-ai/dsh-session": "0.2.0-rc.1",
88
+ "@deepseek-ai/dsh-session-format-catalog": "0.2.0-rc.1",
89
+ "@deepseek-ai/dsh-session-persistence": "0.2.0-rc.1",
90
+ "@deepseek-ai/dsh-session-projection": "0.2.0-rc.1",
91
+ "@deepseek-ai/dsh-session-projection-cache": "0.2.0-rc.1",
92
+ "@deepseek-ai/dsh-spill": "0.2.0-rc.1",
93
+ "@deepseek-ai/dsh-spill-local": "0.2.0-rc.1",
94
+ "@deepseek-ai/dsh-storage": "0.2.0-rc.1",
95
+ "@deepseek-ai/dsh-storage-domain": "0.2.0-rc.1",
96
+ "@deepseek-ai/dsh-typert-protocol": "0.2.0-rc.1",
97
+ "@deepseek-ai/dsh-typert-registry": "0.2.0-rc.1",
98
+ "@deepseek-ai/dsh-workspace": "0.2.0-rc.1",
99
99
  "@types/node": "^22.20.4",
100
100
  "@types/react": "^18.3.31",
101
101
  "@types/react-dom": "^18.0.0",