Files
codewhale/npm/runtime-sdk/README.md
T
Hunter B 26925ae644 feat(runtime-sdk): add fleet helper client
Refs #3163.

Adds the @codewhale/runtime-sdk workspace with typed fleet Runtime API helpers, protocol-shaped TypeScript declarations, JSON/SSE event fixture handling, and typed RuntimeCapabilityError failures for create/event-stream endpoints that the Rust API has not exposed yet.

Documents the SDK contract in docs/RUNTIME_API.md and wires npm workspace verification through npm test --workspace @codewhale/runtime-sdk.
2026-06-12 22:17:16 -07:00

36 lines
1.1 KiB
Markdown

# @codewhale/runtime-sdk
Small JavaScript helpers and TypeScript declarations for CodeWhale's local
Runtime API. The package is intentionally transport-only: it never bypasses the
Rust runtime, sandbox, approvals, provider configuration, or fleet ledger.
```js
import { createRuntimeClient } from "@codewhale/runtime-sdk";
const client = createRuntimeClient({
baseUrl: "http://127.0.0.1:7878",
token: process.env.CODEWHALE_RUNTIME_TOKEN,
});
const { runs } = await client.listFleetRuns();
const workers = await client.listFleetWorkers(runs[0].id);
await client.interruptWorker(workers.workers[0].worker_id);
```
## Fleet Helpers
- `listFleetRuns()`
- `getFleetRun(runId)`
- `listFleetWorkers(runId)`
- `getFleetWorker(workerId)`
- `interruptWorker(workerId)`
- `restartWorker(workerId)`
- `stopFleetRun(runId)`
- `fleetEvents(runId)`
- `createFleetRun(spec)`
`fleetEvents` and `createFleetRun` are typed ahead of the current v0.8.60 Rust
Runtime API. If the local runtime does not expose those endpoints, the helpers
raise `RuntimeCapabilityError` with a stable `capability` string instead of a
generic fetch failure.