New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@llama-node/llama-cpp

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@llama-node/llama-cpp - npm Package Compare versions

Comparing version
0.0.30
to
0.0.31
+0
-1
Cargo.toml

@@ -13,3 +13,2 @@ [package]

# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
clap = { version = "4.1.8", features = ["derive"] }
env_logger = "0.10.0"

@@ -16,0 +15,0 @@ log = "0.4"

+4
-6

@@ -1,2 +0,2 @@

import { LLama, LlamaContextParams, LlamaInvocation } from "../index";
import { LLama, LlamaInvocation } from "../index";
import path from "path";

@@ -12,7 +12,6 @@

const prompt = `
### Human: ${template}
const prompt = `A chat between a user and an assistant.
USER: ${template}
ASSISTANT:`;
### Assistant:`;
const params: LlamaInvocation = {

@@ -25,3 +24,2 @@ nThreads: 4,

repeatPenalty: 1,
stopSequence: "### Human",
prompt,

@@ -28,0 +26,0 @@ };

@@ -7,2 +7,3 @@ #![allow(clippy::uninlined_format_args)]

use platforms::{Arch, Platform, OS};
use std::env;

@@ -12,4 +13,4 @@ use std::path::PathBuf;

fn main() {
let (_host, target_arch, target_os) = get_build_target();
let target = env::var("TARGET").unwrap();
let platform = Platform::find(&target).unwrap();
env::set_var("RUSTFLAGS", "-C target-feature=+crt-static");

@@ -20,3 +21,3 @@ env::set_var("CXXFLAGS", "-fPIC");

// Link macOS Accelerate framework for matrix calculations
if target.contains("apple") {
if platform.target_os == OS::MacOS {
println!("cargo:rustc-link-lib=framework=Accelerate");

@@ -29,33 +30,25 @@ }

if env::var("LLAMA_DONT_GENERATE_BINDINGS").is_ok() {
let _: u64 = std::fs::copy(
"src/bindings.rs",
env::var("OUT_DIR").unwrap() + "/bindings.rs",
)
.expect("Failed to copy bindings.rs");
} else {
let bindings = bindgen::Builder::default()
.header("wrapper.h")
.clang_arg("-I./llama.cpp")
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
.generate();
let bindings = bindgen::Builder::default()
.header("wrapper.h")
.clang_arg("-I./llama.cpp")
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
.generate();
match bindings {
Ok(b) => {
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
b.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings!");
}
Err(e) => {
println!("cargo:warning=Unable to generate bindings: {}", e);
println!("cargo:warning=Using bundled bindings.rs, which may be out of date");
// copy src/bindings.rs to OUT_DIR
std::fs::copy(
"src/bindings.rs",
env::var("OUT_DIR").unwrap() + "/bindings.rs",
)
.expect("Unable to copy bindings.rs");
}
match bindings {
Ok(b) => {
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
b.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings!");
}
};
Err(e) => {
println!("cargo:warning=Unable to generate bindings: {}", e);
println!("cargo:warning=Using bundled bindings.rs, which may be out of date");
// copy src/bindings.rs to OUT_DIR
std::fs::copy(
"src/bindings.rs",
env::var("OUT_DIR").unwrap() + "/bindings.rs",
)
.expect("Unable to copy bindings.rs");
}
}

@@ -83,10 +76,18 @@ // stop if we're on docs.rs

if target_os.contains("darwin") && target_arch.contains("aarch64") {
command
.arg("-DCMAKE_SYSTEM_NAME=Darwin")
.arg("-DCMAKE_SYSTEM_PROCESSOR=apple-m1")
.arg("-DCMAKE_OSX_ARCHITECTURES=arm64")
.arg("-DLLAMA_NATIVE=OFF");
println!("command: {:?}", command.get_args());
if platform.target_os == OS::MacOS {
if platform.target_arch == Arch::AArch64 {
command
.arg("-DAPPLE=ON")
.arg("-DLLAMA_ACCELERATE=ON")
.arg("-DCMAKE_SYSTEM_NAME=Darwin")
.arg("-DCMAKE_SYSTEM_PROCESSOR=apple-m1")
.arg("-DCMAKE_OSX_ARCHITECTURES=arm64")
.arg("-DLLAMA_NATIVE=OFF");
} else {
command
.arg("-DAPPLE=ON")
.arg("-DLLAMA_ACCELERATE=ON")
.arg("-DCMAKE_SYSTEM_NAME=Darwin")
.arg("-DCMAKE_SYSTEM_PROCESSOR=x86_64");
}
}

@@ -130,27 +131,1 @@

}
// From https://github.com/alexcrichton/cc-rs/blob/fba7feded71ee4f63cfe885673ead6d7b4f2f454/src/lib.rs#L2462
// fn get_cpp_link_stdlib(target: &str) -> Option<&'static str> {
// if target.contains("msvc") {
// None
// } else if target.contains("apple") || target.contains("freebsd") || target.contains("openbsd") {
// Some("c++")
// } else if target.contains("android") {
// Some("c++_shared")
// } else {
// Some("stdc++")
// }
// }
fn get_build_target() -> (String, String, String) {
let target = env::var("TARGET").unwrap();
let target_triple = target.split('-').collect::<Vec<&str>>();
let target_arch = target_triple[0];
let target_os = target_triple[2];
let host = env::var("HOST").unwrap();
println!("target_arch: {}", target_arch);
println!("target_os: {}", target_os);
println!("host: {}", host);
(host, target_arch.to_string(), target_os.to_string())
}

@@ -10,2 +10,3 @@ [package]

[build-dependencies]
bindgen = "0.64"
bindgen = "0.64"
platforms = "3.0.2"
{
"name": "@llama-node/llama-cpp",
"version": "0.0.30",
"version": "0.0.31",
"main": "index.js",

@@ -25,3 +25,2 @@ "types": "index.d.ts",

"scripts": {
"prepublish": "npm run artifacts",
"cross-compile": "rimraf @llama-node && tsx scripts/cross-compile.mts",

@@ -28,0 +27,0 @@ "artifacts": "tsx scripts/artifacts.ts",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet