Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"Scrapybara"
],
"typescript.tsdk": "node_modules/typescript/lib",
"python.languageServer": "None"
"python.languageServer": "None",
"deno.enable": false
}
3 changes: 3 additions & 0 deletions internal/bench/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
"main": "index.js",
"license": "MIT",
"dependencies": {
"@langchain/core": "^1.1.24",
"@langchain/langgraph": "workspace:*",
"@langchain/langgraph-checkpoint": "workspace:*",
"@tsconfig/recommended": "^1.0.2",
"@types/node": "^18.15.11",
"prettier": "^2.8.3",
"typescript": "^4.9.5 || ^5.4.5",
"uuid": "^13.0.0",
"vitest": "^3.2.4"
}
}
2 changes: 2 additions & 0 deletions libs/langgraph-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"lint": "pnpm lint:eslint && pnpm lint:dpdm",
"lint:fix": "pnpm lint:eslint --fix && pnpm lint:dpdm",
"prepublish": "pnpm build",
"perf:analyze": "ENABLE_PERFORMANCE_ANALYSIS=true vitest run",
"test": "vitest run",
"test:browser": "vitest run --mode browser",
"test:watch": "vitest watch",
Expand Down Expand Up @@ -83,6 +84,7 @@
"typescript": "^4.9.5 || ^5.4.5",
"vite-plugin-node-polyfills": "^0.23.0",
"vitest": "^3.2.4",
"zeitzeuge": "^0.6.6",
"zod-to-json-schema": "^3.22.4"
},
"publishConfig": {
Expand Down
5 changes: 5 additions & 0 deletions libs/langgraph-core/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,12 @@ export class EmptyInputError extends BaseLangGraphError {

export class EmptyChannelError extends BaseLangGraphError {
constructor(message?: string, fields?: BaseLangGraphErrorFields) {
// Skip expensive stack trace capture — this error is used for
// control flow in hot paths (channel reads) rather than exceptional cases.
const prevLimit = Error.stackTraceLimit;
Error.stackTraceLimit = 0;
super(message, fields);
Error.stackTraceLimit = prevLimit;
this.name = "EmptyChannelError";
}

Expand Down
11 changes: 6 additions & 5 deletions libs/langgraph-core/src/hash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ function assert(a: boolean) {
if (!a) throw new Error("Assert failed");
}

const bswap64Scratch = new DataView(new ArrayBuffer(8));
function bswap64(a: bigint) {
const scratchbuf = new DataView(new ArrayBuffer(8));
scratchbuf.setBigUint64(0, a, true);
return scratchbuf.getBigUint64(0, false);
bswap64Scratch.setBigUint64(0, a, true);
return bswap64Scratch.getBigUint64(0, false);
}

function bswap32(input: bigint) {
Expand Down Expand Up @@ -476,13 +476,14 @@ function XXH3_len_129to240_128b(
return h128l | (h128h << n(64));
}

const encoder = new TextEncoder();
const hexDigest = (data: bigint) => data.toString(16).padStart(32, "0");

// 16 byte min input
export function XXH3(input: Uint8Array | string, seed: bigint = n(0)) {
const encoder = new TextEncoder();
const data = view(typeof input === "string" ? encoder.encode(input) : input);
const len = data.byteLength;

const hexDigest = (data: bigint) => data.toString(16).padStart(32, "0");
if (len <= 16) return hexDigest(XXH3_len_0to16_128b(data, seed));
if (len <= 128) return hexDigest(XXH3_len_17to128_128b(data, kkey, seed));
if (len <= 240) return hexDigest(XXH3_len_129to240_128b(data, kkey, seed));
Expand Down
Loading
Loading