feat(sdk,cli): unify default endpoint, tighten typing, fix wire format#22
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DX-audit response across the TS SDK, Go SDK, and
sbxCLI:SANDBOXD_ENDPOINT→ Unix socket →http://localhost:7522. SDKs also honourSBX_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.fs.rename, typedfs.statasStatResult, dropped the brokenspawn/ptystubs, validatedenv.set/env.delete, and wrappednet.expose/close/portserrors with body context (CapacityErroron 429/503).fs.renamewas sending{oldPath, newPath}but the agent expects{old, new};fs.statwas readingisDir/modTimebut the agent emitsis_dirandmod_time(RFC3339). Fixed in both SDKs.process.execexit_codemismatch in the Go SDK is noted as a follow-up.SBX_DEBUG=1traces requests; "connection refused" errors now print a hint with the exactdocker runcommand andSANDBOXD_ENDPOINTfallback.CapacityErrorretry recipe,signatureAuth()multi-tenant example, capabilities footnote noting TS SDK doesn't yet exposespawn/pty.Test plan
go test ./...— all packages passbunx --bun vitest runinsdk/typescript— 20/20bunx --bun vitest runinmcp— 22/22 (after rebuilding the SDKdist)fs.rename/fs.statround-trip works