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:
1 parent
289ef664da
commit
97bf3301a3
5 files changed
+190
-19
No files matched your search
@@ -81,9 +81,20 @@ const READ_ONLY_COMMANDS: Record<string, string[]> = {
|
||||
skill: ["dump", "status"],
|
||||
service: ["status", "logs"],
|
||||
doctor: ["", "guide", "paths", "tenant", "auth"],
|
||||
// Bare form only; the optional trailing `<corpId>` selector is handled by
|
||||
// SELECTOR_POSITIONAL_AREAS below, since a bare entry matches no tokens.
|
||||
probe: [""],
|
||||
openapi: [""]
|
||||
};
|
||||
|
||||
/**
|
||||
* Areas whose trailing positional is an enterprise selector, not a subcommand:
|
||||
* `seal-use probe [<corpId>]` has no verb to list, so its read form is the bare
|
||||
* command plus at most that one selector. A second token is not a form the area
|
||||
* accepts at all, and falls through to the refusal below.
|
||||
*/
|
||||
const SELECTOR_POSITIONAL_AREAS = new Set(["probe"]);
|
||||
|
||||
/**
|
||||
* Read-only commands handled by the CLI outside the help registry (no area/subcommand shape).
|
||||
* `help` is limited to the bare form on purpose: `help <topic>` adds nothing over the skill docs.
|
||||
@@ -110,6 +121,8 @@ export function isReadOnlyCliCommand(argv: string[]): boolean {
|
||||
}
|
||||
|
||||
if (actionTokens.length === 0 && TOP_LEVEL_READ_ONLY.has(area)) return true;
|
||||
// The `<corpId>` selector form; the bare form falls through to the `""` entry.
|
||||
if (SELECTOR_POSITIONAL_AREAS.has(area) && actionTokens.length === 1) return true;
|
||||
|
||||
const allowed = READ_ONLY_COMMANDS[area];
|
||||
if (!allowed) return false;
|
||||
|
||||
Reference in new issue
Block a user