dsh-mnemon 0.1.4 → 0.1.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 +19 -5
- package/README.zh-CN.md +19 -5
- package/cordis.patch.yml +3 -2
- package/lib/client.js +380 -348
- package/lib/index.js +203 -82
- package/lib/types/activity.d.ts +2 -18
- package/lib/types/channels.d.ts +1 -4
- package/lib/types/client/MnemonLogo.d.ts +0 -1
- package/lib/types/client/MnemonPackSection.d.ts +1 -2
- package/lib/types/client/MnemonSaveAction.d.ts +1 -2
- package/lib/types/client/MnemonSettingsCard.d.ts +1 -3
- package/lib/types/client/MnemonTurnTail.d.ts +1 -2
- package/lib/types/client/MnemonView.d.ts +1 -3
- package/lib/types/client/MnemonViewAppearance.d.ts +0 -1
- package/lib/types/client/anchor.d.ts +0 -1
- package/lib/types/client/api.d.ts +1 -9
- package/lib/types/client/dsh-compat.d.ts +0 -1
- package/lib/types/client/index.d.ts +0 -1
- package/lib/types/client/locales.d.ts +14 -1
- package/lib/types/client/settings.d.ts +1 -2
- package/lib/types/client/sidebar-entry.d.ts +0 -1
- package/lib/types/client/workspace-controller.d.ts +0 -1
- package/lib/types/client/workspace-mount.d.ts +1 -3
- package/lib/types/commands.d.ts +0 -1
- package/lib/types/config-values.d.ts +0 -1
- package/lib/types/config.d.ts +6 -80
- package/lib/types/contracts.d.ts +2 -60
- package/lib/types/documents.d.ts +2 -79
- package/lib/types/guidance.d.ts +0 -1
- package/lib/types/index.d.ts +0 -1
- package/lib/types/lifecycle.d.ts +3 -45
- package/lib/types/live-runtime.d.ts +0 -1
- package/lib/types/memory-bodies.d.ts +3 -20
- package/lib/types/pack.d.ts +2 -48
- package/lib/types/process.d.ts +0 -1
- package/lib/types/review-activity.d.ts +2 -16
- package/lib/types/rpc.d.ts +0 -1
- package/lib/types/runner.d.ts +22 -12
- package/lib/types/runtime-memory.d.ts +2 -59
- package/lib/types/service.d.ts +3 -149
- package/lib/types/settings.d.ts +1 -4
- package/lib/types/shared/contracts.d.ts +609 -0
- package/lib/types/storage-scope.d.ts +2 -29
- package/lib/types/subagent.d.ts +2 -15
- package/lib/types/tools.d.ts +0 -1
- package/lib/types/version-updates.d.ts +2 -26
- package/package.json +8 -7
- package/docs/README.md +0 -8
- package/docs/assets/diagrams/en/memory-system-flow.png +0 -0
- package/docs/assets/diagrams/en/project-architecture.svg +0 -182
- package/docs/assets/diagrams/zh-CN/memory-system-flow.png +0 -0
- package/docs/assets/diagrams/zh-CN/project-architecture.svg +0 -182
- package/docs/assets/media/dsh-mnemon-memory-system-demo-poster.jpg +0 -0
- package/docs/assets/media/dsh-mnemon-memory-system-demo.gif +0 -0
- package/docs/assets/media/dsh-mnemon-memory-system-demo.mp4 +0 -0
- package/docs/assets/screenshots/conversation-memory-jump.png +0 -0
- package/docs/assets/screenshots/conversation-save-dialog.png +0 -0
- package/docs/assets/screenshots/conversation-turn-memory.png +0 -0
- package/docs/assets/screenshots/document-create-dialog.png +0 -0
- package/docs/assets/screenshots/documents-markdown.png +0 -0
- package/docs/assets/screenshots/entities-context.png +0 -0
- package/docs/assets/screenshots/memory-content.png +0 -0
- package/docs/assets/screenshots/overview-memory-graph.png +0 -0
- package/docs/assets/screenshots/recall-agent-answer.png +0 -0
- package/docs/assets/screenshots/remember-dialog.png +0 -0
- package/docs/assets/screenshots/runtime-memory-add.png +0 -0
- package/docs/assets/screenshots/runtime-memory.png +0 -0
- package/docs/assets/screenshots/settings-memory-system.png +0 -0
- package/docs/assets/screenshots/status-overview.png +0 -0
- package/docs/assets/screenshots/version-check.png +0 -0
- package/docs/en/README.md +0 -48
- package/docs/en/architecture.md +0 -133
- package/docs/en/configuration.md +0 -223
- package/docs/en/development.md +0 -198
- package/docs/en/getting-started.md +0 -155
- package/docs/en/interfaces.md +0 -181
- package/docs/en/operations.md +0 -166
- package/docs/en/project-overview.md +0 -145
- package/docs/en/roadmap.md +0 -41
- package/docs/en/storage-model.md +0 -185
- package/docs/en/ui-guide.md +0 -156
- package/docs/en/workflows.md +0 -290
- package/docs/zh-CN/README.md +0 -48
- package/docs/zh-CN/architecture.md +0 -133
- package/docs/zh-CN/configuration.md +0 -223
- package/docs/zh-CN/development.md +0 -198
- package/docs/zh-CN/getting-started.md +0 -155
- package/docs/zh-CN/interfaces.md +0 -181
- package/docs/zh-CN/operations.md +0 -166
- package/docs/zh-CN/project-overview.md +0 -145
- package/docs/zh-CN/roadmap.md +0 -41
- package/docs/zh-CN/storage-model.md +0 -185
- package/docs/zh-CN/ui-guide.md +0 -160
- package/docs/zh-CN/workflows.md +0 -290
- package/lib/client.js.map +0 -1
- package/lib/types/activity.d.ts.map +0 -1
- package/lib/types/activity.js +0 -93
- package/lib/types/activity.js.map +0 -1
- package/lib/types/channels.d.ts.map +0 -1
- package/lib/types/channels.js +0 -4
- package/lib/types/channels.js.map +0 -1
- package/lib/types/client/MnemonLogo.d.ts.map +0 -1
- package/lib/types/client/MnemonLogo.js +0 -6
- package/lib/types/client/MnemonLogo.js.map +0 -1
- package/lib/types/client/MnemonPackSection.d.ts.map +0 -1
- package/lib/types/client/MnemonPackSection.js +0 -136
- package/lib/types/client/MnemonPackSection.js.map +0 -1
- package/lib/types/client/MnemonSaveAction.d.ts.map +0 -1
- package/lib/types/client/MnemonSaveAction.js +0 -90
- package/lib/types/client/MnemonSaveAction.js.map +0 -1
- package/lib/types/client/MnemonSettingsCard.d.ts.map +0 -1
- package/lib/types/client/MnemonSettingsCard.js +0 -155
- package/lib/types/client/MnemonSettingsCard.js.map +0 -1
- package/lib/types/client/MnemonTurnTail.d.ts.map +0 -1
- package/lib/types/client/MnemonTurnTail.js +0 -56
- package/lib/types/client/MnemonTurnTail.js.map +0 -1
- package/lib/types/client/MnemonView.d.ts.map +0 -1
- package/lib/types/client/MnemonView.js +0 -1585
- package/lib/types/client/MnemonView.js.map +0 -1
- package/lib/types/client/MnemonViewAppearance.d.ts.map +0 -1
- package/lib/types/client/MnemonViewAppearance.js +0 -67
- package/lib/types/client/MnemonViewAppearance.js.map +0 -1
- package/lib/types/client/anchor.d.ts.map +0 -1
- package/lib/types/client/anchor.js +0 -46
- package/lib/types/client/anchor.js.map +0 -1
- package/lib/types/client/api.d.ts.map +0 -1
- package/lib/types/client/api.js +0 -150
- package/lib/types/client/api.js.map +0 -1
- package/lib/types/client/dsh-compat.d.ts.map +0 -1
- package/lib/types/client/dsh-compat.js +0 -2
- package/lib/types/client/dsh-compat.js.map +0 -1
- package/lib/types/client/index.d.ts.map +0 -1
- package/lib/types/client/index.js +0 -161
- package/lib/types/client/index.js.map +0 -1
- package/lib/types/client/locales.d.ts.map +0 -1
- package/lib/types/client/locales.js +0 -1162
- package/lib/types/client/locales.js.map +0 -1
- package/lib/types/client/settings.d.ts.map +0 -1
- package/lib/types/client/settings.js +0 -70
- package/lib/types/client/settings.js.map +0 -1
- package/lib/types/client/sidebar-entry.d.ts.map +0 -1
- package/lib/types/client/sidebar-entry.js +0 -134
- package/lib/types/client/sidebar-entry.js.map +0 -1
- package/lib/types/client/workspace-controller.d.ts.map +0 -1
- package/lib/types/client/workspace-controller.js +0 -21
- package/lib/types/client/workspace-controller.js.map +0 -1
- package/lib/types/client/workspace-mount.d.ts.map +0 -1
- package/lib/types/client/workspace-mount.js +0 -138
- package/lib/types/client/workspace-mount.js.map +0 -1
- package/lib/types/commands.d.ts.map +0 -1
- package/lib/types/commands.js +0 -104
- package/lib/types/commands.js.map +0 -1
- package/lib/types/config-values.d.ts.map +0 -1
- package/lib/types/config-values.js +0 -4
- package/lib/types/config-values.js.map +0 -1
- package/lib/types/config.d.ts.map +0 -1
- package/lib/types/config.js +0 -127
- package/lib/types/config.js.map +0 -1
- package/lib/types/contracts.d.ts.map +0 -1
- package/lib/types/contracts.js +0 -2
- package/lib/types/contracts.js.map +0 -1
- package/lib/types/documents.d.ts.map +0 -1
- package/lib/types/documents.js +0 -495
- package/lib/types/documents.js.map +0 -1
- package/lib/types/guidance.d.ts.map +0 -1
- package/lib/types/guidance.js +0 -34
- package/lib/types/guidance.js.map +0 -1
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/index.js +0 -55
- package/lib/types/index.js.map +0 -1
- package/lib/types/lifecycle.d.ts.map +0 -1
- package/lib/types/lifecycle.js +0 -456
- package/lib/types/lifecycle.js.map +0 -1
- package/lib/types/live-runtime.d.ts.map +0 -1
- package/lib/types/live-runtime.js +0 -146
- package/lib/types/live-runtime.js.map +0 -1
- package/lib/types/memory-bodies.d.ts.map +0 -1
- package/lib/types/memory-bodies.js +0 -186
- package/lib/types/memory-bodies.js.map +0 -1
- package/lib/types/pack.d.ts.map +0 -1
- package/lib/types/pack.js +0 -709
- package/lib/types/pack.js.map +0 -1
- package/lib/types/process.d.ts.map +0 -1
- package/lib/types/process.js +0 -65
- package/lib/types/process.js.map +0 -1
- package/lib/types/review-activity.d.ts.map +0 -1
- package/lib/types/review-activity.js +0 -37
- package/lib/types/review-activity.js.map +0 -1
- package/lib/types/rpc.d.ts.map +0 -1
- package/lib/types/rpc.js +0 -384
- package/lib/types/rpc.js.map +0 -1
- package/lib/types/runner.d.ts.map +0 -1
- package/lib/types/runner.js +0 -155
- package/lib/types/runner.js.map +0 -1
- package/lib/types/runtime-memory.d.ts.map +0 -1
- package/lib/types/runtime-memory.js +0 -415
- package/lib/types/runtime-memory.js.map +0 -1
- package/lib/types/service.d.ts.map +0 -1
- package/lib/types/service.js +0 -512
- package/lib/types/service.js.map +0 -1
- package/lib/types/settings.d.ts.map +0 -1
- package/lib/types/settings.js +0 -103
- package/lib/types/settings.js.map +0 -1
- package/lib/types/storage-scope.d.ts.map +0 -1
- package/lib/types/storage-scope.js +0 -179
- package/lib/types/storage-scope.js.map +0 -1
- package/lib/types/subagent.d.ts.map +0 -1
- package/lib/types/subagent.js +0 -624
- package/lib/types/subagent.js.map +0 -1
- package/lib/types/tools.d.ts.map +0 -1
- package/lib/types/tools.js +0 -341
- package/lib/types/tools.js.map +0 -1
- package/lib/types/version-updates.d.ts.map +0 -1
- package/lib/types/version-updates.js +0 -377
- package/lib/types/version-updates.js.map +0 -1
package/lib/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import z from "schemastery";
|
|
2
|
-
import { basename, delimiter, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
2
|
+
import { basename, delimiter, dirname, isAbsolute, join, posix, relative, resolve, sep, win32 } from "node:path";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import { accessSync, closeSync, constants, existsSync, fstatSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { homedir, tmpdir } from "node:os";
|
|
6
6
|
import { strToU8, unzipSync, zipSync } from "fflate";
|
|
7
7
|
import { spawn } from "node:child_process";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
|
-
//#region
|
|
9
|
+
//#region src/config-values.ts
|
|
10
10
|
const DEFAULT_TIMEOUT_MS = 1e4;
|
|
11
11
|
const DEFAULT_IDLE_REVIEW_MS = 3e4;
|
|
12
12
|
//#endregion
|
|
13
|
-
//#region
|
|
13
|
+
//#region src/config.ts
|
|
14
14
|
const InteractionConfig = z.object({
|
|
15
15
|
turnBar: z.boolean().default(true),
|
|
16
16
|
saveAction: z.boolean().default(true)
|
|
@@ -132,7 +132,7 @@ function resolveConfig(config = {}) {
|
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
//#endregion
|
|
135
|
-
//#region
|
|
135
|
+
//#region src/commands.ts
|
|
136
136
|
function isAgentServiceSource(value) {
|
|
137
137
|
return "forAgent" in value && typeof value.forAgent === "function";
|
|
138
138
|
}
|
|
@@ -185,7 +185,8 @@ async function execute(serviceOrSource, coordinator, invocation) {
|
|
|
185
185
|
return {
|
|
186
186
|
kind: "success",
|
|
187
187
|
text: [
|
|
188
|
-
`Mnemon ${status.version ?? ""} ·
|
|
188
|
+
`Mnemon ${status.version ?? ""} · default=${status.mnemonDefaultStore}`.trim(),
|
|
189
|
+
`DSH 已激活: ${status.dshActiveStores.join(", ") || "none"}`,
|
|
189
190
|
`CLI: ${status.cliPath}`,
|
|
190
191
|
`数据目录: ${status.dataDir}`,
|
|
191
192
|
`有效记忆: ${stats?.totalInsights ?? 0} · 连接: ${stats?.edgeCount ?? 0} · 已删除: ${stats?.deletedInsights ?? 0}`,
|
|
@@ -783,7 +784,7 @@ var DocumentManager = class {
|
|
|
783
784
|
}
|
|
784
785
|
};
|
|
785
786
|
//#endregion
|
|
786
|
-
//#region
|
|
787
|
+
//#region src/guidance.ts
|
|
787
788
|
const GUIDANCE_SECTION_NAME = "mnemon:routing";
|
|
788
789
|
const RUNTIME_MEMORY_SECTION_NAME = "mnemon:runtime-memory";
|
|
789
790
|
const ROUTING_GUIDANCE = "Use memory only by need. For substantial project records, search active Mnemon Documents before deep recall. Call mnemon_recall when durable history may matter or an exact prior detail is missing; never infer a missing historical rule. New explicit reusable facts normally go to mnemon_runtime_memory. A write completes only with a tool receipt.";
|
|
@@ -1249,7 +1250,7 @@ IMPORTANT: USER.md and MEMORY.md above are always relevant when applicable. Foll
|
|
|
1249
1250
|
}
|
|
1250
1251
|
};
|
|
1251
1252
|
//#endregion
|
|
1252
|
-
//#region
|
|
1253
|
+
//#region src/pack.ts
|
|
1253
1254
|
const MNEMON_PACK_FORMAT = "mnemonpack";
|
|
1254
1255
|
const MNEMON_PACK_MIME = "application/zip";
|
|
1255
1256
|
const MAX_FILE_BYTES = 134217728;
|
|
@@ -1807,6 +1808,27 @@ function mergeRegistry(root, pack) {
|
|
|
1807
1808
|
}
|
|
1808
1809
|
return current;
|
|
1809
1810
|
}
|
|
1811
|
+
function persistedStore(root) {
|
|
1812
|
+
try {
|
|
1813
|
+
const value = readFileSync(join(root, "active"), "utf8").trim();
|
|
1814
|
+
if (BODY_ID.test(value)) return value;
|
|
1815
|
+
} catch {}
|
|
1816
|
+
return "default";
|
|
1817
|
+
}
|
|
1818
|
+
function reconcilePersistedStore(root) {
|
|
1819
|
+
const current = readCurrentRegistry(root).registry.bodies;
|
|
1820
|
+
const ids = new Set(current.map((body) => body.id));
|
|
1821
|
+
const selected = persistedStore(root);
|
|
1822
|
+
if (ids.has(selected)) return;
|
|
1823
|
+
const replacement = ids.has("default") ? "default" : current.filter((body) => body.active).map((body) => body.id).sort()[0] ?? [...ids].sort()[0] ?? "default";
|
|
1824
|
+
const temporary = join(root, `.active-${process.pid}-${randomUUID()}.tmp`);
|
|
1825
|
+
try {
|
|
1826
|
+
writeFileSync(temporary, `${replacement}\n`, { mode: 384 });
|
|
1827
|
+
renameSync(temporary, join(root, "active"));
|
|
1828
|
+
} finally {
|
|
1829
|
+
rmSync(temporary, { force: true });
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1810
1832
|
function stageImport(root, pack, components, mode) {
|
|
1811
1833
|
const staging = join(root, `.dsh-pack-stage-${randomUUID()}`);
|
|
1812
1834
|
mkdirSync(staging, {
|
|
@@ -1824,6 +1846,7 @@ function stageImport(root, pack, components, mode) {
|
|
|
1824
1846
|
}
|
|
1825
1847
|
if (components.includes("memory-spaces")) {
|
|
1826
1848
|
const memory = mode === "merge" ? mergeRegistry(root, pack) : archiveRegistry(pack);
|
|
1849
|
+
if (mode === "replace" && readCurrentRegistry(root).registry.bodies.length > 0 && memory.registry.bodies.length === 0) throw new Error("cannot replace the last Mnemon Store with an empty Memory Space set");
|
|
1827
1850
|
writeRegistry(join(staging, "data"), memory.registry, memory.databases);
|
|
1828
1851
|
}
|
|
1829
1852
|
return staging;
|
|
@@ -1843,6 +1866,8 @@ function commitStaging(root, staging, components) {
|
|
|
1843
1866
|
});
|
|
1844
1867
|
const committed = [];
|
|
1845
1868
|
const replacementLocks = components.flatMap((component) => component === "runtime" ? [join(staging, "runtime", ".memories.lock")] : component === "documents" ? [join(staging, "documents", ".index.lock")] : []);
|
|
1869
|
+
const activePath = join(root, "active");
|
|
1870
|
+
const previousActive = existsSync(activePath) ? readFileSync(activePath) : void 0;
|
|
1846
1871
|
try {
|
|
1847
1872
|
for (const lock of replacementLocks) writeFileSync(lock, "pack-import\n", { mode: 384 });
|
|
1848
1873
|
for (const component of components) {
|
|
@@ -1862,6 +1887,7 @@ function commitStaging(root, staging, components) {
|
|
|
1862
1887
|
hadPrevious
|
|
1863
1888
|
});
|
|
1864
1889
|
}
|
|
1890
|
+
if (components.includes("memory-spaces")) reconcilePersistedStore(root);
|
|
1865
1891
|
if (components.includes("runtime")) rmSync(join(root, "runtime", ".memories.lock"), { force: true });
|
|
1866
1892
|
if (components.includes("documents")) rmSync(join(root, "documents", ".index.lock"), { force: true });
|
|
1867
1893
|
} catch (error) {
|
|
@@ -1873,6 +1899,10 @@ function commitStaging(root, staging, components) {
|
|
|
1873
1899
|
});
|
|
1874
1900
|
if (entry.hadPrevious) renameSync(join(backup, entry.directory), target);
|
|
1875
1901
|
}
|
|
1902
|
+
if (components.includes("memory-spaces")) {
|
|
1903
|
+
if (previousActive === void 0) rmSync(activePath, { force: true });
|
|
1904
|
+
else writeFileSync(activePath, previousActive, { mode: 384 });
|
|
1905
|
+
}
|
|
1876
1906
|
throw error;
|
|
1877
1907
|
} finally {
|
|
1878
1908
|
rmSync(staging, {
|
|
@@ -2005,7 +2035,7 @@ var MnemonPackManager = class {
|
|
|
2005
2035
|
}
|
|
2006
2036
|
};
|
|
2007
2037
|
//#endregion
|
|
2008
|
-
//#region
|
|
2038
|
+
//#region src/process.ts
|
|
2009
2039
|
const DEFAULT_MAX_OUTPUT_BYTES = 2097152;
|
|
2010
2040
|
/** Spawn without a shell, with bounded output and cooperative cancellation. */
|
|
2011
2041
|
const runProcess = (command, args, options) => new Promise((resolve, reject) => {
|
|
@@ -2015,7 +2045,8 @@ const runProcess = (command, args, options) => new Promise((resolve, reject) =>
|
|
|
2015
2045
|
"pipe",
|
|
2016
2046
|
"pipe"
|
|
2017
2047
|
],
|
|
2018
|
-
shell: false
|
|
2048
|
+
shell: false,
|
|
2049
|
+
windowsHide: true
|
|
2019
2050
|
});
|
|
2020
2051
|
const maxOutputBytes = options.maxOutputBytes ?? DEFAULT_MAX_OUTPUT_BYTES;
|
|
2021
2052
|
let stdout = "";
|
|
@@ -2077,48 +2108,71 @@ const runProcess = (command, args, options) => new Promise((resolve, reject) =>
|
|
|
2077
2108
|
else options.signal?.addEventListener("abort", abort, { once: true });
|
|
2078
2109
|
});
|
|
2079
2110
|
//#endregion
|
|
2080
|
-
//#region
|
|
2081
|
-
const
|
|
2111
|
+
//#region src/runner.ts
|
|
2112
|
+
const UNIX_COMMON_CLI_PATHS = [
|
|
2082
2113
|
"~/.local/bin/mnemon",
|
|
2083
2114
|
"/opt/homebrew/bin/mnemon",
|
|
2084
2115
|
"/usr/local/bin/mnemon",
|
|
2085
2116
|
"/usr/bin/mnemon"
|
|
2086
2117
|
];
|
|
2087
|
-
function
|
|
2088
|
-
|
|
2089
|
-
|
|
2118
|
+
function pathApi(platform) {
|
|
2119
|
+
return platform === "win32" ? win32 : posix;
|
|
2120
|
+
}
|
|
2121
|
+
function expandHome$1(path, home = homedir(), platform = process.platform) {
|
|
2122
|
+
if (path === "~") return home;
|
|
2123
|
+
return path.startsWith("~/") || path.startsWith("~\\") ? pathApi(platform).join(home, path.slice(2)) : path;
|
|
2124
|
+
}
|
|
2125
|
+
function envValue(env, name, platform) {
|
|
2126
|
+
if (platform !== "win32") return env[name];
|
|
2127
|
+
const key = Object.keys(env).find((candidate) => candidate.toLowerCase() === name.toLowerCase());
|
|
2128
|
+
return key === void 0 ? void 0 : env[key];
|
|
2090
2129
|
}
|
|
2091
|
-
function executable$1(path) {
|
|
2130
|
+
function executable$1(path, platform = process.platform) {
|
|
2131
|
+
if (platform === "win32" && win32.extname(path).toLowerCase() !== ".exe") return false;
|
|
2092
2132
|
try {
|
|
2093
|
-
accessSync(path, constants.X_OK);
|
|
2094
|
-
return
|
|
2133
|
+
accessSync(path, platform === "win32" ? constants.F_OK : constants.X_OK);
|
|
2134
|
+
return statSync(path).isFile();
|
|
2095
2135
|
} catch {
|
|
2096
2136
|
return false;
|
|
2097
2137
|
}
|
|
2098
2138
|
}
|
|
2139
|
+
function windowsCommonCliPaths(env, home) {
|
|
2140
|
+
const candidates = [];
|
|
2141
|
+
const goBin = envValue(env, "GOBIN", "win32")?.trim();
|
|
2142
|
+
if (goBin !== void 0 && win32.isAbsolute(goBin)) candidates.push(win32.join(goBin, "mnemon.exe"));
|
|
2143
|
+
const goInstallRoot = (envValue(env, "GOPATH", "win32")?.trim())?.split(win32.delimiter).map((candidate) => candidate.trim()).find((candidate) => candidate !== "" && win32.isAbsolute(candidate)) ?? win32.join(home, "go");
|
|
2144
|
+
candidates.push(win32.join(goInstallRoot, "bin", "mnemon.exe"));
|
|
2145
|
+
const localAppData = envValue(env, "LOCALAPPDATA", "win32")?.trim();
|
|
2146
|
+
if (localAppData !== void 0 && win32.isAbsolute(localAppData)) candidates.push(win32.join(localAppData, "Programs", "mnemon", "mnemon.exe"));
|
|
2147
|
+
const programFiles = envValue(env, "ProgramFiles", "win32")?.trim();
|
|
2148
|
+
if (programFiles !== void 0 && win32.isAbsolute(programFiles)) candidates.push(win32.join(programFiles, "mnemon", "mnemon.exe"));
|
|
2149
|
+
return [...new Set(candidates)];
|
|
2150
|
+
}
|
|
2151
|
+
function commonCliPaths(platform, env, home) {
|
|
2152
|
+
if (platform === "win32") return windowsCommonCliPaths(env, home);
|
|
2153
|
+
return UNIX_COMMON_CLI_PATHS.map((candidate) => expandHome$1(candidate, home, platform));
|
|
2154
|
+
}
|
|
2099
2155
|
/** Locate the local Mnemon binary without invoking a shell. */
|
|
2100
|
-
function findMnemonCommand(config) {
|
|
2101
|
-
|
|
2102
|
-
const
|
|
2156
|
+
function findMnemonCommand(config, options = {}) {
|
|
2157
|
+
const platform = options.platform ?? process.platform;
|
|
2158
|
+
const env = options.env ?? process.env;
|
|
2159
|
+
const home = options.home ?? homedir();
|
|
2160
|
+
const isExecutable = options.isExecutable ?? ((path) => executable$1(path, platform));
|
|
2161
|
+
if (config.cliPath !== void 0) return expandHome$1(config.cliPath, home, platform);
|
|
2162
|
+
const envPath = envValue(env, "MNEMON_CLI_PATH", platform)?.trim();
|
|
2103
2163
|
if (envPath !== void 0 && envPath !== "") {
|
|
2104
|
-
const path = expandHome$1(envPath);
|
|
2105
|
-
if (
|
|
2164
|
+
const path = expandHome$1(envPath, home, platform);
|
|
2165
|
+
if (isExecutable(path)) return path;
|
|
2106
2166
|
}
|
|
2107
|
-
|
|
2167
|
+
const paths = pathApi(platform);
|
|
2168
|
+
for (const directory of (envValue(env, "PATH", platform) ?? "").split(paths.delimiter)) {
|
|
2108
2169
|
if (directory === "") continue;
|
|
2109
|
-
for (const name of
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
"mnemon"
|
|
2113
|
-
] : ["mnemon"]) {
|
|
2114
|
-
const path = join(directory, name);
|
|
2115
|
-
if (executable$1(path)) return path;
|
|
2170
|
+
for (const name of platform === "win32" ? ["mnemon.exe"] : ["mnemon"]) {
|
|
2171
|
+
const path = paths.join(directory, name);
|
|
2172
|
+
if (isExecutable(path)) return path;
|
|
2116
2173
|
}
|
|
2117
2174
|
}
|
|
2118
|
-
for (const
|
|
2119
|
-
const path = expandHome$1(candidate);
|
|
2120
|
-
if (executable$1(path)) return path;
|
|
2121
|
-
}
|
|
2175
|
+
for (const path of commonCliPaths(platform, env, home)) if (isExecutable(path)) return path;
|
|
2122
2176
|
}
|
|
2123
2177
|
var MnemonCliError = class extends Error {
|
|
2124
2178
|
exitCode;
|
|
@@ -2146,6 +2200,14 @@ function createRunner(config, processRunner = runProcess, workspaceRoot) {
|
|
|
2146
2200
|
if (config.storageScope === "custom") return expandHome$1(config.dataDir);
|
|
2147
2201
|
return expandHome$1(process.env.MNEMON_DATA_DIR?.trim() || "~/.mnemon");
|
|
2148
2202
|
};
|
|
2203
|
+
const persistedStore = () => {
|
|
2204
|
+
const active = join(effectiveDataDir(), "active");
|
|
2205
|
+
if (existsSync(active)) try {
|
|
2206
|
+
const value = readFileSync(active, "utf8").trim();
|
|
2207
|
+
if (/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(value)) return value;
|
|
2208
|
+
} catch {}
|
|
2209
|
+
return "default";
|
|
2210
|
+
};
|
|
2149
2211
|
const launch = async (args, options = {}) => {
|
|
2150
2212
|
if (options.signal?.aborted === true) throw new MnemonCliError(`mnemon command aborted: ${String(options.signal.reason ?? "cancelled")}`);
|
|
2151
2213
|
const argv = options.globalFlags === false ? [...args] : [...globalArgs(options.store), ...args];
|
|
@@ -2157,7 +2219,7 @@ function createRunner(config, processRunner = runProcess, workspaceRoot) {
|
|
|
2157
2219
|
try {
|
|
2158
2220
|
result = await processRunner(command, argv, processOptions);
|
|
2159
2221
|
} catch (error) {
|
|
2160
|
-
throw new MnemonCliError(`${error instanceof Error ? error.message : String(error)}. Install Mnemon and ensure "mnemon" is on PATH, or set
|
|
2222
|
+
throw new MnemonCliError(`${error instanceof Error ? error.message : String(error)}. ${process.platform === "win32" ? "Install the official Mnemon Windows release, ensure mnemon.exe is on PATH or under %LOCALAPPDATA%\\Programs\\mnemon, or set MNEMON_CLI_PATH or mnemon.cliPath to its absolute path." : "Install Mnemon and ensure \"mnemon\" is on PATH, or set MNEMON_CLI_PATH or mnemon.cliPath."}`);
|
|
2161
2223
|
}
|
|
2162
2224
|
if (result.exitCode !== 0) {
|
|
2163
2225
|
const detail = result.stderr.trim() || result.stdout.trim() || "no output";
|
|
@@ -2183,6 +2245,15 @@ function createRunner(config, processRunner = runProcess, workspaceRoot) {
|
|
|
2183
2245
|
}
|
|
2184
2246
|
},
|
|
2185
2247
|
runText: execute,
|
|
2248
|
+
runTextBatch(commands) {
|
|
2249
|
+
const result = processQueue.then(async () => {
|
|
2250
|
+
const outputs = [];
|
|
2251
|
+
for (const command of commands) outputs.push(await launch(command.args, command.options));
|
|
2252
|
+
return outputs;
|
|
2253
|
+
});
|
|
2254
|
+
processQueue = result.then(() => void 0, () => void 0);
|
|
2255
|
+
return result;
|
|
2256
|
+
},
|
|
2186
2257
|
withExclusive(operation) {
|
|
2187
2258
|
const result = processQueue.then(operation);
|
|
2188
2259
|
processQueue = result.then(() => void 0, () => void 0);
|
|
@@ -2191,21 +2262,19 @@ function createRunner(config, processRunner = runProcess, workspaceRoot) {
|
|
|
2191
2262
|
effectiveDataDir() {
|
|
2192
2263
|
return effectiveDataDir();
|
|
2193
2264
|
},
|
|
2265
|
+
persistedStore() {
|
|
2266
|
+
return persistedStore();
|
|
2267
|
+
},
|
|
2194
2268
|
effectiveStore() {
|
|
2195
2269
|
if (config.store !== void 0) return config.store;
|
|
2196
2270
|
const fromEnvironment = process.env.MNEMON_STORE?.trim();
|
|
2197
2271
|
if (fromEnvironment !== void 0 && fromEnvironment !== "") return fromEnvironment;
|
|
2198
|
-
|
|
2199
|
-
if (existsSync(active)) try {
|
|
2200
|
-
const value = readFileSync(active, "utf8").trim();
|
|
2201
|
-
if (value !== "") return value;
|
|
2202
|
-
} catch {}
|
|
2203
|
-
return "default";
|
|
2272
|
+
return persistedStore();
|
|
2204
2273
|
}
|
|
2205
2274
|
};
|
|
2206
2275
|
}
|
|
2207
2276
|
//#endregion
|
|
2208
|
-
//#region
|
|
2277
|
+
//#region src/memory-bodies.ts
|
|
2209
2278
|
const REGISTRY_VERSION = 1;
|
|
2210
2279
|
const ID_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9_-]*$/;
|
|
2211
2280
|
function requiredText(value, label, max) {
|
|
@@ -2261,8 +2330,10 @@ var MemoryBodyRegistry = class {
|
|
|
2261
2330
|
async create(request, signal) {
|
|
2262
2331
|
const name = requiredText(request.name, "name", 100);
|
|
2263
2332
|
const description = requiredText(request.description, "description", 1e3);
|
|
2264
|
-
|
|
2265
|
-
|
|
2333
|
+
const reservedIds = new Set(this.list().map((body) => body.id));
|
|
2334
|
+
const nativeStoreIds = this.nativeStoreIds();
|
|
2335
|
+
let id = nativeStoreIds.length === 0 && !reservedIds.has("default") ? "default" : validateMemoryBodyId(randomUUID());
|
|
2336
|
+
while (reservedIds.has(id) || nativeStoreIds.includes(id)) id = validateMemoryBodyId(randomUUID());
|
|
2266
2337
|
await this.runner.runText([
|
|
2267
2338
|
"store",
|
|
2268
2339
|
"create",
|
|
@@ -2301,14 +2372,40 @@ var MemoryBodyRegistry = class {
|
|
|
2301
2372
|
}
|
|
2302
2373
|
async remove(id, signal) {
|
|
2303
2374
|
const body = this.get(id);
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2375
|
+
const nativeStoreIds = this.nativeStoreIds();
|
|
2376
|
+
if (nativeStoreIds.includes(body.id) && nativeStoreIds.length === 1) throw new Error(`cannot delete the last Mnemon Store "${body.id}"; disable it for DSH or create another Memory Space first`);
|
|
2377
|
+
const persistedStore = this.runner.persistedStore();
|
|
2378
|
+
const commands = [];
|
|
2379
|
+
let commandStore = persistedStore;
|
|
2380
|
+
if (persistedStore === body.id) {
|
|
2381
|
+
const nativeIds = new Set(nativeStoreIds);
|
|
2382
|
+
const replacement = this.list().filter((candidate) => candidate.id !== body.id && nativeIds.has(candidate.id)).sort((left, right) => Number(right.active) - Number(left.active) || left.id.localeCompare(right.id))[0]?.id ?? nativeStoreIds.filter((candidate) => candidate !== body.id).sort()[0];
|
|
2383
|
+
if (replacement === void 0) throw new Error(`cannot switch away from Mnemon Store "${body.id}" before deleting it`);
|
|
2384
|
+
commandStore = replacement;
|
|
2385
|
+
commands.push({
|
|
2386
|
+
args: [
|
|
2387
|
+
"store",
|
|
2388
|
+
"set",
|
|
2389
|
+
replacement
|
|
2390
|
+
],
|
|
2391
|
+
options: {
|
|
2392
|
+
...signal === void 0 ? {} : { signal },
|
|
2393
|
+
store: replacement
|
|
2394
|
+
}
|
|
2395
|
+
});
|
|
2396
|
+
}
|
|
2397
|
+
commands.push({
|
|
2398
|
+
args: [
|
|
2399
|
+
"store",
|
|
2400
|
+
"remove",
|
|
2401
|
+
body.id
|
|
2402
|
+
],
|
|
2403
|
+
options: {
|
|
2404
|
+
...signal === void 0 ? {} : { signal },
|
|
2405
|
+
store: commandStore
|
|
2406
|
+
}
|
|
2311
2407
|
});
|
|
2408
|
+
await this.runner.runTextBatch(commands);
|
|
2312
2409
|
this.bodies = this.bodies.filter((entry) => entry.id !== body.id);
|
|
2313
2410
|
this.save();
|
|
2314
2411
|
return body;
|
|
@@ -2363,6 +2460,10 @@ var MemoryBodyRegistry = class {
|
|
|
2363
2460
|
}
|
|
2364
2461
|
if (changed) this.save();
|
|
2365
2462
|
}
|
|
2463
|
+
nativeStoreIds() {
|
|
2464
|
+
if (!existsSync(this.directory)) return [];
|
|
2465
|
+
return readdirSync(this.directory, { withFileTypes: true }).filter((entry) => entry.isDirectory() && ID_PATTERN.test(entry.name)).map((entry) => entry.name).sort();
|
|
2466
|
+
}
|
|
2366
2467
|
view(body) {
|
|
2367
2468
|
return {
|
|
2368
2469
|
...body,
|
|
@@ -2385,7 +2486,12 @@ var MemoryBodyRegistry = class {
|
|
|
2385
2486
|
}
|
|
2386
2487
|
};
|
|
2387
2488
|
//#endregion
|
|
2388
|
-
//#region
|
|
2489
|
+
//#region src/shared/contracts.ts
|
|
2490
|
+
const MNEMON_READ_CHANNEL = "/dsh-mnemon-read";
|
|
2491
|
+
const MNEMON_WRITE_CHANNEL = "/dsh-mnemon-write";
|
|
2492
|
+
const MNEMON_PACK_CHANNEL = "/dsh-mnemon-pack";
|
|
2493
|
+
const MNEMON_SETTINGS_CHANNEL = "/dsh-mnemon-settings";
|
|
2494
|
+
const MNEMON_SETTINGS_NAMESPACE = "mnemon";
|
|
2389
2495
|
const CATEGORIES = [
|
|
2390
2496
|
"preference",
|
|
2391
2497
|
"decision",
|
|
@@ -2411,6 +2517,8 @@ const INTENTS = [
|
|
|
2411
2517
|
"ENTITY",
|
|
2412
2518
|
"GENERAL"
|
|
2413
2519
|
];
|
|
2520
|
+
//#endregion
|
|
2521
|
+
//#region src/service.ts
|
|
2414
2522
|
function record$1(value) {
|
|
2415
2523
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
2416
2524
|
}
|
|
@@ -2539,7 +2647,8 @@ var MnemonService = class {
|
|
|
2539
2647
|
}
|
|
2540
2648
|
async bodies(signal) {
|
|
2541
2649
|
const items = [];
|
|
2542
|
-
|
|
2650
|
+
const mnemonDefaultStore = this.runner.persistedStore();
|
|
2651
|
+
for (const body of this.memoryBodies.list()) items.push(await this.bodyStatus(body, body.id === mnemonDefaultStore, signal));
|
|
2543
2652
|
return {
|
|
2544
2653
|
items,
|
|
2545
2654
|
total: items.length,
|
|
@@ -2551,11 +2660,14 @@ var MnemonService = class {
|
|
|
2551
2660
|
async status(signal) {
|
|
2552
2661
|
const catalog = await this.bodies(signal);
|
|
2553
2662
|
const active = catalog.items.filter((body) => body.active);
|
|
2663
|
+
const dshActiveStores = active.map((body) => body.id);
|
|
2554
2664
|
const base = {
|
|
2555
2665
|
cliPath: this.runner.command,
|
|
2556
2666
|
commandFound: this.runner.commandFound,
|
|
2557
2667
|
dataDir: this.runner.effectiveDataDir(),
|
|
2558
|
-
store:
|
|
2668
|
+
store: dshActiveStores.join(", ") || "none",
|
|
2669
|
+
mnemonDefaultStore: this.runner.persistedStore(),
|
|
2670
|
+
dshActiveStores,
|
|
2559
2671
|
writeEnabled: this.config.writeEnabled,
|
|
2560
2672
|
timeoutMs: this.config.timeoutMs,
|
|
2561
2673
|
defaultRecallLimit: this.config.defaultRecallLimit,
|
|
@@ -2875,7 +2987,7 @@ var MnemonService = class {
|
|
|
2875
2987
|
});
|
|
2876
2988
|
}
|
|
2877
2989
|
}
|
|
2878
|
-
async bodyStatus(body, signal) {
|
|
2990
|
+
async bodyStatus(body, mnemonDefault, signal) {
|
|
2879
2991
|
try {
|
|
2880
2992
|
const status = record$1(await this.runner.runJson(["status"], {
|
|
2881
2993
|
...signal === void 0 ? {} : { signal },
|
|
@@ -2884,12 +2996,14 @@ var MnemonService = class {
|
|
|
2884
2996
|
if (status === void 0) throw new Error("mnemon status returned an unexpected payload");
|
|
2885
2997
|
return {
|
|
2886
2998
|
...body,
|
|
2999
|
+
mnemonDefault,
|
|
2887
3000
|
healthy: true,
|
|
2888
3001
|
stats: this.parseStats(status)
|
|
2889
3002
|
};
|
|
2890
3003
|
} catch (error) {
|
|
2891
3004
|
return {
|
|
2892
3005
|
...body,
|
|
3006
|
+
mnemonDefault,
|
|
2893
3007
|
healthy: false,
|
|
2894
3008
|
error: error instanceof Error ? error.message : String(error)
|
|
2895
3009
|
};
|
|
@@ -3007,7 +3121,7 @@ var MnemonService = class {
|
|
|
3007
3121
|
}
|
|
3008
3122
|
};
|
|
3009
3123
|
//#endregion
|
|
3010
|
-
//#region
|
|
3124
|
+
//#region src/storage-scope.ts
|
|
3011
3125
|
function expandHome(path) {
|
|
3012
3126
|
if (path === "~") return homedir();
|
|
3013
3127
|
return path.startsWith("~/") ? join(homedir(), path.slice(2)) : path;
|
|
@@ -3245,7 +3359,7 @@ var StorageScopeInspector = class {
|
|
|
3245
3359
|
}
|
|
3246
3360
|
};
|
|
3247
3361
|
//#endregion
|
|
3248
|
-
//#region
|
|
3362
|
+
//#region src/live-runtime.ts
|
|
3249
3363
|
/**
|
|
3250
3364
|
* Build a complete generation before it can become visible. Constructors also
|
|
3251
3365
|
* validate and initialize the selected storage root, so a failed candidate is
|
|
@@ -3383,7 +3497,7 @@ var LiveMnemonRuntime = class {
|
|
|
3383
3497
|
}
|
|
3384
3498
|
};
|
|
3385
3499
|
//#endregion
|
|
3386
|
-
//#region
|
|
3500
|
+
//#region src/subagent.ts
|
|
3387
3501
|
function isAgentRuntimeSource$1(value) {
|
|
3388
3502
|
return typeof value === "object" && value !== null && "forAgent" in value && typeof value.forAgent === "function";
|
|
3389
3503
|
}
|
|
@@ -4142,7 +4256,7 @@ ${indentedText(request.content ?? "")}`;
|
|
|
4142
4256
|
}
|
|
4143
4257
|
};
|
|
4144
4258
|
//#endregion
|
|
4145
|
-
//#region
|
|
4259
|
+
//#region src/review-activity.ts
|
|
4146
4260
|
/**
|
|
4147
4261
|
* QoderWork 0.9.12's deterministic post-turn review gate.
|
|
4148
4262
|
*
|
|
@@ -4178,7 +4292,7 @@ function scoreReviewActivity(activity) {
|
|
|
4178
4292
|
};
|
|
4179
4293
|
}
|
|
4180
4294
|
//#endregion
|
|
4181
|
-
//#region
|
|
4295
|
+
//#region src/activity.ts
|
|
4182
4296
|
const RECALL_TOOLS = /* @__PURE__ */ new Set(["mnemon_recall", "mnemon_related"]);
|
|
4183
4297
|
const INSPECTION_TOOLS = /* @__PURE__ */ new Set(["mnemon_status", "mnemon_memory_bodies"]);
|
|
4184
4298
|
const WRITE_TOOLS = /* @__PURE__ */ new Set([
|
|
@@ -4274,7 +4388,7 @@ var TurnActivityProjection = class {
|
|
|
4274
4388
|
}
|
|
4275
4389
|
};
|
|
4276
4390
|
//#endregion
|
|
4277
|
-
//#region
|
|
4391
|
+
//#region src/lifecycle.ts
|
|
4278
4392
|
const MNEMON_PLUGIN_SOURCE = "dsh-mnemon";
|
|
4279
4393
|
function createPluginMessage(text, form, summary) {
|
|
4280
4394
|
return structuredClone({
|
|
@@ -4698,7 +4812,7 @@ var MnemonLifecycle = class {
|
|
|
4698
4812
|
}
|
|
4699
4813
|
};
|
|
4700
4814
|
//#endregion
|
|
4701
|
-
//#region
|
|
4815
|
+
//#region src/version-updates.ts
|
|
4702
4816
|
const DSH_MNEMON_PACKAGE = "dsh-mnemon";
|
|
4703
4817
|
const MNEMON_MODULE = "github.com/mnemon-dev/mnemon";
|
|
4704
4818
|
const PACKAGE_MANIFEST_PATH = fileURLToPath(new URL("../package.json", import.meta.url));
|
|
@@ -4840,11 +4954,16 @@ function profileFromAncestor(packageManifestPath) {
|
|
|
4840
4954
|
let directory = dirname(packageManifestPath);
|
|
4841
4955
|
for (let depth = 0; depth < 12; depth++) {
|
|
4842
4956
|
const profile = manifest(join(directory, "package.json"));
|
|
4843
|
-
if (profile?.name?.startsWith("dsh-profile-") === true)
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4957
|
+
if (profile?.name?.startsWith("dsh-profile-") === true) {
|
|
4958
|
+
const spec = dependencySpec(profile);
|
|
4959
|
+
const linked = isLinkSpec(spec);
|
|
4960
|
+
return {
|
|
4961
|
+
mode: linked ? "link" : "npm",
|
|
4962
|
+
locationDir: linked && spec !== void 0 ? linkedTarget(directory, spec) ?? resolve(dirname(packageManifestPath)) : directory,
|
|
4963
|
+
profileName: profile.name.slice(12),
|
|
4964
|
+
profileDir: directory
|
|
4965
|
+
};
|
|
4966
|
+
}
|
|
4848
4967
|
const parent = dirname(directory);
|
|
4849
4968
|
if (parent === directory) break;
|
|
4850
4969
|
directory = parent;
|
|
@@ -4865,19 +4984,24 @@ function linkedProfile(packageManifestPath, dshHome) {
|
|
|
4865
4984
|
try {
|
|
4866
4985
|
if (realpathSync(target) === packageRoot) matches.push({
|
|
4867
4986
|
name: entry.name,
|
|
4868
|
-
dir: profileDir
|
|
4987
|
+
dir: profileDir,
|
|
4988
|
+
locationDir: target
|
|
4869
4989
|
});
|
|
4870
4990
|
} catch {}
|
|
4871
4991
|
}
|
|
4872
4992
|
const match = matches[0];
|
|
4873
4993
|
return match === void 0 ? void 0 : {
|
|
4874
4994
|
mode: "link",
|
|
4995
|
+
locationDir: match.locationDir,
|
|
4875
4996
|
profileName: match.name,
|
|
4876
4997
|
profileDir: match.dir
|
|
4877
4998
|
};
|
|
4878
4999
|
}
|
|
4879
5000
|
function inspectDshInstall(packageManifestPath, dshHome) {
|
|
4880
|
-
return profileFromAncestor(packageManifestPath) ?? linkedProfile(packageManifestPath, dshHome) ?? {
|
|
5001
|
+
return profileFromAncestor(packageManifestPath) ?? linkedProfile(packageManifestPath, dshHome) ?? {
|
|
5002
|
+
mode: "manual",
|
|
5003
|
+
locationDir: resolve(dirname(packageManifestPath))
|
|
5004
|
+
};
|
|
4881
5005
|
}
|
|
4882
5006
|
async function resultOrThrow(runner, command, args, timeoutMs) {
|
|
4883
5007
|
const result = await runner(command, args, {
|
|
@@ -4933,7 +5057,8 @@ var VersionUpdateManager = class {
|
|
|
4933
5057
|
try {
|
|
4934
5058
|
realCommand = realpathSync(command);
|
|
4935
5059
|
} catch {}
|
|
4936
|
-
|
|
5060
|
+
const normalizedCommand = realCommand.replaceAll("\\", "/");
|
|
5061
|
+
if (normalizedCommand.includes("/Caskroom/mnemon/")) {
|
|
4937
5062
|
const brew = this.executable("brew");
|
|
4938
5063
|
return {
|
|
4939
5064
|
...current === void 0 ? {} : { current },
|
|
@@ -4951,7 +5076,7 @@ var VersionUpdateManager = class {
|
|
|
4951
5076
|
}
|
|
4952
5077
|
};
|
|
4953
5078
|
}
|
|
4954
|
-
if (
|
|
5079
|
+
if (normalizedCommand.includes("/Cellar/mnemon/")) {
|
|
4955
5080
|
const brew = this.executable("brew");
|
|
4956
5081
|
return {
|
|
4957
5082
|
...current === void 0 ? {} : { current },
|
|
@@ -5006,6 +5131,7 @@ var VersionUpdateManager = class {
|
|
|
5006
5131
|
components: [{
|
|
5007
5132
|
id: "mnemon",
|
|
5008
5133
|
name: "Mnemon CLI",
|
|
5134
|
+
...mnemonLocal.install.command === void 0 ? {} : { executablePath: mnemonLocal.install.command },
|
|
5009
5135
|
...mnemonLocal.current === void 0 ? {} : { current: mnemonLocal.current },
|
|
5010
5136
|
...mnemonLatest === void 0 ? {} : { latest: mnemonLatest },
|
|
5011
5137
|
outdated: mnemonOutdated,
|
|
@@ -5016,6 +5142,8 @@ var VersionUpdateManager = class {
|
|
|
5016
5142
|
}, {
|
|
5017
5143
|
id: "dsh-mnemon",
|
|
5018
5144
|
name: "dsh-mnemon",
|
|
5145
|
+
...dshInstall.profileName === void 0 ? {} : { installProfile: dshInstall.profileName },
|
|
5146
|
+
installPath: dshInstall.locationDir,
|
|
5019
5147
|
current: this.currentDshMnemonVersion,
|
|
5020
5148
|
...dshLatest === void 0 ? {} : { latest: dshLatest },
|
|
5021
5149
|
outdated: dshOutdated,
|
|
@@ -5078,12 +5206,7 @@ var VersionUpdateManager = class {
|
|
|
5078
5206
|
}
|
|
5079
5207
|
};
|
|
5080
5208
|
//#endregion
|
|
5081
|
-
//#region
|
|
5082
|
-
const MNEMON_READ_CHANNEL = "/dsh-mnemon-read";
|
|
5083
|
-
const MNEMON_WRITE_CHANNEL = "/dsh-mnemon-write";
|
|
5084
|
-
const MNEMON_PACK_CHANNEL = "/dsh-mnemon-pack";
|
|
5085
|
-
//#endregion
|
|
5086
|
-
//#region lib/types/rpc.js
|
|
5209
|
+
//#region src/rpc.ts
|
|
5087
5210
|
function isRoutedRuntime(value) {
|
|
5088
5211
|
return "route" in value && typeof value.route === "function";
|
|
5089
5212
|
}
|
|
@@ -5411,9 +5534,7 @@ function findVersionCli(input) {
|
|
|
5411
5534
|
return input.config.cliPath;
|
|
5412
5535
|
}
|
|
5413
5536
|
//#endregion
|
|
5414
|
-
//#region
|
|
5415
|
-
const MNEMON_SETTINGS_CHANNEL = "/dsh-mnemon-settings";
|
|
5416
|
-
const MNEMON_SETTINGS_NAMESPACE = "mnemon";
|
|
5537
|
+
//#region src/settings.ts
|
|
5417
5538
|
function success(value) {
|
|
5418
5539
|
return {
|
|
5419
5540
|
ok: true,
|
|
@@ -5527,7 +5648,7 @@ function registerSettingsRpc(connection, settings) {
|
|
|
5527
5648
|
connection.rpc.handle(MNEMON_SETTINGS_CHANNEL, createSettingsHandler(settings), { authority: "loopback" });
|
|
5528
5649
|
}
|
|
5529
5650
|
//#endregion
|
|
5530
|
-
//#region
|
|
5651
|
+
//#region src/tools.ts
|
|
5531
5652
|
const text = (value) => [{
|
|
5532
5653
|
type: "text",
|
|
5533
5654
|
text: typeof value === "string" ? value : JSON.stringify(value, null, 2)
|
|
@@ -6148,7 +6269,7 @@ function registerTools(ctx, serviceOrSource, coordinator, runtimeMemory, documen
|
|
|
6148
6269
|
}));
|
|
6149
6270
|
}
|
|
6150
6271
|
//#endregion
|
|
6151
|
-
//#region
|
|
6272
|
+
//#region src/index.ts
|
|
6152
6273
|
const name = "dsh-mnemon";
|
|
6153
6274
|
const inject = [
|
|
6154
6275
|
"tools",
|
package/lib/types/activity.d.ts
CHANGED
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
import type { HostSessionEvent } from './contracts.ts';
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
turn: number;
|
|
5
|
-
/** Successful and failed settled Mnemon calls. Running calls are excluded. */
|
|
6
|
-
count: number;
|
|
7
|
-
names: string[];
|
|
8
|
-
recalls: number;
|
|
9
|
-
writes: number;
|
|
10
|
-
documentSearches: number;
|
|
11
|
-
inspections: number;
|
|
12
|
-
failures: number;
|
|
13
|
-
}
|
|
14
|
-
export interface TurnMemoryActivitySnapshot {
|
|
15
|
-
/** Last durable event represented by this snapshot. */
|
|
16
|
-
cursor: number;
|
|
17
|
-
activities: TurnMemoryActivity[];
|
|
18
|
-
}
|
|
2
|
+
import type { TurnMemoryActivitySnapshot } from './shared/contracts.ts';
|
|
3
|
+
export type { TurnMemoryActivity, TurnMemoryActivitySnapshot } from './shared/contracts.ts';
|
|
19
4
|
/**
|
|
20
5
|
* Incremental durable-log projection. Repeated UI reads process only events
|
|
21
6
|
* appended since the previous snapshot instead of rescanning the full session.
|
|
@@ -29,4 +14,3 @@ export declare class TurnActivityProjection {
|
|
|
29
14
|
snapshot(events: readonly HostSessionEvent[]): TurnMemoryActivitySnapshot;
|
|
30
15
|
private consume;
|
|
31
16
|
}
|
|
32
|
-
//# sourceMappingURL=activity.d.ts.map
|
package/lib/types/channels.d.ts
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare const MNEMON_WRITE_CHANNEL = "/dsh-mnemon-write";
|
|
3
|
-
export declare const MNEMON_PACK_CHANNEL = "/dsh-mnemon-pack";
|
|
4
|
-
//# sourceMappingURL=channels.d.ts.map
|
|
1
|
+
export { MNEMON_PACK_CHANNEL, MNEMON_READ_CHANNEL, MNEMON_WRITE_CHANNEL } from './shared/contracts.ts';
|