@@ -18,6 +18,10 @@ import {
|
18 | 18 | } from "../../evidence-summary.js"; |
19 | 19 | import { startQaGatewayChild } from "../../gateway-child.js"; |
20 | 20 | import { isTruthyOptIn } from "../../mantis-options.runtime.js"; |
| 21 | +import { |
| 22 | +parseQaProgressBooleanEnv as parseTelegramQaProgressBooleanEnv, |
| 23 | +sanitizeQaProgressValue as sanitizeTelegramQaProgressValue, |
| 24 | +} from "../../progress-format.js"; |
21 | 25 | import { DEFAULT_QA_LIVE_PROVIDER_MODE } from "../../providers/index.js"; |
22 | 26 | import { |
23 | 27 | defaultQaModelForMode, |
@@ -574,20 +578,6 @@ function readConfigRecord(root: Record<string, unknown>, key: string): Record<st
|
574 | 578 | return value; |
575 | 579 | } |
576 | 580 | |
577 | | -function parseTelegramQaProgressBooleanEnv(value: string | undefined): boolean | undefined { |
578 | | -const normalized = value?.trim().toLowerCase(); |
579 | | -if (!normalized) { |
580 | | -return undefined; |
581 | | -} |
582 | | -if (normalized === "1" || normalized === "true" || normalized === "yes" || normalized === "on") { |
583 | | -return true; |
584 | | -} |
585 | | -if (normalized === "0" || normalized === "false" || normalized === "no" || normalized === "off") { |
586 | | -return false; |
587 | | -} |
588 | | -return undefined; |
589 | | -} |
590 | | - |
591 | 581 | function shouldLogTelegramQaLiveProgress(env: NodeJS.ProcessEnv = process.env) { |
592 | 582 | const override = parseTelegramQaProgressBooleanEnv(env[QA_SUITE_PROGRESS_ENV]); |
593 | 583 | if (override !== undefined) { |
@@ -680,20 +670,6 @@ function writeTelegramQaProgress(enabled: boolean, message: string) {
|
680 | 670 | process.stderr.write(`${TELEGRAM_QA_PROGRESS_PREFIX} ${message}\n`); |
681 | 671 | } |
682 | 672 | |
683 | | -function sanitizeTelegramQaProgressValue(value: string): string { |
684 | | -let normalized = ""; |
685 | | -for (const char of value) { |
686 | | -const code = char.codePointAt(0); |
687 | | -if (code === undefined) { |
688 | | -continue; |
689 | | -} |
690 | | -const isControl = code <= 0x1f || (code >= 0x7f && code <= 0x9f); |
691 | | -normalized += isControl ? " " : char; |
692 | | -} |
693 | | -normalized = normalized.replace(/\s+/gu, " ").trim(); |
694 | | -return normalized.length > 0 ? normalized : "<empty>"; |
695 | | -} |
696 | | - |
697 | 673 | function formatTelegramQaProgressDetails(details: string): string { |
698 | 674 | const sanitized = sanitizeTelegramQaProgressValue(details); |
699 | 675 | if (sanitized.length <= TELEGRAM_QA_PROGRESS_DETAIL_LIMIT) { |
|