dsh-mnemon-source-runtime 0.5.16 → 0.5.18

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/client.js CHANGED
@@ -706,7 +706,7 @@ window.__ModuleLoader__.load({
706
706
  function runtimePageClient(management) {
707
707
  const client = (0, dsh_mnemon_client.createMemorySourcePageClient)(management);
708
708
  return {
709
- runtimeMemory: () => client.read("snapshot"),
709
+ runtimeMemory: () => client.read("snapshot", null, { coalesce: true }),
710
710
  mutateRuntimeMemory: (input) => client.canAssist("mutate") ? client.assist("mutate", {
711
711
  ...input,
712
712
  ...input.old_text === void 0 ? {} : { oldText: input.old_text }
package/lib/index.js CHANGED
@@ -3,10 +3,10 @@ import { createMemoryMutationReceipt, defineMemoryPlugin, defineMemorySource, in
3
3
  import { homedir } from "node:os";
4
4
  import { basename, isAbsolute, join } from "node:path";
5
5
  import z from "@deepseek-ai/schemastery";
6
+ import { createHash } from "node:crypto";
6
7
  import { COMPOSABLE_MEMORY_API_VERSION } from "dsh-mnemon/contracts";
7
8
  import { execFileSync } from "node:child_process";
8
9
  import { closeSync, constants, existsSync, lstatSync, mkdirSync, openSync, readFileSync, renameSync, rmSync, statSync, writeFileSync, writeSync } from "node:fs";
9
- import { createHash } from "node:crypto";
10
10
  //#region src/config.ts
11
11
  const Config = z.object({
12
12
  dataDir: z.string(),
@@ -829,7 +829,28 @@ function createRuntimeMemorySource(config = {}) {
829
829
  memory: effective.memoryLimitBytes,
830
830
  user: effective.userLimitBytes
831
831
  }, { effectiveDataDir: () => effective.userDataDir });
832
- const projection = (workspaceId) => controller.contextProjection(resolveGitBranch(workspaceId));
832
+ const digest = (value) => createHash("sha256").update(JSON.stringify(value)).digest("hex");
833
+ const projection = (workspaceId) => {
834
+ const branch = resolveGitBranch(workspaceId);
835
+ const current = controller.contextProjection(branch);
836
+ return {
837
+ ...current,
838
+ snapshot: {
839
+ version: 1,
840
+ scope: digest([
841
+ effective.dataDir,
842
+ effective.userDataDir,
843
+ branch ?? null
844
+ ]),
845
+ entries: current.entries.map((entry) => digest([
846
+ entry.target,
847
+ entry.content,
848
+ entry.importance,
849
+ entry.branches ?? []
850
+ ])).sort()
851
+ }
852
+ };
853
+ };
833
854
  const prepared = /* @__PURE__ */ new WeakMap();
834
855
  return {
835
856
  facts(request) {
@@ -876,7 +897,10 @@ function createRuntimeMemorySource(config = {}) {
876
897
  mode: request.mode,
877
898
  text: truncateMemoryText(current.text, request.maxCharacters),
878
899
  revision: current.revision,
879
- provenance: { sourceTypeId: "runtime" }
900
+ provenance: {
901
+ sourceTypeId: "runtime",
902
+ ...current.text.length <= request.maxCharacters ? { snapshot: current.snapshot } : {}
903
+ }
880
904
  }],
881
905
  presentation: {
882
906
  visibleItems: current.entries.length,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mnemon-source-runtime",
3
- "version": "0.5.16",
3
+ "version": "0.5.18",
4
4
  "description": "Self-contained runtime Source for Composable View Memory.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -55,12 +55,12 @@
55
55
  "react": "^18.2.0"
56
56
  },
57
57
  "devDependencies": {
58
- "@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.2",
58
+ "@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.5",
59
59
  "@testing-library/react": "^16.3.0",
60
60
  "@types/node": "^22.0.0",
61
61
  "@types/react": "^18.3.0",
62
62
  "@types/react-dom": "^18.3.0",
63
- "dsh-mnemon": "^0.5.35",
63
+ "dsh-mnemon": "^0.5.42",
64
64
  "jsdom": "^26.0.0",
65
65
  "react": "^18.2.0",
66
66
  "react-dom": "^18.2.0",
@@ -84,9 +84,9 @@
84
84
  "micromark-util-sanitize-uri": "^2.0.1",
85
85
  "micromark-util-symbol": "^2.0.1",
86
86
  "shiki": "^4.3.1",
87
- "@deepseek-ai/dsh-client-store": "0.2.1-rc.2",
88
- "@deepseek-ai/dsh-util-code-language": "0.2.1-rc.2",
89
- "@deepseek-ai/dsh-util-workspace-path": "0.2.1-rc.2",
87
+ "@deepseek-ai/dsh-client-store": "0.2.1-rc.5",
88
+ "@deepseek-ai/dsh-util-code-language": "0.2.1-rc.5",
89
+ "@deepseek-ai/dsh-util-workspace-path": "0.2.1-rc.5",
90
90
  "diff": "^9.0.0",
91
91
  "immer": "^10.1.1",
92
92
  "simple-icons": "16.31.0",