From 19fd649631bfab434b47756e1999b3a21d53e693 Mon Sep 17 00:00:00 2001 From: Lyon <88232613+pikasTech@users.noreply.github.com> Date: Mon, 22 Jun 2026 18:39:58 +0800 Subject: [PATCH] fix: add full output for web-probe observe commands (#673) Co-authored-by: Codex --- scripts/src/hwlab-node-impl.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/scripts/src/hwlab-node-impl.ts b/scripts/src/hwlab-node-impl.ts index e39208de..530eb15d 100644 --- a/scripts/src/hwlab-node-impl.ts +++ b/scripts/src/hwlab-node-impl.ts @@ -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 { 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 { 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"); }