Summary
Three agent examples cannot be run with the documented command (npx tsx examples/agents/<file>.ts) — they fail at transpile with TransformError: Top-level await is currently not supported with the "cjs" output format. They use top-level await, but the package resolves to CommonJS output under tsx, and CJS can't have top-level await.
Environment
conductor-oss/javascript-sdk @ main, tsx (bundled), Node 24, macOS
- (env/server irrelevant — failure is at transpile, before any server/LLM call)
Repro
cd javascript-sdk
# a normal example runs fine with the documented command:
export AGENTSPAN_SERVER_URL=http://localhost:8080/api AGENTSPAN_LLM_MODEL=anthropic/claude-sonnet-4-6
npx tsx examples/agents/01-basic-agent.ts # → COMPLETED
# these 3 never compile:
for f in 57-plan-dry-run 63-deploy 63c-run-by-name; do
npx tsx examples/agents/$f.ts
done
Actual
examples/agents/57-plan-dry-run.ts:69:23: ERROR: Top-level await is currently not supported with the "cjs" output format
examples/agents/57-plan-dry-run.ts:90:2: ERROR: Top-level await is currently not supported with the "cjs" output format
examples/agents/63-deploy.ts:75:17: ERROR: Top-level await ...
examples/agents/63-deploy.ts:88:2: ERROR: Top-level await ...
examples/agents/63c-run-by-name.ts:21:17: ERROR: Top-level await ...
examples/agents/63c-run-by-name.ts:33:2: ERROR: Top-level await ...
name: 'TransformError'
01-basic-agent.ts COMPLETES with the exact same command → the run command is correct; these 3 specifically can't compile.
Cause
The examples use top-level await, but the SDK package is CommonJS (no "type": "module"), so tsx emits CJS output, which does not support top-level await.
Suggested fix
Either wrap the top-level await calls in an async function main() { ... } main() (matching the other examples), or make the examples run as ESM.
Affected files
examples/agents/57-plan-dry-run.ts
examples/agents/63-deploy.ts
examples/agents/63c-run-by-name.ts
Summary
Three agent examples cannot be run with the documented command (
npx tsx examples/agents/<file>.ts) — they fail at transpile withTransformError: Top-level await is currently not supported with the "cjs" output format. They use top-levelawait, but the package resolves to CommonJS output undertsx, and CJS can't have top-level await.Environment
conductor-oss/javascript-sdk@main,tsx(bundled), Node 24, macOSRepro
Actual
01-basic-agent.tsCOMPLETES with the exact same command → the run command is correct; these 3 specifically can't compile.Cause
The examples use top-level
await, but the SDK package is CommonJS (no"type": "module"), sotsxemits CJS output, which does not support top-level await.Suggested fix
Either wrap the top-level
awaitcalls in anasync function main() { ... } main()(matching the other examples), or make the examples run as ESM.Affected files
examples/agents/57-plan-dry-run.tsexamples/agents/63-deploy.tsexamples/agents/63c-run-by-name.ts