@inerrata-corporation/errata 2.0.0-dev.80 → 2.0.0-dev.82

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.
@@ -15355,6 +15355,13 @@ var init_project_symbol = __esm({
15355
15355
  }
15356
15356
  });
15357
15357
 
15358
+ // ../../packages/shared/src/lockfile.ts
15359
+ var init_lockfile = __esm({
15360
+ "../../packages/shared/src/lockfile.ts"() {
15361
+ "use strict";
15362
+ }
15363
+ });
15364
+
15358
15365
  // ../../packages/shared/src/nlp/canonicalize.ts
15359
15366
  var init_canonicalize = __esm({
15360
15367
  "../../packages/shared/src/nlp/canonicalize.ts"() {
@@ -15391,6 +15398,7 @@ var init_src = __esm({
15391
15398
  init_symbol_intent();
15392
15399
  init_repo_locator();
15393
15400
  init_project_symbol();
15401
+ init_lockfile();
15394
15402
  init_hash();
15395
15403
  init_error_signature();
15396
15404
  init_canonicalize();
package/errata.mjs CHANGED
@@ -15656,6 +15656,144 @@ var init_project_symbol = __esm({
15656
15656
  }
15657
15657
  });
15658
15658
 
15659
+ // ../../packages/shared/src/lockfile.ts
15660
+ function npmPurl(name2, version2) {
15661
+ return `pkg:npm/${name2}@${version2}`;
15662
+ }
15663
+ function component(name2, version2) {
15664
+ return { purl: npmPurl(name2, version2), name: name2, version: version2, ecosystem: "npm" };
15665
+ }
15666
+ function parsePackageLockJson(jsonText) {
15667
+ let doc;
15668
+ try {
15669
+ doc = JSON.parse(jsonText);
15670
+ } catch {
15671
+ return { components: [], dependencies: [] };
15672
+ }
15673
+ const packages = doc.packages ?? {};
15674
+ const components = [];
15675
+ const hoisted = /* @__PURE__ */ new Map();
15676
+ const byPath = /* @__PURE__ */ new Map();
15677
+ for (const [path2, meta3] of Object.entries(packages)) {
15678
+ if (path2 === "" || meta3.link === true) continue;
15679
+ const ix = path2.lastIndexOf("node_modules/");
15680
+ if (ix === -1) continue;
15681
+ const name2 = path2.slice(ix + "node_modules/".length);
15682
+ const version2 = typeof meta3.version === "string" ? meta3.version : "";
15683
+ if (!name2 || !version2) continue;
15684
+ components.push(component(name2, version2));
15685
+ byPath.set(path2, { name: name2, version: version2 });
15686
+ const depth = path2.split("node_modules/").length;
15687
+ const prev = hoisted.get(name2);
15688
+ if (!prev || depth < prev.depth) hoisted.set(name2, { version: version2, depth });
15689
+ }
15690
+ const dependencies = [];
15691
+ for (const [path2, meta3] of Object.entries(packages)) {
15692
+ const self = byPath.get(path2);
15693
+ if (!self) continue;
15694
+ const deps = meta3.dependencies;
15695
+ if (!deps || typeof deps !== "object") continue;
15696
+ const dependsOn = [];
15697
+ for (const depName of Object.keys(deps)) {
15698
+ const target = hoisted.get(depName);
15699
+ if (target) dependsOn.push(npmPurl(depName, target.version));
15700
+ }
15701
+ if (dependsOn.length > 0)
15702
+ dependencies.push({ ref: npmPurl(self.name, self.version), dependsOn });
15703
+ }
15704
+ return { components, dependencies: dedupeRefs(dependencies) };
15705
+ }
15706
+ function splitPnpmKey(raw2) {
15707
+ let k = raw2.trim().replace(/^['"]|['"]$/g, "");
15708
+ if (k.startsWith("/")) k = k.slice(1);
15709
+ const paren = k.indexOf("(");
15710
+ if (paren !== -1) k = k.slice(0, paren);
15711
+ if (k.startsWith("link:") || k.startsWith("file:") || k.includes("://")) return null;
15712
+ const at = k.lastIndexOf("@");
15713
+ if (at <= 0) return null;
15714
+ const name2 = k.slice(0, at);
15715
+ const version2 = k.slice(at + 1);
15716
+ if (!name2 || !version2) return null;
15717
+ return { name: name2, version: version2 };
15718
+ }
15719
+ function parsePnpmLock(text) {
15720
+ const lines = text.split(/\r?\n/);
15721
+ const components = [];
15722
+ const seen = /* @__PURE__ */ new Set();
15723
+ const dependencies = [];
15724
+ let section = null;
15725
+ let currentPkg = null;
15726
+ let inDepsBlock = false;
15727
+ let currentDeps = [];
15728
+ const flushDeps = () => {
15729
+ if (currentPkg && currentDeps.length > 0) {
15730
+ dependencies.push({
15731
+ ref: npmPurl(currentPkg.name, currentPkg.version),
15732
+ dependsOn: currentDeps.slice()
15733
+ });
15734
+ }
15735
+ currentDeps = [];
15736
+ };
15737
+ for (const line of lines) {
15738
+ if (!line.trim() || line.trimStart().startsWith("#")) continue;
15739
+ const indent = line.length - line.trimStart().length;
15740
+ if (indent === 0) {
15741
+ flushDeps();
15742
+ currentPkg = null;
15743
+ inDepsBlock = false;
15744
+ section = line === "packages:" ? "packages" : line === "snapshots:" ? "snapshots" : null;
15745
+ continue;
15746
+ }
15747
+ if (!section) continue;
15748
+ if (indent === 2 && line.trimEnd().endsWith(":")) {
15749
+ flushDeps();
15750
+ inDepsBlock = false;
15751
+ const key = line.trim().slice(0, -1);
15752
+ currentPkg = splitPnpmKey(key);
15753
+ if (currentPkg && section === "packages") {
15754
+ const purl = npmPurl(currentPkg.name, currentPkg.version);
15755
+ if (!seen.has(purl)) {
15756
+ seen.add(purl);
15757
+ components.push(component(currentPkg.name, currentPkg.version));
15758
+ }
15759
+ }
15760
+ continue;
15761
+ }
15762
+ if (!currentPkg) continue;
15763
+ if (indent === 4) {
15764
+ inDepsBlock = line.trim() === "dependencies:";
15765
+ continue;
15766
+ }
15767
+ if (inDepsBlock && indent === 6) {
15768
+ const t = line.trim();
15769
+ const at = t.indexOf(": ");
15770
+ if (at === -1) continue;
15771
+ const depName = t.slice(0, at).replace(/^['"]|['"]$/g, "");
15772
+ let depVersion = t.slice(at + 2).trim().replace(/^['"]|['"]$/g, "");
15773
+ const paren = depVersion.indexOf("(");
15774
+ if (paren !== -1) depVersion = depVersion.slice(0, paren);
15775
+ if (depName && depVersion && !depVersion.startsWith("link:"))
15776
+ currentDeps.push(npmPurl(depName, depVersion));
15777
+ }
15778
+ }
15779
+ flushDeps();
15780
+ return { components, dependencies: dedupeRefs(dependencies) };
15781
+ }
15782
+ function dedupeRefs(deps) {
15783
+ const byRef = /* @__PURE__ */ new Map();
15784
+ for (const d of deps) {
15785
+ const set2 = byRef.get(d.ref) ?? /* @__PURE__ */ new Set();
15786
+ for (const t of d.dependsOn) set2.add(t);
15787
+ byRef.set(d.ref, set2);
15788
+ }
15789
+ return [...byRef.entries()].map(([ref, set2]) => ({ ref, dependsOn: [...set2] }));
15790
+ }
15791
+ var init_lockfile = __esm({
15792
+ "../../packages/shared/src/lockfile.ts"() {
15793
+ "use strict";
15794
+ }
15795
+ });
15796
+
15659
15797
  // ../../packages/shared/src/nlp/canonicalize.ts
15660
15798
  function canonicalize(value) {
15661
15799
  return value.normalize("NFC").trim().toLowerCase().replace(/\s+/g, " ");
@@ -15774,9 +15912,12 @@ __export(src_exports, {
15774
15912
  normalizePredicate: () => normalizePredicate,
15775
15913
  normalizeRepoLocator: () => normalizeRepoLocator,
15776
15914
  normalizeSymbolPath: () => normalizeSymbolPath,
15915
+ npmPurl: () => npmPurl,
15777
15916
  packageCanonicalId: () => packageCanonicalId,
15778
15917
  pagerankEdgeTypes: () => pagerankEdgeTypes,
15918
+ parsePackageLockJson: () => parsePackageLockJson,
15779
15919
  parsePackageRef: () => parsePackageRef,
15920
+ parsePnpmLock: () => parsePnpmLock,
15780
15921
  prefilterEntities: () => prefilterEntities,
15781
15922
  problemIdFromError: () => problemIdFromError,
15782
15923
  projectSymbolId: () => projectSymbolId,
@@ -15785,6 +15926,7 @@ __export(src_exports, {
15785
15926
  resolveCanonicalId: () => resolveCanonicalId,
15786
15927
  sha256: () => sha256,
15787
15928
  sha256Short: () => sha256Short,
15929
+ splitPnpmKey: () => splitPnpmKey,
15788
15930
  substituteSymbolSummaries: () => substituteSymbolSummaries,
15789
15931
  summarizeIngestResult: () => summarizeIngestResult,
15790
15932
  summaryRejectionReason: () => summaryRejectionReason,
@@ -15802,6 +15944,7 @@ var init_src = __esm({
15802
15944
  init_symbol_intent();
15803
15945
  init_repo_locator();
15804
15946
  init_project_symbol();
15947
+ init_lockfile();
15805
15948
  init_hash();
15806
15949
  init_error_signature();
15807
15950
  init_canonicalize();
@@ -43379,7 +43522,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
43379
43522
  }
43380
43523
 
43381
43524
  // src/engine.ts
43382
- var DAEMON_VERSION = true ? "2.0.0-dev.80" : "2.0.0-alpha.0";
43525
+ var DAEMON_VERSION = true ? "2.0.0-dev.82" : "2.0.0-alpha.0";
43383
43526
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
43384
43527
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
43385
43528
  var GIT_OP_MUTE_MS = 4e3;
@@ -44823,6 +44966,7 @@ async function syncPrinciples(store, cloud, opts) {
44823
44966
  init_reconcile();
44824
44967
 
44825
44968
  // src/lockfile-auto.ts
44969
+ init_src();
44826
44970
  import { existsSync as existsSync20, readFileSync as readFileSync18 } from "node:fs";
44827
44971
  import { join as join24 } from "node:path";
44828
44972
 
@@ -44949,137 +45093,7 @@ function buildContextIngest(store, profile, daemonVersion, ignorePatterns = [],
44949
45093
  }
44950
45094
 
44951
45095
  // src/lockfile-auto.ts
44952
- function npmPurl(name2, version2) {
44953
- return `pkg:npm/${name2}@${version2}`;
44954
- }
44955
- function component(name2, version2) {
44956
- return { purl: npmPurl(name2, version2), name: name2, version: version2, ecosystem: "npm" };
44957
- }
44958
- function parsePackageLockJson(jsonText) {
44959
- let doc;
44960
- try {
44961
- doc = JSON.parse(jsonText);
44962
- } catch {
44963
- return { components: [], dependencies: [] };
44964
- }
44965
- const packages = doc.packages ?? {};
44966
- const components = [];
44967
- const hoisted = /* @__PURE__ */ new Map();
44968
- const byPath = /* @__PURE__ */ new Map();
44969
- for (const [path2, meta3] of Object.entries(packages)) {
44970
- if (path2 === "" || meta3.link === true) continue;
44971
- const ix = path2.lastIndexOf("node_modules/");
44972
- if (ix === -1) continue;
44973
- const name2 = path2.slice(ix + "node_modules/".length);
44974
- const version2 = typeof meta3.version === "string" ? meta3.version : "";
44975
- if (!name2 || !version2) continue;
44976
- components.push(component(name2, version2));
44977
- byPath.set(path2, { name: name2, version: version2 });
44978
- const depth = path2.split("node_modules/").length;
44979
- const prev = hoisted.get(name2);
44980
- if (!prev || depth < prev.depth) hoisted.set(name2, { version: version2, depth });
44981
- }
44982
- const dependencies = [];
44983
- for (const [path2, meta3] of Object.entries(packages)) {
44984
- const self = byPath.get(path2);
44985
- if (!self) continue;
44986
- const deps = meta3.dependencies;
44987
- if (!deps || typeof deps !== "object") continue;
44988
- const dependsOn = [];
44989
- for (const depName of Object.keys(deps)) {
44990
- const target = hoisted.get(depName);
44991
- if (target) dependsOn.push(npmPurl(depName, target.version));
44992
- }
44993
- if (dependsOn.length > 0)
44994
- dependencies.push({ ref: npmPurl(self.name, self.version), dependsOn });
44995
- }
44996
- return { components, dependencies: dedupeRefs(dependencies) };
44997
- }
44998
- function splitPnpmKey(raw2) {
44999
- let k = raw2.trim().replace(/^['"]|['"]$/g, "");
45000
- if (k.startsWith("/")) k = k.slice(1);
45001
- const paren = k.indexOf("(");
45002
- if (paren !== -1) k = k.slice(0, paren);
45003
- if (k.startsWith("link:") || k.startsWith("file:") || k.includes("://")) return null;
45004
- const at = k.lastIndexOf("@");
45005
- if (at <= 0) return null;
45006
- const name2 = k.slice(0, at);
45007
- const version2 = k.slice(at + 1);
45008
- if (!name2 || !version2) return null;
45009
- return { name: name2, version: version2 };
45010
- }
45011
- function parsePnpmLock(text) {
45012
- const lines = text.split(/\r?\n/);
45013
- const components = [];
45014
- const seen = /* @__PURE__ */ new Set();
45015
- const dependencies = [];
45016
- let section = null;
45017
- let currentPkg = null;
45018
- let inDepsBlock = false;
45019
- let currentDeps = [];
45020
- const flushDeps = () => {
45021
- if (currentPkg && currentDeps.length > 0) {
45022
- dependencies.push({
45023
- ref: npmPurl(currentPkg.name, currentPkg.version),
45024
- dependsOn: currentDeps.slice()
45025
- });
45026
- }
45027
- currentDeps = [];
45028
- };
45029
- for (const line of lines) {
45030
- if (!line.trim() || line.trimStart().startsWith("#")) continue;
45031
- const indent = line.length - line.trimStart().length;
45032
- if (indent === 0) {
45033
- flushDeps();
45034
- currentPkg = null;
45035
- inDepsBlock = false;
45036
- section = line === "packages:" ? "packages" : line === "snapshots:" ? "snapshots" : null;
45037
- continue;
45038
- }
45039
- if (!section) continue;
45040
- if (indent === 2 && line.trimEnd().endsWith(":")) {
45041
- flushDeps();
45042
- inDepsBlock = false;
45043
- const key = line.trim().slice(0, -1);
45044
- currentPkg = splitPnpmKey(key);
45045
- if (currentPkg && section === "packages") {
45046
- const purl = npmPurl(currentPkg.name, currentPkg.version);
45047
- if (!seen.has(purl)) {
45048
- seen.add(purl);
45049
- components.push(component(currentPkg.name, currentPkg.version));
45050
- }
45051
- }
45052
- continue;
45053
- }
45054
- if (!currentPkg) continue;
45055
- if (indent === 4) {
45056
- inDepsBlock = line.trim() === "dependencies:";
45057
- continue;
45058
- }
45059
- if (inDepsBlock && indent === 6) {
45060
- const t = line.trim();
45061
- const at = t.indexOf(": ");
45062
- if (at === -1) continue;
45063
- const depName = t.slice(0, at).replace(/^['"]|['"]$/g, "");
45064
- let depVersion = t.slice(at + 2).trim().replace(/^['"]|['"]$/g, "");
45065
- const paren = depVersion.indexOf("(");
45066
- if (paren !== -1) depVersion = depVersion.slice(0, paren);
45067
- if (depName && depVersion && !depVersion.startsWith("link:"))
45068
- currentDeps.push(npmPurl(depName, depVersion));
45069
- }
45070
- }
45071
- flushDeps();
45072
- return { components, dependencies: dedupeRefs(dependencies) };
45073
- }
45074
- function dedupeRefs(deps) {
45075
- const byRef = /* @__PURE__ */ new Map();
45076
- for (const d of deps) {
45077
- const set2 = byRef.get(d.ref) ?? /* @__PURE__ */ new Set();
45078
- for (const t of d.dependsOn) set2.add(t);
45079
- byRef.set(d.ref, set2);
45080
- }
45081
- return [...byRef.entries()].map(([ref, set2]) => ({ ref, dependsOn: [...set2] }));
45082
- }
45096
+ init_src();
45083
45097
  function runLockfilePass(opts) {
45084
45098
  const ts = Date.now();
45085
45099
  const languages = mintLanguageNodes(opts.store, opts.languages, opts.workspaceId, ts);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.0-dev.80",
3
+ "version": "2.0.0-dev.82",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/pass-worker.mjs CHANGED
@@ -15210,6 +15210,13 @@ var init_project_symbol = __esm({
15210
15210
  }
15211
15211
  });
15212
15212
 
15213
+ // ../../packages/shared/src/lockfile.ts
15214
+ var init_lockfile = __esm({
15215
+ "../../packages/shared/src/lockfile.ts"() {
15216
+ "use strict";
15217
+ }
15218
+ });
15219
+
15213
15220
  // ../../packages/shared/src/nlp/canonicalize.ts
15214
15221
  var init_canonicalize = __esm({
15215
15222
  "../../packages/shared/src/nlp/canonicalize.ts"() {
@@ -15236,6 +15243,7 @@ var init_src = __esm({
15236
15243
  init_symbol_intent();
15237
15244
  init_repo_locator();
15238
15245
  init_project_symbol();
15246
+ init_lockfile();
15239
15247
  init_hash();
15240
15248
  init_error_signature();
15241
15249
  init_canonicalize();