Skip to content

feat(sdk,cli): unify default endpoint, tighten typing, fix wire format#22

Merged
ch99q merged 1 commit into
mainfrom
ch99q/dx-userflow-review
May 12, 2026
Merged

feat(sdk,cli): unify default endpoint, tighten typing, fix wire format#22
ch99q merged 1 commit into
mainfrom
ch99q/dx-userflow-review

Conversation

@ch99q
Copy link
Copy Markdown
Contributor

@ch99q ch99q commented May 12, 2026

Summary

DX-audit response across the TS SDK, Go SDK, and sbx CLI:

  • Daemon auto-discovery: SDKs and CLI now resolve the endpoint in the same order — SANDBOXD_ENDPOINT → Unix socket → http://localhost:7522. SDKs also honour SBX_AUTH. This fixes the fresh-user setup where the CLI defaulted to TCP but the SDK defaulted to a socket the host didn't have.
  • TS SDK API cleanup: added fs.rename, typed fs.stat as StatResult, dropped the broken spawn/pty stubs, validated env.set/env.delete, and wrapped net.expose/close/ports errors with body context (CapacityError on 429/503).
  • Pre-existing wire-format bugs: fs.rename was sending {oldPath, newPath} but the agent expects {old, new}; fs.stat was reading isDir/modTime but the agent emits is_dir and mod_time (RFC3339). Fixed in both SDKs. process.exec exit_code mismatch in the Go SDK is noted as a follow-up.
  • CLI: SBX_DEBUG=1 traces requests; "connection refused" errors now print a hint with the exact docker run command and SANDBOXD_ENDPOINT fallback.
  • Docs: env-var table, CapacityError retry recipe, signatureAuth() multi-tenant example, capabilities footnote noting TS SDK doesn't yet expose spawn/pty.

Test plan

  • go test ./... — all packages pass
  • bunx --bun vitest run in sdk/typescript — 20/20
  • bunx --bun vitest run in mcp — 22/22 (after rebuilding the SDK dist)
  • Manual smoke against a running daemon to confirm fs.rename / fs.stat round-trip works

DX audit follow-ups across the TS SDK, Go SDK, and sbx CLI:

* Auto-discover the daemon: SANDBOXD_ENDPOINT env var, then Unix socket,
  then http://localhost:7522. Both SDKs and the CLI now use the same
  precedence, eliminating the mismatch that broke fresh-user setups.
* SDKs honour SBX_AUTH as the default bearer token.
* TS SDK: add fs.rename, type fs.stat as StatResult, drop the broken
  spawn/pty stubs, validate env.set/delete inputs, wrap port-tunnel
  errors with body context and surface CapacityError on 429/503.
* Fix pre-existing wire-format bugs: fs.rename now sends {old, new} and
  fs.stat reads {is_dir, mod_time} (RFC3339) to match the agent.
* sbx: SBX_DEBUG=1 traces requests; connection-refused errors include a
  hint pointing at docker run / SANDBOXD_ENDPOINT.
* README + sdk/typescript/README: env-var table, CapacityError retry
  recipe, signatureAuth() multi-tenant example, capabilities footnote.
@ch99q ch99q merged commit 93ce484 into main May 12, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant