Skip to content

feat(sdk): TypeScript SDK — scaffold + core client - #99

Merged
prashar32 merged 1 commit into
mainfrom
feat/typescript-sdk
Jun 10, 2026
Merged

feat(sdk): TypeScript SDK — scaffold + core client#99
prashar32 merged 1 commit into
mainfrom
feat/typescript-sdk

Conversation

@prashar32

Copy link
Copy Markdown
Owner

The TypeScript/JavaScript SDK (#27), scaffolded with a working core client — the npm-ecosystem analog of the Python SDK.

@riskkernel/sdk mirrors the Python Runtime / Run / Budget over the /v1 API:

  • new Runtime({ baseUrl, token })governedRun({ budget }, async (run) => …)
  • run.step() / checkpoint() / latestCheckpoint() / cancel() / status() / proxyConfig() / approve()
  • a budget halt surfaces as BudgetExceeded (the 402 → exception mapping); the run cancels if the body throws

Same 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.ts via tsup.

Verified

  • npm run typecheck (strict) · npm test — 5 vitest tests against an in-process mock daemon · npm run build → ESM + CJS + types.
  • End-to-end against the real daemon: a governed run with { loops: 3 } halts on the 4th step with loop_budget_exceededBudgetExceeded.
  • A path-filtered TypeScript SDK CI 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 is 0.1.0 until it reaches parity + is published.

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).
@prashar32
prashar32 merged commit 9915f81 into main Jun 10, 2026
7 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