Affected package or area
@sapiom/agent-core load.ts (loadDefinition) and check.ts (check)
Affected version, release, or commit
latest main (3cbe957)
Environment
Node.js >= 18, Windows (or WSL with Windows paths); path.join returns backslash-separated paths
Minimal reproduction and steps
- On Windows, run
sapiom run or sapiom check on any agent project
- Internally, loadDefinition/check calls:
await import(file://${bundlePath}?t=${Date.now()})
where bundlePath is e.g. C:\Users...\definition.mjs
- The resulting URL is invalid: file://C:\Users...\definition.mjs
Expected behavior
Dynamic import succeeds on Windows. pathToFileURL('C:\Users...\definition.mjs') correctly produces file:///C:/Users/.../definition.mjs
Actual behavior
Import throws ERR_INVALID_URL or MODULE_NOT_FOUND because the backslash path produces a malformed file:// URL, e.g.:
file://C:\Users\serhat\AppData\Local\Temp\sapiom-...\definition.mjs?t=1234567890
Logs, screenshots, and additional context
Fix: import { pathToFileURL } from "node:url" and use
${pathToFileURL(bundlePath).href}?t=${Date.now()}
Affected lines:
- load.ts line 69-70
- check.ts line 200-201
Acknowledgements
Affected package or area
@sapiom/agent-core load.ts (loadDefinition) and check.ts (check)
Affected version, release, or commit
latest main (3cbe957)
Environment
Node.js >= 18, Windows (or WSL with Windows paths); path.join returns backslash-separated paths
Minimal reproduction and steps
sapiom runorsapiom checkon any agent projectawait import(
file://${bundlePath}?t=${Date.now()})where bundlePath is e.g. C:\Users...\definition.mjs
Expected behavior
Dynamic import succeeds on Windows. pathToFileURL('C:\Users...\definition.mjs') correctly produces file:///C:/Users/.../definition.mjs
Actual behavior
Import throws ERR_INVALID_URL or MODULE_NOT_FOUND because the backslash path produces a malformed file:// URL, e.g.:
file://C:\Users\serhat\AppData\Local\Temp\sapiom-...\definition.mjs?t=1234567890
Logs, screenshots, and additional context
Fix: import { pathToFileURL } from "node:url" and use
${pathToFileURL(bundlePath).href}?t=${Date.now()}Affected lines:
Acknowledgements