mirror of
https://github.com/ruvnet/RuView
synced 2026-07-22 17:23:19 +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.
65 lines
1.8 KiB
TypeScript
65 lines
1.8 KiB
TypeScript
/**
|
|
* ruview csi — CSI frame commands.
|
|
*
|
|
* csi tail — stream live CSI frames from the sensing-server.
|
|
*/
|
|
|
|
import type { Argv } from "yargs";
|
|
import { sensingGet } from "../http.js";
|
|
import { loadConfig } from "../config.js";
|
|
|
|
export function csiCommand(cli: Argv): void {
|
|
cli.command(
|
|
"csi <action>",
|
|
"CSI frame commands",
|
|
(y) =>
|
|
y
|
|
.positional("action", {
|
|
choices: ["tail"] as const,
|
|
description: "Action to perform",
|
|
})
|
|
.option("url", {
|
|
type: "string",
|
|
description:
|
|
"Sensing-server URL (default: RUVIEW_SENSING_SERVER_URL or http://localhost:3000)",
|
|
})
|
|
.option("interval", {
|
|
type: "number",
|
|
default: 500,
|
|
description: "Polling interval in milliseconds (default: 500)",
|
|
}),
|
|
async (args) => {
|
|
const config = loadConfig();
|
|
const baseUrl = (args["url"] as string | undefined) ?? config.sensingServerUrl;
|
|
|
|
if (args.action === "tail") {
|
|
process.stderr.write(
|
|
`[ruview csi tail] Streaming from ${baseUrl} every ${args.interval}ms. Ctrl-C to stop.\n`
|
|
);
|
|
|
|
// Streaming poll loop.
|
|
// eslint-disable-next-line no-constant-condition
|
|
while (true) {
|
|
const result = await sensingGet<object>(
|
|
baseUrl,
|
|
"/api/v1/sensing/latest",
|
|
config.apiToken
|
|
);
|
|
|
|
if (!result.ok) {
|
|
process.stderr.write(
|
|
`[WARN] ${result.error} — retrying in ${args.interval}ms\n`
|
|
);
|
|
} else {
|
|
process.stdout.write(JSON.stringify(result.data) + "\n");
|
|
}
|
|
|
|
await new Promise<void>((resolve) =>
|
|
setTimeout(resolve, args.interval as number)
|
|
);
|
|
}
|
|
}
|
|
}
|
|
);
|
|
}
|