mirror of
https://github.com/ruvnet/RuView
synced 2026-07-25 17:51:48 +00:00
7393cc2b73
- rvcsi-runtime — the composition layer (no FFI): CaptureRuntime (CsiSource + validate_frame + SignalPipeline + EventPipeline, with next_validated_frame / next_clean_frame / drain_events / health) plus one-shot helpers (summarize_capture → CaptureSummary, decode_nexmon_records, events_from_capture, export_capture_to_rf_memory, rf_memory_self_check). 10 tests. - rvcsi-node — the napi-rs seam (cdylib+rlib, build.rs runs napi_build::setup): thin #[napi] wrappers over rvcsi-runtime — rvcsiVersion / nexmonShimAbiVersion / nexmonDecodeRecords / inspectCaptureFile / eventsFromCaptureFile / exportCaptureToRfMemory + an RvcsiRuntime streaming class. Everything that crosses the boundary is a validated/normalized rvCSI struct serialized to JSON (D6). deny(clippy::all). - @ruv/rvcsi npm package (package.json + index.js + index.d.ts + README + __test__/api.test.cjs) — curated JS surface that JSON-parses the addon's output into plain CsiFrame/CsiWindow/CsiEvent/SourceHealth/CaptureSummary objects; lazy native-addon load with a helpful "not built" error. - rvcsi-cli — the `rvcsi` binary: record (Nexmon dump → .rvcsi, validating), inspect, replay, stream, events, health, calibrate (v0 baseline), export ruvector. 7 tests exercising every subcommand against in-memory captures. - rvcsi-cli no longer depends on rvcsi-node (a binary can't link the napi addon); the shared logic moved to rvcsi-runtime. .gitignore: ignore the generated *.node / binding.js / binding.d.ts / npm/ under rvcsi-node. All rvcsi crates: build together OK, clippy-clean, 140 unit/integration tests + 2 doctests, 0 failures (core 29, dsp 28, events 18, adapter-file 20+1, adapter-nexmon 9, ruvector 20+1, runtime 10, cli 7). https://claude.ai/code/session_01CdYAPvRTjcch6YrYf42n1z
42 lines
1.4 KiB
JavaScript
42 lines
1.4 KiB
JavaScript
'use strict';
|
|
|
|
// Structural smoke test for the @ruv/rvcsi JS surface.
|
|
//
|
|
// Importing the package never throws (the native addon loads lazily). This test
|
|
// asserts the public API shape; if the .node addon HAS been built (e.g. CI ran
|
|
// `npm run build` first), it also checks `rvcsiVersion()` returns a string —
|
|
// otherwise it asserts the error message is the helpful "not built" one.
|
|
//
|
|
// Run with: node --test (Node >= 18)
|
|
|
|
const test = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const rvcsi = require('../index.js');
|
|
|
|
test('exports the expected functions and class', () => {
|
|
for (const fn of [
|
|
'rvcsiVersion',
|
|
'nexmonShimAbiVersion',
|
|
'nexmonDecodeRecords',
|
|
'inspectCaptureFile',
|
|
'eventsFromCaptureFile',
|
|
'exportCaptureToRfMemory',
|
|
]) {
|
|
assert.equal(typeof rvcsi[fn], 'function', `${fn} should be a function`);
|
|
}
|
|
assert.equal(typeof rvcsi.RvCsi, 'function', 'RvCsi should be a class');
|
|
assert.equal(typeof rvcsi.RvCsi.openCaptureFile, 'function');
|
|
assert.equal(typeof rvcsi.RvCsi.openNexmonFile, 'function');
|
|
});
|
|
|
|
test('native calls either work (addon built) or fail with a helpful message', () => {
|
|
try {
|
|
const v = rvcsi.rvcsiVersion();
|
|
assert.equal(typeof v, 'string');
|
|
assert.match(v, /^\d+\.\d+\.\d+/);
|
|
assert.equal(typeof rvcsi.nexmonShimAbiVersion(), 'number');
|
|
} catch (e) {
|
|
assert.match(e.message, /native addon is not built/i);
|
|
}
|
|
});
|