• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

joaoh82 / rust_sqlite / 25247267037
69%

Build:
DEFAULT BRANCH: main
Ran 02 May 2026 07:55AM UTC
Jobs 1
Files 38
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

02 May 2026 07:51AM UTC coverage: 57.232% (-0.4%) from 57.634%
25247267037

push

github

web-flow
Phase 7g.7: WASM SDK askPrompt() / askParse() (Q9 split shape) (#70)

The structurally different SDK in the wave: per Q9, the WASM module
does the schema-aware prompt construction in-page but does NOT make
the HTTP request itself. The JS caller's backend handles the LLM
API call. Browser tab never sees the API key, never POSTs to a
third-party LLM endpoint, never deals with CORS.

## Public surface — two-step JS API

```js
import init, { Database } from '@joaoh82/sqlrite-wasm';
await init();

const db = new Database();
db.exec(`CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, age INTEGER)`);

// Step 1: build the request body in-browser
const payload = db.askPrompt('How many users are over 30?');
// → Anthropic /v1/messages body: { model, max_tokens, system, messages }

// Step 2: caller's backend forwards to Anthropic with the API key
const apiResponse = await fetch('/api/llm/complete', {
  method: 'POST',
  body: JSON.stringify(payload),
}).then(r => r.text());

// Step 3: WASM parses the response back
const result = db.askParse(apiResponse);
// → { sql, explanation, usage: {...} }
```

Backend proxy is ~10 lines of Express / Cloudflare Worker / Vercel
Edge — README has the worked example (Q9 doc requirement).

## What's new

  * `Database.askPrompt(question, options?)` — builds Anthropic's
    /v1/messages request body. The cache_control marker on the
    schema block is preserved so prompt caching works through the
    proxy.
  * `Database.askParse(rawApiResponse)` — parses the full Anthropic
    API response (text content + usage) back into
    `{ sql, explanation, usage: { inputTokens, outputTokens,
       cacheCreationInputTokens, cacheReadInputTokens } }`.
    Tolerant of fenced JSON / leading prose in the model's text
    (same parser the other SDKs use).
  * `AskPromptOptions` class with `model`, `maxTokens`, `cacheTtl`
    fields. Defaults match every other SDK: claude-sonnet-4-6 /
    1024 / 5m.

## Required structural refactor

Wiri... (continued)

0 of 69 new or added lines in 3 files covered. (0.0%)

552 existing lines in 3 files now uncovered.

5492 of 9596 relevant lines covered (57.23%)

1.17 hits per line

Uncovered Changes

Lines Coverage ∆ File
60
0.0
0.0% sdk/wasm/src/lib.rs
8
7.81
-0.21% src/lib.rs
1
0.0
0.0% sqlrite-ask/src/lib.rs

Coverage Regressions

Lines Coverage ∆ File
550
7.81
-0.21% src/lib.rs
1
0.0
0.0% sqlrite-ask/src/lib.rs
1
0.0
0.0% src/ask/mod.rs
Jobs
ID Job ID Ran Files Coverage
1 25247267037.1 02 May 2026 07:55AM UTC 38
57.23
GitHub Action Run
Source Files on build 25247267037
  • Tree
  • List 38
  • Changed 4
  • Source Changed 0
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 39f60b07 on github
  • Prev Build on main (#25235008657)
  • Next Build on main (#25247339122)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc