mirror of
https://github.com/ruvnet/RuView
synced 2026-07-12 15:43:18 +00:00
3f462a254d
Adds two new npm packages that expose RuView's WiFi-DensePose sensing capabilities outside the Cognitum appliance ecosystem: - tools/ruview-mcp/ (@ruv/ruview-mcp) — MCP server with 6 tools: ruview_csi_latest, ruview_pose_infer, ruview_count_infer, ruview_registry_list, ruview_train_count, ruview_job_status. Uses @modelcontextprotocol/sdk with stdio transport. 6/6 smoke tests pass. TypeScript strict mode, Node 20. - tools/ruview-cli/ (@ruv/ruview-cli) — Yargs CLI with matching subcommands: csi tail, pose infer, count infer, cogs list, train count, job status. Same fail-open pattern as the cog binaries (WARN to stderr, exit 0 on unavailable sensing-server). - docs/adr/ADR-104-ruview-mcp-cli-distribution.md — design rationale, 6-row threat table, packaging plan, acceptance gates, failure modes. - docs/research/sota-2026-05-22/HORIZON.md — 12-hour horizon plan with 7 milestones tracked (M1 complete in this commit). Both packages are private:true pending the user's publish decision. Inference is via subprocess to the signed cog binaries (ADR-100/101/103) — no JS/WASM ML engine bundled.
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
/**
|
|
* Subprocess wrapper for Cognitum Cog binaries (CLI variant).
|
|
* Mirrors tools/ruview-mcp/src/cog.ts.
|
|
*/
|
|
|
|
import { spawn } from "node:child_process";
|
|
|
|
export type Result<T> = { ok: true; data: T } | { ok: false; error: string };
|
|
|
|
const COG_TIMEOUT_MS = 15_000;
|
|
|
|
export async function runCog(binary: string, args: string[]): Promise<Result<string>> {
|
|
return new Promise((resolve) => {
|
|
let stdout = "";
|
|
let stderr = "";
|
|
|
|
const child = spawn(binary, args, {
|
|
timeout: COG_TIMEOUT_MS,
|
|
stdio: ["ignore", "pipe", "pipe"],
|
|
});
|
|
|
|
child.stdout?.on("data", (chunk: Buffer) => { stdout += chunk.toString(); });
|
|
child.stderr?.on("data", (chunk: Buffer) => { stderr += chunk.toString(); });
|
|
|
|
child.on("error", (e) => {
|
|
resolve(err(
|
|
`Failed to launch "${binary}" (${args.join(" ")}): ${e.message}. ` +
|
|
`Set RUVIEW_POSE_COG_BINARY / RUVIEW_COUNT_COG_BINARY or install the cog.`
|
|
));
|
|
});
|
|
|
|
child.on("close", (code) => {
|
|
if (code !== 0) {
|
|
resolve(err(`Cog "${binary} ${args.join(" ")}" exited with code ${code}. stderr: ${stderr.trim() || "(empty)"}`));
|
|
} else {
|
|
resolve({ ok: true, data: stdout });
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
function err(error: string): { ok: false; error: string } {
|
|
return { ok: false, error };
|
|
}
|