@ijfw/memory-server 1.3.0
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/ijfw +27 -0
- package/bin/ijfw-dashboard +180 -0
- package/bin/ijfw-dispatch-plan +41 -0
- package/bin/ijfw-memorize +273 -0
- package/bin/ijfw-memory +51 -0
- package/fixtures/demo-target.js +28 -0
- package/package.json +53 -0
- package/src/api-client.js +190 -0
- package/src/audit-roster.js +315 -0
- package/src/caps.js +37 -0
- package/src/cold-scan-runner.mjs +37 -0
- package/src/compute/edges.js +155 -0
- package/src/compute/extract.js +560 -0
- package/src/compute/fts5.js +420 -0
- package/src/compute/graph-auto-index.js +191 -0
- package/src/compute/graph-lock.js +114 -0
- package/src/compute/index.js +18 -0
- package/src/compute/migration-runner.js +116 -0
- package/src/compute/migrations/001-initial.js +23 -0
- package/src/compute/migrations/002-porter-stemming-source.js +139 -0
- package/src/compute/migrations/003-tier-semantic.js +69 -0
- package/src/compute/migrations/004-kg-tables.js +83 -0
- package/src/compute/migrations/005-stale-candidate.js +72 -0
- package/src/compute/python-resolver.js +106 -0
- package/src/compute/runner-vm.js +185 -0
- package/src/compute/runner.js +416 -0
- package/src/compute/sandbox-detect.js +122 -0
- package/src/compute/sandbox-linux.js +164 -0
- package/src/compute/sandbox-macos.js +167 -0
- package/src/compute/sandbox-windows.js +63 -0
- package/src/compute/schema.sql +118 -0
- package/src/compute/staleness.js +239 -0
- package/src/compute/synonyms.js +367 -0
- package/src/compute/traverse.js +180 -0
- package/src/cost/aggregator.js +229 -0
- package/src/cost/pricing.js +134 -0
- package/src/cost/readers/claude.js +179 -0
- package/src/cost/readers/codex.js +131 -0
- package/src/cost/readers/gemini.js +111 -0
- package/src/cost/savings.js +243 -0
- package/src/cross-dispatcher.js +437 -0
- package/src/cross-orchestrator-cli.js +1885 -0
- package/src/cross-orchestrator.js +598 -0
- package/src/cross-project-search.js +114 -0
- package/src/dashboard-client.html +1180 -0
- package/src/dashboard-server.js +895 -0
- package/src/design-companion.js +81 -0
- package/src/dispatch/colon-syntax.js +732 -0
- package/src/dispatch-planner.js +235 -0
- package/src/dream/cooldown.js +105 -0
- package/src/dream/runner.mjs +373 -0
- package/src/dream/staleness-wiring.js +195 -0
- package/src/feedback-detector.js +57 -0
- package/src/hero-line.js +115 -0
- package/src/importers/claude-mem.js +152 -0
- package/src/importers/cli.js +311 -0
- package/src/importers/common.js +84 -0
- package/src/importers/discover.js +235 -0
- package/src/importers/rtk.js +107 -0
- package/src/intent-router.js +221 -0
- package/src/lib/atomic-io.js +201 -0
- package/src/lib/cache.js +33 -0
- package/src/lib/npm-view.js +104 -0
- package/src/lib/status-card.js +95 -0
- package/src/lib/token.js +85 -0
- package/src/memory/fts5.js +349 -0
- package/src/memory/migration-runner.js +116 -0
- package/src/memory/migrations/001-fts5-init.js +26 -0
- package/src/memory/migrations/002-tier-semantic.js +60 -0
- package/src/memory/migrations/003-stale-candidate.js +60 -0
- package/src/memory/reader.js +300 -0
- package/src/memory/recall-counter.js +76 -0
- package/src/memory/schema.sql +79 -0
- package/src/memory/search.js +431 -0
- package/src/memory/staleness.js +237 -0
- package/src/memory/tier-promotion.js +377 -0
- package/src/memory/tokenize.js +63 -0
- package/src/project-type-detector.js +866 -0
- package/src/prompt-check.js +171 -0
- package/src/ralph-allowlist.js +88 -0
- package/src/receipts.js +129 -0
- package/src/redactor.js +107 -0
- package/src/sandbox.js +275 -0
- package/src/sanitizer.js +69 -0
- package/src/scan-resume.js +167 -0
- package/src/schema.js +82 -0
- package/src/search-bm25.js +108 -0
- package/src/server.js +1414 -0
- package/src/swarm-config.js +80 -0
- package/src/trident/dispatch.js +211 -0
- package/src/trident/lens-health.js +253 -0
- package/src/update-apply.js +79 -0
- package/src/update-check.js +136 -0
- package/src/vectors.js +178 -0
- package/templates/design/bento-grid.md +84 -0
- package/templates/design/brutalist-luxe.md +82 -0
- package/templates/design/cinematic-dark.md +82 -0
- package/templates/design/data-dense-dashboard.md +88 -0
- package/templates/design/editorial-warm.md +81 -0
- package/templates/design/glassmorphic.md +84 -0
- package/templates/design/magazine-editorial.md +84 -0
- package/templates/design/maximalist-vibrant.md +85 -0
- package/templates/design/neo-swiss-tech.md +85 -0
- package/templates/design/swiss-minimal.md +80 -0
- package/templates/design/terminal-native.md +83 -0
- package/templates/design/warm-organic.md +84 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IJFW Design Companion -- visual companion helpers.
|
|
3
|
+
* Zero deps. node:fs, node:events, node:path only.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { EventEmitter } from 'node:events';
|
|
7
|
+
import { existsSync, readdirSync, statSync, watch } from 'node:fs';
|
|
8
|
+
import { join } from 'node:path';
|
|
9
|
+
|
|
10
|
+
export const PLACEHOLDER_HTML = `<!DOCTYPE html>
|
|
11
|
+
<html lang="en">
|
|
12
|
+
<head>
|
|
13
|
+
<meta charset="UTF-8">
|
|
14
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
15
|
+
<title>IJFW Design Companion</title>
|
|
16
|
+
<style>
|
|
17
|
+
*{box-sizing:border-box;margin:0;padding:0}
|
|
18
|
+
body{background:#0f172a;color:#94a3b8;font-family:system-ui,-apple-system,sans-serif;
|
|
19
|
+
display:flex;align-items:center;justify-content:center;min-height:100vh;text-align:center}
|
|
20
|
+
.box{max-width:480px;padding:2rem}
|
|
21
|
+
h1{color:#f1f5f9;font-size:1.5rem;margin-bottom:1rem}
|
|
22
|
+
code{background:#1e293b;color:#7dd3fc;padding:.2em .5em;border-radius:4px;font-size:.875rem}
|
|
23
|
+
</style>
|
|
24
|
+
</head>
|
|
25
|
+
<body>
|
|
26
|
+
<div class="box">
|
|
27
|
+
<h1>Design companion active.</h1>
|
|
28
|
+
<p>Push a design with:<br><br><code>ijfw design push <file></code></p>
|
|
29
|
+
</div>
|
|
30
|
+
</body>
|
|
31
|
+
</html>`;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Returns the path of the newest .html file in contentDir by mtime.
|
|
35
|
+
* Returns null when the directory is empty or does not exist.
|
|
36
|
+
*/
|
|
37
|
+
export function getNewestFile(contentDir) {
|
|
38
|
+
if (!existsSync(contentDir)) return null;
|
|
39
|
+
let newest = null;
|
|
40
|
+
let newestMtime = 0;
|
|
41
|
+
for (const name of readdirSync(contentDir)) {
|
|
42
|
+
if (!name.endsWith('.html')) continue;
|
|
43
|
+
const full = join(contentDir, name);
|
|
44
|
+
try {
|
|
45
|
+
const { mtimeMs } = statSync(full);
|
|
46
|
+
if (mtimeMs > newestMtime) {
|
|
47
|
+
newestMtime = mtimeMs;
|
|
48
|
+
newest = full;
|
|
49
|
+
}
|
|
50
|
+
} catch {}
|
|
51
|
+
}
|
|
52
|
+
return newest;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Watches contentDir for new/changed .html files.
|
|
57
|
+
* Returns an EventEmitter that emits 'new-content' (with the file path) on change.
|
|
58
|
+
* Uses fs.watch with a 100ms debounce.
|
|
59
|
+
*/
|
|
60
|
+
export function watchContentDir(contentDir) {
|
|
61
|
+
const emitter = new EventEmitter();
|
|
62
|
+
let debounce = null;
|
|
63
|
+
|
|
64
|
+
function trigger() {
|
|
65
|
+
clearTimeout(debounce);
|
|
66
|
+
debounce = setTimeout(() => {
|
|
67
|
+
const file = getNewestFile(contentDir);
|
|
68
|
+
emitter.emit('new-content', file);
|
|
69
|
+
}, 100);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!existsSync(contentDir)) return emitter;
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
const w = watch(contentDir, trigger);
|
|
76
|
+
w.on('error', () => { /* Windows EPERM: skip; emitter still serves polled state */ });
|
|
77
|
+
emitter.once('_stop', () => { try { w.close(); } catch {} });
|
|
78
|
+
} catch {}
|
|
79
|
+
|
|
80
|
+
return emitter;
|
|
81
|
+
}
|