Skip to content
Closed
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
1 change: 0 additions & 1 deletion dist/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -52766,7 +52766,6 @@ function createHttpTransport(config) {
...customHeaders,
// Keep these headers lowercase so they will override any user-supplied headers above.
accept: "application/json",
"content-length": body.length.toString(),
"content-type": "application/json; charset=utf-8"
},
method: "POST",
Expand Down
2 changes: 1 addition & 1 deletion dist/cli.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52634,7 +52634,6 @@ function createHttpTransport(config) {
...customHeaders,
// Keep these headers lowercase so they will override any user-supplied headers above.
accept: "application/json",
"content-length": body.length.toString(),
"content-type": "application/json; charset=utf-8"
},
method: "POST",
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions scripts/smoke-dist.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ for (const entry of ["index.js", "cli.js", "router/index.js"]) {
`the @blockrun/llm back-import is missing or broken.`,
);
}
if (/"content-length"\s*:\s*body\.length\.toString\(\)/.test(source)) {
failures.push(
`dist/${entry} contains @solana/rpc-transport-http's manual content-length header — ` +
`Node/undici can reject that header during Solana x402 payment signing in ` +
`OpenClaw-managed runtime paths.`,
);
}
if (source.length > MAX_BUNDLE_BYTES) {
failures.push(
`dist/${entry} is ${(source.length / 1024 / 1024).toFixed(1)}MB, over the ` +
Expand Down
25 changes: 25 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
import { readFileSync } from "node:fs";
import { builtinModules } from "node:module";
import { fileURLToPath } from "node:url";
import { defineConfig } from "tsup";

const stripSolanaRpcContentLength = {
name: "strip-solana-rpc-content-length",
setup(build) {
build.onLoad(
{ filter: /[\\/]@solana[\\/]rpc-transport-http[\\/]dist[\\/]index\.node\.mjs$/ },
(args) => {
const source = readFileSync(args.path, "utf8");
const contents = source.replace(/\n\s+"content-length": body\.length\.toString\(\),/, "");
if (contents === source) {
throw new Error(
`strip-solana-rpc-content-length matched nothing in ${args.path} — ` +
`@solana/rpc-transport-http changed shape. Update the pattern; do not ship.`,
);
}
return {
contents,
loader: "js",
};
},
);
},
};

export default defineConfig({
entry: ["src/index.ts", "src/cli.ts", "src/router/index.ts"],
format: ["esm"],
Expand All @@ -12,6 +36,7 @@ export default defineConfig({
splitting: false,
noExternal: [/.*/],
external: [...builtinModules.flatMap((m) => [m, `node:${m}`])],
esbuildPlugins: [stripSolanaRpcContentLength],
esbuildOptions(options) {
// We and @blockrun/llm depend on each other, and `noExternal` inlines it. Its
// `import { route, ... } from "@blockrun/clawrouter"` therefore resolves through
Expand Down
Loading