dsh-mnemon-source-documents 0.5.4 → 0.5.6

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
@@ -19,6 +19,12 @@ Choose an existing data authority deliberately. Without `dataDir`, each stable S
19
19
 
20
20
  Manual management can create a document without a model, but it still needs a workspace in the request scope. Standalone archiving retains content locally; cross-Source LLM distillation is an optional Host workflow.
21
21
 
22
+ ## Create-only Action / 仅创建操作
23
+
24
+ The `create` Action accepts `title`, `content`, and optional `description`, `sourcePaths`, and `sessionIds`. It always creates a separate document, rejects mutation selectors such as `action` or `id`, and fails at capacity without updating or archiving existing documents. The existing `manage` Action remains available for create/update workflows. Mnemon idle review receives only the create-only document tool and skips already-covered candidates. No document format migration is required.
25
+
26
+ `create` Action 接收 `title`、`content`,以及可选的 `description`、`sourcePaths`、`sessionIds`。它始终新建独立档案,拒绝 `action`、`id` 等 mutation 选择字段;容量不足时失败,不更新或归档已有档案。原有 `manage` Action 继续支持创建和更新。Mnemon 后台审查只获得仅创建档案工具,已有内容覆盖候选时跳过。本变更无需迁移档案格式。
27
+
22
28
  ## Source-owned UI and tests
23
29
 
24
30
  The optional `./client` entry is an ordinary DSH Client plugin. This package owns its pages and `presentation/` resources and uses `dsh-mnemon/client` for the shared frame and scoped management client. It never receives a Host Context, credentials or another Source's controller.
package/lib/client.js CHANGED
@@ -86,7 +86,7 @@ window.__ModuleLoader__.load({
86
86
  "documents.size": "文件大小",
87
87
  "documents.archiveReceipt": "Mnemon 冷索引回执",
88
88
  "documents.archiveTitle": "迁入归档",
89
- "documents.archiveDescription": "先由受限的独立任务 Agent 写入可检索的 Mnemon 摘要和精确路径,成功后才移动原文。",
89
+ "documents.archiveDescription": "独立任务 Agent 先拟定摘要和目标空间;Host 校验后写入冷索引,再移动原文。需要已启用且支持精确写入与删除的记忆空间。",
90
90
  "documents.archive": "归档",
91
91
  "documents.archiveConfirm": "确认建立 Mnemon 索引并迁移这份档案?",
92
92
  "documents.archiving": "索引并迁移中…",
@@ -148,7 +148,7 @@ window.__ModuleLoader__.load({
148
148
  "documents.size": "File size",
149
149
  "documents.archiveReceipt": "Mnemon cold-index receipt",
150
150
  "documents.archiveTitle": "Move to archive",
151
- "documents.archiveDescription": "A restricted independent task Agent first stores a searchable Mnemon summary and exact path. The original moves only after that succeeds.",
151
+ "documents.archiveDescription": "An independent task Agent proposes a summary and destination. The Host validates and writes the cold index before moving the original. An active Memory Space with exact writes and safe deletion is required.",
152
152
  "documents.archive": "Archive",
153
153
  "documents.archiveConfirm": "Create the Mnemon index and archive this document?",
154
154
  "documents.archiving": "Indexing and moving…",
@@ -1198,7 +1198,7 @@ window.__ModuleLoader__.load({
1198
1198
  setVisibleLimit(pageSize);
1199
1199
  try {
1200
1200
  const current = await props.client.documents();
1201
- const filtered = (nextQuery.trim() === "" ? current.documents : (await props.client.searchDocuments(nextQuery, nextStatus === "archived")).results).filter((record) => record.status === nextStatus);
1201
+ const filtered = (nextQuery.trim() === "" ? current.documents : (await props.client.searchDocuments(nextQuery, nextStatus === "archived")).results).filter((record) => record.status === nextStatus).sort((left, right) => Date.parse(right.createdAt) - Date.parse(left.createdAt));
1202
1202
  if (!displayRequests.isCurrent(request)) return;
1203
1203
  setSnapshot(current);
1204
1204
  setItems(filtered);
@@ -1544,8 +1544,8 @@ window.__ModuleLoader__.load({
1544
1544
  onClick: () => selectDocument(document.id),
1545
1545
  children: [
1546
1546
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: document.title }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("time", {
1547
- dateTime: document.updatedAt,
1548
- children: new Date(document.updatedAt).toLocaleDateString(locale)
1547
+ dateTime: document.createdAt,
1548
+ children: new Date(document.createdAt).toLocaleDateString(locale)
1549
1549
  })] }),
1550
1550
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: document.description || document.excerpt || t("documents.noDescription") }),
1551
1551
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("footer", { children: [
package/lib/index.js CHANGED
@@ -686,6 +686,21 @@ function grantIds(grant, includeArchived = false) {
686
686
  const value = memoryInputRecord(grant.value, "Documents ReadGrant");
687
687
  return [...memoryInputStringArray(value.documentIds, "documentIds", 1e4) ?? [], ...includeArchived ? memoryInputStringArray(value.archivedDocumentIds, "archivedDocumentIds", 1e4) ?? [] : []];
688
688
  }
689
+ const CREATE_PROPERTIES = {
690
+ title: { type: "string" },
691
+ description: { type: "string" },
692
+ content: { type: "string" },
693
+ sourcePaths: { type: "array" },
694
+ sessionIds: { type: "array" }
695
+ };
696
+ function documentCreation(value) {
697
+ const input = memoryInputRecord(value, "Documents create");
698
+ for (const key of Object.keys(input)) if (!Object.hasOwn(CREATE_PROPERTIES, key)) throw new Error("unsupported Documents create field: " + key);
699
+ return documentMutation({
700
+ ...input,
701
+ action: "create"
702
+ });
703
+ }
689
704
  function documentMutation(value, allowedIds) {
690
705
  const input = memoryInputRecord(value, "Documents mutation");
691
706
  const action = memoryInputText(input.action, "action", 20);
@@ -762,13 +777,19 @@ function createDocumentsMemorySource(config = {}) {
762
777
  enum: ["create", "update"]
763
778
  },
764
779
  id: { type: "string" },
765
- title: { type: "string" },
766
- description: { type: "string" },
767
- content: { type: "string" },
768
- sourcePaths: { type: "array" },
769
- sessionIds: { type: "array" }
780
+ ...CREATE_PROPERTIES
770
781
  }
771
782
  }
783
+ }, {
784
+ id: "create",
785
+ description: "Create one new project Document without updating or archiving existing documents. Capacity exhaustion rejects the write.",
786
+ capability: "write",
787
+ inputSchema: {
788
+ type: "object",
789
+ required: ["title", "content"],
790
+ additionalProperties: false,
791
+ properties: CREATE_PROPERTIES
792
+ }
772
793
  }],
773
794
  management: {
774
795
  label: "Project Documents",
@@ -811,7 +832,7 @@ function createDocumentsMemorySource(config = {}) {
811
832
  "write"
812
833
  ],
813
834
  routeIds: ["search"],
814
- actionIds: ["manage"]
835
+ actionIds: ["manage", "create"]
815
836
  };
816
837
  const current = snapshot(root);
817
838
  prepared.set(request.scope, current);
@@ -830,7 +851,7 @@ function createDocumentsMemorySource(config = {}) {
830
851
  "write"
831
852
  ],
832
853
  routeIds: ["search"],
833
- actionIds: ["manage"],
854
+ actionIds: ["manage", "create"],
834
855
  hints: { activeCount: active.length }
835
856
  };
836
857
  },
@@ -998,7 +1019,7 @@ function createDocumentsMemorySource(config = {}) {
998
1019
  const root = workspace(request.view.scope);
999
1020
  if (root === void 0) throw new Error("Documents Action requires a workspace-scoped View");
1000
1021
  const grant = request.grant;
1001
- const mutation = documentMutation(request.input, grant === void 0 ? [] : grantIds(grant));
1022
+ const mutation = request.offer.sourceActionId === "create" ? documentCreation(request.input) : documentMutation(request.input, grant === void 0 ? [] : grantIds(grant));
1002
1023
  const result = await documents.forWorkspace(root).mutate(mutation);
1003
1024
  return createMemoryMutationReceipt(request.view.id, request.offer.id, context.sourceInstanceKey, result.snapshot.revision, result, "committed");
1004
1025
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mnemon-source-documents",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "description": "Self-contained documents Source for Composable View Memory.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -57,19 +57,35 @@
57
57
  "react": "^18.2.0"
58
58
  },
59
59
  "devDependencies": {
60
- "@deepseek-ai/dsh-client-ui-primitives": "0.1.2-rc.1",
60
+ "@deepseek-ai/dsh-client-ui-primitives": "0.1.5-rc.1",
61
61
  "@testing-library/react": "^16.3.0",
62
62
  "@types/node": "^22.0.0",
63
63
  "@types/react": "^18.3.0",
64
64
  "@types/react-dom": "^18.3.0",
65
- "dsh-mnemon": "^0.5.4",
65
+ "dsh-mnemon": "^0.5.7",
66
66
  "jsdom": "^26.0.0",
67
67
  "react": "^18.2.0",
68
68
  "react-dom": "^18.2.0",
69
69
  "tsdown": "^0.22.0",
70
70
  "typescript": "^5.9.0",
71
71
  "vitest": "^3.2.0",
72
- "lightningcss": "^1.33.0"
72
+ "lightningcss": "^1.33.0",
73
+ "clsx": "^2.1.1",
74
+ "@shikijs/langs": "^4.3.1",
75
+ "anser": "^2.3.5",
76
+ "katex": "^0.16.47",
77
+ "mdast-util-from-markdown": "^2.0.3",
78
+ "mdast-util-gfm": "^3.1.0",
79
+ "mdast-util-math": "^3.0.0",
80
+ "micromark-core-commonmark": "^2.0.3",
81
+ "micromark-extension-gfm": "^3.0.0",
82
+ "micromark-extension-math": "^3.1.0",
83
+ "micromark-factory-space": "^2.0.1",
84
+ "micromark-util-character": "^2.1.1",
85
+ "micromark-util-classify-character": "^2.0.1",
86
+ "micromark-util-sanitize-uri": "^2.0.1",
87
+ "micromark-util-symbol": "^2.0.1",
88
+ "shiki": "^4.3.1"
73
89
  },
74
90
  "peerDependenciesMeta": {
75
91
  "react": {
@@ -54,7 +54,7 @@
54
54
  "documents.size": "文件大小",
55
55
  "documents.archiveReceipt": "Mnemon 冷索引回执",
56
56
  "documents.archiveTitle": "迁入归档",
57
- "documents.archiveDescription": "先由受限的独立任务 Agent 写入可检索的 Mnemon 摘要和精确路径,成功后才移动原文。",
57
+ "documents.archiveDescription": "独立任务 Agent 先拟定摘要和目标空间;Host 校验后写入冷索引,再移动原文。需要已启用且支持精确写入与删除的记忆空间。",
58
58
  "documents.archive": "归档",
59
59
  "documents.archiveConfirm": "确认建立 Mnemon 索引并迁移这份档案?",
60
60
  "documents.archiving": "索引并迁移中…",
@@ -116,7 +116,7 @@
116
116
  "documents.size": "File size",
117
117
  "documents.archiveReceipt": "Mnemon cold-index receipt",
118
118
  "documents.archiveTitle": "Move to archive",
119
- "documents.archiveDescription": "A restricted independent task Agent first stores a searchable Mnemon summary and exact path. The original moves only after that succeeds.",
119
+ "documents.archiveDescription": "An independent task Agent proposes a summary and destination. The Host validates and writes the cold index before moving the original. An active Memory Space with exact writes and safe deletion is required.",
120
120
  "documents.archive": "Archive",
121
121
  "documents.archiveConfirm": "Create the Mnemon index and archive this document?",
122
122
  "documents.archiving": "Indexing and moving…",