@shahmilsaari/memory-core 1.0.25 → 1.0.27
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 +75 -659
- package/dist/approval-queue-YBYRGBHP.js +7 -0
- package/dist/ast-analyzer-JM4CIOFY.js +44 -0
- package/dist/check-cache-6NWRTZJD.js +52 -0
- package/dist/check-logger-5HYSWA3S.js +21 -0
- package/dist/{chunk-35ZWQFTO.js → chunk-3XTHE74V.js} +239 -830
- package/dist/chunk-M7NKSXFS.js +301 -0
- package/dist/chunk-PQBWHAZN.js +156 -0
- package/dist/chunk-W6WEAV3S.js +69 -0
- package/dist/chunk-ZZBQEXEO.js +183 -0
- package/dist/classifier-MZ65R7FK.js +60 -0
- package/dist/cli.js +415 -14
- package/dist/confidence-gate-ZQDAOS6P.js +64 -0
- package/dist/dashboard/assets/index-Cd_SCzKw.js +2 -0
- package/dist/dashboard/assets/index-DAEzcad9.css +1 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/{dashboard-server-SSYZLQKB.js → dashboard-server-TWLZQE2J.js} +129 -17
- package/dist/db-PRDHI2CN.js +29 -0
- package/dist/deepseek-critique-MALVIYGF.js +82 -0
- package/dist/deterministic-validator-PP56B46I.js +18 -0
- package/dist/evidence-HVMSONTT.js +65 -0
- package/dist/graph-TFNTB5OK.js +98 -0
- package/dist/incident-capture-RVPZULS7.js +20 -0
- package/dist/ollama-judge-D2LFK5PB.js +137 -0
- package/dist/rate-limiter-SLIPCXRF.js +41 -0
- package/dist/rules-V3QMN3AR.js +95 -0
- package/dist/watch-errors-B3FA26N4.js +99 -0
- package/package.json +1 -1
- package/dist/dashboard/assets/index-B7gd4JQc.js +0 -2
- package/dist/dashboard/assets/index-CHgjllWU.css +0 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
collectResolvedImports,
|
|
4
|
+
parseImports
|
|
5
|
+
} from "./chunk-ZZBQEXEO.js";
|
|
6
|
+
|
|
7
|
+
// src/core/ast-analyzer.ts
|
|
8
|
+
import { existsSync } from "fs";
|
|
9
|
+
import { resolve } from "path";
|
|
10
|
+
var ASTAnalyzer = class {
|
|
11
|
+
constructor(cwd = process.cwd()) {
|
|
12
|
+
this.cwd = cwd;
|
|
13
|
+
}
|
|
14
|
+
cwd;
|
|
15
|
+
analyze(filepath) {
|
|
16
|
+
const absPath = resolve(this.cwd, filepath);
|
|
17
|
+
if (!existsSync(absPath)) {
|
|
18
|
+
return { file: filepath, imports: [] };
|
|
19
|
+
}
|
|
20
|
+
const resolved = collectResolvedImports(absPath, this.cwd);
|
|
21
|
+
const imports = resolved.map((imp) => ({
|
|
22
|
+
module: imp.specifier,
|
|
23
|
+
items: [],
|
|
24
|
+
isDefault: false,
|
|
25
|
+
line: imp.line,
|
|
26
|
+
isExternal: imp.isExternal
|
|
27
|
+
}));
|
|
28
|
+
return { file: filepath, imports };
|
|
29
|
+
}
|
|
30
|
+
analyzeSource(filepath, source) {
|
|
31
|
+
const parsed = parseImports(source);
|
|
32
|
+
const imports = parsed.map((imp) => ({
|
|
33
|
+
module: imp.specifier,
|
|
34
|
+
items: [],
|
|
35
|
+
isDefault: false,
|
|
36
|
+
line: imp.line,
|
|
37
|
+
isExternal: !imp.specifier.startsWith(".") && !imp.specifier.startsWith("/")
|
|
38
|
+
}));
|
|
39
|
+
return { file: filepath, imports };
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
ASTAnalyzer
|
|
44
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/core/check-cache.ts
|
|
4
|
+
import { createHash } from "crypto";
|
|
5
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync, statSync } from "fs";
|
|
6
|
+
import { join } from "path";
|
|
7
|
+
var CACHE_TTL_MS = 5 * 60 * 1e3;
|
|
8
|
+
var CheckCache = class {
|
|
9
|
+
cacheDir;
|
|
10
|
+
constructor(rootPath) {
|
|
11
|
+
this.cacheDir = join(rootPath, ".archmind", "cache");
|
|
12
|
+
}
|
|
13
|
+
key(diffOutput, memoriesHash, rulesHash) {
|
|
14
|
+
return createHash("sha256").update(diffOutput + "||" + memoriesHash + "||" + (rulesHash ?? "")).digest("hex").slice(0, 16);
|
|
15
|
+
}
|
|
16
|
+
rulesHash(configDir) {
|
|
17
|
+
const rulesPath = join(configDir, "rules.json");
|
|
18
|
+
try {
|
|
19
|
+
const mtime = statSync(rulesPath).mtimeMs;
|
|
20
|
+
return mtime.toString();
|
|
21
|
+
} catch {
|
|
22
|
+
return "0";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
memoriesHash(memories) {
|
|
26
|
+
const combined = memories.map((m) => m.content).join("|");
|
|
27
|
+
return createHash("sha256").update(combined).digest("hex").slice(0, 8);
|
|
28
|
+
}
|
|
29
|
+
get(key) {
|
|
30
|
+
const path = join(this.cacheDir, key + ".json");
|
|
31
|
+
if (!existsSync(path)) return null;
|
|
32
|
+
try {
|
|
33
|
+
const entry = JSON.parse(readFileSync(path, "utf-8"));
|
|
34
|
+
const age = Date.now() - new Date(entry.cachedAt).getTime();
|
|
35
|
+
if (age > CACHE_TTL_MS) return null;
|
|
36
|
+
return entry;
|
|
37
|
+
} catch {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
set(key, entry) {
|
|
42
|
+
try {
|
|
43
|
+
mkdirSync(this.cacheDir, { recursive: true });
|
|
44
|
+
const full = { ...entry, key, cachedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
45
|
+
writeFileSync(join(this.cacheDir, key + ".json"), JSON.stringify(full, null, 2), "utf-8");
|
|
46
|
+
} catch {
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
CheckCache
|
|
52
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/core/check-logger.ts
|
|
4
|
+
import { appendFileSync, mkdirSync } from "fs";
|
|
5
|
+
import { join, dirname } from "path";
|
|
6
|
+
var CheckLogger = class {
|
|
7
|
+
logPath;
|
|
8
|
+
constructor(rootPath) {
|
|
9
|
+
this.logPath = join(rootPath, ".archmind", "check.log");
|
|
10
|
+
}
|
|
11
|
+
append(entry) {
|
|
12
|
+
try {
|
|
13
|
+
mkdirSync(dirname(this.logPath), { recursive: true });
|
|
14
|
+
appendFileSync(this.logPath, JSON.stringify(entry) + "\n", "utf-8");
|
|
15
|
+
} catch {
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
CheckLogger
|
|
21
|
+
};
|