Keep seal-use probe's stdout to a single JSON document

`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.
This commit is contained in:
gitea committed 2026-09-30 01:16:12 +08:00
1 parent 289ef664da
commit 97bf3301a3
5 files changed
+190 -19

No files matched your search

+8
View File
@@ -128,6 +128,14 @@ describe("CLI read-only classification", () => {
expect(isReadOnlyCliCommand(["openapi", "extra"])).toBe(false);
});
test("probe is read-only bare or with its enterprise selector, but not beyond", () => {
// `seal-use probe [<corpId>]` takes a selector, not a verb: the allow-list
// entry covers the bare form and the selector form is matched separately.
expect(isReadOnlyCliCommand(["probe"])).toBe(true);
expect(isReadOnlyCliCommand(["probe", "corp-a"])).toBe(true);
expect(isReadOnlyCliCommand(["probe", "corp-a", "extra"])).toBe(false);
});
test("refuses command lines that cannot be parsed", () => {
expect(isReadOnlyCliCommand(["--json"])).toBe(false);
});