vercel-labs / vercel-labs/callscript
Core runtime depends on Node Buffer despite documented edge portability
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 86
- Forks
- 5
- Avg merge
- 28m
- Merged PRs (30d)
- 9
Description
Summary
The README states that CallScript supports serverless and edge environments, but the core package currently relies on the Node-specific global Buffer.
The affected locations are:
packages/callscript/src/expr/eval.ts— Base64 and Base64URL helperspackages/callscript/src/execute.ts— tool-result byte measurementpackages/callscript/src/runner.ts— digest-output byte measurement
In a web-standard runtime where globalThis.Buffer is unavailable, Base64 expressions fail, and ordinary tool results can turn an otherwise successful run into an error.
Reproduction
Using the built package:
import { callscript, evalExpr, tool } from "callscript";
globalThis.Buffer = undefined;
evalExpr('Base64.encode("hi")', {});
// TypeError: Cannot read properties of undefined (reading 'from')
const engine = callscript({
tools: [
tool({
name: "demo.echo",
execute: async () => ({ ok: true }),
}),
],
});
const result = await engine.run({
script: {
steps: [
{
id: "result",
call: "demo.echo",
args: {},
},
],
},
});
console.log(result.status);
// "error"
The execution error is caused by attempting to call Buffer.byteLength.
Expected behavior
Core functionality should work in edge and browser-like runtimes without requiring a Buffer polyfill.
Base64 helpers should also preserve their current behavior, including Unicode and Base64URL support.
Proposed fix
Replace the affected Buffer usages with dependency-free, web-standard UTF-8 and Base64 utilities, and add regression tests that run with Buffer unavailable.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the affected Buffer usages in packages/callscript/src/expr/eval.ts, packages/callscript/src/execute.ts, and packages/callscript/src/runner.ts, then reproduce the issue with globalThis.Buffer unavailable. Replace those usages with dependency-free web-standard utilities, add regression tests, and verify Base64, Base64URL, Unicode, and ordinary tool-result execution still work without Buffer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100