@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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  IMPORT_RELATIONS
3
3
  } from "./chunk-AA75N6NR.mjs";
4
- import "./chunk-LYW75USL.mjs";
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 = resolve2(dirname(graphPath), ".graphify_labels.json");
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
- ...communityOf(n, labels) ? { community: communityOf(n, labels) } : {},
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
- const id = n.community;
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), ".graphify_labels.json");
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) return parsed;
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
- await config.persistence.save(ctx, "embeddings", `${JSON.stringify(cache)}
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) {
@@ -1,5 +1,5 @@
1
1
  import "./chunk-AA75N6NR.mjs";
2
- import "./chunk-LYW75USL.mjs";
2
+ import "./chunk-YBCQMMVE.mjs";
3
3
  import "./chunk-RRJ6KKYL.mjs";
4
4
  import {
5
5
  embedder
@@ -44,7 +44,7 @@ import {
44
44
  rankNodes,
45
45
  rrf,
46
46
  searchText
47
- } from "./chunk-LYW75USL.mjs";
47
+ } from "./chunk-YBCQMMVE.mjs";
48
48
  import "./chunk-RRJ6KKYL.mjs";
49
49
  import {
50
50
  backend,
@@ -1,5 +1,5 @@
1
1
  import "./chunk-AA75N6NR.mjs";
2
- import "./chunk-LYW75USL.mjs";
2
+ import "./chunk-YBCQMMVE.mjs";
3
3
  import "./chunk-RRJ6KKYL.mjs";
4
4
  import {
5
5
  labeler
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  embedQuery,
3
3
  loadEmbeddings
4
- } from "./chunk-LYW75USL.mjs";
4
+ } from "./chunk-YBCQMMVE.mjs";
5
5
  import {
6
6
  linker
7
7
  } from "./chunk-AYOJSS2F.mjs";
package/dist/data/mcp.mjs CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  isSingleTerm,
20
20
  loadSearchRuntime,
21
21
  rankNodes
22
- } from "./chunk-LYW75USL.mjs";
22
+ } from "./chunk-YBCQMMVE.mjs";
23
23
  import "./chunk-RRJ6KKYL.mjs";
24
24
  import "./chunk-AYOJSS2F.mjs";
25
25
  import {
@@ -2,7 +2,7 @@ import {
2
2
  dot,
3
3
  normalize
4
4
  } from "./chunk-AA75N6NR.mjs";
5
- import "./chunk-LYW75USL.mjs";
5
+ import "./chunk-YBCQMMVE.mjs";
6
6
  import "./chunk-RRJ6KKYL.mjs";
7
7
  import {
8
8
  store
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appchy/jarvis",
3
- "version": "0.1.46",
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",