@appchy/jarvis 0.1.46 → 0.1.47
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/dist/bin.js +26 -4
- package/dist/bin.js.map +1 -1
- package/dist/data/backends.mjs +10 -8
- package/dist/data/{chunk-LYW75USL.mjs → chunk-YBCQMMVE.mjs} +24 -2
- package/dist/data/embedders.mjs +1 -1
- package/dist/data/index.mjs +1 -1
- package/dist/data/labelers.mjs +1 -1
- package/dist/data/linkers.mjs +1 -1
- package/dist/data/mcp.mjs +1 -1
- package/dist/data/stores.mjs +1 -1
- package/package.json +5 -5
package/dist/data/backends.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IMPORT_RELATIONS
|
|
3
3
|
} from "./chunk-AA75N6NR.mjs";
|
|
4
|
-
import "./chunk-
|
|
4
|
+
import "./chunk-YBCQMMVE.mjs";
|
|
5
5
|
import "./chunk-RRJ6KKYL.mjs";
|
|
6
6
|
import {
|
|
7
7
|
backend
|
|
@@ -229,7 +229,7 @@ function graphify(options = {}) {
|
|
|
229
229
|
}
|
|
230
230
|
async function loadCommunityLabels(graphPath) {
|
|
231
231
|
const labels = /* @__PURE__ */ new Map();
|
|
232
|
-
const labelPath =
|
|
232
|
+
const labelPath = communityLabelsPath(graphPath);
|
|
233
233
|
try {
|
|
234
234
|
const raw = JSON.parse(await readFile2(labelPath, "utf8"));
|
|
235
235
|
if (!raw || typeof raw !== "object") return labels;
|
|
@@ -255,6 +255,7 @@ function mapAndFilter(raw, options, labels) {
|
|
|
255
255
|
if (matchIgnore && matchIgnore(sourceFile)) continue;
|
|
256
256
|
}
|
|
257
257
|
kept.add(id);
|
|
258
|
+
const community = communityOf(n, labels);
|
|
258
259
|
nodes.push({
|
|
259
260
|
id,
|
|
260
261
|
type: asString(n.file_type) ?? "code",
|
|
@@ -264,7 +265,7 @@ function mapAndFilter(raw, options, labels) {
|
|
|
264
265
|
// graphify carries the symbol's location as e.g. "L123" — keep it so rendered code
|
|
265
266
|
// nodes can surface `file:line` (Claude Code jumps/Reads by line). Parsed in lineOf.
|
|
266
267
|
...asString(n.source_location) ? { sourceLine: asString(n.source_location) } : {},
|
|
267
|
-
...
|
|
268
|
+
...community ? { community } : {},
|
|
268
269
|
origin: "graphify"
|
|
269
270
|
}
|
|
270
271
|
});
|
|
@@ -279,12 +280,13 @@ function mapAndFilter(raw, options, labels) {
|
|
|
279
280
|
return { nodes, edges };
|
|
280
281
|
}
|
|
281
282
|
function communityOf(n, labels) {
|
|
283
|
+
const id = n.community;
|
|
284
|
+
const key = id === void 0 || id === null || id === "" ? "" : String(id);
|
|
285
|
+
const ours = key ? labels.get(key) : void 0;
|
|
286
|
+
if (ours && !PLACEHOLDER_COMMUNITY.test(ours)) return ours;
|
|
282
287
|
const named = asString(n.community_name);
|
|
283
288
|
if (named && !PLACEHOLDER_COMMUNITY.test(named)) return named;
|
|
284
|
-
|
|
285
|
-
if (id === void 0 || id === null || id === "") return void 0;
|
|
286
|
-
const key = String(id);
|
|
287
|
-
return labels.get(key) ?? `Community ${key}`;
|
|
289
|
+
return key ? `Community ${key}` : void 0;
|
|
288
290
|
}
|
|
289
291
|
function graphifyOptions(ctx, graphRel) {
|
|
290
292
|
return { cwd: ctx.config.repoRoot, env: { ...process.env, GRAPHIFY_OUT: dirname(graphRel) } };
|
|
@@ -409,7 +411,7 @@ function sampleCommunities(raw) {
|
|
|
409
411
|
return communities;
|
|
410
412
|
}
|
|
411
413
|
function communityLabelsPath(graphPath) {
|
|
412
|
-
return resolve2(dirname(graphPath), ".
|
|
414
|
+
return resolve2(dirname(graphPath), "community-labels.json");
|
|
413
415
|
}
|
|
414
416
|
async function readCommunityLabels(graphPath) {
|
|
415
417
|
const out = /* @__PURE__ */ new Map();
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
// ../../packages/data/src/embeddings.ts
|
|
2
|
+
var CACHE_FORMAT = 2;
|
|
3
|
+
function encodeVector(vector) {
|
|
4
|
+
const floats = Float32Array.from(vector);
|
|
5
|
+
return Buffer.from(floats.buffer, floats.byteOffset, floats.byteLength).toString("base64");
|
|
6
|
+
}
|
|
7
|
+
function decodeVector(encoded) {
|
|
8
|
+
const buf = Buffer.from(encoded, "base64");
|
|
9
|
+
const floats = new Float32Array(buf.byteLength / 4);
|
|
10
|
+
Buffer.from(floats.buffer).set(buf);
|
|
11
|
+
return Array.from(floats);
|
|
12
|
+
}
|
|
2
13
|
async function buildEmbeddings(config, graph) {
|
|
3
14
|
const cfg = config.search;
|
|
4
15
|
if (!cfg) return void 0;
|
|
@@ -131,7 +142,13 @@ async function loadCache(config, ctx, model) {
|
|
|
131
142
|
const raw = await config.persistence.load(ctx, "embeddings");
|
|
132
143
|
if (raw) {
|
|
133
144
|
const parsed = JSON.parse(raw);
|
|
134
|
-
if (parsed.model === model && parsed.entries)
|
|
145
|
+
if (parsed.model === model && parsed.format === CACHE_FORMAT && parsed.entries) {
|
|
146
|
+
const entries = {};
|
|
147
|
+
for (const [id, entry] of Object.entries(parsed.entries)) {
|
|
148
|
+
entries[id] = { hash: entry.hash, vector: decodeVector(entry.vector) };
|
|
149
|
+
}
|
|
150
|
+
return { model: parsed.model, entries };
|
|
151
|
+
}
|
|
135
152
|
}
|
|
136
153
|
} catch {
|
|
137
154
|
}
|
|
@@ -139,7 +156,12 @@ async function loadCache(config, ctx, model) {
|
|
|
139
156
|
}
|
|
140
157
|
async function writeCache(config, ctx, cache) {
|
|
141
158
|
parsedCache.set(cacheKey(ctx, cache.model), cache);
|
|
142
|
-
|
|
159
|
+
const entries = {};
|
|
160
|
+
for (const [id, entry] of Object.entries(cache.entries)) {
|
|
161
|
+
entries[id] = { hash: entry.hash, vector: encodeVector(entry.vector) };
|
|
162
|
+
}
|
|
163
|
+
const onDisk = { model: cache.model, format: CACHE_FORMAT, entries };
|
|
164
|
+
await config.persistence.save(ctx, "embeddings", `${JSON.stringify(onDisk)}
|
|
143
165
|
`);
|
|
144
166
|
}
|
|
145
167
|
function hashText(text) {
|
package/dist/data/embedders.mjs
CHANGED
package/dist/data/index.mjs
CHANGED
package/dist/data/labelers.mjs
CHANGED
package/dist/data/linkers.mjs
CHANGED
package/dist/data/mcp.mjs
CHANGED
package/dist/data/stores.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appchy/jarvis",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.47",
|
|
4
4
|
"description": "Jarvis — local AI coding assistant CLI",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
"tsup": "^8.5.1",
|
|
50
50
|
"typescript": "^5.7.0",
|
|
51
51
|
"vitest": "^2.1.0",
|
|
52
|
-
"@jarvis/agents": "1.0.0",
|
|
53
|
-
"@jarvis/anthropic": "1.0.0",
|
|
54
|
-
"@jarvis/board": "0.1.0",
|
|
55
52
|
"@jarvis/data": "0.1.0",
|
|
56
53
|
"@jarvis/logger": "1.0.0",
|
|
57
54
|
"@jarvis/rpc": "1.0.0",
|
|
58
55
|
"@jarvis/types": "1.0.0",
|
|
56
|
+
"@jarvis/agents": "1.0.0",
|
|
59
57
|
"@jarvis/typescript-config": "1.0.0",
|
|
60
|
-
"@jarvis/vitest-config": "1.0.0"
|
|
58
|
+
"@jarvis/vitest-config": "1.0.0",
|
|
59
|
+
"@jarvis/board": "0.1.0",
|
|
60
|
+
"@jarvis/anthropic": "1.0.0"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"dev": "tsx watch src/bin.ts start --foreground",
|