akemon 0.3.6 → 0.3.7

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.
Files changed (51) hide show
  1. package/DATA_POLICY.md +11 -3
  2. package/README.md +133 -21
  3. package/dist/akemon-home.js +56 -0
  4. package/dist/akemon-message.js +107 -0
  5. package/dist/best-effort.js +8 -0
  6. package/dist/cli.js +1188 -100
  7. package/dist/cognitive-artifact-store.js +101 -0
  8. package/dist/cognitive-event-log.js +47 -0
  9. package/dist/config.js +45 -9
  10. package/dist/context.js +27 -6
  11. package/dist/core/contracts/layers.js +1 -0
  12. package/dist/core/contracts/permission.js +1 -0
  13. package/dist/core/contracts/workspace.js +1 -0
  14. package/dist/core-cognitive-module.js +768 -0
  15. package/dist/engine-peripheral.js +127 -26
  16. package/dist/engine-routing.js +58 -17
  17. package/dist/interactive-session.js +361 -0
  18. package/dist/local-interconnect.js +156 -0
  19. package/dist/local-registry.js +178 -0
  20. package/dist/mcp-server.js +4 -1
  21. package/dist/memory-proposal.js +379 -0
  22. package/dist/memory-recorder.js +368 -0
  23. package/dist/orphan-scan.js +36 -24
  24. package/dist/passive-reflection-cognitive-module.js +172 -0
  25. package/dist/peripheral-registry.js +235 -0
  26. package/dist/permission-audit.js +132 -0
  27. package/dist/relay-client.js +68 -9
  28. package/dist/relay-mode.js +34 -0
  29. package/dist/relay-peripheral.js +139 -49
  30. package/dist/runtime-platform.js +122 -0
  31. package/dist/secretariat/client.js +87 -0
  32. package/dist/self.js +15 -6
  33. package/dist/server.js +3675 -512
  34. package/dist/social-discovery.js +231 -0
  35. package/dist/software-agent-peripheral.js +185 -244
  36. package/dist/software-agent-transport.js +177 -0
  37. package/dist/task-module.js +243 -0
  38. package/dist/task-registry.js +756 -0
  39. package/dist/vendor/xterm/addon-fit.js +2 -0
  40. package/dist/vendor/xterm/addon-search.js +2 -0
  41. package/dist/vendor/xterm/addon-web-links.js +2 -0
  42. package/dist/vendor/xterm/xterm.css +285 -0
  43. package/dist/vendor/xterm/xterm.js +2 -0
  44. package/dist/work-memory.js +59 -15
  45. package/dist/workbench-peripheral-guide.js +79 -0
  46. package/dist/workbench-session.js +1074 -0
  47. package/dist/workbench.html +4011 -0
  48. package/package.json +8 -3
  49. package/scripts/build.cjs +24 -0
  50. package/scripts/check-architecture-baseline.cjs +68 -0
  51. package/scripts/test.cjs +38 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akemon",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "Local AI companion runtime with memory, modules, relay sync, and software-agent control",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -28,12 +28,13 @@
28
28
  "README.md"
29
29
  ],
30
30
  "scripts": {
31
- "build": "rm -rf dist && tsc && cp src/live.html dist/live.html",
31
+ "build": "node scripts/build.cjs",
32
+ "check:architecture": "node scripts/check-architecture-baseline.cjs",
32
33
  "dev": "tsc --watch",
33
34
  "start": "node dist/cli.js",
34
35
  "postinstall": "node scripts/fix-node-pty.cjs",
35
36
  "prepublishOnly": "npm run build",
36
- "test": "rm -rf test-dist && tsc -p tsconfig.test.json && node --test test-dist/*.test.js"
37
+ "test": "node scripts/test.cjs"
37
38
  },
38
39
  "dependencies": {
39
40
  "@modelcontextprotocol/sdk": "^1.0.0",
@@ -44,6 +45,10 @@
44
45
  "devDependencies": {
45
46
  "@types/node": "^20.0.0",
46
47
  "@types/ws": "^8.18.1",
48
+ "@xterm/addon-fit": "^0.11.0",
49
+ "@xterm/addon-search": "^0.16.0",
50
+ "@xterm/addon-web-links": "^0.12.0",
51
+ "@xterm/xterm": "^6.0.0",
47
52
  "typescript": "^5.0.0"
48
53
  }
49
54
  }
@@ -0,0 +1,24 @@
1
+ const { cpSync, mkdirSync, rmSync } = require("fs");
2
+ const { spawnSync } = require("child_process");
3
+
4
+ function runNodeScript(script, args = []) {
5
+ const result = spawnSync(process.execPath, [script, ...args], { stdio: "inherit", shell: false });
6
+ if (result.error) {
7
+ console.error(result.error.message);
8
+ process.exit(1);
9
+ }
10
+ if (typeof result.status === "number" && result.status !== 0) {
11
+ process.exit(result.status);
12
+ }
13
+ }
14
+
15
+ rmSync("dist", { recursive: true, force: true });
16
+ runNodeScript(require.resolve("typescript/bin/tsc"));
17
+ cpSync("src/live.html", "dist/live.html");
18
+ cpSync("src/workbench.html", "dist/workbench.html");
19
+ mkdirSync("dist/vendor/xterm", { recursive: true });
20
+ cpSync("node_modules/@xterm/xterm/lib/xterm.js", "dist/vendor/xterm/xterm.js");
21
+ cpSync("node_modules/@xterm/xterm/css/xterm.css", "dist/vendor/xterm/xterm.css");
22
+ cpSync("node_modules/@xterm/addon-fit/lib/addon-fit.js", "dist/vendor/xterm/addon-fit.js");
23
+ cpSync("node_modules/@xterm/addon-web-links/lib/addon-web-links.js", "dist/vendor/xterm/addon-web-links.js");
24
+ cpSync("node_modules/@xterm/addon-search/lib/addon-search.js", "dist/vendor/xterm/addon-search.js");
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { readFileSync, readdirSync, statSync } = require("fs");
4
+ const { join, relative } = require("path");
5
+
6
+ const root = process.cwd();
7
+ const srcDir = join(root, "src");
8
+
9
+ const platformPatterns = [
10
+ /from\s+["'](?:node:)?child_process["']/,
11
+ /from\s+["']node-pty["']/,
12
+ /import\(["']node-pty["']\)/,
13
+ /process\.kill\s*\(/,
14
+ /process\.platform\b/,
15
+ ];
16
+
17
+ const crossLayerPatterns = [
18
+ /from\s+["']\.\/relay-client\.js["']/,
19
+ /from\s+["']\.\/software-agent-peripheral\.js["']/,
20
+ ];
21
+
22
+ function walk(dir, files = []) {
23
+ for (const entry of readdirSync(dir)) {
24
+ const path = join(dir, entry);
25
+ const stat = statSync(path);
26
+ if (stat.isDirectory()) {
27
+ if (entry === "node_modules" || entry === "dist") continue;
28
+ walk(path, files);
29
+ continue;
30
+ }
31
+ if (path.endsWith(".ts") && !path.endsWith(".test.ts")) files.push(path);
32
+ }
33
+ return files;
34
+ }
35
+
36
+ function countMatches(files, patterns) {
37
+ const matches = [];
38
+ for (const file of files) {
39
+ const text = readFileSync(file, "utf8");
40
+ const lines = text.split(/\r?\n/);
41
+ lines.forEach((line, index) => {
42
+ if (patterns.some((pattern) => pattern.test(line))) {
43
+ matches.push({
44
+ file: relative(root, file),
45
+ line: index + 1,
46
+ text: line.trim(),
47
+ });
48
+ }
49
+ });
50
+ }
51
+ return matches;
52
+ }
53
+
54
+ const files = walk(srcDir);
55
+ const platformMatches = countMatches(files, platformPatterns);
56
+ const crossLayerMatches = countMatches(files, crossLayerPatterns);
57
+
58
+ console.log("Architecture baseline");
59
+ console.log(`platform-coupling matches: ${platformMatches.length}`);
60
+ for (const match of platformMatches) {
61
+ console.log(` ${match.file}:${match.line} ${match.text}`);
62
+ }
63
+ console.log(`cross-layer import matches: ${crossLayerMatches.length}`);
64
+ for (const match of crossLayerMatches) {
65
+ console.log(` ${match.file}:${match.line} ${match.text}`);
66
+ }
67
+ console.log("baseline only: this script does not fail yet");
68
+ console.log("planned gate: switch to fail mode after platform-coupling reaches 0 outside runtime/platform and cross-layer imports are either moved or explicitly allowlisted.");
@@ -0,0 +1,38 @@
1
+ const { readdirSync, rmSync } = require("fs");
2
+ const { join } = require("path");
3
+ const { spawnSync } = require("child_process");
4
+
5
+ function runNode(args) {
6
+ const result = spawnSync(process.execPath, args, { stdio: "inherit", shell: false });
7
+ if (result.error) {
8
+ console.error(result.error.message);
9
+ process.exit(1);
10
+ }
11
+ if (typeof result.status === "number" && result.status !== 0) {
12
+ process.exit(result.status);
13
+ }
14
+ }
15
+
16
+ function collectTestFiles(dir) {
17
+ const files = [];
18
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
19
+ const path = join(dir, entry.name);
20
+ if (entry.isDirectory()) {
21
+ files.push(...collectTestFiles(path));
22
+ } else if (entry.isFile() && entry.name.endsWith(".test.js")) {
23
+ files.push(path);
24
+ }
25
+ }
26
+ return files.sort();
27
+ }
28
+
29
+ rmSync("test-dist", { recursive: true, force: true });
30
+ runNode([require.resolve("typescript/bin/tsc"), "-p", "tsconfig.test.json"]);
31
+
32
+ const testFiles = collectTestFiles("test-dist");
33
+ if (testFiles.length === 0) {
34
+ console.error("No compiled test files found under test-dist");
35
+ process.exit(1);
36
+ }
37
+
38
+ runNode(["--test", ...testFiles]);