lurqrun 0.1.6 → 0.1.8

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.
Files changed (239) hide show
  1. package/README.md +311 -139
  2. package/dist/auditHandler-VWCXSDVO.js +24 -0
  3. package/dist/autopilotInit-Q62MX5M6.js +178 -0
  4. package/dist/bin/lurq.js +3255 -23319
  5. package/dist/browserAuth-J7APSD4P.js +96 -0
  6. package/dist/cache-AEAKCV4I.js +12 -0
  7. package/dist/check-2JTQDQA6.js +2613 -0
  8. package/dist/check-PQSQ2MMA.js +192 -0
  9. package/dist/checkUpgrade-5YW77OBL.js +24 -0
  10. package/dist/chunk-2GAYNIHG.js +40 -0
  11. package/dist/chunk-2O6Z37IT.js +423 -0
  12. package/dist/chunk-2WD4QAH4.js +116 -0
  13. package/dist/chunk-3676XOBU.js +2235 -0
  14. package/dist/chunk-3D2MPGOQ.js +181 -0
  15. package/dist/chunk-3GHJR7XR.js +2049 -0
  16. package/dist/chunk-4ESO33J6.js +34 -0
  17. package/dist/chunk-4JHDSVIN.js +1229 -0
  18. package/dist/chunk-4KCPOMG6.js +68 -0
  19. package/dist/chunk-53SG6XWA.js +141 -0
  20. package/dist/chunk-5ABNDB3I.js +37 -0
  21. package/dist/chunk-5ALIJFDA.js +114 -0
  22. package/dist/chunk-63MUJNZL.js +318 -0
  23. package/dist/chunk-64ZF7KO4.js +1571 -0
  24. package/dist/chunk-6DM6UQFD.js +318 -0
  25. package/dist/chunk-6EQ3ARXA.js +304 -0
  26. package/dist/chunk-6L67QMCP.js +92 -0
  27. package/dist/chunk-72Y2FDVS.js +172 -0
  28. package/dist/chunk-A3TYI2TF.js +288 -0
  29. package/dist/chunk-B2UUYRBX.js +536 -0
  30. package/dist/chunk-BJT2LHAR.js +320 -0
  31. package/dist/chunk-BM3LF5T6.js +132 -0
  32. package/dist/chunk-BN3NM47Q.js +214 -0
  33. package/dist/chunk-BUALU27S.js +123 -0
  34. package/dist/chunk-C6GLE626.js +160 -0
  35. package/dist/chunk-D3K6IZVR.js +12845 -0
  36. package/dist/chunk-D3VTZS7V.js +222 -0
  37. package/dist/chunk-DM37MTOO.js +636 -0
  38. package/dist/chunk-DONTW3NE.js +171 -0
  39. package/dist/chunk-DSROTZ3Z.js +38 -0
  40. package/dist/chunk-ELGCAM7P.js +184 -0
  41. package/dist/chunk-EQCXENKZ.js +130 -0
  42. package/dist/chunk-EYAKM6YN.js +96 -0
  43. package/dist/chunk-FDFPMBCA.js +112 -0
  44. package/dist/chunk-FVYFV5HA.js +154 -0
  45. package/dist/chunk-GE37NVLN.js +15 -0
  46. package/dist/chunk-GM5Y555O.js +143 -0
  47. package/dist/chunk-GRJXQBQZ.js +793 -0
  48. package/dist/chunk-HWFX4BC4.js +177 -0
  49. package/dist/chunk-I3M2KJXB.js +56 -0
  50. package/dist/chunk-IFNONGRQ.js +603 -0
  51. package/dist/chunk-J3U2CPSK.js +136 -0
  52. package/dist/chunk-J6XQ7OPZ.js +74 -0
  53. package/dist/chunk-KMV4Y6R3.js +127 -0
  54. package/dist/chunk-KP5ZDDPE.js +340 -0
  55. package/dist/chunk-KYKSZ3XZ.js +202 -0
  56. package/dist/chunk-LEGPB7DO.js +81 -0
  57. package/dist/chunk-LUAKDHLZ.js +40 -0
  58. package/dist/chunk-MHUEVBVO.js +35 -0
  59. package/dist/chunk-MYGSLK44.js +37 -0
  60. package/dist/chunk-NEZNAPPN.js +41 -0
  61. package/dist/chunk-NPVN2THM.js +197 -0
  62. package/dist/chunk-NYZU5NCW.js +23 -0
  63. package/dist/chunk-O4KHCV6I.js +320 -0
  64. package/dist/chunk-ONDVTXUO.js +240 -0
  65. package/dist/chunk-OTJFHESY.js +176 -0
  66. package/dist/chunk-P6MIKSPY.js +243 -0
  67. package/dist/chunk-Q5VPF4WI.js +26 -0
  68. package/dist/chunk-QCRBX3LV.js +165 -0
  69. package/dist/chunk-QKGYDMWB.js +7409 -0
  70. package/dist/chunk-QSL6QN5X.js +115 -0
  71. package/dist/chunk-QUIMQ7YL.js +73 -0
  72. package/dist/chunk-RG3YLU6E.js +49 -0
  73. package/dist/chunk-SHCEBP3J.js +107 -0
  74. package/dist/chunk-SHZFOSXC.js +462 -0
  75. package/dist/chunk-SOXFMMXC.js +151 -0
  76. package/dist/chunk-TDTYV6QI.js +119 -0
  77. package/dist/chunk-TNTXWSYA.js +19 -0
  78. package/dist/chunk-TUXQ32WE.js +2251 -0
  79. package/dist/chunk-VGCDRK3S.js +37 -0
  80. package/dist/chunk-VLRHFMGJ.js +58 -0
  81. package/dist/chunk-WHX2ZFCG.js +4048 -0
  82. package/dist/chunk-X4W64MHU.js +2005 -0
  83. package/dist/chunk-XBQA4I36.js +92 -0
  84. package/dist/chunk-XGOV6KV4.js +413 -0
  85. package/dist/chunk-XIFQIFSZ.js +940 -0
  86. package/dist/chunk-XLXPVN3Y.js +15393 -0
  87. package/dist/chunk-ZJMLQ37G.js +90 -0
  88. package/dist/client-MU4EUDZV.js +15 -0
  89. package/dist/commands-UOOTMBKA.js +1023 -0
  90. package/dist/compat-Q5DVPITN.js +201 -0
  91. package/dist/constants-DJFOFZ44.js +24 -0
  92. package/dist/dashboardIssue-KBKLQMGC.js +274 -0
  93. package/dist/diff-I4SNUHU3.js +13 -0
  94. package/dist/dist-4XXIXHHZ.js +12945 -0
  95. package/dist/domains-VRT4BRVZ.js +14 -0
  96. package/dist/e2b-FVPHDULZ.js +172 -0
  97. package/dist/env-UN6KGZ7S.js +15 -0
  98. package/dist/envCheck-KUPTORFQ.js +71 -0
  99. package/dist/extract-6WG265BL.js +455 -0
  100. package/dist/fetch-PJ3SC32M.js +22 -0
  101. package/dist/firstTouch-COJCMOB3.js +55 -0
  102. package/dist/fix-3EDWNKW3.js +220 -0
  103. package/dist/handlers-4Q37WIFT.js +55 -0
  104. package/dist/hook-NA66XJLC.js +412 -0
  105. package/dist/http-25GJ6SKK.js +6928 -0
  106. package/dist/ingestQueue-FSVJC3AA.js +37 -0
  107. package/dist/install-G2HHXYJ2.js +20 -0
  108. package/dist/installSkill-5TIMYIJZ.js +70 -0
  109. package/dist/inventory-5AWSLJYU.js +31 -0
  110. package/dist/local-XPZMRH5R.js +13 -0
  111. package/dist/manifest-ENMIC54B.js +13 -0
  112. package/dist/mcp-PENLL2PK.js +500 -0
  113. package/dist/mcpConfig-3LYPRY5Q.js +80 -0
  114. package/dist/mcpHandlers-PO7GENA7.js +22 -0
  115. package/dist/mcpScan-ULP626TQ.js +1735 -0
  116. package/dist/mcpScanWorkflow-27O44FOE.js +98 -0
  117. package/dist/mcpStack-ZNYIFXZ5.js +20 -0
  118. package/dist/model-ASMZWLM7.js +214 -0
  119. package/dist/packages-RWF2LXST.js +40 -0
  120. package/dist/plan-SDILIDZT.js +465 -0
  121. package/dist/planView-ZAKRTGVS.js +82 -0
  122. package/dist/policy-JAGNMQJI.js +115 -0
  123. package/dist/probe-3IK646WN.js +610 -0
  124. package/dist/publicUpgrades-WTBGLDIK.js +42 -0
  125. package/dist/references-I6Y4BSRR.js +16 -0
  126. package/dist/release-7IU2R4YG.js +128 -0
  127. package/dist/remote-FN6225AH.js +42 -0
  128. package/dist/rename-OS6JYBZQ.js +204 -0
  129. package/dist/reportRuns-O4X7ZFTX.js +77 -0
  130. package/dist/safeFetch-COERXGFN.js +19 -0
  131. package/dist/sandbox-SAPSRKEI.js +39 -0
  132. package/dist/sarif-WLVJFJ7U.js +125 -0
  133. package/dist/server-OLTY3NYT.js +59 -0
  134. package/dist/surface-7MHE3RL7.js +143 -0
  135. package/dist/surface-JS2XU3U3.js +38 -0
  136. package/dist/surfaceHandlers-4B6TMZ34.js +20 -0
  137. package/dist/typecheck-NGOKNAJY.js +282 -0
  138. package/dist/types-M5JP2W3D.js +10 -0
  139. package/dist/uninstall-I2IJP5JZ.js +200 -0
  140. package/dist/upgrade-FS26DJGG.js +650 -0
  141. package/dist/upgradePlan-ZS5IOVMZ.js +181 -0
  142. package/dist/upkeepHandler-VFGYXJKB.js +13 -0
  143. package/dist/userConfig-ICASHI47.js +20 -0
  144. package/dist/watch-OCNEUXG6.js +204 -0
  145. package/package.json +26 -20
  146. package/templates/agent-rules.md +4 -4
  147. package/templates/skill-instructions.md +35 -17
  148. package/dist/bin/lurq.js.map +0 -1
  149. package/dist/index.d.ts +0 -805
  150. package/dist/index.js +0 -23570
  151. package/dist/index.js.map +0 -1
  152. package/drizzle/0000_confused_fabian_cortez.sql +0 -54
  153. package/drizzle/0001_aspiring_timeslip.sql +0 -15
  154. package/drizzle/0002_lyrical_lila_cheney.sql +0 -14
  155. package/drizzle/0003_violet_giant_girl.sql +0 -14
  156. package/drizzle/0004_slim_valeria_richards.sql +0 -15
  157. package/drizzle/0005_petite_luke_cage.sql +0 -12
  158. package/drizzle/0006_calm_nighthawk.sql +0 -3
  159. package/drizzle/0007_slimy_naoko.sql +0 -1
  160. package/drizzle/0008_peaceful_tigra.sql +0 -1
  161. package/drizzle/0009_smooth_harrier.sql +0 -10
  162. package/drizzle/0010_curved_amphibian.sql +0 -2
  163. package/drizzle/0011_compat_provenance_closures.sql +0 -11
  164. package/drizzle/0012_api_surfaces.sql +0 -9
  165. package/drizzle/0013_nice_thanos.sql +0 -1
  166. package/drizzle/0014_luxuriant_malcolm_colcord.sql +0 -10
  167. package/drizzle/0015_past_fat_cobra.sql +0 -11
  168. package/drizzle/0016_futuristic_junta.sql +0 -50
  169. package/drizzle/0017_absent_grandmaster.sql +0 -20
  170. package/drizzle/0018_rainy_proemial_gods.sql +0 -1
  171. package/drizzle/0019_dashing_korvac.sql +0 -11
  172. package/drizzle/0020_normal_vulture.sql +0 -3
  173. package/drizzle/0021_dazzling_blue_shield.sql +0 -17
  174. package/drizzle/0022_massive_ghost_rider.sql +0 -24
  175. package/drizzle/0023_next_shatterstar.sql +0 -1
  176. package/drizzle/0024_dusty_maelstrom.sql +0 -15
  177. package/drizzle/0025_gifted_harpoon.sql +0 -5
  178. package/drizzle/0026_awesome_mordo.sql +0 -1
  179. package/drizzle/0027_charming_ulik.sql +0 -2
  180. package/drizzle/0028_romantic_loners.sql +0 -2
  181. package/drizzle/0029_busy_korvac.sql +0 -16
  182. package/drizzle/0030_steady_mathemanic.sql +0 -6
  183. package/drizzle/0031_redundant_maginty.sql +0 -2
  184. package/drizzle/0032_stack_resolutions.sql +0 -14
  185. package/drizzle/0033_graceful_tyger_tiger.sql +0 -3
  186. package/drizzle/0034_uneven_thunderbird.sql +0 -1
  187. package/drizzle/0035_api_key_scopes.sql +0 -1
  188. package/drizzle/0036_policy_audit.sql +0 -21
  189. package/drizzle/0037_subscription_seats.sql +0 -1
  190. package/drizzle/0038_symbol_offsets.sql +0 -2
  191. package/drizzle/0039_mcp_runtime_scans.sql +0 -80
  192. package/drizzle/0040_subscription_overage_and_interval.sql +0 -4
  193. package/drizzle/0041_account_email.sql +0 -38
  194. package/drizzle/0042_alert_channels.sql +0 -21
  195. package/drizzle/meta/0000_snapshot.json +0 -370
  196. package/drizzle/meta/0001_snapshot.json +0 -482
  197. package/drizzle/meta/0002_snapshot.json +0 -575
  198. package/drizzle/meta/0003_snapshot.json +0 -667
  199. package/drizzle/meta/0004_snapshot.json +0 -769
  200. package/drizzle/meta/0005_snapshot.json +0 -864
  201. package/drizzle/meta/0006_snapshot.json +0 -882
  202. package/drizzle/meta/0007_snapshot.json +0 -876
  203. package/drizzle/meta/0008_snapshot.json +0 -882
  204. package/drizzle/meta/0009_snapshot.json +0 -948
  205. package/drizzle/meta/0010_snapshot.json +0 -969
  206. package/drizzle/meta/0011_snapshot.json +0 -1049
  207. package/drizzle/meta/0012_snapshot.json +0 -1115
  208. package/drizzle/meta/0013_snapshot.json +0 -1121
  209. package/drizzle/meta/0014_snapshot.json +0 -1190
  210. package/drizzle/meta/0015_snapshot.json +0 -1280
  211. package/drizzle/meta/0016_snapshot.json +0 -1683
  212. package/drizzle/meta/0017_snapshot.json +0 -1834
  213. package/drizzle/meta/0018_snapshot.json +0 -1834
  214. package/drizzle/meta/0019_snapshot.json +0 -1909
  215. package/drizzle/meta/0020_snapshot.json +0 -1921
  216. package/drizzle/meta/0021_snapshot.json +0 -2045
  217. package/drizzle/meta/0022_snapshot.json +0 -2246
  218. package/drizzle/meta/0023_snapshot.json +0 -2252
  219. package/drizzle/meta/0024_snapshot.json +0 -2375
  220. package/drizzle/meta/0025_snapshot.json +0 -2407
  221. package/drizzle/meta/0026_snapshot.json +0 -2413
  222. package/drizzle/meta/0027_snapshot.json +0 -2425
  223. package/drizzle/meta/0028_snapshot.json +0 -2438
  224. package/drizzle/meta/0029_snapshot.json +0 -2546
  225. package/drizzle/meta/0030_snapshot.json +0 -2586
  226. package/drizzle/meta/0031_snapshot.json +0 -2598
  227. package/drizzle/meta/0032_snapshot.json +0 -2699
  228. package/drizzle/meta/0033_snapshot.json +0 -2712
  229. package/drizzle/meta/0034_snapshot.json +0 -2719
  230. package/drizzle/meta/0035_snapshot.json +0 -2726
  231. package/drizzle/meta/0036_snapshot.json +0 -2876
  232. package/drizzle/meta/0037_snapshot.json +0 -2883
  233. package/drizzle/meta/0038_snapshot.json +0 -2895
  234. package/drizzle/meta/0039_snapshot.json +0 -3501
  235. package/drizzle/meta/0040_snapshot.json +0 -3527
  236. package/drizzle/meta/0041_snapshot.json +0 -3824
  237. package/drizzle/meta/0042_snapshot.json +0 -3960
  238. package/drizzle/meta/_journal.json +0 -307
  239. package/src/data/seed.json +0 -253
@@ -0,0 +1,115 @@
1
+ import { createRequire as __lurqCreateRequire } from 'node:module'; const require = __lurqCreateRequire(import.meta.url);
2
+ import {
3
+ init_esm_shims
4
+ } from "./chunk-I3M2KJXB.js";
5
+
6
+ // src/security/verdict.ts
7
+ init_esm_shims();
8
+ var SEVERE = /* @__PURE__ */ new Set(["critical", "high"]);
9
+ function describeScope(i) {
10
+ if (!i.exists) return "this name";
11
+ if (!i.subjectVersion) {
12
+ return i.subjectInstalled ? "the installed version" : "the latest published version";
13
+ }
14
+ return i.subjectInstalled ? `the installed ${i.subjectVersion}` : `${i.subjectVersion} (latest)`;
15
+ }
16
+ function hasSevereAdvisory(advisories) {
17
+ return advisories.some((a) => SEVERE.has(a.severity));
18
+ }
19
+ function assessVerdict(i) {
20
+ const reasons = [];
21
+ const unknowns = [];
22
+ if (!i.exists) {
23
+ return {
24
+ level: "invalid",
25
+ reasons: [
26
+ i.typosquatOf ? `no such package on npm \u2014 the name closely mimics "${i.typosquatOf}", which is what a typosquat looks like. Do not install it; check the spelling you meant.` : "no such package on npm. This name does not exist, so there is nothing to assess \u2014 check the spelling, or that you are not recalling a package that was never published."
27
+ ],
28
+ unknowns: [],
29
+ complete: true,
30
+ reassuring: false,
31
+ advisoryCount: null,
32
+ scope: describeScope(i)
33
+ };
34
+ }
35
+ const analysed = i.advisories !== null;
36
+ const advisories = i.advisories ?? [];
37
+ if (!analysed) {
38
+ unknowns.push("advisories have not been checked for this package yet");
39
+ }
40
+ if (i.vulnLookupComplete === false) {
41
+ unknowns.push("the vulnerability lookup did not complete, so results are partial");
42
+ }
43
+ const severe = hasSevereAdvisory(advisories);
44
+ const versionVulns = i.versionVulns ?? [];
45
+ if (i.typosquatOf) {
46
+ reasons.push(`name closely mimics "${i.typosquatOf}" \u2014 possible typosquat`);
47
+ }
48
+ if (versionVulns.length) {
49
+ reasons.push(
50
+ `the installed version is affected by ${versionVulns.length} advisory(ies): ${versionVulns.slice(0, 4).join(", ")}`
51
+ );
52
+ }
53
+ if (severe) {
54
+ const worst = advisories.filter((a) => SEVERE.has(a.severity));
55
+ reasons.push(`${worst.length} critical/high advisory(ies) recorded against this package`);
56
+ }
57
+ const malwarePattern = Boolean(i.installScripts && i.brandNew && i.lowTrust);
58
+ if (malwarePattern) {
59
+ reasons.push(
60
+ "published within the last 7 days, runs install scripts, and has almost no adoption \u2014 the shape of a malicious package"
61
+ );
62
+ }
63
+ if (i.typosquatOf || versionVulns.length || severe || malwarePattern) {
64
+ return {
65
+ level: "high",
66
+ reasons,
67
+ unknowns,
68
+ complete: analysed && i.vulnLookupComplete !== false,
69
+ reassuring: false,
70
+ advisoryCount: analysed ? advisories.length : null,
71
+ scope: describeScope(i)
72
+ };
73
+ }
74
+ if (advisories.length > 0) {
75
+ reasons.push(
76
+ `${advisories.length} advisory(ies) recorded against this package (none critical or high)`
77
+ );
78
+ }
79
+ if (i.deprecated) reasons.push("the publisher has marked this package deprecated");
80
+ if (i.archived) reasons.push("the source repository is archived");
81
+ if (i.installScripts && (i.lowTrust || i.brandNew)) {
82
+ reasons.push("runs install scripts and has little adoption or history");
83
+ }
84
+ if (i.lowTrust && i.singleMaintainer) {
85
+ reasons.push("a single maintainer and very low adoption");
86
+ }
87
+ if (reasons.length > 0) {
88
+ return {
89
+ level: "medium",
90
+ reasons,
91
+ unknowns,
92
+ complete: analysed && i.vulnLookupComplete !== false,
93
+ reassuring: false,
94
+ advisoryCount: analysed ? advisories.length : null,
95
+ scope: describeScope(i)
96
+ };
97
+ }
98
+ const complete = analysed && i.vulnLookupComplete !== false;
99
+ return {
100
+ level: "low",
101
+ reasons: [],
102
+ unknowns,
103
+ complete,
104
+ // The only path that produces a green tick, and it requires the evidence to
105
+ // be complete. An unanalysed package reads as "not checked yet", never as
106
+ // "nothing wrong with it".
107
+ reassuring: complete,
108
+ advisoryCount: analysed ? advisories.length : null,
109
+ scope: describeScope(i)
110
+ };
111
+ }
112
+
113
+ export {
114
+ assessVerdict
115
+ };
@@ -0,0 +1,73 @@
1
+ import { createRequire as __lurqCreateRequire } from 'node:module'; const require = __lurqCreateRequire(import.meta.url);
2
+ import {
3
+ httpRequest
4
+ } from "./chunk-KYKSZ3XZ.js";
5
+ import {
6
+ init_esm_shims
7
+ } from "./chunk-I3M2KJXB.js";
8
+
9
+ // src/ingestion/sources/osv.ts
10
+ init_esm_shims();
11
+ var HOST = "api.osv.dev";
12
+ var URL = `https://${HOST}/v1/querybatch`;
13
+ var BATCH = 250;
14
+ var CONCURRENCY = 4;
15
+ function installKey(name, version) {
16
+ return `${name}@${version}`;
17
+ }
18
+ async function queryVulnerableInstalls(installs, fetchImpl) {
19
+ const affected = /* @__PURE__ */ new Map();
20
+ if (installs.length === 0) return { affected, complete: true };
21
+ const unique = [...new Map(installs.map((i) => [installKey(i.name, i.version), i])).values()];
22
+ const batches = [];
23
+ for (let i = 0; i < unique.length; i += BATCH) batches.push(unique.slice(i, i + BATCH));
24
+ let complete = true;
25
+ let cursor = 0;
26
+ const worker = async () => {
27
+ for (let i = cursor++; i < batches.length; i = cursor++) {
28
+ const batch = batches[i];
29
+ try {
30
+ const { data } = await httpRequest(URL, {
31
+ host: HOST,
32
+ method: "POST",
33
+ headers: { "content-type": "application/json" },
34
+ body: JSON.stringify({
35
+ queries: batch.map((q) => ({
36
+ version: q.version,
37
+ package: { name: q.name, ecosystem: "npm" }
38
+ }))
39
+ }),
40
+ // Uncached on purpose. The shared cache keys on the URL, and every
41
+ // batch here posts to the same one with a different body — a cache hit
42
+ // would answer one tree's question with another tree's vulnerabilities.
43
+ ttlMs: 0,
44
+ // Best-effort by contract: the caller keeps its coarser answer when
45
+ // this fails, so exhausting the default retry ladder would only stall
46
+ // a scheduled scan behind an outage nobody is waiting on.
47
+ retries: 1,
48
+ fetchImpl
49
+ });
50
+ const results = data?.results ?? [];
51
+ if (results.length !== batch.length) {
52
+ complete = false;
53
+ continue;
54
+ }
55
+ results.forEach((result, j) => {
56
+ const ids = (result?.vulns ?? []).map((v) => v?.id).filter((id) => typeof id === "string");
57
+ if (ids.length === 0) return;
58
+ const q = batch[j];
59
+ affected.set(installKey(q.name, q.version), ids);
60
+ });
61
+ } catch {
62
+ complete = false;
63
+ }
64
+ }
65
+ };
66
+ await Promise.all(Array.from({ length: Math.min(CONCURRENCY, batches.length) }, worker));
67
+ return { affected, complete };
68
+ }
69
+
70
+ export {
71
+ installKey,
72
+ queryVulnerableInstalls
73
+ };
@@ -0,0 +1,49 @@
1
+ import { createRequire as __lurqCreateRequire } from 'node:module'; const require = __lurqCreateRequire(import.meta.url);
2
+ import {
3
+ LocalSandbox
4
+ } from "./chunk-C6GLE626.js";
5
+ import {
6
+ getConfig
7
+ } from "./chunk-GRJXQBQZ.js";
8
+ import {
9
+ init_esm_shims
10
+ } from "./chunk-I3M2KJXB.js";
11
+
12
+ // src/sandbox/index.ts
13
+ init_esm_shims();
14
+ var SandboxIsolationError = class extends Error {
15
+ constructor(message) {
16
+ super(message);
17
+ this.name = "SandboxIsolationError";
18
+ }
19
+ };
20
+ var localSandboxAllowed = (env = process.env) => env.LURQ_ALLOW_LOCAL_SANDBOX === "1";
21
+ function isolationGate(opts) {
22
+ if (opts.hasE2BKey) return { ok: true, driver: "e2b" };
23
+ if (opts.allowLocal) return { ok: true, driver: "local" };
24
+ return {
25
+ ok: false,
26
+ reason: "no VM isolation available: E2B_API_KEY is not set, so this would install and import an untrusted package in this process's own container. Set E2B_API_KEY, or set LURQ_ALLOW_LOCAL_SANDBOX=1 to accept local execution deliberately."
27
+ };
28
+ }
29
+ var isolationAvailable = (env) => isolationGate({
30
+ hasE2BKey: Boolean(getConfig().E2B_API_KEY),
31
+ allowLocal: localSandboxAllowed(env)
32
+ }).ok;
33
+ async function getSandbox(opts = {}) {
34
+ const hasE2BKey = Boolean(getConfig().E2B_API_KEY);
35
+ if (opts.isolated) {
36
+ const gate = isolationGate({ hasE2BKey, allowLocal: localSandboxAllowed() });
37
+ if (!gate.ok) throw new SandboxIsolationError(gate.reason);
38
+ }
39
+ if (hasE2BKey) {
40
+ const { E2BSandbox } = await import("./e2b-FVPHDULZ.js");
41
+ return new E2BSandbox();
42
+ }
43
+ return new LocalSandbox();
44
+ }
45
+
46
+ export {
47
+ isolationAvailable,
48
+ getSandbox
49
+ };
@@ -0,0 +1,107 @@
1
+ import { createRequire as __lurqCreateRequire } from 'node:module'; const require = __lurqCreateRequire(import.meta.url);
2
+ import {
3
+ init_esm_shims
4
+ } from "./chunk-I3M2KJXB.js";
5
+
6
+ // src/surface/types.ts
7
+ init_esm_shims();
8
+ function runtimeSymbols(surface) {
9
+ return surface.symbols.filter((s) => s.kind !== "type_only" && s.origin === "local");
10
+ }
11
+ function starReExports(surface) {
12
+ return surface.externalReExports.filter(
13
+ (spec) => !surface.symbols.some((s) => s.origin === `external:${spec}`)
14
+ );
15
+ }
16
+
17
+ // src/surface/diff.ts
18
+ init_esm_shims();
19
+ var empty = (from, to, reason) => ({
20
+ package: from.package,
21
+ fromVersion: from.version,
22
+ toVersion: to.version,
23
+ tier: from.tier,
24
+ removed: [],
25
+ added: [],
26
+ arityChanged: [],
27
+ signatureChanged: [],
28
+ typeOnlyRemoved: [],
29
+ deprecated: [],
30
+ renamed: [],
31
+ inconclusive: reason
32
+ });
33
+ function diffSurfaces(from, to) {
34
+ if (from.tier !== to.tier) {
35
+ return empty(from, to, `cross-tier comparison refused: ${from.tier} vs ${to.tier}`);
36
+ }
37
+ if (from.symbols.length === 0) {
38
+ return empty(from, to, "source surface is empty, extraction failed, not a removal");
39
+ }
40
+ if (to.symbols.length === 0) {
41
+ return empty(from, to, "target surface is empty, extraction failed, not a removal");
42
+ }
43
+ const fromRuntime = new Map(runtimeSymbols(from).map((s) => [s.path, s]));
44
+ const toRuntime = new Map(runtimeSymbols(to).map((s) => [s.path, s]));
45
+ const toPresent = new Set(to.symbols.filter((s) => s.kind !== "type_only").map((s) => s.path));
46
+ const removed = [...fromRuntime.values()].filter((s) => !toPresent.has(s.path));
47
+ const added = [...toRuntime.values()].filter((s) => !fromRuntime.has(s.path));
48
+ const arityChanged = [];
49
+ for (const [path, a] of fromRuntime) {
50
+ const b = toRuntime.get(path);
51
+ if (!b) continue;
52
+ const requiredChanged = a.arity !== null && b.arity !== null && a.arity !== b.arity;
53
+ const measured = a.maxArity !== void 0 && b.maxArity !== void 0;
54
+ const maxShrank = typeof a.maxArity === "number" && typeof b.maxArity === "number" && b.maxArity < a.maxArity;
55
+ if (requiredChanged || maxShrank) {
56
+ arityChanged.push({
57
+ path,
58
+ from: a.arity,
59
+ to: b.arity,
60
+ ...measured ? { fromMax: a.maxArity, toMax: b.maxArity } : {}
61
+ });
62
+ }
63
+ }
64
+ const typeOnlyFrom = from.symbols.filter((s) => s.kind === "type_only");
65
+ const toPaths = new Set(to.symbols.map((s) => s.path));
66
+ const typeOnlyRemoved = typeOnlyFrom.filter((s) => !toPaths.has(s.path));
67
+ const signatureChanged = [];
68
+ if (from.tier === "bundled_dts") {
69
+ const fromAll = new Map(from.symbols.map((s) => [s.path, s]));
70
+ for (const b of to.symbols) {
71
+ const a = fromAll.get(b.path);
72
+ if (a?.signature && b.signature && a.signature !== b.signature) {
73
+ signatureChanged.push({ path: b.path, from: a.signature, to: b.signature });
74
+ }
75
+ }
76
+ }
77
+ const deprecated = [...toRuntime.values()].filter(
78
+ (s) => s.deprecated && !fromRuntime.get(s.path)?.deprecated
79
+ );
80
+ const declKey = (s) => s.sourceRef?.offset === void 0 ? null : `${s.sourceRef.file}#${s.sourceRef.offset}`;
81
+ const renamed = [];
82
+ for (const r of removed) {
83
+ const key = declKey(r);
84
+ if (key === null) continue;
85
+ const survivors = [...fromRuntime.values()].filter((s) => s.path !== r.path && toRuntime.has(s.path) && declKey(s) === key).map((s) => s.path);
86
+ if (survivors.length) renamed.push({ path: r.path, to: survivors });
87
+ }
88
+ return {
89
+ package: from.package,
90
+ fromVersion: from.version,
91
+ toVersion: to.version,
92
+ tier: from.tier,
93
+ removed,
94
+ added,
95
+ arityChanged,
96
+ signatureChanged,
97
+ typeOnlyRemoved,
98
+ deprecated,
99
+ renamed
100
+ };
101
+ }
102
+
103
+ export {
104
+ runtimeSymbols,
105
+ starReExports,
106
+ diffSurfaces
107
+ };