feat(sdk): TypeScript SDK — scaffold + core client - #99
Merged
Conversation
A thin @riskkernel/sdk mirroring the Python SDK over the /v1 API: Runtime, governedRun, Budget, and Run (step / checkpoint / cancel / status / proxyConfig / approve), with the 402 -> BudgetExceeded mapping. Dependency-free (global fetch, Node 18+), dual ESM/CJS build via tsup, vitest tests against an in-process mock daemon, and a path-filtered CI workflow. Verified end-to-end against the real daemon: a governed run with a loop budget halts with loop_budget_exceeded. Crash-resume, framework adapters, and npm publishing are left as tracked contributor issues (#80-#82).
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.
The TypeScript/JavaScript SDK (#27), scaffolded with a working core client — the npm-ecosystem analog of the Python SDK.
@riskkernel/sdkmirrors the PythonRuntime/Run/Budgetover the/v1API:new Runtime({ baseUrl, token })→governedRun({ budget }, async (run) => …)run.step()/checkpoint()/latestCheckpoint()/cancel()/status()/proxyConfig()/approve()BudgetExceeded(the 402 → exception mapping); the run cancels if the body throwsSame ethos as the Python SDK: no governance logic client-side (the Go core decides), and no runtime dependencies — it uses the global
fetch(Node 18+). Dual ESM/CJS build with.d.tsvia tsup.Verified
npm run typecheck(strict) ·npm test— 5 vitest tests against an in-process mock daemon ·npm run build→ ESM + CJS + types.{ loops: 3 }halts on the 4th step withloop_budget_exceeded→BudgetExceeded.TypeScript SDKCI workflow (node 18/20), mirroring the Python SDK's.Left for contributors (tracked)
Crash-resume
resumeRun(#80), the Vercel AI SDK adapter (#81), and npm publishing via Trusted Publishing (#82). The package version is0.1.0until it reaches parity + is published.