remimem 0.1.0 → 0.2.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/README.md +8 -3
- package/dist/cli/index.js +22 -1
- package/dist/cli/program.js +152 -30
- package/dist/cli/ui.js +138 -0
- package/dist/config/index.js +8 -0
- package/dist/dashboard/api.js +196 -0
- package/dist/dashboard/graph.js +58 -0
- package/dist/dashboard/server.js +164 -0
- package/dist/dashboard/ui/app.css +1 -0
- package/dist/dashboard/ui/app.js +324 -0
- package/dist/dashboard/ui/app.js.LEGAL.txt +18 -0
- package/dist/dashboard/ui/index.html +32 -0
- package/dist/embedder/index.js +32 -2
- package/dist/mcp/server.js +15 -1
- package/dist/mcp/tools.js +1 -0
- package/dist/memory/index.js +5 -2
- package/dist/store/index.js +25 -0
- package/package.json +5 -3
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Bundled license information:
|
|
2
|
+
|
|
3
|
+
cytoscape/dist/cytoscape.esm.mjs:
|
|
4
|
+
/*!
|
|
5
|
+
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
|
|
6
|
+
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
|
|
7
|
+
Licensed under The MIT License (http://opensource.org/licenses/MIT)
|
|
8
|
+
*/
|
|
9
|
+
/*!
|
|
10
|
+
Event object based on jQuery events, MIT license
|
|
11
|
+
|
|
12
|
+
https://jquery.org/license/
|
|
13
|
+
https://tldrlegal.com/license/mit-license
|
|
14
|
+
https://github.com/jquery/jquery/blob/master/src/event.js
|
|
15
|
+
*/
|
|
16
|
+
/*! Bezier curve function generator. Copyright 2014-2026 Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License
|
|
17
|
+
* https://github.com/gre/bezier-easing */
|
|
18
|
+
/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<meta name="referrer" content="no-referrer" />
|
|
7
|
+
<title>remimem dashboard</title>
|
|
8
|
+
<link rel="stylesheet" href="/app.css" />
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div class="shell">
|
|
12
|
+
<aside class="side">
|
|
13
|
+
<div class="brand">
|
|
14
|
+
<span class="mark" aria-hidden="true">μ</span>
|
|
15
|
+
<span class="name">remimem</span>
|
|
16
|
+
</div>
|
|
17
|
+
<p class="root" id="root" title=""></p>
|
|
18
|
+
<nav class="tabs" aria-label="Views">
|
|
19
|
+
<a href="#health" data-view="health">Health</a>
|
|
20
|
+
<a href="#graph" data-view="graph">Graph</a>
|
|
21
|
+
<a href="#search" data-view="search">Search</a>
|
|
22
|
+
<a href="#memory" data-view="memory">Memory</a>
|
|
23
|
+
<a href="#settings" data-view="settings">Settings</a>
|
|
24
|
+
</nav>
|
|
25
|
+
<p class="version" id="version"></p>
|
|
26
|
+
</aside>
|
|
27
|
+
<main id="main" tabindex="-1"></main>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="toast" id="toast" role="status" aria-live="polite"></div>
|
|
30
|
+
<script type="module" src="/app.js"></script>
|
|
31
|
+
</body>
|
|
32
|
+
</html>
|
package/dist/embedder/index.js
CHANGED
|
@@ -24,14 +24,44 @@ function normalize(vector) {
|
|
|
24
24
|
const norm = Math.sqrt(sum) || 1;
|
|
25
25
|
return vector.map((x) => x / norm);
|
|
26
26
|
}
|
|
27
|
+
let downloadListener;
|
|
28
|
+
/**
|
|
29
|
+
* Lets the CLI draw the first download of a local model. The MCP server never sets it, so
|
|
30
|
+
* nothing extra is ever written while it serves.
|
|
31
|
+
*/
|
|
32
|
+
export function onModelDownload(listener) {
|
|
33
|
+
downloadListener = listener;
|
|
34
|
+
}
|
|
35
|
+
/** Sums byte progress across a model's files, and reports it only while files download. */
|
|
36
|
+
function progressReporter(model) {
|
|
37
|
+
const files = new Map();
|
|
38
|
+
let downloading = false;
|
|
39
|
+
return (info) => {
|
|
40
|
+
const event = info;
|
|
41
|
+
// Files read from the cache also report progress; only a real download is shown.
|
|
42
|
+
if (event.status === 'download')
|
|
43
|
+
downloading = true;
|
|
44
|
+
if (!downloading || !downloadListener || event.status !== 'progress' || !event.file)
|
|
45
|
+
return;
|
|
46
|
+
files.set(event.file, { loaded: event.loaded ?? 0, total: event.total ?? 0 });
|
|
47
|
+
let loaded = 0;
|
|
48
|
+
let total = 0;
|
|
49
|
+
for (const f of files.values()) {
|
|
50
|
+
loaded += f.loaded;
|
|
51
|
+
total += f.total;
|
|
52
|
+
}
|
|
53
|
+
downloadListener(model, loaded, total);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
27
56
|
function localProvider(model, maxTokens) {
|
|
28
57
|
// Loaded on first use: importing the runtime and reading the model takes a while.
|
|
29
58
|
let ready;
|
|
30
59
|
const load = async () => {
|
|
31
60
|
const { AutoModel, AutoTokenizer, env, mean_pooling } = await import('@huggingface/transformers');
|
|
32
61
|
env.cacheDir = modelCacheDir();
|
|
33
|
-
const
|
|
34
|
-
const
|
|
62
|
+
const progress_callback = progressReporter(model);
|
|
63
|
+
const tokenizer = await AutoTokenizer.from_pretrained(model, { progress_callback });
|
|
64
|
+
const network = await AutoModel.from_pretrained(model, { dtype: 'q8', progress_callback });
|
|
35
65
|
return async (texts) => {
|
|
36
66
|
const inputs = tokenizer(texts, { padding: true, truncation: true, max_length: maxTokens });
|
|
37
67
|
const output = await network(inputs);
|
package/dist/mcp/server.js
CHANGED
|
@@ -4,6 +4,7 @@ import { join } from 'node:path';
|
|
|
4
4
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
5
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
6
6
|
import { CONFIG_DIR, loadConfig } from '../config/index.js';
|
|
7
|
+
import { startDashboard } from '../dashboard/server.js';
|
|
7
8
|
import { createProvider } from '../embedder/index.js';
|
|
8
9
|
import { RemimemError } from '../errors.js';
|
|
9
10
|
import { log } from '../log.js';
|
|
@@ -60,9 +61,22 @@ export async function serve(root) {
|
|
|
60
61
|
mkdirSync(join(root, CONFIG_DIR), { recursive: true });
|
|
61
62
|
const store = new Store(join(root, CONFIG_DIR, 'index.db'));
|
|
62
63
|
const ctx = { root, config, store, provider: createProvider(config.embedding) };
|
|
64
|
+
// The dashboard is a convenience: if its port cannot be opened, the tools still work.
|
|
65
|
+
const dashboard = config.dashboard.enabled
|
|
66
|
+
? await startDashboard(ctx, config.dashboard.port).catch((error) => {
|
|
67
|
+
log.warn(`dashboard not started: ${String(error)}`);
|
|
68
|
+
return undefined;
|
|
69
|
+
})
|
|
70
|
+
: undefined;
|
|
71
|
+
// The dashboard lives as long as the agent's session: it never keeps the process alive.
|
|
72
|
+
dashboard?.unref();
|
|
73
|
+
ctx.dashboardUrl = dashboard?.url;
|
|
63
74
|
const server = createServer(ctx);
|
|
64
75
|
const transport = new StdioServerTransport();
|
|
65
|
-
transport.onclose = () =>
|
|
76
|
+
transport.onclose = () => {
|
|
77
|
+
void dashboard?.close();
|
|
78
|
+
store.close();
|
|
79
|
+
};
|
|
66
80
|
await server.connect(transport);
|
|
67
81
|
log.info(`serving ${root} over stdio`);
|
|
68
82
|
}
|
package/dist/mcp/tools.js
CHANGED
|
@@ -268,5 +268,6 @@ export async function indexStatus(ctx) {
|
|
|
268
268
|
`Last indexed: ${store.getMeta('last_indexed_at') ?? 'unknown'}${commit ? ` at commit ${commit.slice(0, 12)}` : ' (no git commit)'}`,
|
|
269
269
|
`Pending changes: ${pending.changed} changed, ${pending.added} new, ${pending.deleted} deleted${pending.changed + pending.added + pending.deleted > 0 ? ' (run `remimem index`)' : ''}`,
|
|
270
270
|
`Embedding model: ${model ? `${model} (${store.vectorCount()} of ${counts.chunks} chunks embedded)` : 'none (keyword search only)'}`,
|
|
271
|
+
...(ctx.dashboardUrl ? [`Dashboard: ${ctx.dashboardUrl}`] : []),
|
|
271
272
|
].join('\n');
|
|
272
273
|
}
|
package/dist/memory/index.js
CHANGED
|
@@ -150,12 +150,15 @@ export function remember(root, store, input) {
|
|
|
150
150
|
links.push({ ...link, contentHash: currentHash(store, files, link) ?? '' });
|
|
151
151
|
}
|
|
152
152
|
const now = new Date().toISOString();
|
|
153
|
+
const existing = input.id === undefined ? undefined : store.listMemories().find((m) => m.id === input.id);
|
|
154
|
+
if (input.id !== undefined && !existing)
|
|
155
|
+
throw new MemoryError(`No memory with id ${input.id}.`);
|
|
153
156
|
const memory = {
|
|
154
|
-
id: `m_${randomBytes(4).toString('hex')}`,
|
|
157
|
+
id: existing?.id ?? `m_${randomBytes(4).toString('hex')}`,
|
|
155
158
|
kind: input.kind,
|
|
156
159
|
text: input.text.trim(),
|
|
157
160
|
tags: [...new Set(input.tags ?? [])],
|
|
158
|
-
createdAt: now,
|
|
161
|
+
createdAt: existing?.createdAt ?? now,
|
|
159
162
|
updatedAt: now,
|
|
160
163
|
links,
|
|
161
164
|
};
|
package/dist/store/index.js
CHANGED
|
@@ -219,6 +219,31 @@ export class Store {
|
|
|
219
219
|
.prepare('INSERT INTO query_log (tool, query, tokens_returned, baseline_tokens_estimate, latency_ms, created_at) VALUES (?, ?, ?, ?, ?, ?)')
|
|
220
220
|
.run(entry.tool, entry.query, entry.tokensReturned, entry.baselineTokens, entry.latencyMs, new Date().toISOString());
|
|
221
221
|
}
|
|
222
|
+
/** Queries and tokens per day, oldest first, for the dashboard's savings chart. */
|
|
223
|
+
queryLogDaily() {
|
|
224
|
+
return this.db
|
|
225
|
+
.prepare(`SELECT substr(created_at, 1, 10) AS day, COUNT(*) AS queries,
|
|
226
|
+
SUM(tokens_returned) AS tokensReturned, SUM(baseline_tokens_estimate) AS baselineTokens
|
|
227
|
+
FROM query_log GROUP BY day ORDER BY day`)
|
|
228
|
+
.all();
|
|
229
|
+
}
|
|
230
|
+
/** Every file with its language and number of symbols, for the dashboard's graph. */
|
|
231
|
+
fileSummaries() {
|
|
232
|
+
return this.db
|
|
233
|
+
.prepare(`SELECT f.path, f.language, COUNT(s.id) AS symbols
|
|
234
|
+
FROM files f LEFT JOIN symbols s ON s.file_id = f.id GROUP BY f.id ORDER BY f.path`)
|
|
235
|
+
.all();
|
|
236
|
+
}
|
|
237
|
+
/** Resolved symbol edges summed per pair of different files. */
|
|
238
|
+
fileEdges() {
|
|
239
|
+
return this.db
|
|
240
|
+
.prepare(`SELECT sf.path AS src, df.path AS dst, COUNT(*) AS weight
|
|
241
|
+
FROM edges e
|
|
242
|
+
JOIN symbols s ON s.id = e.src_symbol_id JOIN files sf ON sf.id = s.file_id
|
|
243
|
+
JOIN symbols d ON d.id = e.dst_symbol_id JOIN files df ON df.id = d.file_id
|
|
244
|
+
WHERE sf.id <> df.id GROUP BY sf.id, df.id`)
|
|
245
|
+
.all();
|
|
246
|
+
}
|
|
222
247
|
/** Totals per tool over the whole query log. */
|
|
223
248
|
queryLogSummary() {
|
|
224
249
|
return this.db
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "remimem",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Codebase memory for coding agents: a local-first MCP server and CLI that serves only the code context an agent needs",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Jaswanth Remiel AG",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"node": ">=22.13.0"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
|
-
"build": "tsc -p tsconfig.build.json && node -e \"require('fs').chmodSync('dist/cli/index.js', 0o755)\"",
|
|
25
|
-
"typecheck": "tsc --noEmit",
|
|
24
|
+
"build": "tsc -p tsconfig.build.json && node scripts/build-dashboard.mjs && node -e \"require('fs').chmodSync('dist/cli/index.js', 0o755)\"",
|
|
25
|
+
"typecheck": "tsc --noEmit && tsc --noEmit -p src/dashboard/ui",
|
|
26
26
|
"lint": "eslint src test scripts eslint.config.js vitest.config.js",
|
|
27
27
|
"format": "prettier --write src scripts .github grammars/README.md \"docs/**/*.md\" \"test/*.{ts,mjs}\" \"*.{js,json}\" README.md DECISIONS.md PROGRESS.md SETUP.md CONTRIBUTING.md CHANGELOG.md RELEASING.md",
|
|
28
28
|
"format:check": "prettier --check src scripts .github grammars/README.md \"docs/**/*.md\" \"test/*.{ts,mjs}\" \"*.{js,json}\" README.md DECISIONS.md PROGRESS.md SETUP.md CONTRIBUTING.md CHANGELOG.md RELEASING.md",
|
|
@@ -49,6 +49,8 @@
|
|
|
49
49
|
"@types/better-sqlite3": "^9.6.0",
|
|
50
50
|
"@types/node": "^22.20.5",
|
|
51
51
|
"@vitest/coverage-v8": "^5.1.0",
|
|
52
|
+
"cytoscape": "^3.35.0",
|
|
53
|
+
"esbuild": "^0.28.2",
|
|
52
54
|
"eslint": "^10.14.0",
|
|
53
55
|
"prettier": "^3.10.1",
|
|
54
56
|
"typescript": "~6.0.3",
|