`runProbe` wrote its progress notes and three separate JSON blobs to stdout, so every consumer parsing the output — `seal-use probe | jq`, the Agent Harness — got prose interleaved with data. The command is also in the help registry, so this was a documented command breaking its own contract. The probe now returns one `ProbeResult` and the command prints it through `printJson`; the `[probe] …` narration moves to stderr, which is the diagnostics channel. The dev-script entry point keeps the same payload and its exit code. Classified read-only too: `probe` reads tenant state and writes nothing, but the allow-list had no entry, so the MCP read-only tool refused it. Its trailing token is an enterprise selector rather than a verb, so the matcher accepts the bare form and bare-plus-selector while still refusing a third token.
11 lines
538 B
TypeScript
11 lines
538 B
TypeScript
import { runProbe } from "../../probe.js";
|
|
import { stringOption } from "../parser.js";
|
|
import { printJson } from "../printer.js";
|
|
import type { ParsedArgs } from "../types.js";
|
|
|
|
export async function handleProbeCommand(action: string | undefined, maybeName: string | undefined, args: ParsedArgs) {
|
|
const corpId = maybeName ?? stringOption(args.options.corp) ?? (action && action !== "--corp" ? action : undefined);
|
|
// One JSON document on stdout; runProbe narrates progress on stderr only.
|
|
printJson(await runProbe({ corpId }));
|
|
}
|