[Bug]: TypeScript SDK rejects long remote resource URLs with ENAMETOOLONG
Issue Origin
Observed or reproduced in a real environment
Bug Description
The TypeScript SDK's addResource() probes remote sources as local filesystem paths before sending a request. A sufficiently long URL, such as an HTTPS URL with a long signed query string, throws ENAMETOOLONG and never reaches the HTTP transport.
Steps to Reproduce
- Check out upstream
mainat4ab22a4923452362b60aef2826c2083ce36168d2. - Run
cd sdk/typescript && npm ci && npm run build. - Run the example below from the repository root on Node.js.
Expected Behavior
Forward recognized remote sources unchanged in the path field of POST /api/v1/resources, without inspecting the local filesystem.
Actual Behavior
addResource -> nodePathToBlob -> statOrUndefined -> fs.stat(source) treats the URL as a local path. Only ENOENT is ignored for resource inputs, so ENAMETOOLONG escapes before a request is sent.
Minimal Reproducible Example
import { OpenVikingClient } from "./sdk/typescript/dist/index.js";
const source = "https://example.com/resource?signature=" + "x".repeat(5000);
let requests = 0;
const client = new OpenVikingClient({
baseUrl: "http://127.0.0.1:1933",
fetch: async () => {
requests++;
return new Response(JSON.stringify({ status: "ok", result: {} }));
},
});
try {
await client.addResource(source);
} catch (error) {
console.log(error.code, requests);
}
Error Logs
ENAMETOOLONG 0
OpenViking Version
Upstream main at 4ab22a4923452362b60aef2826c2083ce36168d2; TypeScript SDK package version 0.1.0.
Python Version
reproduced with Node.js v24.19.0.
Operating System
macOS
Model Backend
the failure occurs before HTTP or model calls.
Additional Context
The reproduction uses the built public client, real filesystem probing, and an injected HTTP transport. No running OpenViking server is needed. All five existing remote forms (http://, https://, git@, ssh://, git://) reproduced the same error with a 5,000-character suffix and zero transport calls. The unmodified TypeScript suite passes all 61 tests on the same base.
The Go SDK already recognizes these five prefixes before filesystem inspection in merged PR #4285. TypeScript PR #5308 handles inline skill Markdown, not remote resource sources. Searches for ENAMETOOLONG and TypeScript remote-source/path fixes found no duplicate TypeScript resource fix.
Proposed scope: recognize the same five remote prefixes in addResource(), then reuse the existing unchanged body.path = source branch. Keep local file/directory uploads, local filesystem errors, skill handling, and OVPack behavior unchanged. No new dependency, exported type, method signature, or server change is needed.