entroly-wasm 0.19.0 → 0.19.2
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/bin/entroly-wasm.js +3 -0
- package/index.js +84 -0
- package/js/agentskills_export.js +129 -0
- package/js/auto_index.js +262 -0
- package/js/autotune.js +627 -0
- package/js/checkpoint.js +108 -0
- package/js/cli.js +321 -0
- package/js/cogops.js +513 -0
- package/js/config.js +53 -0
- package/js/distill.js +155 -0
- package/js/evolution_daemon.js +335 -0
- package/js/federation.js +444 -0
- package/js/gateways.js +170 -0
- package/js/multimodal.js +64 -0
- package/js/repo_map.js +112 -0
- package/js/server.js +465 -0
- package/js/skills.js +124 -0
- package/js/value_tracker.js +181 -0
- package/js/vault.js +237 -0
- package/js/vault_observer.js +129 -0
- package/js/workspace.js +116 -0
- package/package.json +65 -7
- package/{entroly_wasm_bg.wasm → pkg/entroly_wasm_bg.wasm} +0 -0
- /package/{entroly_wasm.d.ts → pkg/entroly_wasm.d.ts} +0 -0
- /package/{entroly_wasm.js → pkg/entroly_wasm.js} +0 -0
package/js/workspace.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace Change Listener — pure-JS port of entroly/change_listener.py
|
|
3
|
+
* Detects file changes, marks beliefs stale, recompiles, verifies.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const { SOURCE_EXTS } = require('./vault');
|
|
11
|
+
|
|
12
|
+
class WorkspaceChangeListener {
|
|
13
|
+
constructor(vault, compiler, verifier, changePipe, projectDir) {
|
|
14
|
+
this._vault = vault;
|
|
15
|
+
this._compiler = compiler;
|
|
16
|
+
this._verifier = verifier;
|
|
17
|
+
this._changePipe = changePipe;
|
|
18
|
+
this._projectDir = projectDir || process.cwd();
|
|
19
|
+
this._lastScan = {}; // file -> mtime
|
|
20
|
+
this._watcher = null;
|
|
21
|
+
this._running = false;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
scanOnce(force = false, maxFiles = 100) {
|
|
25
|
+
const changes = { new: [], modified: [], deleted: [] };
|
|
26
|
+
const currentFiles = {};
|
|
27
|
+
const walk = (dir, depth = 0) => {
|
|
28
|
+
if (depth > 8) return;
|
|
29
|
+
let entries;
|
|
30
|
+
try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return; }
|
|
31
|
+
for (const e of entries) {
|
|
32
|
+
if (e.name.startsWith('.') || e.name === 'node_modules' || e.name === '__pycache__' || e.name === 'target') continue;
|
|
33
|
+
const full = path.join(dir, e.name);
|
|
34
|
+
if (e.isDirectory()) { walk(full, depth + 1); continue; }
|
|
35
|
+
if (!SOURCE_EXTS.has(path.extname(e.name))) continue;
|
|
36
|
+
try {
|
|
37
|
+
const stat = fs.statSync(full);
|
|
38
|
+
const mtime = stat.mtimeMs;
|
|
39
|
+
const rel = path.relative(this._projectDir, full).replace(/\\/g, '/');
|
|
40
|
+
currentFiles[rel] = mtime;
|
|
41
|
+
if (!this._lastScan[rel]) changes.new.push(rel);
|
|
42
|
+
else if (force || mtime > this._lastScan[rel]) changes.modified.push(rel);
|
|
43
|
+
} catch {}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
walk(this._projectDir);
|
|
47
|
+
|
|
48
|
+
// Detect deletions
|
|
49
|
+
for (const rel of Object.keys(this._lastScan)) {
|
|
50
|
+
if (!currentFiles[rel]) changes.deleted.push(rel);
|
|
51
|
+
}
|
|
52
|
+
this._lastScan = currentFiles;
|
|
53
|
+
|
|
54
|
+
const allChanged = [...changes.new, ...changes.modified].slice(0, maxFiles);
|
|
55
|
+
let beliefsStaled = 0, beliefsRecompiled = 0;
|
|
56
|
+
|
|
57
|
+
if (allChanged.length > 0) {
|
|
58
|
+
const staleResult = this._vault.markBeliefsStaleForFiles(allChanged);
|
|
59
|
+
beliefsStaled = staleResult.updated_entities ? staleResult.updated_entities.length : 0;
|
|
60
|
+
|
|
61
|
+
// Recompile changed files
|
|
62
|
+
for (const rel of allChanged.slice(0, 20)) {
|
|
63
|
+
try {
|
|
64
|
+
const fp = path.join(this._projectDir, rel);
|
|
65
|
+
if (fs.existsSync(fp)) {
|
|
66
|
+
const dir = path.dirname(fp);
|
|
67
|
+
const result = this._compiler.compileDirectory(dir, 1);
|
|
68
|
+
beliefsRecompiled += result.beliefs_written;
|
|
69
|
+
}
|
|
70
|
+
} catch {}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
status: 'scanned',
|
|
76
|
+
new_files: changes.new.length,
|
|
77
|
+
modified_files: changes.modified.length,
|
|
78
|
+
deleted_files: changes.deleted.length,
|
|
79
|
+
beliefs_staled: beliefsStaled,
|
|
80
|
+
beliefs_recompiled: beliefsRecompiled,
|
|
81
|
+
total_tracked: Object.keys(currentFiles).length,
|
|
82
|
+
engine: 'javascript',
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
start(intervalS = 120, maxFiles = 100, forceInitial = false) {
|
|
87
|
+
if (this._running) return { status: 'already_running', engine: 'javascript' };
|
|
88
|
+
this._running = true;
|
|
89
|
+
|
|
90
|
+
// Initial scan
|
|
91
|
+
const initial = this.scanOnce(forceInitial, maxFiles);
|
|
92
|
+
|
|
93
|
+
// Set up interval
|
|
94
|
+
this._interval = setInterval(() => {
|
|
95
|
+
try { this.scanOnce(false, maxFiles); } catch {}
|
|
96
|
+
}, intervalS * 1000);
|
|
97
|
+
|
|
98
|
+
// Unref so it doesn't keep the process alive
|
|
99
|
+
if (this._interval.unref) this._interval.unref();
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
status: 'started',
|
|
103
|
+
interval_s: intervalS,
|
|
104
|
+
initial_scan: initial,
|
|
105
|
+
engine: 'javascript',
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
stop() {
|
|
110
|
+
if (this._interval) { clearInterval(this._interval); this._interval = null; }
|
|
111
|
+
this._running = false;
|
|
112
|
+
return { status: 'stopped', engine: 'javascript' };
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
module.exports = { WorkspaceChangeListener };
|
package/package.json
CHANGED
|
@@ -1,12 +1,70 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "entroly-wasm",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"version": "0.19.2",
|
|
4
|
+
"description": "Information-theoretic context optimization for AI coding agents. Zero-friction, pure WebAssembly - no Python dependency.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "pkg/entroly_wasm.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"entroly-wasm": "./bin/entroly-wasm.js"
|
|
9
|
+
},
|
|
5
10
|
"files": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"entroly_wasm.
|
|
11
|
+
"index.js",
|
|
12
|
+
"pkg/entroly_wasm_bg.wasm",
|
|
13
|
+
"pkg/entroly_wasm.js",
|
|
14
|
+
"pkg/entroly_wasm.d.ts",
|
|
15
|
+
"bin/entroly-wasm.js",
|
|
16
|
+
"js/cli.js",
|
|
17
|
+
"js/server.js",
|
|
18
|
+
"js/config.js",
|
|
19
|
+
"js/auto_index.js",
|
|
20
|
+
"js/checkpoint.js",
|
|
21
|
+
"js/autotune.js",
|
|
22
|
+
"js/vault.js",
|
|
23
|
+
"js/cogops.js",
|
|
24
|
+
"js/workspace.js",
|
|
25
|
+
"js/repo_map.js",
|
|
26
|
+
"js/skills.js",
|
|
27
|
+
"js/multimodal.js",
|
|
28
|
+
"js/value_tracker.js",
|
|
29
|
+
"js/agentskills_export.js",
|
|
30
|
+
"js/gateways.js",
|
|
31
|
+
"js/vault_observer.js",
|
|
32
|
+
"js/distill.js",
|
|
33
|
+
"js/federation.js",
|
|
34
|
+
"js/evolution_daemon.js"
|
|
9
35
|
],
|
|
10
|
-
"
|
|
11
|
-
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "wasm-pack build --target nodejs --out-dir pkg",
|
|
38
|
+
"prepack": "npm run build",
|
|
39
|
+
"pretest": "npm run build",
|
|
40
|
+
"serve": "node js/server.js",
|
|
41
|
+
"optimize": "node js/cli.js optimize",
|
|
42
|
+
"health": "node js/cli.js health",
|
|
43
|
+
"demo": "node js/cli.js demo",
|
|
44
|
+
"autotune": "node js/cli.js autotune",
|
|
45
|
+
"test": "node test_wasm_e2e.js"
|
|
46
|
+
},
|
|
47
|
+
"keywords": [
|
|
48
|
+
"entroly",
|
|
49
|
+
"context-optimization",
|
|
50
|
+
"mcp",
|
|
51
|
+
"mcp-server",
|
|
52
|
+
"ai",
|
|
53
|
+
"agents",
|
|
54
|
+
"wasm",
|
|
55
|
+
"webassembly",
|
|
56
|
+
"information-theory",
|
|
57
|
+
"knapsack",
|
|
58
|
+
"entropy",
|
|
59
|
+
"autotune"
|
|
60
|
+
],
|
|
61
|
+
"repository": {
|
|
62
|
+
"type": "git",
|
|
63
|
+
"url": "https://github.com/juyterman1000/entroly"
|
|
64
|
+
},
|
|
65
|
+
"author": "entroly",
|
|
66
|
+
"license": "Apache-2.0",
|
|
67
|
+
"engines": {
|
|
68
|
+
"node": ">=16.0.0"
|
|
69
|
+
}
|
|
12
70
|
}
|
|
index cd82f59..baa3d64 100644
|
|
|
Binary file
|
|
File without changes
|
|
File without changes
|