feat(tools): scaffold ruview MCP server + CLI + ADR-104 (#705)

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.
This commit is contained in:
rUv
2026-05-21 23:33:18 -04:00
committed by GitHub
parent bb92419ccb
commit 3f462a254d
32 changed files with 11597 additions and 0 deletions
+70
View File
@@ -0,0 +1,70 @@
/**
* ruview pose — Pose estimation commands.
*
* pose infer — run single-shot 17-keypoint inference.
*/
import type { Argv } from "yargs";
import { runCog } from "../cog.js";
import { loadConfig } from "../config.js";
export function poseCommand(cli: Argv): void {
cli.command(
"pose <action>",
"Pose estimation commands",
(y) =>
y
.positional("action", {
choices: ["infer"] as const,
description: "Action to perform",
})
.option("window", {
type: "string",
description: "Path to a CSI window JSON file (omit to use live sensing-server)",
})
.option("binary", {
type: "string",
description: "Path to cog-pose-estimation binary (default: RUVIEW_POSE_COG_BINARY)",
}),
async (args) => {
const config = loadConfig();
const binary = (args["binary"] as string | undefined) ?? config.poseCogBinary;
if (args.action === "infer") {
// M1: verify health, emit stub.
const health = await runCog(binary, ["health"]);
if (!health.ok) {
process.stderr.write(
`[WARN] Cog health check failed: ${health.error}\n` +
`Set RUVIEW_POSE_COG_BINARY or install cog-pose-estimation (ADR-101).\n`
);
process.stdout.write(
JSON.stringify({
ok: false,
warn: true,
error: health.error,
stub: true,
result: { n_persons: 0, persons: [], backend: "stub", latency_ms: 0 },
}) + "\n"
);
process.exit(0); // Fail-open; non-zero would break pipelines.
}
process.stdout.write(
JSON.stringify({
ok: true,
stub: true,
note: "M1 stub — real inference wired in M2. Cog health passed.",
result: {
ts: Date.now() / 1000,
n_persons: 0,
persons: [],
backend: "stub",
latency_ms: 0,
},
}) + "\n"
);
}
}
);
}