Skip to content

replysieve 0.3.0: npm package (WebAssembly) for Cloudflare Workers and Node - #7

Merged
aakashpawar1999 merged 5 commits into
developfrom
feat/0.3.0
Nov 8, 2026
Merged

aakashpawar1999 merged 5 commits into
developfrom
feat/0.3.0

Conversation

@aakashpawar1999

Copy link
Copy Markdown
Contributor

What

  • npm package @zeroonething/replysieve: the library compiled to WebAssembly with wasm-bindgen. new Checker(options, apiKey) with check, checkBatch and a synchronous precheck returns the same verdict JSON as the CLI, inside Cloudflare Workers (the workerd export condition, bundled by wrangler) and Node 20+ (the node condition). TypeScript types included.
  • Options: level, preset, models, rules, stock_phrases, a TOML config string (other fields override it, as CLI flags override the file), timeout_ms, base_url, log. Unknown keys, levels and presets and invalid TOML throw an Error named ReplysieveError.
  • On wasm32 the OpenRouter client calls the runtime's fetch with AbortSignal.timeout, keeping the same ordered model fallback and the needs_review/model_unavailable outcome. Native keeps reqwest.
  • Cargo: clap, tokio, axum, rmcp and schemars sit behind the default cli feature; the binary requires it. cargo build --lib --no-default-features --target wasm32-unknown-unknown builds. std::time::Instant is replaced by web-time; Config::load is native-only.
  • CI: wasm32 clippy and build, and a JavaScript job on Node 20 and 22 that builds the package and runs the Node, golden and workerd suites and checks the gzipped wasm stays under 1 MiB.
  • Release workflow: checks npm/package.json matches Cargo.toml, checks the registry, and publishes to npm with provenance from the npm environment (main only; trusted publishing when configured, otherwise NPM_TOKEN). Skips when the version exists, so reruns stay idempotent. Dependabot watches /npm.
  • README "Use it from JavaScript" (Worker with a secret, Node, browser warning), npm README, CHANGELOG 0.3.0, CONTRIBUTING, version 0.3.0.

Proof

  • cargo test --locked: 48 passed, unchanged from 0.2.0. clippy -D warnings on native and wasm32, fmt, cargo-deny, cargo doc -D warnings, cargo publish --dry-run all pass.
  • npm test: 28 passed on Node 20.20.2, 22.23.4 and 24. Includes a golden test where 15 cases (every pre-check reason, model approve and rejects, fallback, model_unavailable, config and flag precedence) give the same verdicts from the package and the CLI against one mocked OpenRouter.
  • npm run test:workerd: 5 passed. The package is packed, installed into a scratch project, bundled and run by wrangler's local runtime. Covers fallback, timeout abort, duplicate without a network call, checkBatch and typed errors. precheck inside workerd: p99 1 ms over 300 calls.
  • Gzipped wasm is 215 KB and npm pack is 236 KB. tsc --strict passes against the packed types. actionlint passes on both workflows.

…n Debug

- release.yml: npm-pack builds, tests and packs with no credential after the
  tag and GitHub release exist; npm publishes the tarball with provenance from
  the npm environment. Pre-releases go to the next dist-tag and an older
  version never takes latest.
- The API key never appears in Debug output (native and wasm).
- The JavaScript missing-key error names the apiKey argument.
- package.json exports only workerd, worker and node conditions.
- Timeout tests wait for the abort to reach the mock; workerd latency bound
  relaxed on CI runners.
Comment thread .github/workflows/release.yml Dismissed
Comment thread .github/workflows/release.yml Dismissed
Comment thread .github/workflows/release.yml Dismissed
Comment thread .github/workflows/release.yml Dismissed
Comment thread .github/workflows/release.yml Dismissed
Comment thread .github/workflows/release.yml Dismissed
@aakashpawar1999
aakashpawar1999 merged commit a5c9de3 into develop Nov 8, 2026
29 checks passed
@aakashpawar1999 aakashpawar1999 mentioned this pull request Nov 8, 2026
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.

2 participants