dotmem 0.3.1 → 0.3.3
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/AGENTS.md +9 -9
- package/CHANGELOG.md +23 -22
- package/OVERVIEW.md +18 -1
- package/README.md +17 -12
- package/WHATSNEW.md +10 -0
- package/adr/ADR-001-process-intelligence.md +17 -0
- package/agent.cjs +20470 -213
- package/agent.js +20459 -213
- package/bin/cli.cjs +98 -1
- package/bin/cli.js +89 -1
- package/bin/dotmem-burst-stats.cjs +835 -9
- package/bin/dotmem-burst-stats.js +812 -9
- package/bin/mcp.cjs +26 -1
- package/bin/mcp.js +20 -1
- package/built-in-context.json +6 -6
- package/cli.cjs +36333 -381
- package/cli.js +36276 -379
- package/env.cjs +6 -1
- package/env.js +4 -1
- package/global.cjs +20258 -213
- package/global.js +20225 -213
- package/index.cjs +25567 -247
- package/index.js +25505 -247
- package/llms.txt +6 -5
- package/mcp.cjs +31168 -281
- package/mcp.js +31128 -281
- package/package.json +6 -2
- package/types/exports.d.ts +32 -32
- package/types/global-types.d.ts +79 -77
- package/types/llm-cache.d.ts +1 -1
- package/types/memory.d.ts +32 -32
- package/types/policy.d.ts +2 -2
- package/crew/CREW-CERTIFICATION-REPORT.md +0 -52
- package/crew/PHASE-1-DISCOVERY.md +0 -74
- package/crew/PHASE-2-SURFACE-ANALYSIS.md +0 -74
- package/crew/PHASE-3-IMPLEMENTATION-REPORT.md +0 -40
package/bin/cli.cjs
CHANGED
|
@@ -1,2 +1,99 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var process = require('process');
|
|
5
|
+
var url = require('url');
|
|
6
|
+
var fs = require('fs');
|
|
7
|
+
var path = require('path');
|
|
8
|
+
|
|
9
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
10
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
|
|
12
|
+
var process__default = /*#__PURE__*/_interopDefault(process);
|
|
13
|
+
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
14
|
+
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
15
|
+
|
|
16
|
+
var __defProp = Object.defineProperty;
|
|
17
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
18
|
+
var __origWarn = console.warn;
|
|
19
|
+
console.warn = (...args2) => {
|
|
20
|
+
if (typeof args2[0] === "string" && args2[0].includes("Memorio IDB: IndexedDB is not available")) return;
|
|
21
|
+
__origWarn(...args2);
|
|
22
|
+
};
|
|
23
|
+
var rawArgs = process__default.default.argv.slice(2);
|
|
24
|
+
var storageRootFlagIndex = rawArgs.indexOf("--storage-root");
|
|
25
|
+
var hasStorageRootFlag = storageRootFlagIndex !== -1;
|
|
26
|
+
var storageRootFlagValue = hasStorageRootFlag ? rawArgs[storageRootFlagIndex + 1] : void 0;
|
|
27
|
+
if (hasStorageRootFlag && (storageRootFlagValue === void 0 || storageRootFlagValue.startsWith("--"))) {
|
|
28
|
+
console.error("Usage: npx dotmem <command> --storage-root <absolute-directory>");
|
|
29
|
+
process__default.default.exit(1);
|
|
30
|
+
}
|
|
31
|
+
var args = hasStorageRootFlag ? rawArgs.filter((_, index) => index !== storageRootFlagIndex && index !== storageRootFlagIndex + 1) : rawArgs;
|
|
32
|
+
var command = args[0];
|
|
33
|
+
var dispatchArgs = args.slice(1);
|
|
34
|
+
var readPackageJson = /* @__PURE__ */ __name((pkgPath) => {
|
|
35
|
+
try {
|
|
36
|
+
const pkg = JSON.parse(fs__default.default.readFileSync(pkgPath, "utf8"));
|
|
37
|
+
if (pkg && typeof pkg.version === "string") {
|
|
38
|
+
return { version: pkg.version, dir: path__default.default.dirname(pkgPath) };
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
} catch {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
}, "readPackageJson");
|
|
45
|
+
var detectOrigin = /* @__PURE__ */ __name((pkgDir) => {
|
|
46
|
+
const cwd = process__default.default.cwd();
|
|
47
|
+
if (cwd === pkgDir || cwd.startsWith(pkgDir + path__default.default.sep)) {
|
|
48
|
+
return "app";
|
|
49
|
+
}
|
|
50
|
+
return "npm";
|
|
51
|
+
}, "detectOrigin");
|
|
52
|
+
var localCliPath = url.fileURLToPath(new URL("../cli.js", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href))));
|
|
53
|
+
var candidatePkgPaths = [
|
|
54
|
+
url.fileURLToPath(new URL("../../package.json", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href)))),
|
|
55
|
+
url.fileURLToPath(new URL("../package.json", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href)))),
|
|
56
|
+
url.fileURLToPath(new URL("./package.json", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href)))),
|
|
57
|
+
path__default.default.join(path__default.default.dirname(process__default.default.argv[1] ?? ""), "..", "package.json"),
|
|
58
|
+
path__default.default.join(path__default.default.dirname(process__default.default.argv[1] ?? ""), "package.json")
|
|
59
|
+
];
|
|
60
|
+
var localPkg = null;
|
|
61
|
+
for (const candidate of candidatePkgPaths) {
|
|
62
|
+
localPkg = readPackageJson(candidate);
|
|
63
|
+
if (localPkg) break;
|
|
64
|
+
}
|
|
65
|
+
if (!localPkg && typeof process__default.default.env.npm_package_version === "string" && process__default.default.env.npm_package_version.trim()) {
|
|
66
|
+
localPkg = { version: process__default.default.env.npm_package_version.trim(), dir: process__default.default.cwd() };
|
|
67
|
+
}
|
|
68
|
+
var resolveEffectiveInstallation = /* @__PURE__ */ __name(() => {
|
|
69
|
+
const local = {
|
|
70
|
+
origin: localPkg ? detectOrigin(localPkg.dir) : "app",
|
|
71
|
+
version: localPkg?.version ?? "any",
|
|
72
|
+
dir: localPkg?.dir ?? "",
|
|
73
|
+
cliPath: localCliPath
|
|
74
|
+
};
|
|
75
|
+
return local;
|
|
76
|
+
}, "resolveEffectiveInstallation");
|
|
77
|
+
var effective = resolveEffectiveInstallation();
|
|
78
|
+
console.info(`dotmem v${effective.version} (${effective.origin})`);
|
|
79
|
+
void (async () => {
|
|
80
|
+
const cliModule = await import('../cli.js');
|
|
81
|
+
if (hasStorageRootFlag) {
|
|
82
|
+
try {
|
|
83
|
+
cliModule.noteDotMemPackageInstallPath(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href))));
|
|
84
|
+
cliModule.setDotMemStorageRootOverride(storageRootFlagValue);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
console.error(`Invalid --storage-root: ${error instanceof Error ? error.message : String(error)}`);
|
|
87
|
+
process__default.default.exit(1);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
const sessionState = await cliModule.loadSession();
|
|
92
|
+
if (sessionState.doing || sessionState.changedFiles.length > 0 || sessionState.waitingForUser.length > 0 || sessionState.doNotYet.length > 0) {
|
|
93
|
+
console.info("");
|
|
94
|
+
console.info(cliModule.formatSessionState(sessionState));
|
|
95
|
+
}
|
|
96
|
+
} catch {
|
|
97
|
+
}
|
|
98
|
+
cliModule.dispatch(command, dispatchArgs);
|
|
99
|
+
})();
|
package/bin/cli.js
CHANGED
|
@@ -1,2 +1,90 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
2
|
+
import process from 'process';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import fs from 'fs';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var __origWarn = console.warn;
|
|
10
|
+
console.warn = (...args2) => {
|
|
11
|
+
if (typeof args2[0] === "string" && args2[0].includes("Memorio IDB: IndexedDB is not available")) return;
|
|
12
|
+
__origWarn(...args2);
|
|
13
|
+
};
|
|
14
|
+
var rawArgs = process.argv.slice(2);
|
|
15
|
+
var storageRootFlagIndex = rawArgs.indexOf("--storage-root");
|
|
16
|
+
var hasStorageRootFlag = storageRootFlagIndex !== -1;
|
|
17
|
+
var storageRootFlagValue = hasStorageRootFlag ? rawArgs[storageRootFlagIndex + 1] : void 0;
|
|
18
|
+
if (hasStorageRootFlag && (storageRootFlagValue === void 0 || storageRootFlagValue.startsWith("--"))) {
|
|
19
|
+
console.error("Usage: npx dotmem <command> --storage-root <absolute-directory>");
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
var args = hasStorageRootFlag ? rawArgs.filter((_, index) => index !== storageRootFlagIndex && index !== storageRootFlagIndex + 1) : rawArgs;
|
|
23
|
+
var command = args[0];
|
|
24
|
+
var dispatchArgs = args.slice(1);
|
|
25
|
+
var readPackageJson = /* @__PURE__ */ __name((pkgPath) => {
|
|
26
|
+
try {
|
|
27
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
28
|
+
if (pkg && typeof pkg.version === "string") {
|
|
29
|
+
return { version: pkg.version, dir: path.dirname(pkgPath) };
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
} catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}, "readPackageJson");
|
|
36
|
+
var detectOrigin = /* @__PURE__ */ __name((pkgDir) => {
|
|
37
|
+
const cwd = process.cwd();
|
|
38
|
+
if (cwd === pkgDir || cwd.startsWith(pkgDir + path.sep)) {
|
|
39
|
+
return "app";
|
|
40
|
+
}
|
|
41
|
+
return "npm";
|
|
42
|
+
}, "detectOrigin");
|
|
43
|
+
var localCliPath = fileURLToPath(new URL("../cli.js", import.meta.url));
|
|
44
|
+
var candidatePkgPaths = [
|
|
45
|
+
fileURLToPath(new URL("../../package.json", import.meta.url)),
|
|
46
|
+
fileURLToPath(new URL("../package.json", import.meta.url)),
|
|
47
|
+
fileURLToPath(new URL("./package.json", import.meta.url)),
|
|
48
|
+
path.join(path.dirname(process.argv[1] ?? ""), "..", "package.json"),
|
|
49
|
+
path.join(path.dirname(process.argv[1] ?? ""), "package.json")
|
|
50
|
+
];
|
|
51
|
+
var localPkg = null;
|
|
52
|
+
for (const candidate of candidatePkgPaths) {
|
|
53
|
+
localPkg = readPackageJson(candidate);
|
|
54
|
+
if (localPkg) break;
|
|
55
|
+
}
|
|
56
|
+
if (!localPkg && typeof process.env.npm_package_version === "string" && process.env.npm_package_version.trim()) {
|
|
57
|
+
localPkg = { version: process.env.npm_package_version.trim(), dir: process.cwd() };
|
|
58
|
+
}
|
|
59
|
+
var resolveEffectiveInstallation = /* @__PURE__ */ __name(() => {
|
|
60
|
+
const local = {
|
|
61
|
+
origin: localPkg ? detectOrigin(localPkg.dir) : "app",
|
|
62
|
+
version: localPkg?.version ?? "any",
|
|
63
|
+
dir: localPkg?.dir ?? "",
|
|
64
|
+
cliPath: localCliPath
|
|
65
|
+
};
|
|
66
|
+
return local;
|
|
67
|
+
}, "resolveEffectiveInstallation");
|
|
68
|
+
var effective = resolveEffectiveInstallation();
|
|
69
|
+
console.info(`dotmem v${effective.version} (${effective.origin})`);
|
|
70
|
+
void (async () => {
|
|
71
|
+
const cliModule = await import('../cli.js');
|
|
72
|
+
if (hasStorageRootFlag) {
|
|
73
|
+
try {
|
|
74
|
+
cliModule.noteDotMemPackageInstallPath(fileURLToPath(import.meta.url));
|
|
75
|
+
cliModule.setDotMemStorageRootOverride(storageRootFlagValue);
|
|
76
|
+
} catch (error) {
|
|
77
|
+
console.error(`Invalid --storage-root: ${error instanceof Error ? error.message : String(error)}`);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
const sessionState = await cliModule.loadSession();
|
|
83
|
+
if (sessionState.doing || sessionState.changedFiles.length > 0 || sessionState.waitingForUser.length > 0 || sessionState.doNotYet.length > 0) {
|
|
84
|
+
console.info("");
|
|
85
|
+
console.info(cliModule.formatSessionState(sessionState));
|
|
86
|
+
}
|
|
87
|
+
} catch {
|
|
88
|
+
}
|
|
89
|
+
cliModule.dispatch(command, dispatchArgs);
|
|
90
|
+
})();
|