dsh-mnemon-source-documents 0.5.4 → 0.5.5
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 +6 -0
- package/lib/client.js +3 -3
- package/lib/index.js +29 -8
- package/package.json +2 -2
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
|
@@ -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.
|
|
1548
|
-
children: new Date(document.
|
|
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
|
-
|
|
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.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "Self-contained documents Source for Composable View Memory.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -62,7 +62,7 @@
|
|
|
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.
|
|
65
|
+
"dsh-mnemon": "^0.5.6",
|
|
66
66
|
"jsdom": "^26.0.0",
|
|
67
67
|
"react": "^18.2.0",
|
|
68
68
|
"react-dom": "^18.2.0",
|