@neat.is/core 0.4.20-dev.20260620 → 0.4.20-dev.20260622

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.
@@ -18,7 +18,7 @@ import {
18
18
  startPersistLoop,
19
19
  touchLastSeen,
20
20
  writeAtomically
21
- } from "./chunk-Q5EDVWKZ.js";
21
+ } from "./chunk-GNAX2CBF.js";
22
22
  import {
23
23
  assertBindAuthority,
24
24
  buildOtelReceiver,
@@ -745,4 +745,4 @@ export {
745
745
  routeSpanToProject,
746
746
  startDaemon
747
747
  };
748
- //# sourceMappingURL=chunk-ZV7GHZ2D.js.map
748
+ //# sourceMappingURL=chunk-62ELQVIP.js.map
@@ -1320,13 +1320,14 @@ var parentSpanCache = /* @__PURE__ */ new Map();
1320
1320
  function parentSpanKey(traceId, spanId) {
1321
1321
  return `${traceId}:${spanId}`;
1322
1322
  }
1323
- function cacheSpanService(span, now) {
1323
+ function cacheSpanService(span, now, callSite) {
1324
1324
  if (!span.traceId || !span.spanId) return;
1325
1325
  const key = parentSpanKey(span.traceId, span.spanId);
1326
1326
  parentSpanCache.delete(key);
1327
1327
  parentSpanCache.set(key, {
1328
1328
  service: span.service,
1329
1329
  env: span.env ?? "unknown",
1330
+ ...callSite ? { callSite } : {},
1330
1331
  expiresAt: now + PARENT_SPAN_CACHE_TTL_MS
1331
1332
  });
1332
1333
  while (parentSpanCache.size > PARENT_SPAN_CACHE_SIZE) {
@@ -1342,7 +1343,11 @@ function lookupParentSpan(traceId, parentSpanId, now) {
1342
1343
  parentSpanCache.delete(parentSpanKey(traceId, parentSpanId));
1343
1344
  return null;
1344
1345
  }
1345
- return { service: entry.service, env: entry.env };
1346
+ return {
1347
+ service: entry.service,
1348
+ env: entry.env,
1349
+ ...entry.callSite ? { callSite: entry.callSite } : {}
1350
+ };
1346
1351
  }
1347
1352
  function resolveServiceId(graph, host, env) {
1348
1353
  const envTagged = serviceId(host, env);
@@ -1615,9 +1620,9 @@ async function handleSpan(ctx, span) {
1615
1620
  }
1616
1621
  const sourceId = ensureServiceNode(ctx.graph, span.service, env);
1617
1622
  const isError = span.statusCode === 2;
1618
- cacheSpanService(span, nowMs);
1619
1623
  const sourceServiceNode = ctx.graph.getNodeAttributes(sourceId);
1620
1624
  const callSite = callSiteFromSpan(span, sourceServiceNode, ctx.scanPath);
1625
+ cacheSpanService(span, nowMs, callSite);
1621
1626
  const observedSource = () => callSite ? ensureObservedFileNode(ctx.graph, span.service, sourceId, callSite) : sourceId;
1622
1627
  const callSiteEvidence = callSite ? { file: callSite.relPath, ...callSite.line !== void 0 ? { line: callSite.line } : {} } : void 0;
1623
1628
  let affectedNode = sourceId;
@@ -1674,13 +1679,19 @@ async function handleSpan(ctx, span) {
1674
1679
  const parent = lookupParentSpan(span.traceId, span.parentSpanId, nowMs);
1675
1680
  if (parent && parent.service !== span.service) {
1676
1681
  const parentId = ensureServiceNode(ctx.graph, parent.service, parent.env);
1682
+ const fallbackSource = parent.callSite ? ensureObservedFileNode(ctx.graph, parent.service, parentId, parent.callSite) : parentId;
1683
+ const fallbackEvidence = parent.callSite ? {
1684
+ file: parent.callSite.relPath,
1685
+ ...parent.callSite.line !== void 0 ? { line: parent.callSite.line } : {}
1686
+ } : void 0;
1677
1687
  upsertObservedEdge(
1678
1688
  ctx.graph,
1679
1689
  EdgeType3.CALLS,
1680
- parentId,
1690
+ fallbackSource,
1681
1691
  sourceId,
1682
1692
  ts,
1683
- isError
1693
+ isError,
1694
+ fallbackEvidence
1684
1695
  );
1685
1696
  }
1686
1697
  }
@@ -2277,6 +2288,9 @@ function workspaceGlobs(pkg) {
2277
2288
  if (Array.isArray(ws.packages)) return ws.packages.length > 0 ? ws.packages : null;
2278
2289
  return null;
2279
2290
  }
2291
+ async function hasPythonManifest(dir) {
2292
+ return await exists(path8.join(dir, "pyproject.toml")) || await exists(path8.join(dir, "requirements.txt")) || await exists(path8.join(dir, "setup.py"));
2293
+ }
2280
2294
  async function loadGitignore(scanPath) {
2281
2295
  const gitignorePath = path8.join(scanPath, ".gitignore");
2282
2296
  if (!await exists(gitignorePath)) return null;
@@ -2343,6 +2357,13 @@ function detectJsFramework(pkg) {
2343
2357
  if (deps["astro"] !== void 0) return "astro";
2344
2358
  return void 0;
2345
2359
  }
2360
+ async function detectJsServiceLanguage(dir, pkg) {
2361
+ const deps = { ...pkg.dependencies ?? {}, ...pkg.devDependencies ?? {} };
2362
+ if (deps["typescript"] !== void 0) return "typescript";
2363
+ const entries = await fs8.readdir(dir).catch(() => []);
2364
+ if (entries.some((name) => /^tsconfig(\..+)?\.json$/.test(name))) return "typescript";
2365
+ return "javascript";
2366
+ }
2346
2367
  async function discoverNodeService(scanPath, dir) {
2347
2368
  const pkgPath = path8.join(dir, "package.json");
2348
2369
  if (!await exists(pkgPath)) return null;
@@ -2355,11 +2376,12 @@ async function discoverNodeService(scanPath, dir) {
2355
2376
  }
2356
2377
  if (!pkg.name) return null;
2357
2378
  const framework = detectJsFramework(pkg);
2379
+ const language = await detectJsServiceLanguage(dir, pkg);
2358
2380
  const node = {
2359
2381
  id: serviceId2(pkg.name),
2360
2382
  type: NodeType4.ServiceNode,
2361
2383
  name: pkg.name,
2362
- language: "javascript",
2384
+ language,
2363
2385
  version: pkg.version,
2364
2386
  dependencies: pkg.dependencies ?? {},
2365
2387
  repoPath: path8.relative(scanPath, dir),
@@ -2402,7 +2424,11 @@ async function discoverServices(scanPath) {
2402
2424
  if (wsGlobs) {
2403
2425
  candidateDirs.push(...await expandWorkspaceGlobs(scanPath, wsGlobs));
2404
2426
  } else {
2405
- if (rootPkg && rootPkg.name) candidateDirs.push(scanPath);
2427
+ if (rootPkg && rootPkg.name) {
2428
+ candidateDirs.push(scanPath);
2429
+ } else if (await hasPythonManifest(scanPath)) {
2430
+ candidateDirs.push(scanPath);
2431
+ }
2406
2432
  const ig = await loadGitignore(scanPath);
2407
2433
  await walkDirs(
2408
2434
  scanPath,
@@ -2411,7 +2437,7 @@ async function discoverServices(scanPath) {
2411
2437
  async (dir) => {
2412
2438
  if (await exists(path8.join(dir, "package.json"))) {
2413
2439
  candidateDirs.push(dir);
2414
- } else if (await exists(path8.join(dir, "pyproject.toml")) || await exists(path8.join(dir, "requirements.txt")) || await exists(path8.join(dir, "setup.py"))) {
2440
+ } else if (await hasPythonManifest(dir)) {
2415
2441
  candidateDirs.push(dir);
2416
2442
  }
2417
2443
  }
@@ -6588,6 +6614,7 @@ export {
6588
6614
  retireEdgesByFile,
6589
6615
  extractFromDirectory,
6590
6616
  computeDivergences,
6617
+ SCHEMA_VERSION,
6591
6618
  saveGraphToDisk,
6592
6619
  loadGraphFromDisk,
6593
6620
  startPersistLoop,
@@ -6617,4 +6644,4 @@ export {
6617
6644
  pruneRegistry,
6618
6645
  buildApi
6619
6646
  };
6620
- //# sourceMappingURL=chunk-Q5EDVWKZ.js.map
6647
+ //# sourceMappingURL=chunk-GNAX2CBF.js.map