dsh-mnemon-source-documents 0.5.11 → 0.5.13

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,20 @@ 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
+ ## Workspace ownership / 工作区归属
23
+
24
+ Conversation tools use the session workspace (`agent.session.header.cwd`) as the Documents request scope. A shell `cd`, a Source file path, or a delegated task's initial command directory does not rebind that session workspace. Ordinary DSH subagents inherit the parent session's workspace, and delegated memory work retains the parent's pinned workspace authority.
25
+
26
+ For example, a conversation opened in project A that delegates work with an initial command directory in project B still creates Documents in A's configured storage. To create a Document for B, start a conversation in B's DSH workspace, or select B in Memory System and use its manual Project Documents management. Check the selected workspace before writing; the command's current directory is not the destination selector.
27
+
28
+ `workspace` and `workspaces` storage modes isolate data by that workspace identity. `global` and `custom` may share the physical directory, but Documents operations still require a workspace. This documents the current behavior; it adds no `workspace` argument to the conversation tool and requires no migration.
29
+
30
+ 对话工具以会话工作区(`agent.session.header.cwd`)作为项目档案的请求范围。Shell 中的 `cd`、来源文件路径或委派任务执行命令时的初始目录,都不会重新绑定会话工作区。普通 DSH 子代理继承父会话工作区,委派记忆任务也保留父级固定 View 的工作区权限。
31
+
32
+ 例如,在项目 A 的会话中委派任务,即使命令初始目录设为项目 B,新建档案仍进入 A 对应的存储。要为 B 建档,请在 B 的 DSH 工作区新开会话,或在记忆系统中选择 B 后使用项目档案的手动管理。写入前核对所选工作区;命令当前目录不是档案目标选择器。
33
+
34
+ `workspace` 与 `workspaces` 按该工作区身份隔离数据;`global` 与 `custom` 可能共用物理目录,但档案操作仍要求工作区身份。本说明不增加对话工具的 `workspace` 参数,也不涉及数据迁移。
35
+
22
36
  ## Create-only Action / 仅创建操作
23
37
 
24
38
  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.
@@ -36,3 +50,9 @@ The optional `./client` entry is an ordinary DSH Client plugin. This package own
36
50
  From a source checkout, install the declared dependencies and run `pnpm verify` to check Host behavior, Source-backed page interactions and Host/browser artifacts. Unreleased SDK work consumes a packed `dsh-mnemon` peer, not repository aliases or copied root tests.
37
51
 
38
52
  [Plugin development](https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/en/development/extensions.md) · [中文指南](https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/zh-CN/development/extensions.md)
53
+
54
+ ## Editing a document created in the same execution
55
+
56
+ With dsh-mnemon 0.5.40 or later, an authorized `manage` Action can immediately update a document successfully created by `create` or `manage` in that same execution. The create-only Action itself still cannot update. This does not expand the pinned search/read grant or admit documents created by management, another workspace or another delegated execution, even when executions share the same View. Saved documents and indexes need no migration.
57
+
58
+ 使用 dsh-mnemon 0.5.40 及以后版本时,获准的 `manage` Action 可立即更新同一次执行中由 `create` 或 `manage` 成功新建的档案;仅创建 Action 本身仍不能更新。读取与检索范围保持固定,不接纳管理页面、其他工作区或其他委派执行新建的档案,即使执行共享同一个 View。已有档案与索引无需迁移。
package/lib/client.js CHANGED
@@ -1712,7 +1712,7 @@ window.__ModuleLoader__.load({
1712
1712
  function documentsPageClient(management) {
1713
1713
  const client = (0, dsh_mnemon_client.createMemorySourcePageClient)(management);
1714
1714
  return {
1715
- documents: () => client.read("snapshot"),
1715
+ documents: () => client.read("snapshot", null, { coalesce: true }),
1716
1716
  document: (id) => client.read("document", { id }),
1717
1717
  searchDocuments: (query, includeArchived = false, limit = 50) => client.read("search", {
1718
1718
  query,
package/lib/index.js CHANGED
@@ -761,7 +761,7 @@ function createDocumentsMemorySource(config = {}) {
761
761
  }],
762
762
  actions: [{
763
763
  id: "manage",
764
- description: "Create a project Document or update a Document pinned into this View.",
764
+ description: "Create a project Document, or update one pinned into this View or created in this execution.",
765
765
  capability: "write",
766
766
  inputSchema: {
767
767
  type: "object",
@@ -800,6 +800,7 @@ function createDocumentsMemorySource(config = {}) {
800
800
  const documents = new DocumentManager(effective.limitBytes, void 0, () => effective.dataDir);
801
801
  const snapshot = (workspaceId) => workspaceId === void 0 ? void 0 : documents.forWorkspace(workspaceId).catalog();
802
802
  const prepared = /* @__PURE__ */ new WeakMap();
803
+ const created = /* @__PURE__ */ new WeakMap();
803
804
  return {
804
805
  facts(request) {
805
806
  const root = workspace(request.scope);
@@ -1015,8 +1016,16 @@ function createDocumentsMemorySource(config = {}) {
1015
1016
  const root = workspace(request.view.scope);
1016
1017
  if (root === void 0) throw new Error("Documents Action requires a workspace-scoped View");
1017
1018
  const grant = request.grant;
1018
- const mutation = request.offer.sourceActionId === "create" ? documentCreation(request.input) : documentMutation(request.input, grant === void 0 ? [] : grantIds(grant));
1019
+ const mutation = request.offer.sourceActionId === "create" ? documentCreation(request.input) : documentMutation(request.input, [...grant === void 0 ? [] : grantIds(grant), ...created.get(request.view) ?? []]);
1019
1020
  const result = await documents.forWorkspace(root).mutate(mutation);
1021
+ if (mutation.action === "create") {
1022
+ let ids = created.get(request.view);
1023
+ if (ids === void 0) {
1024
+ ids = /* @__PURE__ */ new Set();
1025
+ created.set(request.view, ids);
1026
+ }
1027
+ ids.add(result.document.id);
1028
+ }
1020
1029
  return createMemoryMutationReceipt(request.view.id, request.offer.id, context.sourceInstanceKey, result.snapshot.revision, result, "committed");
1021
1030
  }
1022
1031
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mnemon-source-documents",
3
- "version": "0.5.11",
3
+ "version": "0.5.13",
4
4
  "description": "Self-contained documents Source for Composable View Memory.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -52,16 +52,16 @@
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@deepseek-ai/cordis": "^4.0.1",
55
- "dsh-mnemon": "^0.5.19",
55
+ "dsh-mnemon": "^0.5.40",
56
56
  "react": "^18.2.0"
57
57
  },
58
58
  "devDependencies": {
59
- "@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.2",
59
+ "@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.5",
60
60
  "@testing-library/react": "^16.3.0",
61
61
  "@types/node": "^22.0.0",
62
62
  "@types/react": "^18.3.0",
63
63
  "@types/react-dom": "^18.3.0",
64
- "dsh-mnemon": "^0.5.32",
64
+ "dsh-mnemon": "^0.5.40",
65
65
  "jsdom": "^26.0.0",
66
66
  "react": "^18.2.0",
67
67
  "react-dom": "^18.2.0",
@@ -85,9 +85,9 @@
85
85
  "micromark-util-sanitize-uri": "^2.0.1",
86
86
  "micromark-util-symbol": "^2.0.1",
87
87
  "shiki": "^4.3.1",
88
- "@deepseek-ai/dsh-client-store": "0.2.1-rc.2",
89
- "@deepseek-ai/dsh-util-code-language": "0.2.1-rc.2",
90
- "@deepseek-ai/dsh-util-workspace-path": "0.2.1-rc.2",
88
+ "@deepseek-ai/dsh-client-store": "0.2.1-rc.5",
89
+ "@deepseek-ai/dsh-util-code-language": "0.2.1-rc.5",
90
+ "@deepseek-ai/dsh-util-workspace-path": "0.2.1-rc.5",
91
91
  "diff": "^9.0.0",
92
92
  "immer": "^10.1.1",
93
93
  "simple-icons": "16.31.0",