fix: add full output for web-probe observe commands (#673)

Co-authored-by: Codex <codex@noreply.local>
This commit is contained in:
Lyon
2026-06-22 18:39:58 +08:00
committed by GitHub
parent 8d6fdf63c1
commit 19fd649631
+15 -2
View File
@@ -77,6 +77,7 @@ interface NodeWebProbeObserveOptions {
waitMs: number;
tailLines: number;
maxFiles: number;
full: boolean;
stateDir: string | null;
jobId: string | null;
force: boolean;
@@ -6910,7 +6911,7 @@ function parseNodeWebProbeObserveOptions(
"--label",
"--session-id",
"--provider",
]), new Set(["--force"]));
]), new Set(["--force", "--full"]));
const commandTypeRaw = optionValue(args, "--type") ?? null;
const commandType = commandTypeRaw === null ? null : parseNodeWebProbeObserveCommandType(commandTypeRaw);
const stateDir = optionValue(args, "--state-dir") ?? indexed?.stateDir ?? null;
@@ -6936,6 +6937,7 @@ function parseNodeWebProbeObserveOptions(
waitMs: positiveIntegerOption(args, "--wait-ms", observeActionRaw === "command" || observeActionRaw === "stop" ? 30000 : 0, 600000),
tailLines: positiveIntegerOption(args, "--tail-lines", 5, 200),
maxFiles: positiveIntegerOption(args, "--max-files", 80, 5000),
full: args.includes("--full"),
stateDir,
jobId,
force: args.includes("--force"),
@@ -7670,6 +7672,7 @@ function runNodeWebProbeObserveCommand(options: NodeWebProbeObserveOptions, spec
observerCommand: commandSummaryForOutput(payload),
gracefulResult: compactCommandResult(result),
forceResult: compactCommandResult(killResult),
full: options.full,
valuesRedacted: true,
});
}
@@ -7685,6 +7688,7 @@ function runNodeWebProbeObserveCommand(options: NodeWebProbeObserveOptions, spec
observerCommand: commandSummaryForOutput(payload),
observer: commandResult,
result: compactCommandResult(result),
full: options.full,
valuesRedacted: true,
});
}
@@ -7703,6 +7707,7 @@ function renderWebObserveCommandTable(value: Record<string, unknown>): string {
const observer = record(value.observer);
const result = record(observer?.result);
const id = webObserveText(value.id);
const full = value.full === true;
const lines = [
`hwlab nodes web-probe observe command (${webObserveText(value.status)})`,
"",
@@ -7715,13 +7720,21 @@ function renderWebObserveCommandTable(value: Record<string, unknown>): string {
webObserveShort(webObserveText(observerCommand?.textHash), 24),
webObserveShort(webObserveText(result?.mark ?? result?.currentUrl ?? observer?.error ?? observer?.queued), 80),
]]),
...(full ? [
"",
"Full command result:",
"```json",
JSON.stringify(observer ?? {}, null, 2),
"```",
] : []),
"",
"Next:",
` bun scripts/cli.ts hwlab nodes web-probe observe status ${id}`,
` bun scripts/cli.ts hwlab nodes web-probe observe analyze ${id}`,
"",
"Disclosure:",
" default view is a bounded command result; use observe status/analyze for sampled state.",
" default view is a bounded command result; pass --full to expose the complete command result JSON.",
" use observe status/analyze for sampled state.",
];
return lines.join("\n");
}