diff --git a/.discord/api/interactions.ts b/.discord/api/interactions.ts index f672c6a..c3460f0 100644 --- a/.discord/api/interactions.ts +++ b/.discord/api/interactions.ts @@ -319,7 +319,7 @@ function getRequirementsEmbed() { { name: 'Architecture', value: '• x86-64 / AMD64 (Intel / AMD)\n• Administrator (UAC) for PawnIo', inline: true }, { name: 'CPU Monitoring', value: '• Intel Core / Xeon (PawnIo MSR)\n• AMD Ryzen / Threadripper (PawnIo SMU)', inline: false }, { name: 'GPU Monitoring', value: '• NVIDIA (NVAPI)\n• AMD Radeon (ADLX / ADL)\n• Intel Arc / Xe (IGCL / ControlLib)\n• WDDM Generic Fallback', inline: false }, - { name: 'RAM & Disk Space', value: '• Min 2 GB RAM (4 GB recommended)\n• 200 MB Free Disk Space', inline: false } + { name: 'RAM & Disk Space', value: '• Min 2 GB RAM (4 GB recommended)\n• 100 MB Free Disk Space', inline: false } ], footer: { text: `Requirements: https://github.com/${GITHUB_REPO}#system-requirements` diff --git a/.discord/bun.lock b/.discord/bun.lock index f1c8533..c8f6e6d 100644 --- a/.discord/bun.lock +++ b/.discord/bun.lock @@ -5,13 +5,13 @@ "": { "name": "localtelemetry-discord-bot", "devDependencies": { - "@types/node": "^26.6.5", + "@types/node": "^26.6.11", "typescript": "^7.0.2", }, }, }, "packages": { - "@types/node": ["@types/node@26.6.5", "", { "dependencies": { "undici-types": "~8.9.0" } }, "sha512-uMzsv9stDdofIZBx4UGh4Z9ZgXnGC9seRDscilBcTHAeOFk67MZg/k9bWVfO+bk4qZmG+l52hRnLwUiH2LnJTg=="], + "@types/node": ["@types/node@26.6.11", "", { "dependencies": { "undici-types": "~8.9.0" } }, "sha512-uUyQ2XLEz+EXh34lmS3GhKrkqn/8FU7KUiKRpk347At2bmnMVWss45yz8b4FG/tUtmV1tV/+TVkITItPROyeeQ=="], "@typescript/typescript-aix-ppc64": ["@typescript/typescript-aix-ppc64@7.0.2", "", { "os": "aix", "cpu": "ppc64" }, "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ=="], diff --git a/.discord/package.json b/.discord/package.json index 018d903..875d457 100644 --- a/.discord/package.json +++ b/.discord/package.json @@ -8,7 +8,7 @@ "typecheck": "tsc --noEmit" }, "devDependencies": { - "@types/node": "^26.6.5", + "@types/node": "^26.6.11", "typescript": "^7.0.2" } } diff --git a/.discord/vercel.json b/.discord/vercel.json index 4af72a3..391d146 100644 --- a/.discord/vercel.json +++ b/.discord/vercel.json @@ -1,5 +1,6 @@ { "version": 2, + "ignoreCommand": "git diff HEAD^ HEAD --quiet .", "rewrites": [ { "source": "/api/(.*)", diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 34d7b70..1154c2f 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -5,7 +5,7 @@ Thank you for contributing to LocalTelemetry! ## Prerequisites - Windows 10/11 (64-bit x64) -- [.NET 10 SDK](https://dotnet.microsoft.com/download) +- [.NET 11 SDK](https://dotnet.microsoft.com/download) - [Bun](https://bun.sh/) (runtime and package manager for frontend) - [Visual Studio 2022+](https://visualstudio.microsoft.com/) or [VS Code](https://code.visualstudio.com/) with C# Dev Kit @@ -96,7 +96,6 @@ docs/ # VitePress documentation site ### Documentation Standards -- Write documentation, explanations, and PR descriptions in ASD-STE100 Simplified Technical English. - Keep sentences short and direct (maximum 20-25 words per sentence). - Use active voice and consistent technical terms. diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 62eb262..a984911 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -48,19 +48,23 @@ body: validations: required: true - - type: dropdown + - type: input id: windows-version attributes: - label: Windows Version - options: - - Windows 11 24H2 - - Windows 11 23H2 - - Windows 11 22H2 - - Windows 10 22H2 - - Other (specify in Additional Context) + label: Windows Version & OS Build + description: "Your Windows edition and build number (run 'winver' or check Windows Settings > System > About)." + placeholder: "e.g., Windows 11 24H2 (Build 26100.2161)" validations: required: true + - type: input + id: cpu + attributes: + label: CPU Model + placeholder: "e.g., AMD Ryzen 7 7800X3D, Intel Core i7-14700K" + validations: + required: false + - type: input id: gpu attributes: diff --git a/.github/ISSUE_TEMPLATE/compatibility_report.yml b/.github/ISSUE_TEMPLATE/compatibility_report.yml new file mode 100644 index 0000000..2a30fb6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/compatibility_report.yml @@ -0,0 +1,71 @@ +name: Shell / Taskbar Compatibility +description: Report an issue with third-party taskbar or shell tools (ExplorerPatcher, StartAllBack, RetroBar, Windhawk, etc.) +labels: [bug] +body: + - type: markdown + attributes: + value: | + Use this form if LocalTelemetry conflicts with a taskbar modification or shell customizer. + + - type: input + id: shell-tool + attributes: + label: Shell / Taskbar Tool + description: Name and version of the shell modification tool. + placeholder: "e.g., ExplorerPatcher, StartAllBack, RetroBar, Windhawk" + validations: + required: true + + - type: input + id: windows-version + attributes: + label: Windows Version & OS Build + description: "Your Windows edition and build number (run 'winver' or check Windows Settings > System > About)." + placeholder: "e.g., Windows 11 24H2 (Build 26100.2161)" + validations: + required: true + + - type: textarea + id: description + attributes: + label: Description of Conflict + description: Explain how the overlay or application behaves with the shell tool. + placeholder: "Describe the unexpected behavior (e.g., overlay clips, overlaps taskbar elements, or fails to attach)..." + validations: + required: true + + - type: textarea + id: steps + attributes: + label: Steps to Reproduce + placeholder: | + 1. Enable the shell modification tool + 2. Launch LocalTelemetry + 3. Observe the behavior on the taskbar + validations: + required: true + + - type: input + id: version + attributes: + label: LocalTelemetry Version + description: "The version you are using (e.g., v1.0.0). Check Settings > About." + placeholder: v1.0.0 + validations: + required: true + + - type: textarea + id: screenshots + attributes: + label: Screenshots + description: If applicable, add screenshots to show the conflict. + validations: + required: false + + - type: textarea + id: context + attributes: + label: Additional Context + description: Taskbar alignment (center/left), position (top/bottom), multi-monitor settings, or logs. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 649b3fb..2963da7 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,5 +1,11 @@ blank_issues_enabled: false contact_links: + - name: Questions & Discussions + url: https://github.com/Nicconike/LocalTelemetry/discussions + about: Ask questions, get help with configuration or discuss ideas. + - name: Community Discord + url: https://discord.gg/M2QevSgW3S + about: Join the LocalTelemetry Discord server. - name: Security Vulnerability url: https://github.com/Nicconike/LocalTelemetry/security/advisories/new about: Report security vulnerabilities privately via GitHub Security Advisories. Do NOT open a public issue. diff --git a/.github/ISSUE_TEMPLATE/hardware_request.yml b/.github/ISSUE_TEMPLATE/hardware_request.yml new file mode 100644 index 0000000..fdb922d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/hardware_request.yml @@ -0,0 +1,61 @@ +name: Hardware / Sensor Support +description: Request support for a CPU, GPU, or specific hardware metric +labels: [enhancement] +body: + - type: markdown + attributes: + value: | + Use this form to request support for a hardware component or a missing telemetry sensor. + + - type: input + id: hardware-model + attributes: + label: Hardware Model + description: Exact model name of your CPU or GPU. + placeholder: "e.g., AMD Ryzen 7 7800X3D, Intel Core i7-14700K, NVIDIA RTX 4080" + validations: + required: true + + - type: input + id: target-metric + attributes: + label: Target Metric / Sensor + description: Which metric is missing or unsupported? + placeholder: "e.g., CPU Package Power, GPU Hotspot Temp, Fan RPM" + validations: + required: true + + - type: textarea + id: current-status + attributes: + label: Current Status in LocalTelemetry + description: What currently happens in LocalTelemetry? + placeholder: "Describe the current behavior (e.g., metric is missing from Settings > Layout, shows 0, or shows N/A)..." + validations: + required: true + + - type: input + id: reference-reading + attributes: + label: Expected / Reference Reading (Optional) + description: What does official vendor software or another monitoring tool show? + placeholder: "e.g., 65 W in vendor software, 70 °C in monitoring utility" + validations: + required: false + + - type: input + id: version + attributes: + label: LocalTelemetry Version + description: "The version you are using (e.g., v1.0.0). Check Settings > About." + placeholder: v1.0.0 + validations: + required: true + + - type: textarea + id: context + attributes: + label: Additional Context + description: Any other relevant details, driver versions, or screenshots. + validations: + required: false diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 847c45b..2bc3232 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,12 +5,13 @@ updates: # 1. .NET / C# NuGet Dependencies - package-ecosystem: "nuget" directory: "/" + target-branch: "develop" schedule: interval: "monthly" day: "monday" time: "06:00" timezone: "Asia/Kolkata" # GMT+5:30 - open-pull-requests-limit: 5 + open-pull-requests-limit: 3 rebase-strategy: "auto" commit-message: prefix: "build(deps)" @@ -22,46 +23,21 @@ updates: ignore: - dependency-name: "*" update-types: ["version-update:semver-patch"] - - dependency-name: "Xunit.StaFact" - update-types: ["version-update:semver-major"] groups: dotnet-deps: patterns: - "*" - # 2. .NET SDK Version (global.json) - - package-ecosystem: "dotnet-sdk" - directory: "/" - schedule: - interval: "monthly" - day: "monday" - time: "06:00" - timezone: "Asia/Kolkata" # GMT+5:30 - open-pull-requests-limit: 5 - rebase-strategy: "auto" - commit-message: - prefix: "build(deps)" - labels: - - "dependencies" - - "dependabot" - - "scope:ci" - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-patch"] - groups: - sdk-deps: - patterns: - - "*" - - # 3. Svelte 5 / Vite Frontend Dependencies (Bun) + # 2. Svelte 5 / Vite Frontend Dependencies (Bun) - package-ecosystem: "bun" directory: "/src/LocalTelemetry.App/Settings/wwwroot" + target-branch: "develop" schedule: interval: "monthly" day: "monday" time: "06:00" timezone: "Asia/Kolkata" # GMT+5:30 - open-pull-requests-limit: 5 + open-pull-requests-limit: 3 rebase-strategy: "auto" commit-message: prefix: "build(deps)" @@ -78,15 +54,16 @@ updates: patterns: - "*" - # 4. Svelte 5 / Vite Test Frontend Dependencies (Bun) + # 3. Svelte 5 / Vite Test Frontend Dependencies (Bun) - package-ecosystem: "bun" directory: "/tests/LocalTelemetry.App.Tests/Settings/wwwroot" + target-branch: "develop" schedule: interval: "monthly" day: "monday" time: "06:00" timezone: "Asia/Kolkata" # GMT+5:30 - open-pull-requests-limit: 5 + open-pull-requests-limit: 3 rebase-strategy: "auto" commit-message: prefix: "build(deps)" @@ -103,15 +80,16 @@ updates: patterns: - "*" - # 5. Documentation Site Dependencies (Bun) + # 4. Documentation Site Dependencies (Bun) - package-ecosystem: "bun" directory: "/docs" + target-branch: "develop" schedule: interval: "monthly" day: "monday" time: "06:00" timezone: "Asia/Kolkata" # GMT+5:30 - open-pull-requests-limit: 5 + open-pull-requests-limit: 3 rebase-strategy: "auto" commit-message: prefix: "build(deps)" @@ -128,15 +106,16 @@ updates: patterns: - "*" - # 6. Release Automation Dependencies (Bun) + # 5. Release Automation Dependencies (Bun) - package-ecosystem: "bun" directory: "/.github/release" + target-branch: "develop" schedule: interval: "monthly" day: "monday" time: "06:00" timezone: "Asia/Kolkata" # GMT+5:30 - open-pull-requests-limit: 5 + open-pull-requests-limit: 3 rebase-strategy: "auto" commit-message: prefix: "ci(deps)" @@ -153,40 +132,16 @@ updates: patterns: - "*" - # 7. Discord Webhook Dependencies (Bun) - - package-ecosystem: "bun" - directory: "/.discord" - schedule: - interval: "monthly" - day: "monday" - time: "06:00" - timezone: "Asia/Kolkata" # GMT+5:30 - open-pull-requests-limit: 5 - rebase-strategy: "auto" - commit-message: - prefix: "ci(deps)" - prefix-development: "ci(deps-dev)" - labels: - - "dependencies" - - "dependabot" - - "scope:ci" - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-patch"] - groups: - discord-deps: - patterns: - - "*" - - # 8. GitHub Actions Workflows (.github/workflows/*.yml) + # 6. GitHub Actions Workflows (.github/workflows/*.yml) - package-ecosystem: "github-actions" directory: "/" + target-branch: "develop" schedule: interval: "monthly" day: "monday" time: "06:00" timezone: "Asia/Kolkata" # GMT+5:30 - open-pull-requests-limit: 5 + open-pull-requests-limit: 3 rebase-strategy: "auto" commit-message: prefix: "ci(deps)" diff --git a/.github/release/build.ps1 b/.github/release/build.ps1 index 05d5800..4739fac 100644 --- a/.github/release/build.ps1 +++ b/.github/release/build.ps1 @@ -46,6 +46,21 @@ Write-Host "Downloading PawnIO driver setup..." $pawnUrl = "https://github.com/namazso/PawnIO.Setup/releases/latest/download/PawnIO_setup.exe" Invoke-WebRequest -Uri $pawnUrl -OutFile "./publish/PawnIO_setup.exe" +# Ensure WebView2Loader.dll native interop is present in publish directory +$wv2Paths = @( + "src/LocalTelemetry.App/bin/Release/net11.0-windows10.0.19041.0/win-x64/WebView2Loader.dll", + "src/LocalTelemetry.App/bin/Debug/net11.0-windows10.0.19041.0/win-x64/WebView2Loader.dll" +) +foreach ($wv2 in $wv2Paths) { + if (Test-Path $wv2) { + Copy-Item $wv2 -Destination "./publish/WebView2Loader.dll" -Force + $nativeDir = "./publish/runtimes/win-x64/native" + if (-not (Test-Path $nativeDir)) { New-Item -ItemType Directory -Path $nativeDir -Force | Out-Null } + Copy-Item $wv2 -Destination "$nativeDir/WebView2Loader.dll" -Force + break + } +} + # 4. Locate ISCC.exe and Compile Inno Setup Windows Installer Write-Host "Compiling Inno Setup Windows installer with Inno Setup 7..." $inno7Paths = @( @@ -70,7 +85,7 @@ if (Test-Path $setupIssFile) { (Get-Content $setupIssFile -Raw) ` -replace '(?m)^#define AppVersion\s+".*"$', "#define AppVersion `"$Version`"" ` -replace '(?m)^#define AppVersionInfoVersion\s+".*"$', "#define AppVersionInfoVersion `"$numVer`"" | - Set-Content $setupIssFile -Encoding utf8 + Set-Content $setupIssFile -Encoding utf8 -NoNewline Write-Host "Updated $setupIssFile with version $Version ($numVer)." } @@ -105,51 +120,58 @@ if ($env:GITHUB_ENV) { "RELEASE_TAG=$actualTag" | Out-File -FilePath $env:GITHUB_ENV -Append } -# 6. Update Scoop Bucket Manifest -Write-Host "Updating Scoop bucket manifest..." -$manifestFile = "bucket/localtelemetry.json" -if (Test-Path $manifestFile) { - $zipUrl = "https://github.com/$repo/releases/download/$actualTag/LocalTelemetry-win-x64.zip" - $node = [System.Text.Json.Nodes.JsonNode]::Parse((Get-Content $manifestFile -Raw)) - $node["version"] = $Version - $node["architecture"]["64bit"]["url"] = $zipUrl - $node["architecture"]["64bit"]["hash"] = $zipHash - $jsonOptions = [System.Text.Json.JsonSerializerOptions]::new() - $jsonOptions.WriteIndented = $true - $jsonOptions.IndentSize = 4 - $node.ToJsonString($jsonOptions) | Set-Content $manifestFile -Encoding utf8 - Write-Host "Updated $manifestFile with version $Version." -} -else { - Write-Warning "Manifest file $manifestFile not found." -} +$isPrerelease = $Version.Contains('-') + +if (-not $isPrerelease) { + # 6. Update Scoop Bucket Manifest + Write-Host "Updating Scoop bucket manifest..." + $manifestFile = "bucket/localtelemetry.json" + if (Test-Path $manifestFile) { + $zipUrl = "https://github.com/$repo/releases/download/$actualTag/LocalTelemetry-win-x64.zip" + $node = [System.Text.Json.Nodes.JsonNode]::Parse((Get-Content $manifestFile -Raw)) + $node["version"] = $Version + $node["architecture"]["64bit"]["url"] = $zipUrl + $node["architecture"]["64bit"]["hash"] = $zipHash + $jsonOptions = [System.Text.Json.JsonSerializerOptions]::new() + $jsonOptions.WriteIndented = $true + $jsonOptions.IndentSize = 4 + $node.ToJsonString($jsonOptions) | Set-Content $manifestFile -Encoding utf8 + Write-Host "Updated $manifestFile with version $Version." + } + else { + Write-Warning "Manifest file $manifestFile not found." + } -# 7. Update WinGet Package Manifests (Multi-file v1.12.0) -Write-Host "Updating WinGet package manifests..." -$wingetVersionFile = "packaging/winget/Nicconike.LocalTelemetry.yaml" -$wingetInstallerFile = "packaging/winget/Nicconike.LocalTelemetry.installer.yaml" -$wingetLocaleFile = "packaging/winget/Nicconike.LocalTelemetry.locale.en-US.yaml" + # 7. Update WinGet Package Manifests (Multi-file v1.12.0) + Write-Host "Updating WinGet package manifests..." + $wingetVersionFile = "packaging/winget/Nicconike.LocalTelemetry.yaml" + $wingetInstallerFile = "packaging/winget/Nicconike.LocalTelemetry.installer.yaml" + $wingetLocaleFile = "packaging/winget/Nicconike.LocalTelemetry.locale.en-US.yaml" -if (Test-Path $wingetVersionFile) { - (Get-Content $wingetVersionFile -Raw) -replace '(?m)^PackageVersion:\s*.*$', "PackageVersion: $Version" | - Set-Content $wingetVersionFile -Encoding utf8 - Write-Host "Updated $wingetVersionFile with version $Version." -} + if (Test-Path $wingetVersionFile) { + (Get-Content $wingetVersionFile -Raw) -replace '(?m)^PackageVersion:\s*.*$', "PackageVersion: $Version" | + Set-Content $wingetVersionFile -Encoding utf8 -NoNewline + Write-Host "Updated $wingetVersionFile with version $Version." + } -if (Test-Path $wingetInstallerFile) { - $setupUrl = "https://github.com/$repo/releases/download/$actualTag/LocalTelemetrySetup.exe" - (Get-Content $wingetInstallerFile -Raw) ` - -replace '(?m)^PackageVersion:\s*.*$', "PackageVersion: $Version" ` - -replace '(?m)^\s*InstallerUrl:\s*.*$', " InstallerUrl: $setupUrl" ` - -replace '(?m)^\s*InstallerSha256:\s*.*$', " InstallerSha256: $setupHash" | - Set-Content $wingetInstallerFile -Encoding utf8 - Write-Host "Updated $wingetInstallerFile with version $Version and hash $setupHash." -} + if (Test-Path $wingetInstallerFile) { + $setupUrl = "https://github.com/$repo/releases/download/$actualTag/LocalTelemetrySetup.exe" + (Get-Content $wingetInstallerFile -Raw) ` + -replace '(?m)^PackageVersion:\s*.*$', "PackageVersion: $Version" ` + -replace '(?m)^\s*InstallerUrl:\s*.*$', " InstallerUrl: $setupUrl" ` + -replace '(?m)^\s*InstallerSha256:\s*.*$', " InstallerSha256: $setupHash" | + Set-Content $wingetInstallerFile -Encoding utf8 -NoNewline + Write-Host "Updated $wingetInstallerFile with version $Version and hash $setupHash." + } -if (Test-Path $wingetLocaleFile) { - (Get-Content $wingetLocaleFile -Raw) -replace '(?m)^PackageVersion:\s*.*$', "PackageVersion: $Version" | - Set-Content $wingetLocaleFile -Encoding utf8 - Write-Host "Updated $wingetLocaleFile with version $Version." + if (Test-Path $wingetLocaleFile) { + (Get-Content $wingetLocaleFile -Raw) -replace '(?m)^PackageVersion:\s*.*$', "PackageVersion: $Version" | + Set-Content $wingetLocaleFile -Encoding utf8 -NoNewline + Write-Host "Updated $wingetLocaleFile with version $Version." + } +} +else { + Write-Host "Pre-release version detected ($Version). Skipping Scoop and WinGet package manifest updates." } # 8. Synchronize Package Versions (Docs and Frontend UI) @@ -161,7 +183,7 @@ $packageFiles = @( foreach ($pkgFile in $packageFiles) { if (Test-Path $pkgFile) { (Get-Content $pkgFile -Raw) -replace '(?m)^(\s*"version":\s*")[^"]*(")', "`${1}$Version`${2}" | - Set-Content $pkgFile -Encoding utf8 + Set-Content $pkgFile -Encoding utf8 -NoNewline Write-Host "Updated $pkgFile with version $Version." } } diff --git a/.github/release/bun.lock b/.github/release/bun.lock index 80958a9..d4d4862 100644 --- a/.github/release/bun.lock +++ b/.github/release/bun.lock @@ -5,18 +5,18 @@ "": { "name": "localtelemetry-release", "dependencies": { - "conventional-changelog-conventionalcommits": "^8.0.0", + "conventional-changelog-conventionalcommits": "^10.4.1", }, "devDependencies": { "@octokit/rest": "^22.0.1", - "@semantic-release/changelog": "^6.0.3", + "@semantic-release/changelog": "^7.0.0", "@semantic-release/commit-analyzer": "^13.0.1", - "@semantic-release/exec": "^6.0.3", - "@semantic-release/git": "^10.0.1", - "@semantic-release/github": "^11.0.6", + "@semantic-release/exec": "^7.1.0", + "@semantic-release/git": "^11.0.1", + "@semantic-release/github": "^12.0.11", "@semantic-release/release-notes-generator": "^14.1.1", - "@types/node": "^26.6.5", - "semantic-release": "^24.2.9", + "@types/node": "^26.6.11", + "semantic-release": "^26.0.1", }, }, }, @@ -29,19 +29,29 @@ "sigstore": "^4.1.1", }, "packages": { + "@actions/core": ["@actions/core@3.0.1", "", { "dependencies": { "@actions/exec": "^3.0.0", "@actions/http-client": "^4.0.0" } }, "sha512-a6d/Nwahm9fliVGRhdhofo40HjHQasUPusmc7vBfyky+7Z+P2A1J68zyFVaNcEclc/Se+eO595oAr5nwEIoIUA=="], + + "@actions/exec": ["@actions/exec@3.0.0", "", { "dependencies": { "@actions/io": "^3.0.2" } }, "sha512-6xH/puSoNBXb72VPlZVm7vQ+svQpFyA96qdDBvhB8eNZOE8LtPf9L4oAsfzK/crCL8YZ+19fKYVnM63Sl+Xzlw=="], + + "@actions/http-client": ["@actions/http-client@4.0.1", "", { "dependencies": { "tunnel": "^0.0.6", "undici": "^6.23.0" } }, "sha512-+Nvd1ImaOZBSoPbsUtEhv+1z99H12xzncCkz0a3RuehINE81FZSe2QTj3uvAPTcJX/SCzUQHQ0D1GrPMbrPitg=="], + + "@actions/io": ["@actions/io@3.0.2", "", {}, "sha512-nRBchcMM+QK1pdjO7/idu86rbJI5YHUKCvKs0KxnSYbVe3F51UfGxuZX4Qy/fWlp6l7gWFwIkrOzN+oUK03kfw=="], + "@babel/code-frame": ["@babel/code-frame@7.29.7", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.29.7", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw=="], "@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.29.7", "", {}, "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg=="], "@colors/colors": ["@colors/colors@1.5.0", "", {}, "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ=="], + "@conventional-changelog/template": ["@conventional-changelog/template@1.4.1", "", {}, "sha512-mHyyEL0eIEqJ6+aF24+AdZRo4bu4W5GdUiCiCx5X7kfDY51ye8GQJ264uOINObrRSKxtSRCOWPpl9hbOy4UzxQ=="], + "@octokit/auth-token": ["@octokit/auth-token@6.0.0", "", {}, "sha512-P4YJBPdPSpWTQ1NU4XYdvHvXJJDxM6YwpS0FZHRgP7YFkdVxsWcpWGy/NVqlAA7PcPCnMacXlRm1y2PFZRWL/w=="], "@octokit/core": ["@octokit/core@7.0.8", "", { "dependencies": { "@octokit/auth-token": "^6.0.0", "@octokit/graphql": "^9.0.5", "@octokit/request": "^10.0.16", "@octokit/request-error": "^7.1.2", "@octokit/types": "^18.0.0", "before-after-hook": "^4.0.0", "universal-user-agent": "^7.0.0" } }, "sha512-L7y8eYc+AwxGr2PWI4WFt1VG4TiJ66c26BD16mXpYIlXxG0SMigM1+m4aTSlYyBr5BlQsGAlz8uDCoZN4SEMcg=="], - "@octokit/endpoint": ["@octokit/endpoint@11.0.5", "", { "dependencies": { "@octokit/types": "^18.0.0", "universal-user-agent": "^7.0.2" } }, "sha512-iXa654H3yFafF/ieHkukfbgWo2rmXD2ceD0ZOtrPhw1bc3FDch1d9N/TNs0FQ1/cIbwb7kspUX8jzIs8nzb9DQ=="], + "@octokit/endpoint": ["@octokit/endpoint@11.0.6", "", { "dependencies": { "@octokit/types": "^18.0.0", "universal-user-agent": "^7.0.2" } }, "sha512-H52ocs+dXsxmLtMPqabXz0p+mNWfe5RacpUHq8sB6mJLiMPU6PF/7O0Bl/U8a8WrV1NzWNYpXwZW0zo0BeoT2A=="], - "@octokit/graphql": ["@octokit/graphql@9.0.5", "", { "dependencies": { "@octokit/request": "^10.0.16", "@octokit/types": "^18.0.0", "universal-user-agent": "^7.0.0" } }, "sha512-bt/hm03LeU6Vy7FwTrkkC9p3XGT/lBwClglMqxBSe5/q0E5CdJTXeAqEI0vlw89/LF/G6tryTIH8HirZ3prMVg=="], + "@octokit/graphql": ["@octokit/graphql@9.0.6", "", { "dependencies": { "@octokit/request": "^10.0.16", "@octokit/types": "^18.0.0", "universal-user-agent": "^7.0.0" } }, "sha512-NZuqjuSGn8DEMq4fq/QWhg6DoqGdNOkKPi5R1kZ8Y3k+MqeRopYRSa3hccdHhGP4ISfV8BHv9+YURO4TEkbRWQ=="], "@octokit/openapi-types": ["@octokit/openapi-types@29.0.1", "", {}, "sha512-9qWOMFNxxLokERcms42rU0PTLqQmVs7g5E41TI4mCOxmpFayD1rfC7XxOL55cG9MBZLFlC31BrR37myMKardwg=="], @@ -55,7 +65,7 @@ "@octokit/plugin-throttling": ["@octokit/plugin-throttling@11.0.5", "", { "dependencies": { "@octokit/types": "^17.0.0", "bottleneck": "^2.15.3" }, "peerDependencies": { "@octokit/core": "^7.0.0" } }, "sha512-LIdrkrUv+DWbKeg/49rGuFJ3SU0d3hUS+B4MhNZLepBoNUFXms8Ic9edJjrlx+zycqJHjrMRudVpVb/bAXM2Lw=="], - "@octokit/request": ["@octokit/request@10.0.16", "", { "dependencies": { "@octokit/endpoint": "^11.0.5", "@octokit/request-error": "^7.1.2", "@octokit/types": "^18.0.0", "content-type": "^3.0.0", "json-with-bigint": "^3.5.12", "universal-user-agent": "^7.0.2" } }, "sha512-A0zWGjHzISIb+9ccG8s0dq7LKO5zVpJLRICjgUb+sJxEWqn8RUHB1rD3AE51+PECvXHIxqZ1VVvs4fHTSD9nUQ=="], + "@octokit/request": ["@octokit/request@10.0.19", "", { "dependencies": { "@octokit/endpoint": "^11.0.5", "@octokit/request-error": "^7.1.2", "@octokit/types": "^18.0.0", "content-type": "^3.0.0", "json-with-bigint": "^3.5.12", "universal-user-agent": "^7.0.2" } }, "sha512-FgcDrtnG33ZF4STrBzO6DLfoy5RhqZAiWdfpZRojiEd8O8UU+FqCWQ/7ucUDEXYnKsBk/70R3D8hFkqR2x6lRg=="], "@octokit/request-error": ["@octokit/request-error@7.1.2", "", { "dependencies": { "@octokit/types": "^18.0.0" } }, "sha512-XZRuT3xZ84D3gYErI1DZvhJ33dCWVV6uzBtWkaBB4TvA/L6eOeTZodxLFVB44bBEEo3vEx7y00UfX1tBLrtLRg=="], @@ -71,19 +81,21 @@ "@sec-ant/readable-stream": ["@sec-ant/readable-stream@0.4.1", "", {}, "sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg=="], - "@semantic-release/changelog": ["@semantic-release/changelog@6.0.3", "", { "dependencies": { "@semantic-release/error": "^3.0.0", "aggregate-error": "^3.0.0", "fs-extra": "^11.0.0", "lodash": "^4.17.4" }, "peerDependencies": { "semantic-release": ">=18.0.0" } }, "sha512-dZuR5qByyfe3Y03TpmCvAxCyTnp7r5XwtHRf/8vD9EAn4ZWbavUX8adMtXYzE86EVh0gyLA7lm5yW4IV30XUag=="], + "@semantic-release/changelog": ["@semantic-release/changelog@7.0.0", "", { "dependencies": { "@semantic-release/error": "^4.0.0", "aggregate-error": "^5.0.0", "lodash-es": "^4.17.21" }, "peerDependencies": { "semantic-release": ">=20.1.0" } }, "sha512-TNPyag5db24o7jWjre7UwKB4EcL8oJxbRhnDQ7hmZRAYqzreAc6PgdxQuU3pppp5xQinYtiumL0iG8SSKvnlzg=="], "@semantic-release/commit-analyzer": ["@semantic-release/commit-analyzer@13.0.1", "", { "dependencies": { "conventional-changelog-angular": "^8.0.0", "conventional-changelog-writer": "^8.0.0", "conventional-commits-filter": "^5.0.0", "conventional-commits-parser": "^6.0.0", "debug": "^4.0.0", "import-from-esm": "^2.0.0", "lodash-es": "^4.17.21", "micromatch": "^4.0.2" }, "peerDependencies": { "semantic-release": ">=20.1.0" } }, "sha512-wdnBPHKkr9HhNhXOhZD5a2LNl91+hs8CC2vsAVYxtZH3y0dV3wKn+uZSN61rdJQZ8EGxzWB3inWocBHV9+u/CQ=="], - "@semantic-release/error": ["@semantic-release/error@3.0.0", "", {}, "sha512-5hiM4Un+tpl4cKw3lV4UgzJj+SmfNIDCLLw0TepzQxz9ZGV5ixnqkzIVF+3tp0ZHgcMKE+VNGHJjEeyFG2dcSw=="], + "@semantic-release/core": ["@semantic-release/core@1.0.0", "", { "dependencies": { "@semantic-release/commit-analyzer": "^14.0.0-beta.4", "@semantic-release/error": "^4.0.0", "aggregate-error": "^5.0.0", "cosmiconfig": "^10.0.0", "debug": "^4.0.0", "env-ci": "^11.0.0", "execa": "^10.0.0", "figures": "^6.0.0", "get-stream": "^6.0.0", "git-log-parser": "^1.2.0", "hook-std": "^4.0.0", "hosted-git-info": "^10.0.0", "import-from-esm": "^2.0.0", "lodash-es": "^4.17.21", "micromatch": "^4.0.2", "p-each-series": "^3.0.0", "p-reduce": "^3.0.0", "read-package-up": "^12.0.0", "resolve-from": "^5.0.0", "semver": "^7.3.2", "signale": "^1.2.1" } }, "sha512-tHXmIcTO62N3Xed8dcNCdyIpirDnZAR/Y0sFXFR4+sSdegv7Ma/+tFMip2YwZ0T40Ng1rQ9CR/5GpxbQZ3/cYg=="], + + "@semantic-release/error": ["@semantic-release/error@4.0.0", "", {}, "sha512-mgdxrHTLOjOddRVYIYDo0fR3/v61GNN1YGkfbrjuIKg/uMgCd+Qzo3UAXJ+woLQQpos4pl5Esuw5A7AoNlzjUQ=="], - "@semantic-release/exec": ["@semantic-release/exec@6.0.3", "", { "dependencies": { "@semantic-release/error": "^3.0.0", "aggregate-error": "^3.0.0", "debug": "^4.0.0", "execa": "^5.0.0", "lodash": "^4.17.4", "parse-json": "^5.0.0" }, "peerDependencies": { "semantic-release": ">=18.0.0" } }, "sha512-bxAq8vLOw76aV89vxxICecEa8jfaWwYITw6X74zzlO0mc/Bgieqx9kBRz9z96pHectiTAtsCwsQcUyLYWnp3VQ=="], + "@semantic-release/exec": ["@semantic-release/exec@7.1.0", "", { "dependencies": { "@semantic-release/error": "^4.0.0", "aggregate-error": "^3.0.0", "debug": "^4.0.0", "execa": "^9.0.0", "lodash-es": "^4.17.21", "parse-json": "^8.0.0" }, "peerDependencies": { "semantic-release": ">=24.1.0" } }, "sha512-4ycZ2atgEUutspPZ2hxO6z8JoQt4+y/kkHvfZ1cZxgl9WKJId1xPj+UadwInj+gMn2Gsv+fLnbrZ4s+6tK2TFQ=="], - "@semantic-release/git": ["@semantic-release/git@10.0.1", "", { "dependencies": { "@semantic-release/error": "^3.0.0", "aggregate-error": "^3.0.0", "debug": "^4.0.0", "dir-glob": "^3.0.0", "execa": "^5.0.0", "lodash": "^4.17.4", "micromatch": "^4.0.0", "p-reduce": "^2.0.0" }, "peerDependencies": { "semantic-release": ">=18.0.0" } }, "sha512-eWrx5KguUcU2wUPaO6sfvZI0wPafUKAMNC18aXY4EnNcrZL86dEmpNVnC9uMpGZkmZJ9EfCVJBQx4pV4EMGT1w=="], + "@semantic-release/git": ["@semantic-release/git@11.0.1", "", { "dependencies": { "@semantic-release/error": "^4.0.0", "aggregate-error": "^5.0.0", "debug": "^4.0.0", "dir-glob": "^3.0.0", "execa": "^10.0.0", "lodash-es": "^4.17.21", "micromatch": "^4.0.0", "p-reduce": "^3.0.0" }, "peerDependencies": { "semantic-release": ">=20.1.0" } }, "sha512-Zr8BUYCTZMc8V6wDKN2dpR7nJgewd9I6THL3ydLTnp3OEdTo1/4RBLNYaeRucYMsjMv+BXoCNfXA0NADj1kwhw=="], - "@semantic-release/github": ["@semantic-release/github@11.0.6", "", { "dependencies": { "@octokit/core": "^7.0.0", "@octokit/plugin-paginate-rest": "^13.0.0", "@octokit/plugin-retry": "^8.0.0", "@octokit/plugin-throttling": "^11.0.0", "@semantic-release/error": "^4.0.0", "aggregate-error": "^5.0.0", "debug": "^4.3.4", "dir-glob": "^3.0.1", "http-proxy-agent": "^7.0.0", "https-proxy-agent": "^7.0.0", "issue-parser": "^7.0.0", "lodash-es": "^4.17.21", "mime": "^4.0.0", "p-filter": "^4.0.0", "tinyglobby": "^0.2.14", "url-join": "^5.0.0" }, "peerDependencies": { "semantic-release": ">=24.1.0" } }, "sha512-ctDzdSMrT3H+pwKBPdyCPty6Y47X8dSrjd3aPZ5KKIKKWTwZBE9De8GtsH3TyAlw3Uyo2stegMx6rJMXKpJwJA=="], + "@semantic-release/github": ["@semantic-release/github@12.0.11", "", { "dependencies": { "@octokit/core": "^7.0.0", "@octokit/plugin-paginate-rest": "^15.0.0", "@octokit/plugin-retry": "^8.0.0", "@octokit/plugin-throttling": "^11.0.0", "@semantic-release/error": "^4.0.0", "aggregate-error": "^5.0.0", "debug": "^4.3.4", "dir-glob": "^3.0.1", "http-proxy-agent": "^9.0.0", "https-proxy-agent": "^9.0.0", "issue-parser": "^7.0.0", "lodash-es": "^4.17.21", "mime": "^4.0.0", "p-filter": "^4.0.0", "tinyglobby": "^0.2.14", "undici": "^7.0.0", "url-join": "^5.0.0" }, "peerDependencies": { "semantic-release": ">=24.1.0" } }, "sha512-/8JPlFOV8he+gs+kS8Gx0tNWBboCRBd1q3y7pQhYwtrBL0CzDe9yzguZZAfnjGM2duWYB3rEYn9BdYLu9x00cg=="], - "@semantic-release/npm": ["@semantic-release/npm@12.0.2", "", { "dependencies": { "@semantic-release/error": "^4.0.0", "aggregate-error": "^5.0.0", "execa": "^9.0.0", "fs-extra": "^11.0.0", "lodash-es": "^4.17.21", "nerf-dart": "^1.0.0", "normalize-url": "^8.0.0", "npm": "^10.9.3", "rc": "^1.2.8", "read-pkg": "^9.0.0", "registry-auth-token": "^5.0.0", "semver": "^7.1.2", "tempy": "^3.0.0" }, "peerDependencies": { "semantic-release": ">=20.1.0" } }, "sha512-+M9/Lb35IgnlUO6OSJ40Ie+hUsZLuph2fqXC/qrKn0fMvUU/jiCjpoL6zEm69vzcmaZJ8yNKtMBEKHWN49WBbQ=="], + "@semantic-release/npm": ["@semantic-release/npm@14.0.0-beta.3", "", { "dependencies": { "@actions/core": "^3.0.0", "@semantic-release/error": "^4.0.0", "aggregate-error": "^5.0.0", "env-ci": "^11.2.0", "execa": "^9.0.0", "fs-extra": "^11.0.0", "lodash-es": "^4.17.21", "nerf-dart": "^1.0.0", "normalize-url": "^9.0.0", "npm": "^12.2.1", "rc": "^1.2.8", "read-pkg": "^10.0.0", "registry-auth-token": "^5.0.0", "semver": "^7.1.2", "tempy": "^3.0.0" }, "peerDependencies": { "semantic-release": ">=20.1.0" } }, "sha512-SHt6hBwWkC8hjK0curlE+D1LbfqKCkE4b2SwqyQOBocadPajwBw30Yr9MxrrSBjdVbWn9e1vND4mjwm2JjrNsA=="], "@semantic-release/release-notes-generator": ["@semantic-release/release-notes-generator@14.1.1", "", { "dependencies": { "conventional-changelog-angular": "^8.0.0", "conventional-changelog-writer": "^8.0.0", "conventional-commits-filter": "^5.0.0", "conventional-commits-parser": "^6.0.0", "debug": "^4.0.0", "import-from-esm": "^2.0.0", "lodash-es": "^4.17.21", "read-package-up": "^11.0.0" }, "peerDependencies": { "semantic-release": ">=20.1.0" } }, "sha512-Pbd2e2XRMUD0OxehHpgd5/YghsE76cddkRHSoDvKLK+OCy4Ewxn49rWR631MEUU01lgwF/uyVXvbnVuu6+Z6VA=="], @@ -93,23 +105,25 @@ "@sindresorhus/merge-streams": ["@sindresorhus/merge-streams@4.0.0", "", {}, "sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ=="], - "@types/node": ["@types/node@26.6.5", "", { "dependencies": { "undici-types": "~8.9.0" } }, "sha512-uMzsv9stDdofIZBx4UGh4Z9ZgXnGC9seRDscilBcTHAeOFk67MZg/k9bWVfO+bk4qZmG+l52hRnLwUiH2LnJTg=="], + "@types/node": ["@types/node@26.6.11", "", { "dependencies": { "undici-types": "~8.9.0" } }, "sha512-uUyQ2XLEz+EXh34lmS3GhKrkqn/8FU7KUiKRpk347At2bmnMVWss45yz8b4FG/tUtmV1tV/+TVkITItPROyeeQ=="], "@types/normalize-package-data": ["@types/normalize-package-data@2.4.4", "", {}, "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA=="], - "agent-base": ["agent-base@7.1.4", "", {}, "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ=="], + "agent-base": ["agent-base@9.0.0", "", {}, "sha512-TQf59BsZnytt8GdJKLPfUZ54g/iaUL2OWDSFCCvMOhsHduDQxO8xC4PNeyIkVcA5KwL2phPSv0douC0fgWzmnA=="], - "aggregate-error": ["aggregate-error@3.1.0", "", { "dependencies": { "clean-stack": "^2.0.0", "indent-string": "^4.0.0" } }, "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA=="], + "aggregate-error": ["aggregate-error@5.1.0", "", { "dependencies": { "clean-stack": "^5.2.0", "indent-string": "^5.0.0" } }, "sha512-1m4/ydbOGBbHTtBYa4/ISQcqfPdZAxQLzj71wM71T8lP4ktez8lcsVolvscrujQW4CJr/LJSzoZ6mcfnqzYQ3A=="], "ansi-escapes": ["ansi-escapes@7.3.0", "", { "dependencies": { "environment": "^1.0.0" } }, "sha512-BvU8nYgGQBxcmMuEeUEmNTvrMVjJNSH7RgW24vXexN4Ven6qCvy4TntnvlnwnMLTVlcRQQdbRY8NKnaIoeWDNg=="], - "ansi-regex": ["ansi-regex@6.4.0", "", {}, "sha512-KzTVk2tCWAHtYrvvvaP8bJKJq2pVinhLcGEQdtLIYPbmNGNyYe8QwNaTUYQp2J7/vIsUKt5QCqAfUkYyG9DkOw=="], + "ansi-regex": ["ansi-regex@6.6.0", "", {}, "sha512-XZ5apbzreCbXSKwPjJstu8R0zOi247w3XYwWxtwBXgpZrCyc1Ka7p9/xY0A9/diMewmHbEKz+FIraWaEWjlN5g=="], "ansi-styles": ["ansi-styles@3.2.1", "", { "dependencies": { "color-convert": "^1.9.0" } }, "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA=="], "any-promise": ["any-promise@1.3.0", "", {}, "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A=="], - "argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], + "argparse": ["argparse@3.0.4", "", {}, "sha512-fwWK3Zq22l4XJJjx5mcBHGikIk+hJqO+32dPm0Jur7+rtG5x1scOjSfdT9ZKeWHPpsya/l0HHK4tDImBkTrtvA=="], + + "argue-cli": ["argue-cli@3.2.1", "", {}, "sha512-h8QG03KSAympQnbZe0k5h/mnQCCkoKO9rVQ0L+F99+NNTV4vm18Lq70WwIKE0aLN3mM1EUf42l960bl6Dd0jOw=="], "argv-formatter": ["argv-formatter@1.0.0", "", {}, "sha512-F2+Hkm9xFaRg+GkaNnbwXNDV5O6pnCFEmqyhvfC/Ic5LbgOWjJh3L+mN/s91rxVL3znE7DYVpW0GJFT+4YBgWw=="], @@ -121,19 +135,17 @@ "braces": ["@franciscosolis/braces@3.1.1", "", { "dependencies": { "fill-range": "^7.1.1" } }, "sha512-UbAmg95sQAZBNLndF6etbMQ9QTvmYz3IkHY3cORJNmmVknAZVFmBYyNmNWX7RTOcAfiRHJPtY4jCk8ZCU7qiZQ=="], - "callsites": ["callsites@3.1.0", "", {}, "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ=="], - "chalk": ["chalk@5.6.2", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="], "char-regex": ["char-regex@1.0.2", "", {}, "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw=="], - "clean-stack": ["clean-stack@2.2.0", "", {}, "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A=="], + "clean-stack": ["clean-stack@5.3.0", "", { "dependencies": { "escape-string-regexp": "5.0.0" } }, "sha512-9ngPTOhYGQqNVSfeJkYXHmF7AGWp4/nN5D/QqNQs3Dvxd1Kk/WpjHfNujKHYUQ/5CoGyOyFNoWSPk5afzP0QVg=="], "cli-highlight": ["cli-highlight@2.1.11", "", { "dependencies": { "chalk": "^4.0.0", "highlight.js": "^10.7.1", "mz": "^2.4.0", "parse5": "^5.1.1", "parse5-htmlparser2-tree-adapter": "^6.0.0", "yargs": "^16.0.0" }, "bin": { "highlight": "bin/highlight" } }, "sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg=="], "cli-table3": ["cli-table3@0.6.5", "", { "dependencies": { "string-width": "^4.2.0" }, "optionalDependencies": { "@colors/colors": "1.5.0" } }, "sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ=="], - "cliui": ["cliui@8.0.1", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" } }, "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ=="], + "cliui": ["cliui@9.0.1", "", { "dependencies": { "string-width": "^7.2.0", "strip-ansi": "^7.1.0", "wrap-ansi": "^9.0.0" } }, "sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w=="], "color-convert": ["color-convert@1.9.3", "", { "dependencies": { "color-name": "1.1.3" } }, "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg=="], @@ -147,7 +159,7 @@ "conventional-changelog-angular": ["conventional-changelog-angular@8.3.1", "", { "dependencies": { "compare-func": "^2.0.0" } }, "sha512-6gfI3otXK5Ph5DfCOI1dblr+kN3FAm5a97hYoQkqNZxOaYa5WKfXH+AnpsmS+iUH2mgVC2Cg2Qw9m5OKcmNrIg=="], - "conventional-changelog-conventionalcommits": ["conventional-changelog-conventionalcommits@8.0.0", "", { "dependencies": { "compare-func": "^2.0.0" } }, "sha512-eOvlTO6OcySPyyyk8pKz2dP4jjElYunj9hn9/s0OB+gapTO8zwS9UQWrZ1pmF2hFs3vw1xhonOLGcGjy/zgsuA=="], + "conventional-changelog-conventionalcommits": ["conventional-changelog-conventionalcommits@10.4.1", "", { "dependencies": { "@conventional-changelog/template": "^1.4.0" } }, "sha512-jS1LRFSbRoAr6JbhhRy1JYfNNUj5LM3+v49hRE03CgccsiYqgdVj/RTmrw4J1rylrqijHwdOlJWiJa61JHOgHg=="], "conventional-changelog-writer": ["conventional-changelog-writer@8.4.0", "", { "dependencies": { "@simple-libs/stream-utils": "^1.2.0", "conventional-commits-filter": "^5.0.0", "handlebars": "^4.7.7", "meow": "^13.0.0", "semver": "^7.5.2" }, "bin": { "conventional-changelog-writer": "dist/cli/index.js" } }, "sha512-HHBFkk1EECxxmCi4CTu091iuDpQv5/OavuCUAuZmrkWpmYfyD816nom1CvtfXJ/uYfAAjavgHvXHX291tSLK8g=="], @@ -159,9 +171,9 @@ "core-util-is": ["core-util-is@1.0.3", "", {}, "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="], - "cosmiconfig": ["cosmiconfig@9.0.2", "", { "dependencies": { "env-paths": "^2.2.1", "import-fresh": "^3.3.0", "js-yaml": "^4.1.0", "parse-json": "^5.2.0" }, "peerDependencies": { "typescript": ">=4.9.5" }, "optionalPeers": ["typescript"] }, "sha512-gtTZxTDau1wL7Y7zifc2dd8jHSK/k6BTx/2Xp/BpdlAdnlYWFVt7qhJqgwi7637yRwRQ3qL4ZidbB4I8tA5VOg=="], + "cosmiconfig": ["cosmiconfig@10.0.1", "", { "dependencies": { "env-paths": "^2.2.1", "js-yaml": "^5.4.1" } }, "sha512-/zvGoYn0y27QTBmK+0B+oPdEPC4fKGUmJsMTQbDjqph00TrkqfVFW/M+C6ya54sYCgHC6QCwK/mI6djt8cEGHQ=="], - "cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="], + "cross-spawn": ["cross-spawn@7.1.2", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-8BPK2r+sKWC8sDinRwLwrFMq2lXTBBwzYYEB9LiCznfMurOi4FOvQflq3XOLGG+HPdMSVpe+k/s96+AtDEOgPg=="], "crypto-random-string": ["crypto-random-string@4.0.0", "", { "dependencies": { "type-fest": "^1.0.1" } }, "sha512-x8dy3RnvYdlUcPOjkEHqozhiwzKNSq7GcPuXFbnyMOCHxX8V3OgIg/pYuabl2sbUPfIJaeAQB7PMOK8DFIdoRA=="], @@ -191,7 +203,7 @@ "escape-string-regexp": ["escape-string-regexp@5.0.0", "", {}, "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw=="], - "execa": ["execa@5.1.1", "", { "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", "human-signals": "^2.1.0", "is-stream": "^2.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^4.0.1", "onetime": "^5.1.2", "signal-exit": "^3.0.3", "strip-final-newline": "^2.0.0" } }, "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg=="], + "execa": ["execa@9.6.1", "", { "dependencies": { "@sindresorhus/merge-streams": "^4.0.0", "cross-spawn": "^7.0.6", "figures": "^6.1.0", "get-stream": "^9.0.0", "human-signals": "^8.0.1", "is-plain-obj": "^4.1.0", "is-stream": "^4.0.1", "npm-run-path": "^6.0.0", "pretty-ms": "^9.2.0", "signal-exit": "^4.1.0", "strip-final-newline": "^4.0.0", "yoctocolors": "^2.1.1" } }, "sha512-9Be3ZoN4LmYR90tUoVu2te2BsbzHfhJyfEiAVfz7N5/zv+jduIfLrV2xdQXOHbaD6KgpGdO9PRPM1Y4Q9QkPkA=="], "fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="], @@ -211,11 +223,13 @@ "get-caller-file": ["get-caller-file@2.0.5", "", {}, "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="], - "get-stream": ["get-stream@6.0.1", "", {}, "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg=="], + "get-east-asian-width": ["get-east-asian-width@1.7.0", "", {}, "sha512-XjH1AECxf0giL2V1aU8vKyRR2ppRUb5c0EvT7zuJTokQ74bNo52zOtghqdWIqrhUD79fo3x0WfKZdOqxF6LG1Q=="], + + "get-stream": ["get-stream@9.0.1", "", { "dependencies": { "@sec-ant/readable-stream": "^0.4.1", "is-stream": "^4.0.1" } }, "sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA=="], "git-log-parser": ["git-log-parser@1.2.1", "", { "dependencies": { "argv-formatter": "~1.0.0", "spawn-error-forwarder": "~1.0.0", "split2": "~1.0.0", "stream-combiner2": "~1.1.1", "through2": "~2.0.0", "traverse": "0.6.8" } }, "sha512-PI+sPDvHXNPl5WNOErAK05s3j0lgwUzMN6o8cyQrDaKfT3qd7TmNJKeXX+SknI5I0QhG5fVPAEwSY4tRGDtYoQ=="], - "graceful-fs": ["graceful-fs@4.2.11", "", {}, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="], + "graceful-fs": ["graceful-fs@4.2.10", "", {}, "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA=="], "handlebars": ["handlebars@4.7.10", "", { "dependencies": { "minimist": "^1.2.8", "neo-async": "^2.6.2", "source-map": "^0.6.1", "wordwrap": "^1.0.0" }, "optionalDependencies": { "uglify-js": "^3.1.4" }, "bin": { "handlebars": "bin/handlebars" } }, "sha512-P5VJMVM7qgBn6vjXMw8WG9uVI+ncf2pi72j4de4yz5ZULLj2RGqLYaKOYGsgyrViQ0tePOVlN1tDCCXXtFqXKg=="], @@ -225,21 +239,19 @@ "hook-std": ["hook-std@4.0.0", "", {}, "sha512-IHI4bEVOt3vRUDJ+bFA9VUJlo7SzvFARPNLw75pqSmAOP2HmTWfFJtPvLBrDrlgjEYXY9zs7SFdHPQaJShkSCQ=="], - "hosted-git-info": ["hosted-git-info@8.1.0", "", { "dependencies": { "lru-cache": "^10.0.1" } }, "sha512-Rw/B2DNQaPBICNXEm8balFz9a6WpZrkCGpcWFpy7nCj+NyhSdqXipmfvtmWt9xGfp0wZnBxB+iVpLmQMYt47Tw=="], - - "http-proxy-agent": ["http-proxy-agent@7.0.2", "", { "dependencies": { "agent-base": "^7.1.0", "debug": "^4.3.4" } }, "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig=="], + "hosted-git-info": ["hosted-git-info@10.1.1", "", { "dependencies": { "lru-cache": "^11.1.0" } }, "sha512-DeOnSPAvOndYKfw075gt8yZzQ7S2hNztw34zBTfhIzLhmBTswIBg5/y+pqu/VD5cYWm5goAFTusDmUEmKZ0PEQ=="], - "https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="], + "http-proxy-agent": ["http-proxy-agent@9.1.0", "", { "dependencies": { "agent-base": "9.0.0", "debug": "^4.3.4", "proxy-agent-negotiate": "1.1.0" } }, "sha512-2NxoveTT58mjYT4n3RPTEfCZGLMbidoO8XEieXfpSYxu+PQJ1qpx4ypwH6N+uF9twBPIvRRgvkvW5HUTYWENig=="], - "human-signals": ["human-signals@2.1.0", "", {}, "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw=="], + "https-proxy-agent": ["https-proxy-agent@9.1.0", "", { "dependencies": { "agent-base": "9.0.0", "debug": "^4.3.4", "proxy-agent-negotiate": "1.1.0" } }, "sha512-ag87y7cJJ9/3+GxFr8Oy4O5faDsGRGnBGsJj/YjOSsSx/5eadKLYTMPlzuR6obgoCDDm0abAAZitXXQkMOPSpA=="], - "import-fresh": ["import-fresh@3.3.1", "", { "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" } }, "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ=="], + "human-signals": ["human-signals@8.0.1", "", {}, "sha512-eKCa6bwnJhvxj14kZk5NCPc6Hb6BdsU9DZcOnmQKSnO1VKrfV0zCvtttPZUsBvjmNDn8rpcJfpwSYnHBjc95MQ=="], "import-from-esm": ["import-from-esm@2.0.0", "", { "dependencies": { "debug": "^4.3.4", "import-meta-resolve": "^4.0.0" } }, "sha512-YVt14UZCgsX1vZQ3gKjkWVdBdHQ6eu3MPU1TBgL1H5orXe2+jWD006WCPPtOuwlQm10NuzOW5WawiF1Q9veW8g=="], "import-meta-resolve": ["import-meta-resolve@4.2.0", "", {}, "sha512-Iqv2fzaTQN28s/FwZAoFq0ZSs/7hMAHJVX+w8PZl3cY19Pxk6jFFalxQoIfW2826i/fDLXv8IiEZRIT0lDuWcg=="], - "indent-string": ["indent-string@4.0.0", "", {}, "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg=="], + "indent-string": ["indent-string@5.0.0", "", {}, "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg=="], "index-to-position": ["index-to-position@1.2.0", "", {}, "sha512-Yg7+ztRkqslMAS2iFaU+Oa4KTSidr63OsFGlOrJoW981kIYO3CGCS3wA95P1mUi/IVSJkn0D479KTJpVpvFNuw=="], @@ -257,7 +269,7 @@ "is-plain-obj": ["is-plain-obj@4.1.0", "", {}, "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg=="], - "is-stream": ["is-stream@2.0.1", "", {}, "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg=="], + "is-stream": ["is-stream@4.0.1", "", {}, "sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A=="], "is-unicode-supported": ["is-unicode-supported@2.1.0", "", {}, "sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ=="], @@ -271,24 +283,18 @@ "js-tokens": ["js-tokens@4.0.0", "", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="], - "js-yaml": ["js-yaml@4.3.2", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA=="], + "js-yaml": ["js-yaml@5.5.0", "", { "dependencies": { "argparse": "^3.0.3" }, "bin": { "js-yaml": "bin/js-yaml.mjs" } }, "sha512-paNr4LFIFPjeeSmwNYdrb8FafLLG/Cr2Af3GjbsHJ5CxIjH4r0c2emlmRdAtpPAieP1gRVzk6buBbVP5gBMGAg=="], "json-parse-better-errors": ["json-parse-better-errors@1.0.2", "", {}, "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw=="], - "json-parse-even-better-errors": ["json-parse-even-better-errors@2.3.1", "", {}, "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w=="], - "json-with-bigint": ["json-with-bigint@3.5.12", "", {}, "sha512-uwbF/wSSuOgC7qqlq27Xp5B6a2MHVug3t0idZdTqu0JnlFvgJuH7ju+KAk/J06C7GfhoYy2gnb9wz2INqcne7w=="], "jsonfile": ["jsonfile@6.2.1", "", { "dependencies": { "universalify": "^2.0.0" }, "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q=="], - "lines-and-columns": ["lines-and-columns@1.2.4", "", {}, "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg=="], - "load-json-file": ["load-json-file@4.0.0", "", { "dependencies": { "graceful-fs": "^4.1.2", "parse-json": "^4.0.0", "pify": "^3.0.0", "strip-bom": "^3.0.0" } }, "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw=="], "locate-path": ["locate-path@2.0.0", "", { "dependencies": { "p-locate": "^2.0.0", "path-exists": "^3.0.0" } }, "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA=="], - "lodash": ["lodash@4.18.1", "", {}, "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q=="], - "lodash-es": ["lodash-es@4.18.1", "", {}, "sha512-J8xewKD/Gk22OZbhpOVSwcs60zhd95ESDwezOFuA3/099925PdHJ7OFHNTGtajL3AlZkykD32HykiMo+BIBI8A=="], "lodash.capitalize": ["lodash.capitalize@4.2.1", "", {}, "sha512-kZzYOKspf8XVX5AvmQF94gQW0lejFVgb80G85bU4ZWzoJ6C03PQg3coYAUpSTpQWelrZELd3XWgHzw4Ck5kaIw=="], @@ -301,13 +307,13 @@ "lodash.uniqby": ["lodash.uniqby@4.7.0", "", {}, "sha512-e/zcLx6CSbmaEgFHCA7BnoQKyCtKMxnuWrJygbwPs/AIn+IMKl66L8/s+wBUn5LRw2pZx3bUHibiV1b6aTWIww=="], - "lru-cache": ["lru-cache@10.4.3", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="], + "lru-cache": ["lru-cache@11.5.4", "", {}, "sha512-B8nJCTi8JuSaDBg0tBdnImV6j5O2CXaqKfdj24ZTCFbyivN8KZ2Z+RL3aHjwJAfLutD9cNnObG4SIgW4gMufiw=="], "make-asynchronous": ["make-asynchronous@1.1.0", "", { "dependencies": { "p-event": "^6.0.0", "type-fest": "^4.6.0", "web-worker": "^1.5.0" } }, "sha512-ayF7iT+44LXdxJLTrTd3TLQpFDDvPCBxXxbv+pMUSuHA5Q8zyAfwkRP6aHHwNVFBUFWtxAHqwNJxF8vMZLAbVg=="], "marked": ["marked@15.0.12", "", { "bin": { "marked": "bin/marked.js" } }, "sha512-8dD6FusOQSrpv9Z1rdNMdlSgQOIP880DHqnohobOmYLElGEqAL/JvxvuxZO16r4HtjTlfPRDC1hbvxC9dPN2nA=="], - "marked-terminal": ["marked-terminal@7.3.0", "", { "dependencies": { "ansi-escapes": "^7.0.0", "ansi-regex": "^6.1.0", "chalk": "^5.4.1", "cli-highlight": "^2.1.11", "cli-table3": "^0.6.5", "node-emoji": "^2.2.0", "supports-hyperlinks": "^3.1.0" }, "peerDependencies": { "marked": ">=1 <16" } }, "sha512-t4rBvPsHc57uE/2nJOLmMbZCQ4tgAccAED3ngXQqW6g+TxA488JzJ+FK3lQkzBQOI1mRV/r/Kq+1ZlJ4D0owQw=="], + "marked-terminal": ["marked-terminal@7.3.1", "", { "dependencies": { "ansi-escapes": "^7.3.0", "ansi-regex": "^6.4.0", "chalk": "^5.6.2", "cli-highlight": "^2.1.11", "cli-table3": "^0.6.5", "node-emoji": "^2.2.0", "supports-hyperlinks": "^3.2.0" }, "peerDependencies": { "marked": ">=1 <19" } }, "sha512-B1eKs5mRiacjHHMlex1zn0zkVomz2/KWjD/dyA8WRQTXk2d15OzVjiK/iuPfvDFB27Gvr8p/u6MYgU0NY/O45w=="], "meow": ["meow@13.2.0", "", {}, "sha512-pxQJQzB6djGPXh08dacEloMFopsOqGVRKFPYvPOt9XDZ1HasbgDZA74CJGreSU4G3Ak7EFJGoiH2auq+yXISgA=="], @@ -315,9 +321,9 @@ "micromatch": ["micromatch@4.0.8", "", { "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" } }, "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA=="], - "mime": ["mime@4.1.0", "", { "bin": { "mime": "bin/cli.js" } }, "sha512-X5ju04+cAzsojXKes0B/S4tcYtFAJ6tTMuSPBEn9CPGlrWr8Fiw7qYeLT0XyH80HSoAoqWCaz+MWKh22P7G1cw=="], + "mime": ["mime@4.1.2", "", { "bin": { "mime": "bin/cli.js" } }, "sha512-ikRzZ2RwbUVDyL9SsU0f2Phcmav4yq5r8faH5ZZKHtOZrMBLnrQOrj0uvqZ5R1uQnj+RO7Wcklw/lAf81mP9LQ=="], - "mimic-fn": ["mimic-fn@2.1.0", "", {}, "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg=="], + "mimic-fn": ["mimic-fn@4.0.0", "", {}, "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw=="], "minimist": ["minimist@1.2.8", "", {}, "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="], @@ -333,15 +339,15 @@ "normalize-package-data": ["normalize-package-data@6.0.2", "", { "dependencies": { "hosted-git-info": "^7.0.0", "semver": "^7.3.5", "validate-npm-package-license": "^3.0.4" } }, "sha512-V6gygoYb/5EmNI+MEGrWkC+e6+Rr7mTmfHrxDbLzxQogBkgzo76rkok0Am6thgSF7Mv2nLOajAJj5vDJZEFn7g=="], - "normalize-url": ["normalize-url@8.1.1", "", {}, "sha512-JYc0DPlpGWB40kH5g07gGTrYuMqV653k3uBKY6uITPWds3M0ov3GaWGp9lbE3Bzngx8+XkfzgvASb9vk9JDFXQ=="], + "normalize-url": ["normalize-url@9.0.1", "", {}, "sha512-ARftfC5HdUNu9jJeL8pHj8debUIHA2b91FizCoMzY4lG6dDX13jdvTK0TBe24IBDRf2HvJSzzwEPvmbkQWHRSg=="], - "npm": ["npm@10.9.9", "", { "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", "@npmcli/arborist": "^8.0.5", "@npmcli/config": "^9.0.0", "@npmcli/fs": "^4.0.0", "@npmcli/map-workspaces": "^4.0.2", "@npmcli/package-json": "^6.2.0", "@npmcli/promise-spawn": "^8.0.3", "@npmcli/redact": "^3.2.2", "@npmcli/run-script": "^9.1.0", "@sigstore/tuf": "^3.1.1", "abbrev": "^3.0.1", "archy": "~1.0.0", "cacache": "^19.0.1", "chalk": "^5.6.2", "ci-info": "^4.4.0", "cli-columns": "^4.0.0", "fastest-levenshtein": "^1.0.16", "fs-minipass": "^3.0.3", "glob": "^10.5.0", "graceful-fs": "^4.2.11", "hosted-git-info": "^8.1.0", "ini": "^5.0.0", "init-package-json": "^7.0.2", "is-cidr": "^5.1.1", "json-parse-even-better-errors": "^4.0.0", "libnpmaccess": "^9.0.0", "libnpmdiff": "^7.0.5", "libnpmexec": "^9.0.5", "libnpmfund": "^6.0.5", "libnpmhook": "^11.0.0", "libnpmorg": "^7.0.0", "libnpmpack": "^8.0.5", "libnpmpublish": "^10.0.2", "libnpmsearch": "^8.0.0", "libnpmteam": "^7.0.0", "libnpmversion": "^7.0.0", "make-fetch-happen": "^14.0.3", "minimatch": "^9.0.9", "minipass": "^7.1.3", "minipass-pipeline": "^1.2.4", "ms": "^2.1.2", "node-gyp": "^11.5.0", "nopt": "^8.1.0", "normalize-package-data": "^7.0.1", "npm-audit-report": "^6.0.0", "npm-install-checks": "^7.1.2", "npm-package-arg": "^12.0.2", "npm-pick-manifest": "^10.0.0", "npm-profile": "^11.0.1", "npm-registry-fetch": "^18.0.2", "npm-user-validate": "^3.0.0", "p-map": "^7.0.4", "pacote": "^19.0.1", "parse-conflict-json": "^4.0.0", "proc-log": "^5.0.0", "qrcode-terminal": "^0.12.0", "read": "^4.1.0", "semver": "^7.7.4", "spdx-expression-parse": "^4.0.0", "ssri": "^12.0.0", "supports-color": "^9.4.0", "tar": "^7.5.22", "text-table": "~0.2.0", "tiny-relative-date": "^1.3.0", "treeverse": "^3.0.0", "validate-npm-package-name": "^6.0.2", "which": "^5.0.0", "write-file-atomic": "^6.0.0" }, "bin": { "npm": "bin/npm-cli.js", "npx": "bin/npx-cli.js" } }, "sha512-1g+6jLQvaIuB4zwvHL7yrXuXcWZwDsCtBX8bbWDqbvJSSr9nPiDDWTHNgwXR27iIcTTW7v3A57hDW9RYv2W4Yg=="], + "npm": ["npm@12.2.3", "", { "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", "@npmcli/arborist": "^10.0.5", "@npmcli/config": "^11.2.1", "@npmcli/fs": "^6.0.0", "@npmcli/git": "^8.0.0", "@npmcli/map-workspaces": "^6.0.0", "@npmcli/metavuln-calculator": "^10.0.0", "@npmcli/package-json": "^8.0.0", "@npmcli/promise-spawn": "^10.0.1", "@npmcli/redact": "^5.0.0", "@npmcli/run-script": "^11.0.0", "@sigstore/tuf": "^5.0.0", "abbrev": "^5.0.0", "archy": "~1.0.0", "bin-links": "^7.0.1", "cacache": "^21.0.1", "chalk": "^5.6.2", "ci-info": "^4.4.0", "diff": "^8.0.2", "fastest-levenshtein": "^1.0.16", "fs-minipass": "^3.0.3", "glob": "^13.0.6", "graceful-fs": "^4.2.11", "hosted-git-info": "^10.1.1", "ini": "^7.0.0", "init-package-json": "^9.0.0", "is-cidr": "^7.0.0", "json-parse-even-better-errors": "^6.0.0", "libnpmaccess": "^11.0.0", "libnpmdiff": "^9.0.5", "libnpmexec": "^11.0.6", "libnpmfund": "^8.0.5", "libnpmorg": "^9.0.0", "libnpmpack": "^10.0.5", "libnpmpublish": "^12.0.1", "libnpmsearch": "^10.0.0", "libnpmteam": "^9.0.0", "libnpmversion": "^9.0.0", "make-fetch-happen": "^16.0.1", "minimatch": "^10.2.5", "minipass": "^7.1.3", "minipass-pipeline": "^1.2.4", "ms": "^2.1.2", "node-gyp": "^13.0.0", "nopt": "^10.0.1", "npm-audit-report": "^8.0.0", "npm-install-checks": "^9.0.0", "npm-package-arg": "^14.0.0", "npm-pick-manifest": "^12.0.0", "npm-profile": "^13.0.1", "npm-registry-fetch": "^20.0.1", "npm-user-validate": "^5.0.0", "p-map": "^7.0.4", "pacote": "^22.0.1", "parse-conflict-json": "^6.0.0", "proc-log": "^7.0.0", "qrcode-terminal": "^0.12.0", "read": "^6.0.0", "semver": "^7.8.6", "spdx-expression-parse": "^4.0.0", "ssri": "^14.0.0", "supports-color": "^10.2.2", "tar": "^7.5.22", "text-table": "~0.2.0", "tiny-relative-date": "^2.0.2", "treeverse": "^3.0.0", "validate-npm-package-name": "^8.0.0", "which": "^7.0.0" }, "bin": { "npm": "bin/npm-cli.js", "npx": "bin/npx-cli.js" } }, "sha512-ovmNRRe76Jvcp1E6iOePQ6H9Zr4XMOrqgfaeGNhtRvP3XSl2Lo/a9C1N5/jRlLLrsqCem/omgGdZHpZ5a6yn1Q=="], - "npm-run-path": ["npm-run-path@4.0.1", "", { "dependencies": { "path-key": "^3.0.0" } }, "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw=="], + "npm-run-path": ["npm-run-path@6.0.0", "", { "dependencies": { "path-key": "^4.0.0", "unicorn-magic": "^0.3.0" } }, "sha512-9qny7Z9DsQU8Ou39ERsPU4OZQlSTP47ShQzuKZ6PRXpYLtIFgl/DEBYEXKlvcEa+9tHVcK8CF81Y2V72qaZhWA=="], "object-assign": ["object-assign@4.1.1", "", {}, "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="], - "onetime": ["onetime@5.1.2", "", { "dependencies": { "mimic-fn": "^2.1.0" } }, "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg=="], + "onetime": ["onetime@6.0.0", "", { "dependencies": { "mimic-fn": "^4.0.0" } }, "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ=="], "p-each-series": ["p-each-series@3.0.0", "", {}, "sha512-lastgtAdoH9YaLyDa5i5z64q+kzOcQHsQ5SsZJD3q0VEyI8mq872S3geuNbRUQLVAE9siMfgKrpj7MloKFHruw=="], @@ -355,15 +361,13 @@ "p-map": ["p-map@7.1.1", "", {}, "sha512-6Lh3jQPLthYujSrlw6ccWXBGZTkoTCz27Hd92g79LH/kjAbgoEu0t442cCCNbegPSJsA0lwDX8z0bcKtkpA32g=="], - "p-reduce": ["p-reduce@2.1.0", "", {}, "sha512-2USApvnsutq8uoxZBGbbWM0JIYLiEMJ9RlaN7fAzVNb9OZN0SHjjTTfIcb667XynS5Y1VhwDJVDa72TnPzAYWw=="], + "p-reduce": ["p-reduce@3.0.0", "", {}, "sha512-xsrIUgI0Kn6iyDYm9StOpOeK29XM1aboGji26+QEortiFST1hGZaUQOLhtEbqHErPpGW/aSz6allwK2qcptp0Q=="], "p-timeout": ["p-timeout@6.1.4", "", {}, "sha512-MyIV3ZA/PmyBN/ud8vV9XzwTrNtR4jFrObymZYnZqMmW0zA8Z17vnT0rBgFE/TlohB+YCHqXMgZzb3Csp49vqg=="], "p-try": ["p-try@1.0.0", "", {}, "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww=="], - "parent-module": ["parent-module@1.0.1", "", { "dependencies": { "callsites": "^3.0.0" } }, "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g=="], - - "parse-json": ["parse-json@5.2.0", "", { "dependencies": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", "json-parse-even-better-errors": "^2.3.0", "lines-and-columns": "^1.1.6" } }, "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg=="], + "parse-json": ["parse-json@8.3.0", "", { "dependencies": { "@babel/code-frame": "^7.26.2", "index-to-position": "^1.1.0", "type-fest": "^4.39.1" } }, "sha512-ybiGyvspI+fAoRQbIPRddCcSTV9/LsJbf0e/S85VLowVGzRmokfneg2kwVW/KU5rOXrPSbF1qAKPMgNTqqROQQ=="], "parse-ms": ["parse-ms@4.0.0", "", {}, "sha512-TXfryirbmq34y8QBwgqCVLi+8oA3oWx2eAnSn62ITyEhEYaWRlVZ2DvMM9eZbMs/RfxPu/PK/aBLyGj4IrqMHw=="], @@ -391,6 +395,8 @@ "proto-list": ["proto-list@1.2.4", "", {}, "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA=="], + "proxy-agent-negotiate": ["proxy-agent-negotiate@1.1.0", "", { "peerDependencies": { "kerberos": "^2.0.0" }, "optionalPeers": ["kerberos"] }, "sha512-N8IBcM3UgCVzz2L2Lqv8DVntDnnC8/hiV4nEDUPkqq72TPUgYWjQc+bdZlBPZK9LzPAvOY//gAt0S0DApoOXWQ=="], + "rc": ["rc@1.2.8", "", { "dependencies": { "deep-extend": "^0.6.0", "ini": "~1.3.0", "minimist": "^1.2.0", "strip-json-comments": "~2.0.1" }, "bin": { "rc": "./cli.js" } }, "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw=="], "read-package-up": ["read-package-up@11.0.0", "", { "dependencies": { "find-up-simple": "^1.0.0", "read-pkg": "^9.0.0", "type-fest": "^4.6.0" } }, "sha512-MbgfoNPANMdb4oRBNg5eqLbB2t2r+o5Ua1pNt8BqGp4I0FJZhuVSOj3PaBPni4azWuSzEdNn2evevzVmEk1ohQ=="], @@ -407,11 +413,9 @@ "safe-buffer": ["safe-buffer@5.1.2", "", {}, "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="], - "semantic-release": ["semantic-release@24.2.9", "", { "dependencies": { "@semantic-release/commit-analyzer": "^13.0.0-beta.1", "@semantic-release/error": "^4.0.0", "@semantic-release/github": "^11.0.0", "@semantic-release/npm": "^12.0.2", "@semantic-release/release-notes-generator": "^14.0.0-beta.1", "aggregate-error": "^5.0.0", "cosmiconfig": "^9.0.0", "debug": "^4.0.0", "env-ci": "^11.0.0", "execa": "^9.0.0", "figures": "^6.0.0", "find-versions": "^6.0.0", "get-stream": "^6.0.0", "git-log-parser": "^1.2.0", "hook-std": "^4.0.0", "hosted-git-info": "^8.0.0", "import-from-esm": "^2.0.0", "lodash-es": "^4.17.21", "marked": "^15.0.0", "marked-terminal": "^7.3.0", "micromatch": "^4.0.2", "p-each-series": "^3.0.0", "p-reduce": "^3.0.0", "read-package-up": "^11.0.0", "resolve-from": "^5.0.0", "semver": "^7.3.2", "semver-diff": "^5.0.0", "signale": "^1.2.1", "yargs": "^17.5.1" }, "bin": { "semantic-release": "bin/semantic-release.js" } }, "sha512-phCkJ6pjDi9ANdhuF5ElS10GGdAKY6R1Pvt9lT3SFhOwM4T7QZE7MLpBDbNruUx/Q3gFD92/UOFringGipRqZA=="], + "semantic-release": ["semantic-release@26.0.1", "", { "dependencies": { "@semantic-release/commit-analyzer": "^14.0.0-beta.4", "@semantic-release/core": "^1.0.0-beta.13", "@semantic-release/github": "^12.0.0", "@semantic-release/npm": "^14.0.0-beta.2", "@semantic-release/release-notes-generator": "^15.0.0-beta.3", "debug": "^4.0.0", "execa": "^10.0.0", "find-versions": "^6.0.0", "lodash-es": "^4.17.21", "marked": "^15.0.0", "marked-terminal": "^7.3.0", "semver": "^7.3.2", "yargs": "^18.0.0" }, "bin": { "semantic-release": "bin/semantic-release.js" } }, "sha512-nVDjgiPeiYuHtq4sjiJJVnq9i7zyXMFNGFL8MU0GWQLE0EPq98fTogh5RzHPvqxltnezmQ8QfiYZ100DFXyPQw=="], - "semver": ["semver@7.8.5", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA=="], - - "semver-diff": ["semver-diff@5.0.0", "", { "dependencies": { "semver": "^7.3.5" } }, "sha512-0HbGtOm+S7T6NGQ/pxJSJipJvc4DK3FcRVMRkhsIwJDJ4Jcz5DQC1cPPzB5GhzyHjwttW878HaWQq46CkL3cqg=="], + "semver": ["semver@7.8.6", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw=="], "semver-regex": ["semver-regex@4.0.5", "", {}, "sha512-hunMQrEy1T6Jr2uEVjrAIqjwWcQTgOAcIM52C8MY1EZSD3DDNft04XzvYKPqjED65bNVVko0YI38nYeEHCX3yw=="], @@ -419,7 +423,7 @@ "shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="], - "signal-exit": ["signal-exit@3.0.7", "", {}, "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="], + "signal-exit": ["signal-exit@4.1.0", "", {}, "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw=="], "signale": ["signale@1.4.0", "", { "dependencies": { "chalk": "^2.3.2", "figures": "^2.0.0", "pkg-conf": "^2.1.0" } }, "sha512-iuh+gPf28RkltuJC7W5MRi6XAjTDCAPC/prJUpQoG4vIP3MJZ+GTydVnodXA7pwvTKb2cA0m9OFZW/cdWy/I/w=="], @@ -441,24 +445,26 @@ "stream-combiner2": ["stream-combiner2@1.1.1", "", { "dependencies": { "duplexer2": "~0.1.0", "readable-stream": "^2.0.2" } }, "sha512-3PnJbYgS56AeWgtKF5jtJRT6uFJe56Z0Hc5Ngg/6sI6rIt8iiMBTa9cvdyFfpMQjaVHr8dusbNeFGIIonxOvKw=="], - "string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], + "string-width": ["string-width@8.3.0", "", { "dependencies": { "get-east-asian-width": "^1.5.0", "strip-ansi": "^7.1.2" } }, "sha512-ZbmZM0JCihQN91dWnxoipT2KOEyHqEyfRXUyjuRhW8b/xnqPDoq4gWEVApTVa9db2wN8mmoikgFBbjh71+cGeQ=="], "string_decoder": ["string_decoder@1.1.1", "", { "dependencies": { "safe-buffer": "~5.1.0" } }, "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg=="], - "strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], + "strip-ansi": ["strip-ansi@7.2.0", "", { "dependencies": { "ansi-regex": "^6.2.2" } }, "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w=="], "strip-bom": ["strip-bom@3.0.0", "", {}, "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA=="], - "strip-final-newline": ["strip-final-newline@2.0.0", "", {}, "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA=="], + "strip-final-newline": ["strip-final-newline@4.0.0", "", {}, "sha512-aulFJcD6YK8V1G7iRB5tigAP4TsHBZZrOV8pjV++zdUwmeV8uzbY7yn6h9MswN62adStNZFuCIx4haBnRuMDaw=="], "strip-json-comments": ["strip-json-comments@2.0.1", "", {}, "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ=="], "super-regex": ["super-regex@1.1.0", "", { "dependencies": { "function-timeout": "^1.0.1", "make-asynchronous": "^1.0.1", "time-span": "^5.1.0" } }, "sha512-WHkws2ZflZe41zj6AolvvmaTrWds/VuyeYr9iPVv/oQeaIoVxMKaushfFWpOGDT+GuBrM/sVqF8KUCYQlSSTdQ=="], - "supports-color": ["supports-color@9.4.0", "", {}, "sha512-VL+lNrEoIXww1coLPOmiEmK/0sGigko5COxI09KzHc2VJXJsQ37UaQ+8quuxjDeA7+KnLGTWRyOXSLLR2Wb4jw=="], + "supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], "supports-hyperlinks": ["supports-hyperlinks@3.2.0", "", { "dependencies": { "has-flag": "^4.0.0", "supports-color": "^7.0.0" } }, "sha512-zFObLMyZeEwzAoKCyu1B91U79K2t7ApXuQfo8OuxwXLDgcKxuwM+YvcbIhm6QWqz7mHUH1TVytR1PwVVjEuMig=="], + "tagged-tag": ["tagged-tag@1.0.0", "", {}, "sha512-yEFYrVhod+hdNyx7g5Bnkkb0G6si8HJurOoOEgC8B/O0uXLHlaey/65KRv6cuWBNhBgHKAROVpc7QyYqE5gFng=="], + "temp-dir": ["temp-dir@3.0.0", "", {}, "sha512-nHc6S/bwIilKHNRgK/3jlhDoIHcp45YgyiwcAk46Tr0LfEqGBVpmiAyuiuxeVE44m3mXnEeVhaipLOEWmH+Njw=="], "tempy": ["tempy@3.2.0", "", { "dependencies": { "is-stream": "^3.0.0", "temp-dir": "^3.0.0", "type-fest": "^2.12.2", "unique-string": "^3.0.0" } }, "sha512-d79HhZya5Djd7am0q+W4RTsSU+D/aJzM+4Y4AGJGuGlgM2L6sx5ZvOYTmZjqPhrDrV6xJTtRSm1JCLj6V6LHLQ=="], @@ -477,15 +483,19 @@ "traverse": ["traverse@0.6.8", "", {}, "sha512-aXJDbk6SnumuaZSANd21XAo15ucCDE38H4fkqiGsc3MhCK+wOlZvLP9cB/TvpHT0mOyWgC4Z8EwRlzqYSUzdsA=="], + "tunnel": ["tunnel@0.0.6", "", {}, "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg=="], + "type-fest": ["type-fest@4.41.0", "", {}, "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA=="], "uglify-js": ["uglify-js@3.19.3", "", { "bin": { "uglifyjs": "bin/uglifyjs" } }, "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ=="], + "undici": ["undici@7.30.2", "", {}, "sha512-mLyPQnHwUxaM/rideoK/+KL8DaAJLRl4aBCfmX444aCSLnIaomqPLtNRe2jdCYcsk5wZzXrDIQC8ZeYNRAYyIA=="], + "undici-types": ["undici-types@8.9.0", "", {}, "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg=="], "unicode-emoji-modifier-base": ["unicode-emoji-modifier-base@1.0.0", "", {}, "sha512-yLSH4py7oFH3oG/9K+XWrz1pSi3dfUrWEnInbxMfArOfc1+33BlGPQtLsOYwvdMy11AwUBetYuaRxSPqgkq+8g=="], - "unicorn-magic": ["unicorn-magic@0.1.0", "", {}, "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ=="], + "unicorn-magic": ["unicorn-magic@0.3.0", "", {}, "sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA=="], "unique-string": ["unique-string@3.0.0", "", { "dependencies": { "crypto-random-string": "^4.0.0" } }, "sha512-VGXBUVwxKMBUznyffQweQABPRRW1vHZAbadFZud4pLFAqRGvv/96vafgjWFqzourzr8YonlQiPgH0YCJfawoGQ=="], @@ -493,30 +503,36 @@ "universalify": ["universalify@2.0.1", "", {}, "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw=="], - "url-join": ["url-join@5.0.0", "", {}, "sha512-n2huDr9h9yzd6exQVnH/jU5mr+Pfx08LRXXZhkLLetAMESRj+anQsTAh940iMrIetKAmry9coFuZQ2jY8/p3WA=="], + "url-join": ["url-join@5.2.0", "", {}, "sha512-/tMVQdp/2eE90fGb6npbd2nLHH8jamzLLeZhLEKTz4Rc38wO5AeEuIhoWroWWfQJS50ZzL4Xod9JER/pJWTTEQ=="], "util-deprecate": ["util-deprecate@1.0.2", "", {}, "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="], "validate-npm-package-license": ["validate-npm-package-license@3.0.4", "", { "dependencies": { "spdx-correct": "^3.0.0", "spdx-expression-parse": "^3.0.0" } }, "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew=="], + "verkit": ["verkit@0.5.0", "", {}, "sha512-u4J1hr6Y+C/hit34GwL3eIcUf3wngT8TlYUjK7tk0jxydKLAq3sYvifjdTDA6U3KCKRcQCQDGf/srjxfZF3l7g=="], + "web-worker": ["web-worker@1.5.0", "", {}, "sha512-RiMReJrTAiA+mBjGONMnjVDP2u3p9R1vkcGz6gDIrOMT3oGuYwX2WRMYI9ipkphSuE5XKEhydbhNEJh4NY9mlw=="], "which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="], + "which-command": ["which-command@0.1.0", "", { "bin": { "which-command": "cli.js" } }, "sha512-XZyoF5/5hZtXitIwzrU4NKK+Wtbb9aB9CezUEw2Q0wlYK8NUYQxC1rRXgNueYLtBAJwXIb+/tFVk4dozciNJMA=="], + "wordwrap": ["wordwrap@1.0.0", "", {}, "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q=="], - "wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], + "wrap-ansi": ["wrap-ansi@9.0.2", "", { "dependencies": { "ansi-styles": "^6.2.1", "string-width": "^7.0.0", "strip-ansi": "^7.1.0" } }, "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww=="], "xtend": ["xtend@4.0.2", "", {}, "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="], "y18n": ["y18n@5.0.8", "", {}, "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA=="], - "yargs": ["yargs@17.7.3", "", { "dependencies": { "cliui": "^8.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", "yargs-parser": "^21.1.1" } }, "sha512-GZtjxm/J/4TSxuL3FNYjCmLktBTnIw/rVmKSIyKeYAZpmJB2ig9VauCC5xsa82GNKVKDAqpOn3KVzNt0zmrU0g=="], + "yargs": ["yargs@18.2.0", "", { "dependencies": { "cliui": "^9.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "string-width": "^8.2.1", "y18n": "^5.0.5", "yargs-parser": "^22.0.0" } }, "sha512-9OpKOLeaoNFecEp7P6iYbzze/5CqWoH7N3SMs/6y1XF4nMvFMspEGZzJ6uFi9MmQwXhyzqYoSEKO3tvA3Z/o2w=="], - "yargs-parser": ["yargs-parser@21.1.1", "", {}, "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw=="], + "yargs-parser": ["yargs-parser@22.0.0", "", {}, "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw=="], "yoctocolors": ["yoctocolors@2.2.0", "", {}, "sha512-xYqdZFUK/VYazNl/oCDYN+3WloWQwMfZxBoiNt6qNyk+xfOdi598muWE42rNZFp1kNOiqW936q5RhUdnpqElSg=="], + "@actions/http-client/undici": ["undici@6.29.1", "", {}, "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA=="], + "@octokit/plugin-paginate-rest/@octokit/types": ["@octokit/types@16.0.0", "", { "dependencies": { "@octokit/openapi-types": "^27.0.0" } }, "sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg=="], "@octokit/plugin-rest-endpoint-methods/@octokit/types": ["@octokit/types@16.0.0", "", { "dependencies": { "@octokit/openapi-types": "^27.0.0" } }, "sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg=="], @@ -525,197 +541,167 @@ "@octokit/plugin-throttling/@octokit/types": ["@octokit/types@17.0.0", "", { "dependencies": { "@octokit/openapi-types": "^28.0.0" } }, "sha512-ByP1v7YL5SMveFPP7+sj0/ZuWCOOg/Chs4NafOMpq6WNIM/hdGY0S7C0TCGDBWu1aGmOxmUIhMx3cO+IdwYZ1Q=="], - "@pnpm/network.ca-file/graceful-fs": ["graceful-fs@4.2.10", "", {}, "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA=="], + "@semantic-release/core/@semantic-release/commit-analyzer": ["@semantic-release/commit-analyzer@14.0.0-beta.5", "", { "dependencies": { "conventional-changelog-angular": "^9.0.0", "conventional-changelog-conventionalcommits": "^10.0.0", "conventional-commits-filter": "^6.0.0", "conventional-commits-parser": "^7.0.0", "debug": "^4.0.0", "import-from-esm": "^2.0.0", "lodash-es": "^4.17.21", "micromatch": "^4.0.2" }, "peerDependencies": { "semantic-release": ">=20.1.0" } }, "sha512-fnmPi9LP8e1Ai0OhaF4ZdfNLlq2xJfxxKKvap/7GjRaPBGNmeTEC+1S3Q722DN+vO4yjSWUyaxmNJzRiiS21gw=="], + + "@semantic-release/core/execa": ["execa@10.2.1", "", { "dependencies": { "@sindresorhus/merge-streams": "^4.0.0", "figures": "^6.1.0", "get-stream": "^9.0.1", "human-signals": "^8.0.1", "is-plain-obj": "^4.1.0", "is-stream": "^4.0.1", "npm-run-path": "^6.0.0", "pretty-ms": "^9.3.1", "signal-exit": "^4.1.0", "strip-final-newline": "^4.0.0", "which-command": "^0.1.0", "yoctocolors": "^2.2.0" } }, "sha512-/Bofl3ZBh2Q4/PG0W63qFzP5vDAypi8Zc90UWTBzaDNIYiX7apPOd0N6L8hG8CojUdq4V51adu8BObP+iVsSTw=="], - "@semantic-release/github/@octokit/plugin-paginate-rest": ["@octokit/plugin-paginate-rest@13.2.1", "", { "dependencies": { "@octokit/types": "^15.0.1" }, "peerDependencies": { "@octokit/core": ">=6" } }, "sha512-Tj4PkZyIL6eBMYcG/76QGsedF0+dWVeLhYprTmuFVVxzDW7PQh23tM0TP0z+1MvSkxB29YFZwnUX+cXfTiSdyw=="], + "@semantic-release/core/get-stream": ["get-stream@6.0.1", "", {}, "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg=="], - "@semantic-release/github/@semantic-release/error": ["@semantic-release/error@4.0.0", "", {}, "sha512-mgdxrHTLOjOddRVYIYDo0fR3/v61GNN1YGkfbrjuIKg/uMgCd+Qzo3UAXJ+woLQQpos4pl5Esuw5A7AoNlzjUQ=="], + "@semantic-release/core/read-package-up": ["read-package-up@12.0.0", "", { "dependencies": { "find-up-simple": "^1.0.1", "read-pkg": "^10.0.0", "type-fest": "^5.2.0" } }, "sha512-Q5hMVBYur/eQNWDdbF4/Wqqr9Bjvtrw2kjGxxBbKLbx8bVCL8gcArjTy8zDUuLGQicftpMuU0riQNcAsbtOVsw=="], - "@semantic-release/github/aggregate-error": ["aggregate-error@5.0.0", "", { "dependencies": { "clean-stack": "^5.2.0", "indent-string": "^5.0.0" } }, "sha512-gOsf2YwSlleG6IjRYG2A7k0HmBMEo6qVNk9Bp/EaLgAJT5ngH6PXbqa4ItvnEwCm/velL5jAnQgsHsWnjhGmvw=="], + "@semantic-release/exec/aggregate-error": ["aggregate-error@3.1.0", "", { "dependencies": { "clean-stack": "^2.0.0", "indent-string": "^4.0.0" } }, "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA=="], - "@semantic-release/npm/@semantic-release/error": ["@semantic-release/error@4.0.0", "", {}, "sha512-mgdxrHTLOjOddRVYIYDo0fR3/v61GNN1YGkfbrjuIKg/uMgCd+Qzo3UAXJ+woLQQpos4pl5Esuw5A7AoNlzjUQ=="], + "@semantic-release/git/execa": ["execa@10.2.1", "", { "dependencies": { "@sindresorhus/merge-streams": "^4.0.0", "figures": "^6.1.0", "get-stream": "^9.0.1", "human-signals": "^8.0.1", "is-plain-obj": "^4.1.0", "is-stream": "^4.0.1", "npm-run-path": "^6.0.0", "pretty-ms": "^9.3.1", "signal-exit": "^4.1.0", "strip-final-newline": "^4.0.0", "which-command": "^0.1.0", "yoctocolors": "^2.2.0" } }, "sha512-/Bofl3ZBh2Q4/PG0W63qFzP5vDAypi8Zc90UWTBzaDNIYiX7apPOd0N6L8hG8CojUdq4V51adu8BObP+iVsSTw=="], - "@semantic-release/npm/aggregate-error": ["aggregate-error@5.0.0", "", { "dependencies": { "clean-stack": "^5.2.0", "indent-string": "^5.0.0" } }, "sha512-gOsf2YwSlleG6IjRYG2A7k0HmBMEo6qVNk9Bp/EaLgAJT5ngH6PXbqa4ItvnEwCm/velL5jAnQgsHsWnjhGmvw=="], + "@semantic-release/github/@octokit/plugin-paginate-rest": ["@octokit/plugin-paginate-rest@15.0.0", "", { "dependencies": { "@octokit/types": "^17.0.0" }, "peerDependencies": { "@octokit/core": ">=6" } }, "sha512-lw9A9YL5s4VPj+VEx8uMxaxQm2YTgrPDkrLEuZuu18R8TK3oPcXF4K6t52nx6xn1RcogZC9i188sAr/4XYJaQQ=="], - "@semantic-release/npm/execa": ["execa@9.6.1", "", { "dependencies": { "@sindresorhus/merge-streams": "^4.0.0", "cross-spawn": "^7.0.6", "figures": "^6.1.0", "get-stream": "^9.0.0", "human-signals": "^8.0.1", "is-plain-obj": "^4.1.0", "is-stream": "^4.0.1", "npm-run-path": "^6.0.0", "pretty-ms": "^9.2.0", "signal-exit": "^4.1.0", "strip-final-newline": "^4.0.0", "yoctocolors": "^2.1.1" } }, "sha512-9Be3ZoN4LmYR90tUoVu2te2BsbzHfhJyfEiAVfz7N5/zv+jduIfLrV2xdQXOHbaD6KgpGdO9PRPM1Y4Q9QkPkA=="], + "@semantic-release/npm/read-pkg": ["read-pkg@10.1.0", "", { "dependencies": { "@types/normalize-package-data": "^2.4.4", "normalize-package-data": "^8.0.0", "parse-json": "^8.3.0", "type-fest": "^5.4.4", "unicorn-magic": "^0.4.0" } }, "sha512-I8g2lArQiP78ll51UeMZojewtYgIRCKCWqZEgOO8c/uefTI+XDXvCSXu3+YNUaTNvZzobrL5+SqHjBrByRRTdg=="], "cli-highlight/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], "cli-highlight/yargs": ["yargs@16.2.2", "", { "dependencies": { "cliui": "^7.0.2", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.0", "y18n": "^5.0.5", "yargs-parser": "^20.2.2" } }, "sha512-Nt9ZJjXTv5R8MHbqby/wXQ6Gi0Bb3TcYZkR1bzuL4yB2OxWPkXknz513gEF0GoA6tn00UpbPvERW8rzCuWCA6w=="], + "cli-table3/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], + + "cliui/string-width": ["string-width@7.2.0", "", { "dependencies": { "emoji-regex": "^10.3.0", "get-east-asian-width": "^1.0.0", "strip-ansi": "^7.1.0" } }, "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ=="], + "crypto-random-string/type-fest": ["type-fest@1.4.0", "", {}, "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA=="], "env-ci/execa": ["execa@8.0.1", "", { "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^8.0.1", "human-signals": "^5.0.0", "is-stream": "^3.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^5.1.0", "onetime": "^6.0.0", "signal-exit": "^4.1.0", "strip-final-newline": "^3.0.0" } }, "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg=="], "fdir/picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="], - "import-fresh/resolve-from": ["resolve-from@4.0.0", "", {}, "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g=="], - "load-json-file/parse-json": ["parse-json@4.0.0", "", { "dependencies": { "error-ex": "^1.3.1", "json-parse-better-errors": "^1.0.1" } }, "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw=="], "normalize-package-data/hosted-git-info": ["hosted-git-info@7.0.2", "", { "dependencies": { "lru-cache": "^10.0.1" } }, "sha512-puUZAUKT5m8Zzvs72XWy3HtvVbTWljRE66cP60bxJzAqf2DgICo7lYTY2IHUmLnNpjYvw5bvmoHvPc0QO2a62w=="], "npm/@gar/promise-retry": ["@gar/promise-retry@1.0.3", "", {}, "sha512-GmzA9ckNokPypTg10pgpeHNQe7ph+iIKKmhKu3Ob9ANkswreCx7R3cKmY781K8QK3AqVL3xVh9A42JvIAbkkSA=="], - "npm/@isaacs/cliui": ["@isaacs/cliui@8.0.2", "", { "dependencies": { "string-width": "^5.1.2", "string-width-cjs": "npm:string-width@^4.2.0", "strip-ansi": "^7.0.1", "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", "wrap-ansi": "^8.1.0", "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" } }, "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA=="], - "npm/@isaacs/fs-minipass": ["@isaacs/fs-minipass@4.0.1", "", { "dependencies": { "minipass": "^7.0.4" } }, "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w=="], - "npm/@isaacs/string-locale-compare": ["@isaacs/string-locale-compare@1.1.0", "", { "bundled": true }, "sha512-SQ7Kzhh9+D+ZW9MA0zkYv3VXhIDNx+LzM6EJ+/65I3QY+enU6Itte7E5XX7EWrqLW2FN4n06GWzBnPoC3th2aQ=="], + "npm/@isaacs/nonrecursive-glob-match": ["@isaacs/nonrecursive-glob-match@1.1.0", "", {}, "sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw=="], - "npm/@npmcli/agent": ["@npmcli/agent@3.0.0", "", { "dependencies": { "agent-base": "^7.1.0", "http-proxy-agent": "^7.0.0", "https-proxy-agent": "^7.0.1", "lru-cache": "^10.0.1", "socks-proxy-agent": "^8.0.3" } }, "sha512-S79NdEgDQd/NGCay6TCoVzXSj74skRZIKJcpJjC5lOq34SZzyI6MqtiiWoiVWoVrTcGjNeC4ipbh1VIHlpfF5Q=="], + "npm/@isaacs/string-locale-compare": ["@isaacs/string-locale-compare@1.1.0", "", { "bundled": true }, "sha512-SQ7Kzhh9+D+ZW9MA0zkYv3VXhIDNx+LzM6EJ+/65I3QY+enU6Itte7E5XX7EWrqLW2FN4n06GWzBnPoC3th2aQ=="], - "npm/@npmcli/arborist": ["@npmcli/arborist@8.0.5", "", { "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", "@npmcli/fs": "^4.0.0", "@npmcli/installed-package-contents": "^3.0.0", "@npmcli/map-workspaces": "^4.0.1", "@npmcli/metavuln-calculator": "^8.0.0", "@npmcli/name-from-folder": "^3.0.0", "@npmcli/node-gyp": "^4.0.0", "@npmcli/package-json": "^6.0.1", "@npmcli/query": "^4.0.0", "@npmcli/redact": "^3.0.0", "@npmcli/run-script": "^9.0.1", "bin-links": "^5.0.0", "cacache": "^19.0.1", "common-ancestor-path": "^1.0.1", "hosted-git-info": "^8.0.0", "json-parse-even-better-errors": "^4.0.0", "json-stringify-nice": "^1.1.4", "lru-cache": "^10.2.2", "minimatch": "^9.0.4", "nopt": "^8.0.0", "npm-install-checks": "^7.1.0", "npm-package-arg": "^12.0.0", "npm-pick-manifest": "^10.0.0", "npm-registry-fetch": "^18.0.1", "pacote": "^19.0.0", "parse-conflict-json": "^4.0.0", "proc-log": "^5.0.0", "proggy": "^3.0.0", "promise-all-reject-late": "^1.0.0", "promise-call-limit": "^3.0.1", "promise-retry": "^2.0.1", "read-package-json-fast": "^4.0.0", "semver": "^7.3.7", "ssri": "^12.0.0", "treeverse": "^3.0.0", "walk-up-path": "^3.0.1" }, "bundled": true, "bin": { "arborist": "bin/index.js" } }, "sha512-dFby80JSC3e8825FRGRuhOMWFeKFHokz8j8osLOujmjOSKm6smGu/b1/gbgW0lP8d84iMZO+RxpqBbC5KgL6DQ=="], + "npm/@npmcli/agent": ["@npmcli/agent@5.0.2", "", { "dependencies": { "agent-base": "^9.0.0", "http-proxy-agent": "^9.0.0", "https-proxy-agent": "^9.0.0", "lru-cache": "^11.2.1", "socks-proxy-agent": "^10.0.0" } }, "sha512-EkzGmEsgbQ1rqWkRJe2P0oQHx/ylZozDUNPMXCklLuSFL3GY+QyEfBUjhjCsgGXzh4OGpnHvkboSQgczjP/jJg=="], - "npm/@npmcli/config": ["@npmcli/config@9.0.0", "", { "dependencies": { "@npmcli/map-workspaces": "^4.0.1", "@npmcli/package-json": "^6.0.1", "ci-info": "^4.0.0", "ini": "^5.0.0", "nopt": "^8.0.0", "proc-log": "^5.0.0", "semver": "^7.3.5", "walk-up-path": "^3.0.1" }, "bundled": true }, "sha512-P5Vi16Y+c8E0prGIzX112ug7XxqfaPFUVW/oXAV+2VsxplKZEnJozqZ0xnK8V8w/SEsBf+TXhUihrEIAU4CA5Q=="], + "npm/@npmcli/arborist": ["@npmcli/arborist@10.0.5", "", { "dependencies": { "@gar/promise-retry": "^1.0.0", "@isaacs/string-locale-compare": "^1.1.0", "@npmcli/fs": "^6.0.0", "@npmcli/installed-package-contents": "^5.0.0", "@npmcli/map-workspaces": "^6.0.0", "@npmcli/metavuln-calculator": "^10.0.0", "@npmcli/name-from-folder": "^5.0.0", "@npmcli/node-gyp": "^6.0.0", "@npmcli/package-json": "^8.0.0", "@npmcli/query": "^5.0.0", "@npmcli/redact": "^5.0.0", "@npmcli/run-script": "^11.0.0", "bin-links": "^7.0.0", "cacache": "^21.0.1", "common-ancestor-path": "^2.0.0", "diff": "^8.0.2", "hosted-git-info": "^10.1.1", "json-stringify-nice": "^1.1.4", "lru-cache": "^11.2.1", "minimatch": "^10.0.3", "nopt": "^10.0.1", "npm-install-checks": "^9.0.0", "npm-package-arg": "^14.0.0", "npm-pick-manifest": "^12.0.0", "npm-registry-fetch": "^20.0.1", "pacote": "^22.0.0", "parse-conflict-json": "^6.0.0", "proc-log": "^7.0.0", "proggy": "^4.0.0", "promise-all-reject-late": "^1.0.0", "promise-call-limit": "^3.0.1", "semver": "^7.3.7", "ssri": "^14.0.0", "treeverse": "^3.0.0", "validate-npm-package-name": "^8.0.0", "walk-up-path": "^4.0.0" }, "bundled": true, "bin": { "arborist": "bin/index.js" } }, "sha512-igPGIIQHSg/+iDD5D3zDWpaw47M3XGjAPnn/7S2QKjF4BIrnFuX3g9ahG6mz78oDEgtil6pI5jNMlDUS5AfR+g=="], - "npm/@npmcli/fs": ["@npmcli/fs@4.0.0", "", { "dependencies": { "semver": "^7.3.5" }, "bundled": true }, "sha512-/xGlezI6xfGO9NwuJlnwz/K14qD1kCSAGtacBHnGzeAIuJGazcp45KP5NuyARXoKb7cwulAGWVsbeSxdG/cb0Q=="], + "npm/@npmcli/config": ["@npmcli/config@11.2.1", "", { "dependencies": { "@npmcli/map-workspaces": "^6.0.0", "@npmcli/package-json": "^8.0.0", "ci-info": "^4.0.0", "ini": "^7.0.0", "nopt": "^10.0.1", "proc-log": "^7.0.0", "semver": "^7.3.5", "walk-up-path": "^4.0.0" }, "bundled": true }, "sha512-7xw0JmyhI59EpAZEobBUUo5SeofFilDKTq5lu/+TwE1/7PFpQwhf/gwnInyfH+nXAU5Nh5cEdNQvNpDg1DokiA=="], - "npm/@npmcli/git": ["@npmcli/git@6.0.3", "", { "dependencies": { "@npmcli/promise-spawn": "^8.0.0", "ini": "^5.0.0", "lru-cache": "^10.0.1", "npm-pick-manifest": "^10.0.0", "proc-log": "^5.0.0", "promise-retry": "^2.0.1", "semver": "^7.3.5", "which": "^5.0.0" } }, "sha512-GUYESQlxZRAdhs3UhbB6pVRNUELQOHXwK9ruDkwmCv2aZ5y0SApQzUJCg02p3A7Ue2J5hxvlk1YI53c00NmRyQ=="], + "npm/@npmcli/fs": ["@npmcli/fs@6.0.0", "", { "dependencies": { "semver": "^7.3.5" }, "bundled": true }, "sha512-AheOs4swKka/XLtht6xxJDPezlQ7K2IYQ9Y8lST4JLDjnralnWuMM9AE2CdVcgQJ5omrXhsRzM7F7aYmeZBvKQ=="], - "npm/@npmcli/installed-package-contents": ["@npmcli/installed-package-contents@3.0.0", "", { "dependencies": { "npm-bundled": "^4.0.0", "npm-normalize-package-bin": "^4.0.0" }, "bin": { "installed-package-contents": "bin/index.js" } }, "sha512-fkxoPuFGvxyrH+OQzyTkX2LUEamrF4jZSmxjAtPPHHGO0dqsQ8tTKjnIS8SAnPHdk2I03BDtSMR5K/4loKg79Q=="], + "npm/@npmcli/git": ["@npmcli/git@8.0.0", "", { "dependencies": { "@gar/promise-retry": "^1.0.0", "@npmcli/promise-spawn": "^10.0.0", "ini": "^7.0.0", "lru-cache": "^11.2.1", "npm-pick-manifest": "^12.0.0", "proc-log": "^7.0.0", "semver": "^7.3.5", "which": "^7.0.0" }, "bundled": true }, "sha512-5P1oo+TbxZNAiiMBtpzHA8QyEGh5D69LYLexNWJEDXLdxnAZvT/SLitGJBXxjtCE4ftAcFOS/Tu2185MeIjooQ=="], - "npm/@npmcli/map-workspaces": ["@npmcli/map-workspaces@4.0.2", "", { "dependencies": { "@npmcli/name-from-folder": "^3.0.0", "@npmcli/package-json": "^6.0.0", "glob": "^10.2.2", "minimatch": "^9.0.0" }, "bundled": true }, "sha512-mnuMuibEbkaBTYj9HQ3dMe6L0ylYW+s/gfz7tBDMFY/la0w9Kf44P9aLn4/+/t3aTR3YUHKoT6XQL9rlicIe3Q=="], + "npm/@npmcli/installed-package-contents": ["@npmcli/installed-package-contents@5.0.0", "", { "dependencies": { "npm-bundled": "^6.0.0", "npm-normalize-package-bin": "^6.0.0" }, "bin": { "installed-package-contents": "bin/index.js" } }, "sha512-6Ay12sf2Lh7U1ifvnS1mq7TZFeh/rXHMXye+kV7jQrANIubaoVcleeh4HdFumxhsRYwm9OaHycB5lYmSwGrcIQ=="], - "npm/@npmcli/metavuln-calculator": ["@npmcli/metavuln-calculator@8.0.1", "", { "dependencies": { "cacache": "^19.0.0", "json-parse-even-better-errors": "^4.0.0", "pacote": "^20.0.0", "proc-log": "^5.0.0", "semver": "^7.3.5" } }, "sha512-WXlJx9cz3CfHSt9W9Opi1PTFc4WZLFomm5O8wekxQZmkyljrBRwATwDxfC9iOXJwYVmfiW1C1dUe0W2aN0UrSg=="], + "npm/@npmcli/map-workspaces": ["@npmcli/map-workspaces@6.0.1", "", { "dependencies": { "@npmcli/name-from-folder": "^5.0.0", "@npmcli/package-json": "^8.0.1", "glob": "^14.0.5", "minimatch": "^11.0.2" }, "bundled": true }, "sha512-7jUv56bxKcWpHBr5uGr1U9jMCCyPrWe0XDZoMkZtsS6+efTlVRqXDqiShoGtfI8RBBnotXaYL2e/iPepW/DA7Q=="], - "npm/@npmcli/name-from-folder": ["@npmcli/name-from-folder@3.0.0", "", {}, "sha512-61cDL8LUc9y80fXn+lir+iVt8IS0xHqEKwPu/5jCjxQTVoSCmkXvw4vbMrzAMtmghz3/AkiBjhHkDKUH+kf7kA=="], + "npm/@npmcli/metavuln-calculator": ["@npmcli/metavuln-calculator@10.0.0", "", { "dependencies": { "cacache": "^21.0.1", "json-parse-even-better-errors": "^6.0.0", "pacote": "^22.0.0", "proc-log": "^7.0.0", "semver": "^7.3.5" }, "bundled": true }, "sha512-fC56lpGOae+unrFx6hoiWeWa0/4q+bLhOQTSrB65qcy+Zm34i1OdBcevAQFJJdUB/3i9uXw7PjdrrRjt0KSKXw=="], - "npm/@npmcli/node-gyp": ["@npmcli/node-gyp@4.0.0", "", {}, "sha512-+t5DZ6mO/QFh78PByMq1fGSAub/agLJZDRfJRMeOSNCt8s9YVlTjmGpIPwPhvXTGUIJk+WszlT0rQa1W33yzNA=="], + "npm/@npmcli/name-from-folder": ["@npmcli/name-from-folder@5.0.0", "", {}, "sha512-Mua2i5asmOn4sGGAsANS9Guamo7sgUd4BihhQWzlNGz6l/Ki23CzC2oGe4I94r2k/39ImCjDLbyu/rSJr/SXoA=="], - "npm/@npmcli/package-json": ["@npmcli/package-json@6.2.0", "", { "dependencies": { "@npmcli/git": "^6.0.0", "glob": "^10.2.2", "hosted-git-info": "^8.0.0", "json-parse-even-better-errors": "^4.0.0", "proc-log": "^5.0.0", "semver": "^7.5.3", "validate-npm-package-license": "^3.0.4" }, "bundled": true }, "sha512-rCNLSB/JzNvot0SEyXqWZ7tX2B5dD2a1br2Dp0vSYVo5jh8Z0EZ7lS9TsZ1UtziddB1UfNUaMCc538/HztnJGA=="], + "npm/@npmcli/node-gyp": ["@npmcli/node-gyp@6.0.0", "", {}, "sha512-MFakpea4pcZNlHSTbMi15HK8RY8zl2UpgDtxhZCWOer+KRN3x7HFIMk/fKpOMgR55L4LIcA2qn8IHeyABhIFtw=="], - "npm/@npmcli/promise-spawn": ["@npmcli/promise-spawn@8.0.3", "", { "dependencies": { "which": "^5.0.0" }, "bundled": true }, "sha512-Yb00SWaL4F8w+K8YGhQ55+xE4RUNdMHV43WZGsiTM92gS+lC0mGsn7I4hLug7pbao035S6bj3Y3w0cUNGLfmkg=="], + "npm/@npmcli/package-json": ["@npmcli/package-json@8.0.1", "", { "dependencies": { "@npmcli/git": "^8.0.0", "glob": "^14.0.3", "hosted-git-info": "^10.1.1", "json-parse-even-better-errors": "^6.0.0", "proc-log": "^7.0.0", "semver": "^7.5.3", "spdx-expression-parse": "^4.0.0" }, "bundled": true }, "sha512-pm/9c8qwjdV+FnApJDa7ZF6BLtXg+fJ3MrB2eUePCKg2gOqpzLQt4XyDuBL+fZ01zgdJJ8q2il+9+h5YW8svFg=="], - "npm/@npmcli/query": ["@npmcli/query@4.0.1", "", { "dependencies": { "postcss-selector-parser": "^7.0.0" } }, "sha512-4OIPFb4weUUwkDXJf4Hh1inAn8neBGq3xsH4ZsAaN6FK3ldrFkH7jSpCc7N9xesi0Sp+EBXJ9eGMDrEww2Ztqw=="], + "npm/@npmcli/promise-spawn": ["@npmcli/promise-spawn@10.0.1", "", { "dependencies": { "which": "^7.0.0" }, "bundled": true }, "sha512-IstFcKAoEIZ7olS9iTwBsyNOZkIturafO2da9ocSP3LifRlm1+sxuo8IVM5phg5sNe0tNYLT0ZqCBRTLNzz0AA=="], - "npm/@npmcli/redact": ["@npmcli/redact@3.2.2", "", { "bundled": true }, "sha512-7VmYAmk4csGv08QzrDKScdzn11jHPFGyqJW39FyPgPuAp3zIaUmuCo1yxw9aGs+NEJuTGQ9Gwqpt93vtJubucg=="], + "npm/@npmcli/query": ["@npmcli/query@5.0.0", "", { "dependencies": { "postcss-selector-parser": "^7.0.0" } }, "sha512-8TZWfTQOsODpLqo9SVhVjHovmKXNpevHU0gO9e+y4V4fRIOneiXy0u0sMP9LmS71XivrEWfZWg50ReH4WRT4aQ=="], - "npm/@npmcli/run-script": ["@npmcli/run-script@9.1.0", "", { "dependencies": { "@npmcli/node-gyp": "^4.0.0", "@npmcli/package-json": "^6.0.0", "@npmcli/promise-spawn": "^8.0.0", "node-gyp": "^11.0.0", "proc-log": "^5.0.0", "which": "^5.0.0" }, "bundled": true }, "sha512-aoNSbxtkePXUlbZB+anS1LqsJdctG5n3UVhfU47+CDdwMi6uNTBMF9gPcQRnqghQd2FGzcwwIFBruFMxjhBewg=="], + "npm/@npmcli/redact": ["@npmcli/redact@5.0.0", "", { "bundled": true }, "sha512-3zcN5Q3yEmeyxXBzqB6fXPQFzYa2ROsGFSr69W0ArXIAGJqxl/aFECOVPD2kbkYPm0U/EHxFKgclK3UA9WQg5A=="], - "npm/@pkgjs/parseargs": ["@pkgjs/parseargs@0.11.0", "", {}, "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg=="], + "npm/@npmcli/run-script": ["@npmcli/run-script@11.0.1", "", { "dependencies": { "@npmcli/node-gyp": "^6.0.0", "@npmcli/package-json": "^8.0.1", "@npmcli/promise-spawn": "^10.0.0", "node-gyp": "^13.0.0", "proc-log": "^7.0.0" }, "bundled": true }, "sha512-8A6ICbU8FBUd5a1jPlCozJj5HDF3MaYUbIIM0K57QcKaZcK/9vTuYf+ME+ThzaMO5XAxhvrAQRO4zL+/fEt98A=="], "npm/@sigstore/bundle": ["@sigstore/bundle@4.0.0", "", { "dependencies": { "@sigstore/protobuf-specs": "^0.5.0" } }, "sha512-NwCl5Y0V6Di0NexvkTqdoVfmjTaQwoLM236r89KEojGmq/jMls8S+zb7yOwAPdXvbwfKDlP+lmXgAL4vKSQT+A=="], "npm/@sigstore/core": ["@sigstore/core@3.2.1", "", {}, "sha512-qRsxPnCrbC/puegGxKuynfnxgLiHqWStrSjxkoB4YKqq3Z3s4cyZyj42ZdWFAEblNP65C+rBH8EuREHIXoi83g=="], - "npm/@sigstore/protobuf-specs": ["@sigstore/protobuf-specs@0.4.3", "", {}, "sha512-fk2zjD9117RL9BjqEwF7fwv7Q/P9yGsMV4MUJZ/DocaQJ6+3pKr+syBq1owU5Q5qGw5CUbXzm+4yJ2JVRDQeSA=="], + "npm/@sigstore/protobuf-specs": ["@sigstore/protobuf-specs@0.5.2", "", {}, "sha512-SQqvFMt4V78fdjcDdYX6HbiVSOR4QK3ZgwCa2KOsopAgPIHy1rU5UDUmzLl02r5oyyaYcYHR1hpwDRk/yUe+Mw=="], "npm/@sigstore/sign": ["@sigstore/sign@4.1.1", "", { "dependencies": { "@gar/promise-retry": "^1.0.2", "@sigstore/bundle": "^4.0.0", "@sigstore/core": "^3.2.0", "@sigstore/protobuf-specs": "^0.5.0", "make-fetch-happen": "^15.0.4", "proc-log": "^6.1.0" } }, "sha512-Hf4xglukg0XXQ2RiD5vSoLjdPe8OBUPA8XeVjUObheuDcWdYWrnH/BNmxZCzkAy68MzmNCxXLeurJvs6hcP2OQ=="], - "npm/@sigstore/tuf": ["@sigstore/tuf@3.1.1", "", { "dependencies": { "@sigstore/protobuf-specs": "^0.4.1", "tuf-js": "^3.0.1" }, "bundled": true }, "sha512-eFFvlcBIoGwVkkwmTi/vEQFSva3xs5Ot3WmBcjgjVdiaoelBLQaQ/ZBfhlG0MnG0cmTYScPpk7eDdGDWUcFUmg=="], + "npm/@sigstore/tuf": ["@sigstore/tuf@5.0.1", "", { "dependencies": { "@sigstore/protobuf-specs": "^0.5.2", "tuf-js": "^6.0.2" }, "bundled": true }, "sha512-ofwYu9iXeMm85zPh0cauUXzXtIFNfHI1o9Ux1e0Eil6shsbx+8bAe58fhiU1FcHdOIxOkyDhZzD6Gu6uPnzoUg=="], "npm/@sigstore/verify": ["@sigstore/verify@3.1.1", "", { "dependencies": { "@sigstore/bundle": "^4.0.0", "@sigstore/core": "^3.2.1", "@sigstore/protobuf-specs": "^0.5.0" } }, "sha512-qv7+G3J2cc6wwFj3yKvXOamzqhMwSk1ogPGmhpS8iXllcPrJaIIBA+4HbttlHVu1pqWTdmaCH/WE7UOC51kdoA=="], "npm/@tufjs/canonical-json": ["@tufjs/canonical-json@2.0.0", "", {}, "sha512-yVtV8zsdo8qFHe+/3kw81dSLyF7D576A5cCFCi4X7B39tWT7SekaEFUnvnWJHz+9qO7qJTah1JbrDjWKqFtdWA=="], - "npm/@tufjs/models": ["@tufjs/models@3.0.1", "", { "dependencies": { "@tufjs/canonical-json": "2.0.0", "minimatch": "^9.0.5" } }, "sha512-UUYHISyhCU3ZgN8yaear3cGATHb3SMuKHsQ/nVbHXcmnBf+LzQ/cQfhNG+rfaSHgqGKNEm2cOCLVLELStUQ1JA=="], - - "npm/abbrev": ["abbrev@3.0.1", "", { "bundled": true }, "sha512-AO2ac6pjRB3SJmGJo+v5/aK6Omggp6fsLrs6wN9bd35ulu4cCwaAU9+7ZhXjeqHVkaHThLuzH0nZr0YpCDhygg=="], + "npm/@tufjs/models": ["@tufjs/models@5.0.3", "", { "dependencies": { "@tufjs/canonical-json": "2.0.0", "minimatch": "^11.0.9" } }, "sha512-rNNqM2QoZoGLhUxMp0RK4fIFRhQz9viRHph6N3qA4+Hpa8linMhZv0VdQ+tDaNRzbWPiE2YAikU0orDk2X4DvA=="], - "npm/agent-base": ["agent-base@7.1.4", "", {}, "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ=="], + "npm/abbrev": ["abbrev@5.0.0", "", { "bundled": true }, "sha512-/XrFJgzQQQHpti1raDJC6m4ws6aNktmjBlhk8Fdlk7LwCEuDoieEJJY9OFHjfiFJFFRM2tK+Ky/IsfbbmlMu1w=="], - "npm/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], - - "npm/ansi-styles": ["ansi-styles@6.2.3", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="], + "npm/agent-base": ["agent-base@9.0.0", "", {}, "sha512-TQf59BsZnytt8GdJKLPfUZ54g/iaUL2OWDSFCCvMOhsHduDQxO8xC4PNeyIkVcA5KwL2phPSv0douC0fgWzmnA=="], "npm/aproba": ["aproba@2.1.0", "", {}, "sha512-tLIEcj5GuR2RSTnxNKdkK0dJ/GrC7P38sUkiDmDuHfsHmbagTFAxDVIBltoklXEVIQ/f14IL8IMJ5pn9Hez1Ew=="], "npm/archy": ["archy@1.0.0", "", { "bundled": true }, "sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw=="], - "npm/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], + "npm/balanced-match": ["balanced-match@4.0.4", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="], - "npm/bin-links": ["bin-links@5.0.0", "", { "dependencies": { "cmd-shim": "^7.0.0", "npm-normalize-package-bin": "^4.0.0", "proc-log": "^5.0.0", "read-cmd-shim": "^5.0.0", "write-file-atomic": "^6.0.0" } }, "sha512-sdleLVfCjBtgO5cNjA2HVRvWBJAHs4zwenaCPMNJAJU0yNxpzj80IpjOIimkpkr+mhlA+how5poQtt53PygbHA=="], + "npm/bin-links": ["bin-links@7.0.1", "", { "dependencies": { "cmd-shim": "^9.0.0", "npm-normalize-package-bin": "^6.0.0", "proc-log": "^7.0.0", "read-cmd-shim": "^7.0.0", "write-file-atomic": "^8.0.0" }, "bundled": true }, "sha512-lgxd7FtxW02eSuafotQOGEQf1iGfDExMz2BRaL+e1tU5xTLx+vvSVA5oHIO6B1tR91LDKcWqYGsktUHdFMtHHQ=="], - "npm/binary-extensions": ["binary-extensions@2.3.0", "", {}, "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw=="], + "npm/binary-extensions": ["binary-extensions@3.2.0", "", {}, "sha512-DjR9rgAOMQn9TrUHzijJUtvoKviDRvFxuIyqZrubxHqRpQN9OzfXrrLivm7xb3q8oJSKsiuBor4bAS2wafLnVQ=="], - "npm/brace-expansion": ["brace-expansion@2.1.7", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g=="], + "npm/brace-expansion": ["brace-expansion@5.1.0", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-aa11Dv491GKnYqxaul3aRJ0szew7yMJMfZPnqD44NjGrZXoj62l41OEDDpdpC4eE2P88vBFfLuSyRhpG91NUvg=="], - "npm/cacache": ["cacache@19.0.1", "", { "dependencies": { "@npmcli/fs": "^4.0.0", "fs-minipass": "^3.0.0", "glob": "^10.2.2", "lru-cache": "^10.0.1", "minipass": "^7.0.3", "minipass-collect": "^2.0.1", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", "p-map": "^7.0.2", "ssri": "^12.0.0", "tar": "^7.4.3", "unique-filename": "^4.0.0" }, "bundled": true }, "sha512-hdsUxulXCi5STId78vRVYEtDAjq99ICAUktLTeTYsLoTE6Z8dS0c8pWNCxwdrk9YfJeobDZc2Y186hD/5ZQgFQ=="], + "npm/cacache": ["cacache@21.0.2", "", { "dependencies": { "@npmcli/fs": "^6.0.0", "fs-minipass": "^3.0.0", "glob": "^14.0.3", "lru-cache": "^11.1.0", "minipass": "^7.0.3", "minipass-collect": "^2.0.1", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", "p-map": "^7.0.2", "ssri": "^14.0.0" }, "bundled": true }, "sha512-P1W9H2p3vBmvDhk5g/82aKTOxB3RpHK55IdiH2cAjX7Ts0bE/3OJI9F8HHoNTrCqsZq9XM3XB+ZblaDL8Ycd/g=="], "npm/chalk": ["chalk@5.6.2", "", { "bundled": true }, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="], "npm/chownr": ["chownr@3.0.0", "", {}, "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g=="], - "npm/ci-info": ["ci-info@4.4.0", "", { "bundled": true }, "sha512-77PSwercCZU2Fc4sX94eF8k8Pxte6JAwL4/ICZLFjJLqegs7kCuAsqqj/70NQF6TvDpgFjkubQB2FW2ZZddvQg=="], - - "npm/cidr-regex": ["cidr-regex@4.1.3", "", { "dependencies": { "ip-regex": "^5.0.0" } }, "sha512-86M1y3ZeQvpZkZejQCcS+IaSWjlDUC+ORP0peScQ4uEUFCZ8bEQVz7NlJHqysoUb6w3zCjx4Mq/8/2RHhMwHYw=="], - - "npm/cli-columns": ["cli-columns@4.0.0", "", { "dependencies": { "string-width": "^4.2.3", "strip-ansi": "^6.0.1" }, "bundled": true }, "sha512-XW2Vg+w+L9on9wtwKpyzluIPCWXjaBahI7mTcYjx+BVIYD9c3yqcv/yKC7CmdCZat4rq2yiE1UMSJC5ivKfMtQ=="], - - "npm/cmd-shim": ["cmd-shim@7.0.0", "", {}, "sha512-rtpaCbr164TPPh+zFdkWpCyZuKkjpAzODfaZCf/SVJZzJN+4bHQb/LP3Jzq5/+84um3XXY8r548XiWKSborwVw=="], + "npm/ci-info": ["ci-info@4.5.0", "", { "bundled": true }, "sha512-d1uM8k5UZEyPza1n/MG3ko8nKupKN0KJpFsipgPcgaCCvV+IqIfJ+NzTjetlLM+UcXZx3+cLrNr76+eAO7G1Mw=="], - "npm/color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], + "npm/cidr-regex": ["cidr-regex@7.1.2", "", {}, "sha512-D8F5oI0M5PagJvTjyycBf7LG+LufTNLrg0WY9J0cPUuG1dIWC2hFvl5SNQr8btm4Qtl7bS7IPvhw/+30IyhBmA=="], - "npm/color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], + "npm/cmd-shim": ["cmd-shim@9.0.2", "", {}, "sha512-xVHoI+wNrM4tDB9iC1idf/8D0tYnVimlBp/5zHW+x1sGjjRD69NvR9th3Z1JAYGN/BTW4he6aZFYV6kzy+k+jw=="], - "npm/common-ancestor-path": ["common-ancestor-path@1.0.1", "", {}, "sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w=="], + "npm/common-ancestor-path": ["common-ancestor-path@2.0.0", "", {}, "sha512-dnN3ibLeoRf2HNC+OlCiNc5d2zxbLJXOtiZUudNFSXZrNSydxcCsSpRzXwfu7BBWCIfHPw+xTayeBvJCP/D8Ng=="], "npm/content-type": ["content-type@2.1.0", "", {}, "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag=="], - "npm/cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="], - - "npm/cssesc": ["cssesc@3.0.0", "", { "bin": { "cssesc": "bin/cssesc" } }, "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg=="], - "npm/debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" }, "peerDependencies": { "supports-color": "*" }, "optionalPeers": ["supports-color"] }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="], - "npm/diff": ["diff@5.2.2", "", {}, "sha512-vtcDfH3TOjP8UekytvnHH1o1P4FcUdt4eQ1Y+Abap1tk/OB2MWQvcwS2ClCd1zuIhc3JKOx6p3kod8Vfys3E+A=="], - - "npm/eastasianwidth": ["eastasianwidth@0.2.0", "", {}, "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA=="], - - "npm/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], - - "npm/encoding": ["encoding@0.1.13", "", { "dependencies": { "iconv-lite": "^0.6.2" } }, "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A=="], + "npm/diff": ["diff@8.0.4", "", { "bundled": true }, "sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw=="], "npm/env-paths": ["env-paths@2.2.1", "", {}, "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A=="], - "npm/err-code": ["err-code@2.0.3", "", {}, "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA=="], - "npm/exponential-backoff": ["exponential-backoff@3.1.3", "", {}, "sha512-ZgEeZXj30q+I0EN+CbSSpIyPaJ5HVQD18Z1m+u1FXbAeT94mr1zw50q4q6jiiC447Nl/YTcIYSAftiGqetwXCA=="], "npm/fastest-levenshtein": ["fastest-levenshtein@1.0.16", "", { "bundled": true }, "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg=="], "npm/fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="], - "npm/foreground-child": ["foreground-child@3.3.1", "", { "dependencies": { "cross-spawn": "^7.0.6", "signal-exit": "^4.0.1" } }, "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw=="], - "npm/fs-minipass": ["fs-minipass@3.0.3", "", { "dependencies": { "minipass": "^7.0.3" }, "bundled": true }, "sha512-XUBA9XClHbnJWSfBzjkm6RvPsyg3sryZt06BEQoXcF7EK/xpGaQYJgQKDJSUH5SGZ76Y7pFx1QBnXz09rU5Fbw=="], - "npm/glob": ["glob@10.5.0", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bundled": true, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg=="], + "npm/glob": ["glob@13.0.7", "", { "dependencies": { "minimatch": "^10.2.2", "minipass": "^7.1.3", "path-scurry": "^2.0.2" }, "bundled": true }, "sha512-wfsFgXQ8A3SEI9XGf7Nl3Y9l7ffSrGh7SUCT7vU/2CzYPep9kjxAn1S40F9OPKxAMGCVl7HtNlJhrCJUeUq83g=="], - "npm/graceful-fs": ["graceful-fs@4.2.11", "", { "bundled": true }, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="], + "npm/graceful-fs": ["graceful-fs@4.2.12", "", { "bundled": true }, "sha512-iuyGF2E4oafQfPsRrG2wtY2ILupMhvtdrhzrxB+0VcjsPpSPttpfYdjnGFGsTi5MaJFjI1jOKHPQ6UTbTj9TAw=="], - "npm/hosted-git-info": ["hosted-git-info@8.1.0", "", { "dependencies": { "lru-cache": "^10.0.1" }, "bundled": true }, "sha512-Rw/B2DNQaPBICNXEm8balFz9a6WpZrkCGpcWFpy7nCj+NyhSdqXipmfvtmWt9xGfp0wZnBxB+iVpLmQMYt47Tw=="], + "npm/hosted-git-info": ["hosted-git-info@10.1.1", "", { "dependencies": { "lru-cache": "^11.1.0" }, "bundled": true }, "sha512-DeOnSPAvOndYKfw075gt8yZzQ7S2hNztw34zBTfhIzLhmBTswIBg5/y+pqu/VD5cYWm5goAFTusDmUEmKZ0PEQ=="], "npm/http-cache-semantics": ["http-cache-semantics@4.3.0", "", {}, "sha512-M5t5LlJpS1UHMjvwRQVdFHvPISGeLAxNcrWuJkeGh0KxsqCHZ1O3NXZU/8x7cD0BDcGW8kapxMKTvwlqrNkHkA=="], - "npm/http-proxy-agent": ["http-proxy-agent@7.0.2", "", { "dependencies": { "agent-base": "^7.1.0", "debug": "^4.3.4" } }, "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig=="], + "npm/http-proxy-agent": ["http-proxy-agent@9.1.0", "", { "dependencies": { "agent-base": "9.0.0", "debug": "^4.3.4", "proxy-agent-negotiate": "1.1.0" } }, "sha512-2NxoveTT58mjYT4n3RPTEfCZGLMbidoO8XEieXfpSYxu+PQJ1qpx4ypwH6N+uF9twBPIvRRgvkvW5HUTYWENig=="], - "npm/https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="], + "npm/https-proxy-agent": ["https-proxy-agent@9.1.0", "", { "dependencies": { "agent-base": "9.0.0", "debug": "^4.3.4", "proxy-agent-negotiate": "1.1.0" } }, "sha512-ag87y7cJJ9/3+GxFr8Oy4O5faDsGRGnBGsJj/YjOSsSx/5eadKLYTMPlzuR6obgoCDDm0abAAZitXXQkMOPSpA=="], - "npm/iconv-lite": ["iconv-lite@0.6.3", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw=="], + "npm/iconv-lite": ["iconv-lite@0.7.3", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ=="], "npm/ignore-walk": ["ignore-walk@8.0.0", "", { "dependencies": { "minimatch": "^10.0.3" } }, "sha512-FCeMZT4NiRQGh+YkeKMtWrOmBgWjHjMJ26WQWrRQyoyzqevdaGSakUaJW5xQYmjLlUVk2qUnCjYVBax9EKKg8A=="], - "npm/imurmurhash": ["imurmurhash@0.1.4", "", {}, "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA=="], - - "npm/ini": ["ini@5.0.0", "", { "bundled": true }, "sha512-+N0ngpO3e7cRUWOJAS7qw0IZIVc6XPrW4MlFBdD066F2L4k1L6ker3hLqSq7iXxU5tgS4WGkIUElWn5vogAEnw=="], - - "npm/init-package-json": ["init-package-json@7.0.2", "", { "dependencies": { "@npmcli/package-json": "^6.0.0", "npm-package-arg": "^12.0.0", "promzard": "^2.0.0", "read": "^4.0.0", "semver": "^7.3.5", "validate-npm-package-license": "^3.0.4", "validate-npm-package-name": "^6.0.0" }, "bundled": true }, "sha512-Qg6nAQulaOQZjvaSzVLtYRqZmuqOi7gTknqqgdhZy7LV5oO+ppvHWq15tZYzGyxJLTH5BxRTqTa+cPDx2pSD9Q=="], - - "npm/ip-address": ["ip-address@10.7.4", "", {}, "sha512-DWBMKyeM25D70nrIiTkgQth59/G+naKOTep6huF9j+GmeK3DMD60Zvxg5d5qQnz+38AHgou6ean2LECX+lrKDg=="], - - "npm/ip-regex": ["ip-regex@5.0.0", "", {}, "sha512-fOCG6lhoKKakwv+C6KdsOnGvgXnmgfmp0myi3bcNwj3qfwPAxRKWEuFhvEFF7ceYIz6+1jRZ+yguLFAmUNPEfw=="], + "npm/ini": ["ini@7.0.0", "", { "bundled": true }, "sha512-ifK0CgjALofS5bkrcTy4RaQ9Vx2Knf/eLeIO+NaswQEpH1UblrtTSCIvN71qQDMq0PeQ/SSPojvEJp9vvvfr+w=="], - "npm/is-cidr": ["is-cidr@5.1.1", "", { "dependencies": { "cidr-regex": "^4.1.1" }, "bundled": true }, "sha512-AwzRMjtJNTPOgm7xuYZ71715z99t+4yRnSnSzgK5err5+heYi4zMuvmpUadaJ28+KCXCQo8CjUrKQZRWSPmqTQ=="], + "npm/init-package-json": ["init-package-json@9.0.1", "", { "dependencies": { "@npmcli/package-json": "^8.0.1", "npm-package-arg": "^14.0.0", "promzard": "^4.0.0", "read": "^6.0.0", "semver": "^7.7.2", "validate-npm-package-name": "^8.0.0" }, "bundled": true }, "sha512-TWKD1wG/ABnAZU6DJo+TBDIzwyjd6zDa1AxI4k+CyXnhgV24uaiZltNtxFyXw1G0Mt4ansUHdhRpCClv3seBhg=="], - "npm/is-fullwidth-code-point": ["is-fullwidth-code-point@3.0.0", "", {}, "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="], + "npm/ip-address": ["ip-address@10.7.7", "", {}, "sha512-He15rAs4jip5AEAz7XM9L+S6Y8LBMIDj6YewbYuJfmDnOCKWb+3TLOGnHFBTAIW7wpm5ohtZ+Xyo5PEaG+O2vQ=="], - "npm/isexe": ["isexe@3.1.5", "", {}, "sha512-6B3tLtFqtQS4ekarvLVMZ+X+VlvQekbe4taUkf/rhVO3d/h0M2rfARm/pXLcPEsjjMsFgrFgSrhQIxcSVrBz8w=="], + "npm/is-cidr": ["is-cidr@7.0.3", "", { "dependencies": { "cidr-regex": "^7.1.1" }, "bundled": true }, "sha512-lNg3nOT+LHKO4vughx1zLUpWUWkt87qu1dBzVrzzOpliIx6gnSIUCXvQfV0FzSHCm6p4ym7BhbakusmZQEC6pw=="], - "npm/jackspeak": ["jackspeak@3.4.3", "", { "dependencies": { "@isaacs/cliui": "^8.0.2" }, "optionalDependencies": { "@pkgjs/parseargs": "^0.11.0" } }, "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw=="], + "npm/isexe": ["isexe@4.0.0", "", {}, "sha512-FFUtZMpoZ8RqHS3XeXEmHWLA4thH+ZxCv2lOiPIn1Xc7CxrqhWzNSDzD+/chS/zbYezmiwWLdQC09JdQKmthOw=="], - "npm/json-parse-even-better-errors": ["json-parse-even-better-errors@4.0.0", "", { "bundled": true }, "sha512-lR4MXjGNgkJc7tkQ97kb2nuEMnNCyU//XYVH0MKTGcXEiSudQ5MKGKen3C5QubYy0vmq+JGitUg92uuywGEwIA=="], + "npm/json-parse-even-better-errors": ["json-parse-even-better-errors@6.0.0", "", { "bundled": true }, "sha512-2/8adwnK1/+Fdjyts4r6wSpfANWw8zdNhU9U/Llk59c6O+DjSisPWPykwoL8gZmocP9Dy64S7oie2g+Mia123A=="], "npm/json-stringify-nice": ["json-stringify-nice@1.1.4", "", {}, "sha512-5Z5RFW63yxReJ7vANgW6eZFGWaQvnPE3WNmZoOJrSkGju2etKA2L5rrOa1sm877TVTFt57A80BH1bArcmlLfPw=="], @@ -725,125 +711,109 @@ "npm/just-diff-apply": ["just-diff-apply@5.5.0", "", {}, "sha512-OYTthRfSh55WOItVqwpefPtNt2VdKsq5AnAK6apdtR6yCH8pr0CmSr710J0Mf+WdQy7K/OzMy7K2MgAfdQURDw=="], - "npm/libnpmaccess": ["libnpmaccess@9.0.0", "", { "dependencies": { "npm-package-arg": "^12.0.0", "npm-registry-fetch": "^18.0.1" }, "bundled": true }, "sha512-mTCFoxyevNgXRrvgdOhghKJnCWByBc9yp7zX4u9RBsmZjwOYdUDEBfL5DdgD1/8gahsYnauqIWFbq0iK6tO6CQ=="], + "npm/libnpmaccess": ["libnpmaccess@11.0.0", "", { "dependencies": { "npm-package-arg": "^14.0.0", "npm-registry-fetch": "^20.0.1" }, "bundled": true }, "sha512-qku5OaTtCv7f4xq5lmZMh4H6pd9WRalww3WF4PEk/aFo1Bpi7/IRCzy28EQBvyrprhzZGifbpM378U4waB9/0Q=="], - "npm/libnpmdiff": ["libnpmdiff@7.0.5", "", { "dependencies": { "@npmcli/arborist": "^8.0.5", "@npmcli/installed-package-contents": "^3.0.0", "binary-extensions": "^2.3.0", "diff": "^5.1.0", "minimatch": "^9.0.4", "npm-package-arg": "^12.0.0", "pacote": "^19.0.0", "tar": "^7.5.11" }, "bundled": true }, "sha512-pQ9Hg/j1DcHoY2tbkMKK8mIuEuDlwL9sYKmhY8foofBC8isgtjfrzXDjm4teoy91Pa2ukpnV8dXqKmFb04mc4A=="], + "npm/libnpmdiff": ["libnpmdiff@9.0.5", "", { "dependencies": { "@npmcli/arborist": "^10.0.5", "@npmcli/installed-package-contents": "^5.0.0", "binary-extensions": "^3.0.0", "diff": "^8.0.2", "minimatch": "^10.0.3", "npm-package-arg": "^14.0.0", "pacote": "^22.0.0", "tar": "^7.5.1" }, "bundled": true }, "sha512-KLY/F2KAlrcZ4wAQxV9Q8pOWLisj0Skq84MUogKHKBYeCuG7um9gmstMHDRfF4agFa14q3vR/96Rl9e/h933kg=="], - "npm/libnpmexec": ["libnpmexec@9.0.5", "", { "dependencies": { "@npmcli/arborist": "^8.0.5", "@npmcli/run-script": "^9.0.1", "ci-info": "^4.0.0", "npm-package-arg": "^12.0.0", "pacote": "^19.0.0", "proc-log": "^5.0.0", "read": "^4.0.0", "read-package-json-fast": "^4.0.0", "semver": "^7.3.7", "walk-up-path": "^3.0.1" }, "bundled": true }, "sha512-XAuPuoQhSgv8FEI03zvnxgr7ueeClSLUfHRwG+xtE9Ue2gjny7CIgpJsjd2a6evS0yHu8CcqtEumq50WzQ/UtQ=="], + "npm/libnpmexec": ["libnpmexec@11.0.6", "", { "dependencies": { "@gar/promise-retry": "^1.0.0", "@npmcli/arborist": "^10.0.5", "@npmcli/package-json": "^8.0.0", "@npmcli/run-script": "^11.0.0", "ci-info": "^4.0.0", "npm-package-arg": "^14.0.0", "pacote": "^22.0.0", "proc-log": "^7.0.0", "read": "^6.0.0", "semver": "^7.3.7", "signal-exit": "^4.1.0", "walk-up-path": "^4.0.0" }, "bundled": true }, "sha512-mBDikMWH93mjNtCKbE3jQCCfSWBgZwNWGSAY8qkHS94b6kE5iETgX7JoGXZ/XoZGq+hidChytTiys5PdHjgHUw=="], - "npm/libnpmfund": ["libnpmfund@6.0.5", "", { "dependencies": { "@npmcli/arborist": "^8.0.5" }, "bundled": true }, "sha512-8tGUrvobGjeAmbUxFI7ivjgWpeGsSz9CmI7FtrMdu7iGbtAcTESszl2J+R1+Pu0M+TO9fQIbyeovWGM6lI0akA=="], + "npm/libnpmfund": ["libnpmfund@8.0.5", "", { "dependencies": { "@npmcli/arborist": "^10.0.5" }, "bundled": true }, "sha512-AHUv2TCRW9BJ+DCpE/BvfLwwsa/1z27FRGs/skZ142kxty5gTfigXF+IhmJ32cKHj9H7KlQf8K4SmuVSGShHnA=="], - "npm/libnpmhook": ["libnpmhook@11.0.0", "", { "dependencies": { "aproba": "^2.0.0", "npm-registry-fetch": "^18.0.1" }, "bundled": true }, "sha512-Xc18rD9NFbRwZbYCQ+UCF5imPsiHSyuQA8RaCA2KmOUo8q4kmBX4JjGWzmZnxZCT8s6vwzmY1BvHNqBGdg9oBQ=="], + "npm/libnpmorg": ["libnpmorg@9.0.0", "", { "dependencies": { "aproba": "^2.0.0", "npm-registry-fetch": "^20.0.1" }, "bundled": true }, "sha512-cPiStT2aFEGu5/so+VZlQDb5AuhiYFsEAHBOCjuXWbBQP2EcGmr6doOUNRV17L2HNTw1Wvqnq2+nSrINdBphAg=="], - "npm/libnpmorg": ["libnpmorg@7.0.0", "", { "dependencies": { "aproba": "^2.0.0", "npm-registry-fetch": "^18.0.1" }, "bundled": true }, "sha512-DcTodX31gDEiFrlIHurBQiBlBO6Var2KCqMVCk+HqZhfQXqUfhKGmFOp0UHr6HR1lkTVM0MzXOOYtUObk0r6Dg=="], + "npm/libnpmpack": ["libnpmpack@10.0.5", "", { "dependencies": { "@npmcli/arborist": "^10.0.5", "@npmcli/run-script": "^11.0.0", "npm-package-arg": "^14.0.0", "pacote": "^22.0.0" }, "bundled": true }, "sha512-Ae0OBWgGmIt+g2A2UZD7oRvlIjVL7A1FEu85eRVAxKbQC652UTpnBExHhU4XmRCxyRuMkOpaRseWAFENX9U5yQ=="], - "npm/libnpmpack": ["libnpmpack@8.0.5", "", { "dependencies": { "@npmcli/arborist": "^8.0.5", "@npmcli/run-script": "^9.0.1", "npm-package-arg": "^12.0.0", "pacote": "^19.0.0" }, "bundled": true }, "sha512-j1Zyacp6VRe1HsmOH4MWpEOLMzPKwBkmSgMn5ep83wbALPIwD7LcAvhyjM9sEFjKyFuqmX56XUvNLcF8sUayOg=="], + "npm/libnpmpublish": ["libnpmpublish@12.0.1", "", { "dependencies": { "@npmcli/package-json": "^8.0.0", "ci-info": "^4.0.0", "npm-package-arg": "^14.0.0", "npm-registry-fetch": "^20.0.1", "proc-log": "^7.0.0", "semver": "^7.3.7", "sigstore": "^5.0.0", "ssri": "^14.0.0" }, "bundled": true }, "sha512-gG32Hgikbb8mx+c+b2MKseuQcwKbiIl7wM4a5+scxuRtu/Q7L/fbywMyLD4naUfL0yexdKWzfi6kglMz6BGOWQ=="], - "npm/libnpmpublish": ["libnpmpublish@10.0.2", "", { "dependencies": { "ci-info": "^4.0.0", "normalize-package-data": "^7.0.0", "npm-package-arg": "^12.0.0", "npm-registry-fetch": "^18.0.1", "proc-log": "^5.0.0", "semver": "^7.3.7", "sigstore": "^3.0.0", "ssri": "^12.0.0" }, "bundled": true }, "sha512-Q+PlGO6vOZDlZ6jKPDqDLYbARfV5OBusmJZj9GPbNUiys8OK6/yrwJ8ty8ibbc4GkMspqgOMdJ/1dcJwhtpkDg=="], + "npm/libnpmsearch": ["libnpmsearch@10.0.0", "", { "dependencies": { "npm-registry-fetch": "^20.0.1" }, "bundled": true }, "sha512-dNDPxoeIY8IC3ftpOaMGbaHMcxngu4PEyTdR5XZnWgh62QaCucUVK+7z7i2igIEUiOe4HJbZw/sU/5VOCCjkmA=="], - "npm/libnpmsearch": ["libnpmsearch@8.0.0", "", { "dependencies": { "npm-registry-fetch": "^18.0.1" }, "bundled": true }, "sha512-W8FWB78RS3Nkl1gPSHOlF024qQvcoU/e3m9BGDuBfVZGfL4MJ91GXXb04w3zJCGOW9dRQUyWVEqupFjCrgltDg=="], + "npm/libnpmteam": ["libnpmteam@9.0.0", "", { "dependencies": { "aproba": "^2.0.0", "npm-registry-fetch": "^20.0.1" }, "bundled": true }, "sha512-zZhmjQlRZDUyoHC1/Knc5lG7NVLZfu3wEGaotvILo6xKxE/njDDeZVJa2CS/cmZZ5ki7rSXg+0GNlqusiHqPTQ=="], - "npm/libnpmteam": ["libnpmteam@7.0.0", "", { "dependencies": { "aproba": "^2.0.0", "npm-registry-fetch": "^18.0.1" }, "bundled": true }, "sha512-PKLOoVukN34qyJjgEm5DEOnDwZkeVMUHRx8NhcKDiCNJGPl7G/pF1cfBw8yicMwRlHaHkld1FdujOzKzy4AlwA=="], + "npm/libnpmversion": ["libnpmversion@9.0.0", "", { "dependencies": { "@npmcli/git": "^8.0.0", "@npmcli/run-script": "^11.0.0", "json-parse-even-better-errors": "^6.0.0", "proc-log": "^7.0.0", "semver": "^7.3.7" }, "bundled": true }, "sha512-v7vTEPiODFT6ciWXoVWEpsD5fPFNoyQ35OvrZgK7F0ZjJxR23l+UBvGzkhPGYc8Fft39k90Ej+l3/zCGu5tzcg=="], - "npm/libnpmversion": ["libnpmversion@7.0.0", "", { "dependencies": { "@npmcli/git": "^6.0.1", "@npmcli/run-script": "^9.0.1", "json-parse-even-better-errors": "^4.0.0", "proc-log": "^5.0.0", "semver": "^7.3.7" }, "bundled": true }, "sha512-0xle91R6F8r/Q/4tHOnyKko+ZSquEXNdxwRdKCPv4kC1cOVBMFXRsKKrVtRKtXcFn362U8ZlJefk4Apu00424g=="], + "npm/lru-cache": ["lru-cache@11.5.4", "", {}, "sha512-B8nJCTi8JuSaDBg0tBdnImV6j5O2CXaqKfdj24ZTCFbyivN8KZ2Z+RL3aHjwJAfLutD9cNnObG4SIgW4gMufiw=="], - "npm/lru-cache": ["lru-cache@10.4.3", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="], + "npm/make-fetch-happen": ["make-fetch-happen@16.0.2", "", { "dependencies": { "@gar/promise-retry": "^1.0.0", "@npmcli/agent": "^5.0.0", "@npmcli/redact": "^5.0.0", "cacache": "^21.0.2", "http-cache-semantics": "^4.1.1", "minipass": "^7.0.2", "minipass-fetch": "^6.0.0", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", "negotiator": "^1.0.0", "proc-log": "^7.0.0", "ssri": "^14.0.0" }, "bundled": true }, "sha512-IUlTXyoHTIWxcy4ZoQEyWzPwyE5GX9At5NcJTWzlW+5JXhvWDjDOj0F0qYIgoREKRR8csah8wNpxRuDeiGlEGQ=="], - "npm/make-fetch-happen": ["make-fetch-happen@14.0.3", "", { "dependencies": { "@npmcli/agent": "^3.0.0", "cacache": "^19.0.1", "http-cache-semantics": "^4.1.1", "minipass": "^7.0.2", "minipass-fetch": "^4.0.0", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", "negotiator": "^1.0.0", "proc-log": "^5.0.0", "promise-retry": "^2.0.1", "ssri": "^12.0.0" }, "bundled": true }, "sha512-QMjGbFTP0blj97EeidG5hk/QhKQ3T4ICckQGLgz38QF7Vgbk6e6FTARN8KhKxyBbWn8R0HU+bnw8aSoFPD4qtQ=="], - - "npm/minimatch": ["minimatch@9.0.9", "", { "dependencies": { "brace-expansion": "^2.0.2" }, "bundled": true }, "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg=="], + "npm/minimatch": ["minimatch@10.2.6", "", { "dependencies": { "brace-expansion": "^5.0.8" }, "bundled": true }, "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A=="], "npm/minipass": ["minipass@7.1.3", "", { "bundled": true }, "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A=="], "npm/minipass-collect": ["minipass-collect@2.0.1", "", { "dependencies": { "minipass": "^7.0.3" } }, "sha512-D7V8PO9oaz7PWGLbCACuI1qEOsq7UKfLotx/C0Aet43fCUB/wfQ7DYeq2oR/svFJGYDHPr38SHATeaj/ZoKHKw=="], - "npm/minipass-fetch": ["minipass-fetch@4.0.1", "", { "dependencies": { "minipass": "^7.0.3", "minipass-sized": "^1.0.3", "minizlib": "^3.0.1" }, "optionalDependencies": { "encoding": "^0.1.13" } }, "sha512-j7U11C5HXigVuutxebFadoYBbd7VSdZWggSe64NVdvWNBqGAiXPL2QVCehjmw7lY1oF9gOllYbORh+hiNgfPgQ=="], + "npm/minipass-fetch": ["minipass-fetch@6.0.1", "", { "dependencies": { "minipass": "^7.0.3", "minipass-sized": "^2.0.0", "minizlib": "^3.0.1" }, "optionalDependencies": { "iconv-lite": "^0.7.2" } }, "sha512-wV03kbBre0q+NJLfcUswkG+6vGn/atIdXOMiD0uKIqdWpevHiCFg3ML9V8jolPoKM7H/kmDV9Xsk0j7/FDRyhA=="], "npm/minipass-flush": ["minipass-flush@1.0.7", "", { "dependencies": { "minipass": "^3.0.0" } }, "sha512-TbqTz9cUwWyHS2Dy89P3ocAGUGxKjjLuR9z8w4WUTGAVgEj17/4nhgo2Du56i0Fm3Pm30g4iA8Lcqctc76jCzA=="], "npm/minipass-pipeline": ["minipass-pipeline@1.2.4", "", { "dependencies": { "minipass": "^3.0.0" }, "bundled": true }, "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A=="], - "npm/minipass-sized": ["minipass-sized@1.0.3", "", { "dependencies": { "minipass": "^3.0.0" } }, "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g=="], + "npm/minipass-sized": ["minipass-sized@2.0.0", "", { "dependencies": { "minipass": "^7.1.2" } }, "sha512-zSsHhto5BcUVM2m1LurnXY6M//cGhVaegT71OfOXoprxT6o780GZd792ea6FfrQkuU4usHZIUczAQMRUE2plzA=="], "npm/minizlib": ["minizlib@3.1.0", "", { "dependencies": { "minipass": "^7.1.2" } }, "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw=="], "npm/ms": ["ms@2.1.3", "", { "bundled": true }, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="], - "npm/mute-stream": ["mute-stream@2.0.0", "", {}, "sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA=="], + "npm/mute-stream": ["mute-stream@4.0.0", "", {}, "sha512-gSrprq0fJ3EiOErzjdIZrjysVVmJ4uu1QWfCDss5LypA5OXvrMje5Ym5z6V6RLyJ2eF87lasX7t6a0AnFvZblg=="], "npm/negotiator": ["negotiator@1.1.0", "", { "dependencies": { "content-type": "^2.1.0" } }, "sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg=="], - "npm/node-gyp": ["node-gyp@11.5.0", "", { "dependencies": { "env-paths": "^2.2.0", "exponential-backoff": "^3.1.1", "graceful-fs": "^4.2.6", "make-fetch-happen": "^14.0.3", "nopt": "^8.0.0", "proc-log": "^5.0.0", "semver": "^7.3.5", "tar": "^7.4.3", "tinyglobby": "^0.2.12", "which": "^5.0.0" }, "bundled": true, "bin": { "node-gyp": "bin/node-gyp.js" } }, "sha512-ra7Kvlhxn5V9Slyus0ygMa2h+UqExPqUIkfk7Pc8QTLT956JLSy51uWFwHtIYy0vI8cB4BDhc/S03+880My/LQ=="], - - "npm/nopt": ["nopt@8.1.0", "", { "dependencies": { "abbrev": "^3.0.0" }, "bundled": true, "bin": { "nopt": "bin/nopt.js" } }, "sha512-ieGu42u/Qsa4TFktmaKEwM6MQH0pOWnaB3htzh0JRtx84+Mebc0cbZYN5bC+6WTZ4+77xrL9Pn5m7CV6VIkV7A=="], + "npm/node-gyp": ["node-gyp@13.1.0", "", { "dependencies": { "env-paths": "^2.2.0", "exponential-backoff": "^3.1.1", "graceful-fs": "^4.2.6", "nopt": "^10.0.0", "proc-log": "^7.0.0", "semver": "^7.3.5", "tar": "^7.5.7", "tinyglobby": "^0.2.12", "undici": "^8.4.1", "which": "^7.0.0" }, "bundled": true, "bin": { "node-gyp": "bin/node-gyp.js" } }, "sha512-FpNzOLFACKG0oRBYbZ5WOeWD1EqRTIWX90MaRIWTO18lVYPx8fqIjrdS3pihjnCkSmgop6zVGkSqg1vXZLksuw=="], - "npm/normalize-package-data": ["normalize-package-data@7.0.1", "", { "dependencies": { "hosted-git-info": "^8.0.0", "semver": "^7.3.5", "validate-npm-package-license": "^3.0.4" }, "bundled": true }, "sha512-linxNAT6M0ebEYZOx2tO6vBEFsVgnPpv+AVjk0wJHfaUIbq31Jm3T6vvZaarnOeWDh8ShnwXuaAyM7WT3RzErA=="], + "npm/nopt": ["nopt@10.0.1", "", { "dependencies": { "abbrev": "^5.0.0" }, "bundled": true, "bin": { "nopt": "bin/nopt.js" } }, "sha512-df3sBr/6ax9hSGuC3CspvLlbnX8cP5L5nZwXF8cGN8l0zSWR6BvzmQ6jPUKjvo6+/xdpkNvEcucBNUdBeeV13g=="], - "npm/npm-audit-report": ["npm-audit-report@6.0.0", "", { "bundled": true }, "sha512-Ag6Y1irw/+CdSLqEEAn69T8JBgBThj5mw0vuFIKeP7hATYuQuS5jkMjK6xmVB8pr7U4g5Audbun0lHhBDMIBRA=="], + "npm/npm-audit-report": ["npm-audit-report@8.0.0", "", { "bundled": true }, "sha512-LrRtLB4NKdXin5dw4yxcES8GDXncfoVVcYzkn8bdwc0etpHmxtKKwwI1YTWpQ9+lEmzEnZo10Lzb11QLxuuBnA=="], - "npm/npm-bundled": ["npm-bundled@4.0.0", "", { "dependencies": { "npm-normalize-package-bin": "^4.0.0" } }, "sha512-IxaQZDMsqfQ2Lz37VvyyEtKLe8FsRZuysmedy/N06TU1RyVppYKXrO4xIhR0F+7ubIBox6Q7nir6fQI3ej39iA=="], + "npm/npm-bundled": ["npm-bundled@6.0.0", "", { "dependencies": { "npm-normalize-package-bin": "^6.0.0" } }, "sha512-EqdodKEW6pYM+dPxA66TZQfMEqVDiuzjDM9edSjuPI1mXUbUJwVxkgqMZSJvs8RTXz2CGq8HUol/AffTZX5g8w=="], - "npm/npm-install-checks": ["npm-install-checks@7.1.2", "", { "dependencies": { "semver": "^7.1.1" }, "bundled": true }, "sha512-z9HJBCYw9Zr8BqXcllKIs5nI+QggAImbBdHphOzVYrz2CB4iQ6FzWyKmlqDZua+51nAu7FcemlbTc9VgQN5XDQ=="], + "npm/npm-install-checks": ["npm-install-checks@9.0.0", "", { "dependencies": { "semver": "^7.1.1" }, "bundled": true }, "sha512-t05Izcgi7p15cpldqoiXYpjzlkTTvBw33sgjmL/JjcvtV0ydbm2O4iEXO8A6smqComu5FAQhUas86HTMQ6Z1Uw=="], - "npm/npm-normalize-package-bin": ["npm-normalize-package-bin@4.0.0", "", {}, "sha512-TZKxPvItzai9kN9H/TkmCtx/ZN/hvr3vUycjlfmH0ootY9yFBzNOpiXAdIn1Iteqsvk4lQn6B5PTrt+n6h8k/w=="], + "npm/npm-normalize-package-bin": ["npm-normalize-package-bin@6.0.0", "", {}, "sha512-tdt4aFn9QamlhdN3HV2D2ccpBwO5/fyjjbXUxYA6uBjyekMZcZvDq0aSj9t5Jo+tih6AYFnt/cuIRn9013e0Uw=="], - "npm/npm-package-arg": ["npm-package-arg@12.0.2", "", { "dependencies": { "hosted-git-info": "^8.0.0", "proc-log": "^5.0.0", "semver": "^7.3.5", "validate-npm-package-name": "^6.0.0" }, "bundled": true }, "sha512-f1NpFjNI9O4VbKMOlA5QoBq/vSQPORHcTZ2feJpFkTHJ9eQkdlmZEKSjcAhxTGInC7RlEyScT9ui67NaOsjFWA=="], + "npm/npm-package-arg": ["npm-package-arg@14.0.0", "", { "dependencies": { "hosted-git-info": "^10.1.0", "proc-log": "^7.0.0", "semver": "^7.3.5", "validate-npm-package-name": "^8.0.0" }, "bundled": true }, "sha512-69XQh3k+dtGa1p+7RaR57IuG3rCko96xr/nUfN4yDYBXbTYICiWcOpsFKLN2GtGE9cyIljE+f1exnaYt9MvM+Q=="], "npm/npm-packlist": ["npm-packlist@10.0.4", "", { "dependencies": { "ignore-walk": "^8.0.0", "proc-log": "^6.0.0" } }, "sha512-uMW73iajD8hiH4ZBxEV3HC+eTnppIqwakjOYuvgddnalIw2lJguKviK1pcUJDlIWm1wSJkchpDZDSVVsZEYRng=="], - "npm/npm-pick-manifest": ["npm-pick-manifest@10.0.0", "", { "dependencies": { "npm-install-checks": "^7.1.0", "npm-normalize-package-bin": "^4.0.0", "npm-package-arg": "^12.0.0", "semver": "^7.3.5" }, "bundled": true }, "sha512-r4fFa4FqYY8xaM7fHecQ9Z2nE9hgNfJR+EmoKv0+chvzWkBcORX3r0FpTByP+CbOVJDladMXnPQGVN8PBLGuTQ=="], + "npm/npm-pick-manifest": ["npm-pick-manifest@12.0.0", "", { "dependencies": { "npm-install-checks": "^9.0.0", "npm-normalize-package-bin": "^6.0.0", "npm-package-arg": "^14.0.0", "semver": "^7.3.5" }, "bundled": true }, "sha512-8Fs3YLrnNOhrCdPNZy18MzNgVC58LTDAFzq1FdZO/p3BHeCC/coz+t4F5Pxabys8HJpyTUorMea26GkXsb4J/Q=="], - "npm/npm-profile": ["npm-profile@11.0.1", "", { "dependencies": { "npm-registry-fetch": "^18.0.0", "proc-log": "^5.0.0" }, "bundled": true }, "sha512-HP5Cw9WHwFS9vb4fxVlkNAQBUhVL5BmW6rAR+/JWkpwqcFJid7TihKUdYDWqHl0NDfLd0mpucheGySqo8ysyfw=="], + "npm/npm-profile": ["npm-profile@13.0.2", "", { "dependencies": { "npm-registry-fetch": "^20.0.2", "proc-log": "^7.0.0" }, "bundled": true }, "sha512-PDnVHBYVelhsrmzsr67216czNpIJwdnvw3vzD5giPFLT4aaROKMxeeQMWrOg5Pea5pMcJ8c3gey/SdOFirGs7g=="], - "npm/npm-registry-fetch": ["npm-registry-fetch@18.0.2", "", { "dependencies": { "@npmcli/redact": "^3.0.0", "jsonparse": "^1.3.1", "make-fetch-happen": "^14.0.0", "minipass": "^7.0.2", "minipass-fetch": "^4.0.0", "minizlib": "^3.0.1", "npm-package-arg": "^12.0.0", "proc-log": "^5.0.0" }, "bundled": true }, "sha512-LeVMZBBVy+oQb5R6FDV9OlJCcWDU+al10oKpe+nsvcHnG24Z3uM3SvJYKfGJlfGjVU8v9liejCrUR/M5HO5NEQ=="], + "npm/npm-registry-fetch": ["npm-registry-fetch@20.0.2", "", { "dependencies": { "@npmcli/redact": "^5.0.0", "jsonparse": "^1.3.1", "make-fetch-happen": "^16.0.2", "minipass": "^7.0.2", "minipass-fetch": "^6.0.0", "minizlib": "^3.0.1", "npm-package-arg": "^14.0.0", "proc-log": "^7.0.0" }, "bundled": true }, "sha512-bWLzEezfbIY2U23lUCQFA16j5PboZxB1QrYhZUQEFXZ1+y+CRmsTeMbMsqfYmu+qi6BAfMKsa23tlRTKDHzM3A=="], - "npm/npm-user-validate": ["npm-user-validate@3.0.0", "", { "bundled": true }, "sha512-9xi0RdSmJ4mPYTC393VJPz1Sp8LyCx9cUnm/L9Qcb3cFO8gjT4mN20P9FAsea8qDHdQ7LtcN8VLh2UT47SdKCw=="], + "npm/npm-user-validate": ["npm-user-validate@5.0.0", "", { "bundled": true }, "sha512-yZKlDPJOukQIRzXL+qYyuczXtnQTSF732zT6umGfy/8DxXEAdnv22eA/UpBsC0Fv9s4yfDYkK1pLnCPB0GxsqQ=="], "npm/p-map": ["p-map@7.1.1", "", { "bundled": true }, "sha512-6Lh3jQPLthYujSrlw6ccWXBGZTkoTCz27Hd92g79LH/kjAbgoEu0t442cCCNbegPSJsA0lwDX8z0bcKtkpA32g=="], - "npm/package-json-from-dist": ["package-json-from-dist@1.0.1", "", {}, "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw=="], - - "npm/pacote": ["pacote@21.5.1", "", { "dependencies": { "@gar/promise-retry": "^1.0.0", "@npmcli/git": "^7.0.0", "@npmcli/installed-package-contents": "^4.0.0", "@npmcli/package-json": "^7.0.0", "@npmcli/promise-spawn": "^9.0.0", "@npmcli/run-script": "^10.0.0", "cacache": "^20.0.0", "fs-minipass": "^3.0.0", "minipass": "^7.0.2", "npm-package-arg": "^13.0.0", "npm-packlist": "^10.0.1", "npm-pick-manifest": "^11.0.1", "npm-registry-fetch": "^19.0.0", "proc-log": "^6.0.0", "sigstore": "^4.0.0", "ssri": "^13.0.0", "tar": "^7.4.3" }, "bundled": true, "bin": { "pacote": "bin/index.js" } }, "sha512-KvcJ9iy3crysCsgqc4+PknH/w6jkrp8JN36mpZBPwNaDRwTfMZD37YzRazNstiZUOhuF5pno9f78n9mEJBavwg=="], - - "npm/parse-conflict-json": ["parse-conflict-json@4.0.0", "", { "dependencies": { "json-parse-even-better-errors": "^4.0.0", "just-diff": "^6.0.0", "just-diff-apply": "^5.2.0" }, "bundled": true }, "sha512-37CN2VtcuvKgHUs8+0b1uJeEsbGn61GRHz469C94P5xiOoqpDYJYwjg4RY9Vmz39WyZAVkR5++nbJwLMIgOCnQ=="], + "npm/pacote": ["pacote@21.5.3", "", { "dependencies": { "@gar/promise-retry": "^1.0.0", "@npmcli/git": "^7.0.0", "@npmcli/installed-package-contents": "^4.0.0", "@npmcli/package-json": "^7.0.0", "@npmcli/promise-spawn": "^9.0.0", "@npmcli/run-script": "^10.0.0", "cacache": "^20.0.0", "fs-minipass": "^3.0.0", "minipass": "^7.0.2", "npm-package-arg": "^13.0.0", "npm-packlist": "^10.0.1", "npm-pick-manifest": "^11.0.1", "npm-registry-fetch": "^19.0.0", "proc-log": "^6.0.0", "sigstore": "^4.0.0", "ssri": "^13.0.0", "tar": "^7.4.3" }, "bundled": true, "bin": { "pacote": "bin/index.js" } }, "sha512-XAHnxRzERPW/Y3sLaCgfUVdfP5Di1K0wiUWsDaK4reodu20Kl0pVZcw8Mdd2LaLsUpot6YLVOEgmIqMEL9Tjog=="], - "npm/path-key": ["path-key@3.1.1", "", {}, "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="], + "npm/parse-conflict-json": ["parse-conflict-json@6.0.0", "", { "dependencies": { "json-parse-even-better-errors": "^6.0.0", "just-diff": "^6.0.0", "just-diff-apply": "^5.2.0" }, "bundled": true }, "sha512-JIdsITvN0yVRpYxiip9DpCduYi75AryIDSCf6ez/Yul6PV46L0B/8SxSvLiMmWiUZKopLrD1BZgexxCfufoT9w=="], - "npm/path-scurry": ["path-scurry@1.11.1", "", { "dependencies": { "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" } }, "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA=="], + "npm/path-scurry": ["path-scurry@2.0.2", "", { "dependencies": { "lru-cache": "^11.0.0", "minipass": "^7.1.2" } }, "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg=="], "npm/picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="], - "npm/postcss-selector-parser": ["postcss-selector-parser@7.1.6", "", { "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" } }, "sha512-7qASPzhKF2l2KLboRZux8CCTRMdGiV08vWmyKzPz22qZ7ZjQBOeY7rNzNoCLSUiftJ7HUq0GERHmxw/t0dCdMw=="], + "npm/postcss-selector-parser": ["postcss-selector-parser@7.2.1", "", { "dependencies": { "util-deprecate": "^1.0.2" } }, "sha512-GwxlMgTTXwIom+ebC7an3k6RaJDwklRQQnfiXsLPGicu8FYV/k/+1/9YY2OU2+r938H2t4X0TDxoif+HP2rjzQ=="], - "npm/proc-log": ["proc-log@5.0.0", "", { "bundled": true }, "sha512-Azwzvl90HaF0aCz1JrDdXQykFakSSNPaPoiZ9fm5qJIMHioDZEi7OAdRwSm6rSoPtY3Qutnm3L7ogmg3dc+wbQ=="], + "npm/proc-log": ["proc-log@7.0.0", "", { "bundled": true }, "sha512-FYgfaA69XZ93zaXLoMNQ+ViDXGGBgR8aLh03txzcFhV+9xOXx7+8DLCULrKKpR9+GsH9ZfHm82aSUPpozX0Ztg=="], - "npm/proggy": ["proggy@3.0.0", "", {}, "sha512-QE8RApCM3IaRRxVzxrjbgNMpQEX6Wu0p0KBeoSiSEw5/bsGwZHsshF4LCxH2jp/r6BU+bqA3LrMDEYNfJnpD8Q=="], + "npm/proggy": ["proggy@4.0.0", "", {}, "sha512-MbA4R+WQT76ZBm/5JUpV9yqcJt92175+Y0Bodg3HgiXzrmKu7Ggq+bpn6y6wHH+gN9NcyKn3yg1+d47VaKwNAQ=="], "npm/promise-all-reject-late": ["promise-all-reject-late@1.0.1", "", {}, "sha512-vuf0Lf0lOxyQREH7GDIOUMLS7kz+gs8i6B+Yi8dC68a2sychGrHTJYghMBD6k7eUcH0H5P73EckCA48xijWqXw=="], "npm/promise-call-limit": ["promise-call-limit@3.0.2", "", {}, "sha512-mRPQO2T1QQVw11E7+UdCJu7S61eJVWknzml9sC1heAdj1jxl0fWMBypIt9ZOcLFf8FkG995ZD7RnVk7HH72fZw=="], - "npm/promise-retry": ["promise-retry@2.0.1", "", { "dependencies": { "err-code": "^2.0.2", "retry": "^0.12.0" } }, "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g=="], + "npm/promzard": ["promzard@4.0.0", "", { "dependencies": { "read": "^6.0.0" } }, "sha512-zqf38XGznB+ECFHQPGt0RNQCh0YF+r5iac0EZloSQlEWDxt0vCS39PEtUShBJOZU0tcJ+USPvmnyGo+3CEFwcQ=="], - "npm/promzard": ["promzard@2.0.0", "", { "dependencies": { "read": "^4.0.0" } }, "sha512-Ncd0vyS2eXGOjchIRg6PVCYKetJYrW1BSbbIo+bKdig61TB6nH2RQNF2uP+qMpsI73L/jURLWojcw8JNIKZ3gg=="], + "npm/proxy-agent-negotiate": ["proxy-agent-negotiate@1.1.0", "", { "peerDependencies": { "kerberos": "^2.0.0" }, "optionalPeers": ["kerberos"] }, "sha512-N8IBcM3UgCVzz2L2Lqv8DVntDnnC8/hiV4nEDUPkqq72TPUgYWjQc+bdZlBPZK9LzPAvOY//gAt0S0DApoOXWQ=="], "npm/qrcode-terminal": ["qrcode-terminal@0.12.0", "", { "bundled": true, "bin": { "qrcode-terminal": "./bin/qrcode-terminal.js" } }, "sha512-EXtzRZmC+YGmGlDFbXKxQiMZNwCLEO6BANKXG4iCtSIM0yqc/pappSx3RIKr4r0uh5JsBckOXeKrB3Iz7mdQpQ=="], - "npm/read": ["read@4.1.0", "", { "dependencies": { "mute-stream": "^2.0.0" }, "bundled": true }, "sha512-uRfX6K+f+R8OOrYScaM3ixPY4erg69f8DN6pgTvMcA9iRc8iDhwrA4m3Yu8YYKsXJgVvum+m8PkRboZwwuLzYA=="], + "npm/read": ["read@6.0.0", "", { "dependencies": { "mute-stream": "^4.0.0" }, "bundled": true }, "sha512-Tg/LaEke7h9SDbp0xJJj53oa4s1VPPySVnxQF9nUS9DgA25M/ZCLk7RVF1kHjytC87XbkgQKmQ/79+DQgEIqLA=="], - "npm/read-cmd-shim": ["read-cmd-shim@5.0.0", "", {}, "sha512-SEbJV7tohp3DAAILbEMPXavBjAnMN0tVnh4+9G8ihV4Pq3HYF9h8QNez9zkJ1ILkv9G2BjdzwctznGZXgu/HGw=="], - - "npm/read-package-json-fast": ["read-package-json-fast@4.0.0", "", { "dependencies": { "json-parse-even-better-errors": "^4.0.0", "npm-normalize-package-bin": "^4.0.0" } }, "sha512-qpt8EwugBWDw2cgE2W+/3oxC+KTez2uSVR8JU9Q36TXPAGCaozfQUs59v4j4GFpWTaw0i6hAZSvOmu1J0uOEUg=="], - - "npm/retry": ["retry@0.12.0", "", {}, "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow=="], + "npm/read-cmd-shim": ["read-cmd-shim@7.0.1", "", {}, "sha512-GhAsW4iJS0xNqv8P6HocT3gb5HCKHtEBKLIN7fE2oWr27jGIEihu48lXyGGeexkbiLv1XAbwyXvgjYMfT81kZA=="], "npm/safer-buffer": ["safer-buffer@2.1.2", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="], - "npm/semver": ["semver@7.8.5", "", { "bundled": true, "bin": { "semver": "bin/semver.js" } }, "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA=="], - - "npm/shebang-command": ["shebang-command@2.0.0", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="], - - "npm/shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="], + "npm/semver": ["semver@7.8.6", "", { "bundled": true, "bin": { "semver": "bin/semver.js" } }, "sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw=="], "npm/signal-exit": ["signal-exit@4.1.0", "", {}, "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw=="], @@ -851,11 +821,9 @@ "npm/smart-buffer": ["smart-buffer@4.2.0", "", {}, "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg=="], - "npm/socks": ["socks@2.8.10", "", { "dependencies": { "ip-address": "^10.1.1", "smart-buffer": "^4.2.0" } }, "sha512-e0VyvkVTwVYViNovRkZ9aodhxVlyoMn7eJhVUPxZ+eK9P/7CBkxvvsBOHqFPEH416726W8tLXXXjKwqgTErrCQ=="], - - "npm/socks-proxy-agent": ["socks-proxy-agent@8.0.5", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "^4.3.4", "socks": "^2.8.3" } }, "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw=="], + "npm/socks": ["socks@2.8.11", "", { "dependencies": { "ip-address": "^10.1.1", "smart-buffer": "^4.2.0" } }, "sha512-2H/uQ7+SNP0hK16RorTak0mWrFoqo4AnAVGSUl2dT07obgWdWt9grml+VDl1LklgUOPWM4Abo0u86Cvp8vFjYw=="], - "npm/spdx-correct": ["spdx-correct@3.2.0", "", { "dependencies": { "spdx-expression-parse": "^3.0.0", "spdx-license-ids": "^3.0.0" } }, "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA=="], + "npm/socks-proxy-agent": ["socks-proxy-agent@10.1.0", "", { "dependencies": { "agent-base": "9.0.0", "debug": "^4.3.4", "socks": "^2.8.3" } }, "sha512-WlMj/67cEJ6MDI1OcsnjuYKDNDoyPCCYZ249kuuXPiMDw9F8PXkVaQ7YWu3siTydfQ/4BEZcvGzu+aYvz7dDCQ=="], "npm/spdx-exceptions": ["spdx-exceptions@2.5.0", "", {}, "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w=="], @@ -863,81 +831,61 @@ "npm/spdx-license-ids": ["spdx-license-ids@3.0.24", "", {}, "sha512-cLS9TtWkIQFyLkJ3/5aFQAOHOSKTlOs/7WDut/XPSdjom1fJhUdkepeJAKXa9Y05+FabHd0sti+Et559vDtkpQ=="], - "npm/ssri": ["ssri@12.0.0", "", { "dependencies": { "minipass": "^7.0.3" }, "bundled": true }, "sha512-S7iGNosepx9RadX82oimUkvr0Ct7IjJbEbs4mJcTxst8um95J3sDYU1RBEOvdu6oL1Wek2ODI5i4MAw+dZ6cAQ=="], - - "npm/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], - - "npm/string-width-cjs": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], + "npm/ssri": ["ssri@14.0.0", "", { "dependencies": { "minipass": "^7.0.3" }, "bundled": true }, "sha512-jQxKI0yx0ZnTKrqjKkLDV2DXkBQn3k49JVmVqDGcDwKDtGDbImD/GXsq04KD0VVzCQQ9wZJYal3RwR1GzWTSow=="], - "npm/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], + "npm/supports-color": ["supports-color@10.2.2", "", { "bundled": true }, "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g=="], - "npm/strip-ansi-cjs": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], - - "npm/supports-color": ["supports-color@9.4.0", "", { "bundled": true }, "sha512-VL+lNrEoIXww1coLPOmiEmK/0sGigko5COxI09KzHc2VJXJsQ37UaQ+8quuxjDeA7+KnLGTWRyOXSLLR2Wb4jw=="], - - "npm/tar": ["tar@7.5.22", "", { "dependencies": { "@isaacs/fs-minipass": "^4.0.0", "chownr": "^3.0.0", "minipass": "^7.1.2", "minizlib": "^3.1.0", "yallist": "^5.0.0" }, "bundled": true }, "sha512-MFO/QzvtAOmJbkhOaCTvbGcFN9L9b+JunIsDwaKljSOdcLMea3NJ1k9Usz/rjdfSXTq4dfzfeS7W4p4YOAAHeA=="], + "npm/tar": ["tar@7.5.24", "", { "dependencies": { "@isaacs/fs-minipass": "^4.0.0", "chownr": "^3.0.0", "minipass": "^7.1.2", "minizlib": "^3.1.0", "yallist": "^5.0.0" }, "bundled": true }, "sha512-to/OxuCk5DeVONcjjODT7aeoRq5NIPPlfPc0tNML+wLlnf6u5BcJz97Uukv3pT3jzorkFhUevylkAiBr+ZmV2w=="], "npm/text-table": ["text-table@0.2.0", "", { "bundled": true }, "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw=="], - "npm/tiny-relative-date": ["tiny-relative-date@1.3.0", "", { "bundled": true }, "sha512-MOQHpzllWxDCHHaDno30hhLfbouoYlOI8YlMNtvKe1zXbjEVhbcEovQxvZrPvtiYW630GQDoMMarCnjfyfHA+A=="], + "npm/tiny-relative-date": ["tiny-relative-date@2.0.2", "", { "bundled": true }, "sha512-rGxAbeL9z3J4pI2GtBEoFaavHdO4RKAU54hEuOef5kfx5aPqiQtbhYktMOTL5OA33db8BjsDcLXuNp+/v19PHw=="], "npm/tinyglobby": ["tinyglobby@0.2.17", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" } }, "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g=="], "npm/treeverse": ["treeverse@3.0.0", "", { "bundled": true }, "sha512-gcANaAnd2QDZFmHFEOF4k7uc1J/6a6z3DJMd/QwEyxLoKGiptJRwid582r7QIsFlFMIZ3SnxfS52S4hm2DHkuQ=="], - "npm/tuf-js": ["tuf-js@3.1.0", "", { "dependencies": { "@tufjs/models": "3.0.1", "debug": "^4.4.1", "make-fetch-happen": "^14.0.3" } }, "sha512-3T3T04WzowbwV2FDiGXBbr81t64g1MUGGJRgT4x5o97N+8ArdhVCAF9IxFrxuSJmM3E5Asn7nKHkao0ibcZXAg=="], - - "npm/undici": ["undici@6.29.1", "", {}, "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA=="], + "npm/tuf-js": ["tuf-js@6.0.3", "", { "dependencies": { "@gar/promise-retry": "^1.0.3", "@tufjs/models": "5.0.3", "debug": "^4.4.3" } }, "sha512-CQz50PPEMX20Fv7VMjsZLrCT7sb5TZ1I43h59JPO7AixmWBJKbgYNLBbRUYXI4dAR1/gdi964+XG7vxIN98wzQ=="], - "npm/unique-filename": ["unique-filename@4.0.0", "", { "dependencies": { "unique-slug": "^5.0.0" } }, "sha512-XSnEewXmQ+veP7xX2dS5Q4yZAvO40cBN2MWkJ7D/6sW4Dg6wYBNwM1Vrnz1FhH5AdeLIlUXRI9e28z1YZi71NQ=="], - - "npm/unique-slug": ["unique-slug@5.0.0", "", { "dependencies": { "imurmurhash": "^0.1.4" } }, "sha512-9OdaqO5kwqR+1kVgHAhsp5vPNU0hnxRa26rBFNfNgM7M6pNtgzeBn3s/xbyCQL3dcjzOatcef6UUHpB/6MaETg=="], + "npm/undici": ["undici@8.14.0", "", {}, "sha512-MqM6wqORYo0jb1WFUwFKZTFWFz6VeBMPj9op5Hq+RvlrQjISQCyLEfx5+/iqOLWC/LL1HliJ5t0NP1BgYpXeVQ=="], "npm/util-deprecate": ["util-deprecate@1.0.2", "", {}, "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="], - "npm/validate-npm-package-license": ["validate-npm-package-license@3.0.4", "", { "dependencies": { "spdx-correct": "^3.0.0", "spdx-expression-parse": "^3.0.0" } }, "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew=="], - - "npm/validate-npm-package-name": ["validate-npm-package-name@6.0.2", "", { "bundled": true }, "sha512-IUoow1YUtvoBBC06dXs8bR8B9vuA3aJfmQNKMoaPG/OFsPmoQvw8xh+6Ye25Gx9DQhoEom3Pcu9MKHerm/NpUQ=="], - - "npm/walk-up-path": ["walk-up-path@3.0.1", "", {}, "sha512-9YlCL/ynK3CTlrSRrDxZvUauLzAswPCrsaCgilqFevUYpeEW0/3ScEjaa3kbW/T0ghhkEr7mv+fpjqn1Y1YuTA=="], - - "npm/which": ["which@5.0.0", "", { "dependencies": { "isexe": "^3.1.1" }, "bundled": true, "bin": { "node-which": "bin/which.js" } }, "sha512-JEdGzHwwkrbWoGOlIHqQ5gtprKGOenpDHpxE9zVR1bWbOtYRyPPHMe9FaP6x61CmNaTThSkb0DAJte5jD+DmzQ=="], + "npm/validate-npm-package-name": ["validate-npm-package-name@8.0.0", "", { "bundled": true }, "sha512-SCv6OOV6Xj2/3cXy3dGmADluJTNcL3o7hZAglNPTe+WYuEuvxgJzxPrSDLZhF+CwyQOubqgecjMmTJGMVLWjYQ=="], - "npm/wrap-ansi": ["wrap-ansi@8.1.0", "", { "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", "strip-ansi": "^7.0.1" } }, "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ=="], + "npm/walk-up-path": ["walk-up-path@4.0.0", "", {}, "sha512-3hu+tD8YzSLGuFYtPRb48vdhKMi0KQV5sn+uWr8+7dMEq/2G/dtLrdDinkLjqq5TIbIBjYJ4Ax/n3YiaW7QM8A=="], - "npm/wrap-ansi-cjs": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], + "npm/which": ["which@7.0.0", "", { "dependencies": { "isexe": "^4.0.0" }, "bundled": true, "bin": { "node-which": "bin/which.js" } }, "sha512-RancgH2dmbLdHl6LRhEqvklWMgl/Hdnun0Y90KhBOLkMefg8Qa7/Zel8Sm+8HEcP6DEjzsWzpkuBQEZok58isA=="], - "npm/write-file-atomic": ["write-file-atomic@6.0.0", "", { "dependencies": { "imurmurhash": "^0.1.4", "signal-exit": "^4.0.1" }, "bundled": true }, "sha512-GmqrO8WJ1NuzJ2DrziEI2o57jKAVIQNf8a18W3nCYU3H7PNWqCCVTeH6/NQE93CIllIgQS98rrmVkYgTX9fFJQ=="], + "npm/write-file-atomic": ["write-file-atomic@8.0.0", "", { "dependencies": { "signal-exit": "^4.0.1" } }, "sha512-dYwyZredl67GyLLIHJnRM3h2PcOmN5SkcgC7eM5DPDEOEl6dLFqVrMg3F1Ea32usj4VSVZtd2H4MtKTNOf6nPg=="], "npm/yallist": ["yallist@5.0.0", "", {}, "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw=="], - "parse5-htmlparser2-tree-adapter/parse5": ["parse5@6.0.1", "", {}, "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw=="], + "npm-run-path/path-key": ["path-key@4.0.0", "", {}, "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ=="], - "read-pkg/parse-json": ["parse-json@8.3.0", "", { "dependencies": { "@babel/code-frame": "^7.26.2", "index-to-position": "^1.1.0", "type-fest": "^4.39.1" } }, "sha512-ybiGyvspI+fAoRQbIPRddCcSTV9/LsJbf0e/S85VLowVGzRmokfneg2kwVW/KU5rOXrPSbF1qAKPMgNTqqROQQ=="], + "parse5-htmlparser2-tree-adapter/parse5": ["parse5@6.0.1", "", {}, "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw=="], - "semantic-release/@semantic-release/error": ["@semantic-release/error@4.0.0", "", {}, "sha512-mgdxrHTLOjOddRVYIYDo0fR3/v61GNN1YGkfbrjuIKg/uMgCd+Qzo3UAXJ+woLQQpos4pl5Esuw5A7AoNlzjUQ=="], + "read-pkg/unicorn-magic": ["unicorn-magic@0.1.0", "", {}, "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ=="], - "semantic-release/aggregate-error": ["aggregate-error@5.0.0", "", { "dependencies": { "clean-stack": "^5.2.0", "indent-string": "^5.0.0" } }, "sha512-gOsf2YwSlleG6IjRYG2A7k0HmBMEo6qVNk9Bp/EaLgAJT5ngH6PXbqa4ItvnEwCm/velL5jAnQgsHsWnjhGmvw=="], + "semantic-release/@semantic-release/commit-analyzer": ["@semantic-release/commit-analyzer@14.0.0-beta.5", "", { "dependencies": { "conventional-changelog-angular": "^9.0.0", "conventional-changelog-conventionalcommits": "^10.0.0", "conventional-commits-filter": "^6.0.0", "conventional-commits-parser": "^7.0.0", "debug": "^4.0.0", "import-from-esm": "^2.0.0", "lodash-es": "^4.17.21", "micromatch": "^4.0.2" }, "peerDependencies": { "semantic-release": ">=20.1.0" } }, "sha512-fnmPi9LP8e1Ai0OhaF4ZdfNLlq2xJfxxKKvap/7GjRaPBGNmeTEC+1S3Q722DN+vO4yjSWUyaxmNJzRiiS21gw=="], - "semantic-release/execa": ["execa@9.6.1", "", { "dependencies": { "@sindresorhus/merge-streams": "^4.0.0", "cross-spawn": "^7.0.6", "figures": "^6.1.0", "get-stream": "^9.0.0", "human-signals": "^8.0.1", "is-plain-obj": "^4.1.0", "is-stream": "^4.0.1", "npm-run-path": "^6.0.0", "pretty-ms": "^9.2.0", "signal-exit": "^4.1.0", "strip-final-newline": "^4.0.0", "yoctocolors": "^2.1.1" } }, "sha512-9Be3ZoN4LmYR90tUoVu2te2BsbzHfhJyfEiAVfz7N5/zv+jduIfLrV2xdQXOHbaD6KgpGdO9PRPM1Y4Q9QkPkA=="], + "semantic-release/@semantic-release/release-notes-generator": ["@semantic-release/release-notes-generator@15.0.0-beta.4", "", { "dependencies": { "conventional-changelog-angular": "^9.0.0", "conventional-changelog-conventionalcommits": "^10.0.0", "conventional-changelog-writer": "^9.0.0", "conventional-commits-filter": "^6.0.0", "conventional-commits-parser": "^7.0.0", "debug": "^4.0.0", "import-from-esm": "^2.0.0", "lodash-es": "^4.17.21", "read-package-up": "^11.0.0" }, "peerDependencies": { "semantic-release": ">=20.1.0" } }, "sha512-LSyBUHHsrg+1MgzoXD4eBQGNBCBVCJfgFf2oU9L5pZ2B53Xhke6Apwp4IHIKiOONYEFnnzFmBdi5J0vEmipnig=="], - "semantic-release/p-reduce": ["p-reduce@3.0.0", "", {}, "sha512-xsrIUgI0Kn6iyDYm9StOpOeK29XM1aboGji26+QEortiFST1hGZaUQOLhtEbqHErPpGW/aSz6allwK2qcptp0Q=="], + "semantic-release/execa": ["execa@10.2.1", "", { "dependencies": { "@sindresorhus/merge-streams": "^4.0.0", "figures": "^6.1.0", "get-stream": "^9.0.1", "human-signals": "^8.0.1", "is-plain-obj": "^4.1.0", "is-stream": "^4.0.1", "npm-run-path": "^6.0.0", "pretty-ms": "^9.3.1", "signal-exit": "^4.1.0", "strip-final-newline": "^4.0.0", "which-command": "^0.1.0", "yoctocolors": "^2.2.0" } }, "sha512-/Bofl3ZBh2Q4/PG0W63qFzP5vDAypi8Zc90UWTBzaDNIYiX7apPOd0N6L8hG8CojUdq4V51adu8BObP+iVsSTw=="], "signale/chalk": ["chalk@2.4.2", "", { "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" } }, "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ=="], "signale/figures": ["figures@2.0.0", "", { "dependencies": { "escape-string-regexp": "^1.0.5" } }, "sha512-Oa2M9atig69ZkfwiApY8F2Yy+tzMbazyvqv21R0NsSC8floSOC09BbT1ITWAdoMGQvJ/aZnR1KMwdx9tvHnTNA=="], - "strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], - - "supports-hyperlinks/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], - "tempy/is-stream": ["is-stream@3.0.0", "", {}, "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA=="], "tempy/type-fest": ["type-fest@2.19.0", "", {}, "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA=="], "tinyglobby/picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="], - "wrap-ansi/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], + "wrap-ansi/ansi-styles": ["ansi-styles@6.2.3", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="], + + "wrap-ansi/string-width": ["string-width@7.2.0", "", { "dependencies": { "emoji-regex": "^10.3.0", "get-east-asian-width": "^1.0.0", "strip-ansi": "^7.1.0" } }, "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ=="], "@octokit/plugin-paginate-rest/@octokit/types/@octokit/openapi-types": ["@octokit/openapi-types@27.0.0", "", {}, "sha512-whrdktVs1h6gtR+09+QsNk2+FO+49j6ga1c55YZudfEG+oKJVvJLQi3zkOm5JjiUXAagWK2tI2kTGKJ2Ys7MGA=="], @@ -947,36 +895,42 @@ "@octokit/plugin-throttling/@octokit/types/@octokit/openapi-types": ["@octokit/openapi-types@28.0.0", "", {}, "sha512-0rFyLuyHvIj6uuZWuDslxkowFYdPXoNIkeAv4b27dzm2Tf4vGWXnPsMcxs7d65kLdMERgP3wc1AEPlqMz8e1cQ=="], - "@semantic-release/github/@octokit/plugin-paginate-rest/@octokit/types": ["@octokit/types@15.0.2", "", { "dependencies": { "@octokit/openapi-types": "^26.0.0" } }, "sha512-rR+5VRjhYSer7sC51krfCctQhVTmjyUMAaShfPB8mscVa8tSoLyon3coxQmXu0ahJoLVWl8dSGD/3OGZlFV44Q=="], + "@semantic-release/core/@semantic-release/commit-analyzer/conventional-changelog-angular": ["conventional-changelog-angular@9.4.0", "", { "dependencies": { "@conventional-changelog/template": "^1.4.0" } }, "sha512-HdxRxuS8bBXVIuo4V82gvSwAXT0vYQUizrjs/izmPg5JdDstr8v8I5hduGL3iQbG+o310dUDxC4+LetuS5hu9w=="], - "@semantic-release/github/aggregate-error/clean-stack": ["clean-stack@5.3.0", "", { "dependencies": { "escape-string-regexp": "5.0.0" } }, "sha512-9ngPTOhYGQqNVSfeJkYXHmF7AGWp4/nN5D/QqNQs3Dvxd1Kk/WpjHfNujKHYUQ/5CoGyOyFNoWSPk5afzP0QVg=="], + "@semantic-release/core/@semantic-release/commit-analyzer/conventional-commits-filter": ["conventional-commits-filter@6.0.1", "", {}, "sha512-cs+LadpH7Kpw0M3k8wurk+sOVVDAENA0iK4OBOrkL94j5lEVYRJ4j3zd2bhY9qgzyrPqthdcYT3axzRN7AliMg=="], - "@semantic-release/github/aggregate-error/indent-string": ["indent-string@5.0.0", "", {}, "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg=="], + "@semantic-release/core/@semantic-release/commit-analyzer/conventional-commits-parser": ["conventional-commits-parser@7.1.4", "", { "dependencies": { "@simple-libs/stream-utils": "^2.0.0", "argue-cli": "^3.1.0" }, "bin": { "conventional-commits-parser": "./dist/cli/index.js" } }, "sha512-TW3PZHi6hwF4cyu7KKc4kNqD1cgg8AkkK5ge9+zsEfpjaSXOeeIQyNWBr7kx5hR2wFuKVmr0be37RzcpmACQIA=="], - "@semantic-release/npm/aggregate-error/clean-stack": ["clean-stack@5.3.0", "", { "dependencies": { "escape-string-regexp": "5.0.0" } }, "sha512-9ngPTOhYGQqNVSfeJkYXHmF7AGWp4/nN5D/QqNQs3Dvxd1Kk/WpjHfNujKHYUQ/5CoGyOyFNoWSPk5afzP0QVg=="], + "@semantic-release/core/execa/get-stream": ["get-stream@9.0.1", "", { "dependencies": { "@sec-ant/readable-stream": "^0.4.1", "is-stream": "^4.0.1" } }, "sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA=="], - "@semantic-release/npm/aggregate-error/indent-string": ["indent-string@5.0.0", "", {}, "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg=="], + "@semantic-release/core/read-package-up/read-pkg": ["read-pkg@10.1.0", "", { "dependencies": { "@types/normalize-package-data": "^2.4.4", "normalize-package-data": "^8.0.0", "parse-json": "^8.3.0", "type-fest": "^5.4.4", "unicorn-magic": "^0.4.0" } }, "sha512-I8g2lArQiP78ll51UeMZojewtYgIRCKCWqZEgOO8c/uefTI+XDXvCSXu3+YNUaTNvZzobrL5+SqHjBrByRRTdg=="], - "@semantic-release/npm/execa/get-stream": ["get-stream@9.0.1", "", { "dependencies": { "@sec-ant/readable-stream": "^0.4.1", "is-stream": "^4.0.1" } }, "sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA=="], + "@semantic-release/core/read-package-up/type-fest": ["type-fest@5.10.0", "", { "dependencies": { "tagged-tag": "^1.0.0" } }, "sha512-NoSdpq/WEiAg5sjmBkmV/hfxv6HJH4NqPNrqjtSO5CwRmpsDfaf4begxW34KdJykH/l1yHtwBWQkCRdoXO8mPA=="], - "@semantic-release/npm/execa/human-signals": ["human-signals@8.0.1", "", {}, "sha512-eKCa6bwnJhvxj14kZk5NCPc6Hb6BdsU9DZcOnmQKSnO1VKrfV0zCvtttPZUsBvjmNDn8rpcJfpwSYnHBjc95MQ=="], + "@semantic-release/exec/aggregate-error/clean-stack": ["clean-stack@2.2.0", "", {}, "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A=="], - "@semantic-release/npm/execa/is-stream": ["is-stream@4.0.1", "", {}, "sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A=="], + "@semantic-release/exec/aggregate-error/indent-string": ["indent-string@4.0.0", "", {}, "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg=="], - "@semantic-release/npm/execa/npm-run-path": ["npm-run-path@6.0.0", "", { "dependencies": { "path-key": "^4.0.0", "unicorn-magic": "^0.3.0" } }, "sha512-9qny7Z9DsQU8Ou39ERsPU4OZQlSTP47ShQzuKZ6PRXpYLtIFgl/DEBYEXKlvcEa+9tHVcK8CF81Y2V72qaZhWA=="], + "@semantic-release/github/@octokit/plugin-paginate-rest/@octokit/types": ["@octokit/types@17.0.0", "", { "dependencies": { "@octokit/openapi-types": "^28.0.0" } }, "sha512-ByP1v7YL5SMveFPP7+sj0/ZuWCOOg/Chs4NafOMpq6WNIM/hdGY0S7C0TCGDBWu1aGmOxmUIhMx3cO+IdwYZ1Q=="], - "@semantic-release/npm/execa/signal-exit": ["signal-exit@4.1.0", "", {}, "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw=="], + "@semantic-release/npm/read-pkg/normalize-package-data": ["normalize-package-data@8.0.0", "", { "dependencies": { "hosted-git-info": "^9.0.0", "semver": "^7.3.5", "validate-npm-package-license": "^3.0.4" } }, "sha512-RWk+PI433eESQ7ounYxIp67CYuVsS1uYSonX3kA6ps/3LWfjVQa/ptEg6Y3T6uAMq1mWpX9PQ+qx+QaHpsc7gQ=="], - "@semantic-release/npm/execa/strip-final-newline": ["strip-final-newline@4.0.0", "", {}, "sha512-aulFJcD6YK8V1G7iRB5tigAP4TsHBZZrOV8pjV++zdUwmeV8uzbY7yn6h9MswN62adStNZFuCIx4haBnRuMDaw=="], + "@semantic-release/npm/read-pkg/type-fest": ["type-fest@5.10.0", "", { "dependencies": { "tagged-tag": "^1.0.0" } }, "sha512-NoSdpq/WEiAg5sjmBkmV/hfxv6HJH4NqPNrqjtSO5CwRmpsDfaf4begxW34KdJykH/l1yHtwBWQkCRdoXO8mPA=="], - "cli-highlight/chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], + "@semantic-release/npm/read-pkg/unicorn-magic": ["unicorn-magic@0.4.1", "", {}, "sha512-lzlXPoVB0Uy/FvTaUgX39RbixYiSKoc3JSoSf01+0c2B6FR3qdYIPN7Qjo/AV7n6sqLCk0509cT3LRj1oSZ1+A=="], - "cli-highlight/chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], + "cli-highlight/chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], "cli-highlight/yargs/cliui": ["cliui@7.0.4", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", "wrap-ansi": "^7.0.0" } }, "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ=="], + "cli-highlight/yargs/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], + "cli-highlight/yargs/yargs-parser": ["yargs-parser@20.2.9", "", {}, "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w=="], + "cli-table3/string-width/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], + + "cliui/string-width/emoji-regex": ["emoji-regex@10.6.0", "", {}, "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A=="], + "env-ci/execa/get-stream": ["get-stream@8.0.1", "", {}, "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA=="], "env-ci/execa/human-signals": ["human-signals@5.0.0", "", {}, "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ=="], @@ -985,36 +939,28 @@ "env-ci/execa/npm-run-path": ["npm-run-path@5.3.0", "", { "dependencies": { "path-key": "^4.0.0" } }, "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ=="], - "env-ci/execa/onetime": ["onetime@6.0.0", "", { "dependencies": { "mimic-fn": "^4.0.0" } }, "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ=="], - - "env-ci/execa/signal-exit": ["signal-exit@4.1.0", "", {}, "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw=="], - "env-ci/execa/strip-final-newline": ["strip-final-newline@3.0.0", "", {}, "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw=="], - "npm/@isaacs/cliui/string-width": ["string-width@5.1.2", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="], + "normalize-package-data/hosted-git-info/lru-cache": ["lru-cache@10.4.3", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="], - "npm/@isaacs/cliui/strip-ansi": ["strip-ansi@7.2.0", "", { "dependencies": { "ansi-regex": "^6.2.2" } }, "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w=="], + "npm/@npmcli/map-workspaces/glob": ["glob@14.0.7", "", { "dependencies": { "minimatch": "^11.0.5", "minipass": "^7.1.3", "path-scurry": "^3.0.0" } }, "sha512-ob8P0VbyEjcLG2ycNYmzYhZj65kkcN5b7tt5moGhTq3rkXtuU8MB+i0GIzPtLnSHVF2DkK4M+nQRojDvsOGVJw=="], - "npm/@sigstore/bundle/@sigstore/protobuf-specs": ["@sigstore/protobuf-specs@0.5.2", "", {}, "sha512-SQqvFMt4V78fdjcDdYX6HbiVSOR4QK3ZgwCa2KOsopAgPIHy1rU5UDUmzLl02r5oyyaYcYHR1hpwDRk/yUe+Mw=="], + "npm/@npmcli/map-workspaces/minimatch": ["minimatch@11.0.9", "", { "dependencies": { "@isaacs/nonrecursive-glob-match": "^1.1.0", "brace-expansion": "^5.0.12" } }, "sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q=="], - "npm/@sigstore/sign/@sigstore/protobuf-specs": ["@sigstore/protobuf-specs@0.5.2", "", {}, "sha512-SQqvFMt4V78fdjcDdYX6HbiVSOR4QK3ZgwCa2KOsopAgPIHy1rU5UDUmzLl02r5oyyaYcYHR1hpwDRk/yUe+Mw=="], + "npm/@npmcli/package-json/glob": ["glob@14.0.7", "", { "dependencies": { "minimatch": "^11.0.5", "minipass": "^7.1.3", "path-scurry": "^3.0.0" } }, "sha512-ob8P0VbyEjcLG2ycNYmzYhZj65kkcN5b7tt5moGhTq3rkXtuU8MB+i0GIzPtLnSHVF2DkK4M+nQRojDvsOGVJw=="], "npm/@sigstore/sign/make-fetch-happen": ["make-fetch-happen@15.0.6", "", { "dependencies": { "@gar/promise-retry": "^1.0.0", "@npmcli/agent": "^4.0.0", "@npmcli/redact": "^4.0.0", "cacache": "^20.0.1", "http-cache-semantics": "^4.1.1", "minipass": "^7.0.2", "minipass-fetch": "^5.0.0", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", "negotiator": "^1.0.0", "proc-log": "^6.0.0", "ssri": "^13.0.0" } }, "sha512-Je0fLJ0F5atA7F+eIlLzk+Wkcl57JDf4kf+EW8xiP5E31xOQxkIxTbgf1Oi1Lw9tRI9UEMRdI5Vz2xTzoNU1Jw=="], "npm/@sigstore/sign/proc-log": ["proc-log@6.1.0", "", {}, "sha512-iG+GYldRf2BQ0UDUAd6JQ/RwzaQy6mXmsk/IzlYyal4A4SNFw54MeH4/tLkF4I5WoWG9SQwuqWzS99jaFQHBuQ=="], - "npm/@sigstore/verify/@sigstore/protobuf-specs": ["@sigstore/protobuf-specs@0.5.2", "", {}, "sha512-SQqvFMt4V78fdjcDdYX6HbiVSOR4QK3ZgwCa2KOsopAgPIHy1rU5UDUmzLl02r5oyyaYcYHR1hpwDRk/yUe+Mw=="], - - "npm/cross-spawn/which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="], + "npm/@tufjs/models/minimatch": ["minimatch@11.0.9", "", { "dependencies": { "@isaacs/nonrecursive-glob-match": "^1.1.0", "brace-expansion": "^5.0.12" } }, "sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q=="], - "npm/ignore-walk/minimatch": ["minimatch@10.2.6", "", { "dependencies": { "brace-expansion": "^5.0.8" } }, "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A=="], + "npm/cacache/glob": ["glob@14.0.7", "", { "dependencies": { "minimatch": "^11.0.5", "minipass": "^7.1.3", "path-scurry": "^3.0.0" } }, "sha512-ob8P0VbyEjcLG2ycNYmzYhZj65kkcN5b7tt5moGhTq3rkXtuU8MB+i0GIzPtLnSHVF2DkK4M+nQRojDvsOGVJw=="], "npm/minipass-flush/minipass": ["minipass@3.3.6", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw=="], "npm/minipass-pipeline/minipass": ["minipass@3.3.6", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw=="], - "npm/minipass-sized/minipass": ["minipass@3.3.6", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw=="], - "npm/npm-packlist/proc-log": ["proc-log@6.1.0", "", {}, "sha512-iG+GYldRf2BQ0UDUAd6JQ/RwzaQy6mXmsk/IzlYyal4A4SNFw54MeH4/tLkF4I5WoWG9SQwuqWzS99jaFQHBuQ=="], "npm/pacote/@npmcli/git": ["@npmcli/git@7.0.2", "", { "dependencies": { "@gar/promise-retry": "^1.0.0", "@npmcli/promise-spawn": "^9.0.0", "ini": "^6.0.0", "lru-cache": "^11.2.1", "npm-pick-manifest": "^11.0.1", "proc-log": "^6.0.0", "semver": "^7.3.5", "which": "^6.0.0" } }, "sha512-oeolHDjExNAJAnlYP2qzNjMX/Xi9bmu78C9dIGr4xjobrSKbuMYCph8lTzn4vnW3NjIqVmw/f8BCfouqyJXlRg=="], @@ -1023,7 +969,7 @@ "npm/pacote/@npmcli/package-json": ["@npmcli/package-json@7.0.5", "", { "dependencies": { "@npmcli/git": "^7.0.0", "glob": "^13.0.0", "hosted-git-info": "^9.0.0", "json-parse-even-better-errors": "^5.0.0", "proc-log": "^6.0.0", "semver": "^7.5.3", "spdx-expression-parse": "^4.0.0" } }, "sha512-iVuTlG3ORq2iaVa1IWUxAO/jIp77tUKBhoMjuzYW2kL4MLN1bi/ofqkZ7D7OOwh8coAx1/S2ge0rMdGv8sLSOQ=="], - "npm/pacote/@npmcli/promise-spawn": ["@npmcli/promise-spawn@9.0.1", "", { "dependencies": { "which": "^6.0.0" } }, "sha512-OLUaoqBuyxeTqUvjA3FZFiXUfYC1alp3Sa99gW3EUDz3tZ3CbXDdcZ7qWKBzicrJleIgucoWamWH1saAmH/l2Q=="], + "npm/pacote/@npmcli/promise-spawn": ["@npmcli/promise-spawn@9.0.2", "", { "dependencies": { "which": "^6.0.0" } }, "sha512-h7b1j0egrruBm/32eVA6/zMw5VJxxaB3vT+uVGGQ4SAAMrQVFHNuzL4+EAXn66j+huj0jApINc1fW3fC+kVoeA=="], "npm/pacote/@npmcli/run-script": ["@npmcli/run-script@10.0.4", "", { "dependencies": { "@npmcli/node-gyp": "^5.0.0", "@npmcli/package-json": "^7.0.0", "@npmcli/promise-spawn": "^9.0.0", "node-gyp": "^12.1.0", "proc-log": "^6.0.0" } }, "sha512-mGUWr1uMnf0le2TwfOZY4SFxZGXGfm4Jtay/nwAa2FLNAKXUoUwaGwBMNH36UHPtinWfTSJ3nqFQr0091CxVGg=="], @@ -1039,59 +985,57 @@ "npm/pacote/ssri": ["ssri@13.0.1", "", { "dependencies": { "minipass": "^7.0.3" } }, "sha512-QUiRf1+u9wPTL/76GTYlKttDEBWV1ga9ZXW8BG6kfdeyyM8LGPix9gROyg9V2+P0xNyF3X2Go526xKFdMZrHSQ=="], - "npm/sigstore/@sigstore/protobuf-specs": ["@sigstore/protobuf-specs@0.5.2", "", {}, "sha512-SQqvFMt4V78fdjcDdYX6HbiVSOR4QK3ZgwCa2KOsopAgPIHy1rU5UDUmzLl02r5oyyaYcYHR1hpwDRk/yUe+Mw=="], - "npm/sigstore/@sigstore/tuf": ["@sigstore/tuf@4.0.2", "", { "dependencies": { "@sigstore/protobuf-specs": "^0.5.0", "tuf-js": "^4.1.0" } }, "sha512-TCAzTy0xzdP79EnxSjq9KQ3eaR7+FmudLC6eRKknVKZbV7ZNlGLClAAQb/HMNJ5n2OBNk2GT1tEmU0xuPr+SLQ=="], - "npm/spdx-correct/spdx-expression-parse": ["spdx-expression-parse@3.0.1", "", { "dependencies": { "spdx-exceptions": "^2.1.0", "spdx-license-ids": "^3.0.0" } }, "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q=="], + "semantic-release/@semantic-release/commit-analyzer/conventional-changelog-angular": ["conventional-changelog-angular@9.4.0", "", { "dependencies": { "@conventional-changelog/template": "^1.4.0" } }, "sha512-HdxRxuS8bBXVIuo4V82gvSwAXT0vYQUizrjs/izmPg5JdDstr8v8I5hduGL3iQbG+o310dUDxC4+LetuS5hu9w=="], - "npm/validate-npm-package-license/spdx-expression-parse": ["spdx-expression-parse@3.0.1", "", { "dependencies": { "spdx-exceptions": "^2.1.0", "spdx-license-ids": "^3.0.0" } }, "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q=="], + "semantic-release/@semantic-release/commit-analyzer/conventional-commits-filter": ["conventional-commits-filter@6.0.1", "", {}, "sha512-cs+LadpH7Kpw0M3k8wurk+sOVVDAENA0iK4OBOrkL94j5lEVYRJ4j3zd2bhY9qgzyrPqthdcYT3axzRN7AliMg=="], - "npm/wrap-ansi/string-width": ["string-width@5.1.2", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="], + "semantic-release/@semantic-release/commit-analyzer/conventional-commits-parser": ["conventional-commits-parser@7.1.4", "", { "dependencies": { "@simple-libs/stream-utils": "^2.0.0", "argue-cli": "^3.1.0" }, "bin": { "conventional-commits-parser": "./dist/cli/index.js" } }, "sha512-TW3PZHi6hwF4cyu7KKc4kNqD1cgg8AkkK5ge9+zsEfpjaSXOeeIQyNWBr7kx5hR2wFuKVmr0be37RzcpmACQIA=="], - "npm/wrap-ansi/strip-ansi": ["strip-ansi@7.2.0", "", { "dependencies": { "ansi-regex": "^6.2.2" } }, "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w=="], + "semantic-release/@semantic-release/release-notes-generator/conventional-changelog-angular": ["conventional-changelog-angular@9.4.0", "", { "dependencies": { "@conventional-changelog/template": "^1.4.0" } }, "sha512-HdxRxuS8bBXVIuo4V82gvSwAXT0vYQUizrjs/izmPg5JdDstr8v8I5hduGL3iQbG+o310dUDxC4+LetuS5hu9w=="], - "npm/wrap-ansi-cjs/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], + "semantic-release/@semantic-release/release-notes-generator/conventional-changelog-writer": ["conventional-changelog-writer@9.3.0", "", { "dependencies": { "@conventional-changelog/template": "^1.4.0", "@simple-libs/stream-utils": "^2.0.0", "argue-cli": "^3.1.0", "conventional-commits-filter": "^6.0.1", "verkit": "^0.5.0" }, "bin": { "conventional-changelog-writer": "./dist/cli/index.js" } }, "sha512-lxiECDlvy880e7JIYAtAhxg0wD/CGCVbZCdeua5aOlQVFTEd39zAeOzwK22i/FO4xnEOURK1gbUTETNEYW7zxQ=="], - "semantic-release/aggregate-error/clean-stack": ["clean-stack@5.3.0", "", { "dependencies": { "escape-string-regexp": "5.0.0" } }, "sha512-9ngPTOhYGQqNVSfeJkYXHmF7AGWp4/nN5D/QqNQs3Dvxd1Kk/WpjHfNujKHYUQ/5CoGyOyFNoWSPk5afzP0QVg=="], + "semantic-release/@semantic-release/release-notes-generator/conventional-commits-filter": ["conventional-commits-filter@6.0.1", "", {}, "sha512-cs+LadpH7Kpw0M3k8wurk+sOVVDAENA0iK4OBOrkL94j5lEVYRJ4j3zd2bhY9qgzyrPqthdcYT3axzRN7AliMg=="], - "semantic-release/aggregate-error/indent-string": ["indent-string@5.0.0", "", {}, "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg=="], + "semantic-release/@semantic-release/release-notes-generator/conventional-commits-parser": ["conventional-commits-parser@7.1.4", "", { "dependencies": { "@simple-libs/stream-utils": "^2.0.0", "argue-cli": "^3.1.0" }, "bin": { "conventional-commits-parser": "./dist/cli/index.js" } }, "sha512-TW3PZHi6hwF4cyu7KKc4kNqD1cgg8AkkK5ge9+zsEfpjaSXOeeIQyNWBr7kx5hR2wFuKVmr0be37RzcpmACQIA=="], - "semantic-release/execa/get-stream": ["get-stream@9.0.1", "", { "dependencies": { "@sec-ant/readable-stream": "^0.4.1", "is-stream": "^4.0.1" } }, "sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA=="], + "signale/chalk/escape-string-regexp": ["escape-string-regexp@1.0.5", "", {}, "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg=="], - "semantic-release/execa/human-signals": ["human-signals@8.0.1", "", {}, "sha512-eKCa6bwnJhvxj14kZk5NCPc6Hb6BdsU9DZcOnmQKSnO1VKrfV0zCvtttPZUsBvjmNDn8rpcJfpwSYnHBjc95MQ=="], + "signale/chalk/supports-color": ["supports-color@5.5.0", "", { "dependencies": { "has-flag": "^3.0.0" } }, "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow=="], - "semantic-release/execa/is-stream": ["is-stream@4.0.1", "", {}, "sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A=="], + "signale/figures/escape-string-regexp": ["escape-string-regexp@1.0.5", "", {}, "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg=="], - "semantic-release/execa/npm-run-path": ["npm-run-path@6.0.0", "", { "dependencies": { "path-key": "^4.0.0", "unicorn-magic": "^0.3.0" } }, "sha512-9qny7Z9DsQU8Ou39ERsPU4OZQlSTP47ShQzuKZ6PRXpYLtIFgl/DEBYEXKlvcEa+9tHVcK8CF81Y2V72qaZhWA=="], + "wrap-ansi/string-width/emoji-regex": ["emoji-regex@10.6.0", "", {}, "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A=="], - "semantic-release/execa/signal-exit": ["signal-exit@4.1.0", "", {}, "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw=="], + "@semantic-release/core/@semantic-release/commit-analyzer/conventional-commits-parser/@simple-libs/stream-utils": ["@simple-libs/stream-utils@2.0.0", "", {}, "sha512-fCTuZK4QBa+39Oz9l4OGfJfz+GpwCp3AqO7Zch3to99xHPgstVsRFpeQ8LNd2o1Gv8raL2mCFwiaHh7bFSp5DQ=="], - "semantic-release/execa/strip-final-newline": ["strip-final-newline@4.0.0", "", {}, "sha512-aulFJcD6YK8V1G7iRB5tigAP4TsHBZZrOV8pjV++zdUwmeV8uzbY7yn6h9MswN62adStNZFuCIx4haBnRuMDaw=="], + "@semantic-release/core/read-package-up/read-pkg/normalize-package-data": ["normalize-package-data@8.0.0", "", { "dependencies": { "hosted-git-info": "^9.0.0", "semver": "^7.3.5", "validate-npm-package-license": "^3.0.4" } }, "sha512-RWk+PI433eESQ7ounYxIp67CYuVsS1uYSonX3kA6ps/3LWfjVQa/ptEg6Y3T6uAMq1mWpX9PQ+qx+QaHpsc7gQ=="], - "signale/chalk/escape-string-regexp": ["escape-string-regexp@1.0.5", "", {}, "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg=="], + "@semantic-release/core/read-package-up/read-pkg/unicorn-magic": ["unicorn-magic@0.4.1", "", {}, "sha512-lzlXPoVB0Uy/FvTaUgX39RbixYiSKoc3JSoSf01+0c2B6FR3qdYIPN7Qjo/AV7n6sqLCk0509cT3LRj1oSZ1+A=="], - "signale/chalk/supports-color": ["supports-color@5.5.0", "", { "dependencies": { "has-flag": "^3.0.0" } }, "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow=="], + "@semantic-release/github/@octokit/plugin-paginate-rest/@octokit/types/@octokit/openapi-types": ["@octokit/openapi-types@28.0.0", "", {}, "sha512-0rFyLuyHvIj6uuZWuDslxkowFYdPXoNIkeAv4b27dzm2Tf4vGWXnPsMcxs7d65kLdMERgP3wc1AEPlqMz8e1cQ=="], - "signale/figures/escape-string-regexp": ["escape-string-regexp@1.0.5", "", {}, "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg=="], + "@semantic-release/npm/read-pkg/normalize-package-data/hosted-git-info": ["hosted-git-info@9.0.3", "", { "dependencies": { "lru-cache": "^11.1.0" } }, "sha512-Hc+ghLoSt6QaYZUv0WBiIvmMDZuZZ7oaDvdH8MbfOO4lOsxdXLEvuC6ePoGs9H1X9oCLyq6+NVN0MKqD+ydxyg=="], - "wrap-ansi/ansi-styles/color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], + "cli-highlight/chalk/ansi-styles/color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], - "@semantic-release/github/@octokit/plugin-paginate-rest/@octokit/types/@octokit/openapi-types": ["@octokit/openapi-types@26.0.0", "", {}, "sha512-7AtcfKtpo77j7Ts73b4OWhOZHTKo/gGY8bB3bNBQz4H+GRSWqx2yvj8TXRsbdTE0eRmYmXOEY66jM7mJ7LzfsA=="], + "cli-highlight/yargs/cliui/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], - "@semantic-release/npm/execa/npm-run-path/path-key": ["path-key@4.0.0", "", {}, "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ=="], + "cli-highlight/yargs/cliui/wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], - "@semantic-release/npm/execa/npm-run-path/unicorn-magic": ["unicorn-magic@0.3.0", "", {}, "sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA=="], + "cli-highlight/yargs/string-width/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], - "cli-highlight/chalk/ansi-styles/color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], + "cli-table3/string-width/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], "env-ci/execa/npm-run-path/path-key": ["path-key@4.0.0", "", {}, "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ=="], - "env-ci/execa/onetime/mimic-fn": ["mimic-fn@4.0.0", "", {}, "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw=="], + "npm/@npmcli/map-workspaces/glob/path-scurry": ["path-scurry@3.0.3", "", { "dependencies": { "lru-cache": "^11.0.0", "minipass": "^7.1.2" } }, "sha512-Ie3c3F+7WJOUCr0r8V8uEunY5Sj4PGFDoBZvFw7JmHJs/+H5GZK+GsIM8tHMcZy7c27Zj+U1NOcVzqlC7tBJpg=="], - "npm/@isaacs/cliui/string-width/emoji-regex": ["emoji-regex@9.2.2", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="], + "npm/@npmcli/package-json/glob/minimatch": ["minimatch@11.0.9", "", { "dependencies": { "@isaacs/nonrecursive-glob-match": "^1.1.0", "brace-expansion": "^5.0.12" } }, "sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q=="], - "npm/@isaacs/cliui/strip-ansi/ansi-regex": ["ansi-regex@6.4.0", "", {}, "sha512-KzTVk2tCWAHtYrvvvaP8bJKJq2pVinhLcGEQdtLIYPbmNGNyYe8QwNaTUYQp2J7/vIsUKt5QCqAfUkYyG9DkOw=="], + "npm/@npmcli/package-json/glob/path-scurry": ["path-scurry@3.0.3", "", { "dependencies": { "lru-cache": "^11.0.0", "minipass": "^7.1.2" } }, "sha512-Ie3c3F+7WJOUCr0r8V8uEunY5Sj4PGFDoBZvFw7JmHJs/+H5GZK+GsIM8tHMcZy7c27Zj+U1NOcVzqlC7tBJpg=="], "npm/@sigstore/sign/make-fetch-happen/@npmcli/agent": ["@npmcli/agent@4.0.2", "", { "dependencies": { "agent-base": "^7.1.0", "http-proxy-agent": "^7.0.0", "https-proxy-agent": "^7.0.1", "lru-cache": "^11.2.1", "socks-proxy-agent": "^8.0.3" } }, "sha512-EUEuWAxnL07Sp5/iC/1X6Xj+XThUvnbei9zfRWZdEXa7lss9RTHMhAHBeg+MZ5To9s/gGaSI+UwZTPdYMvKSeg=="], @@ -1103,28 +1047,22 @@ "npm/@sigstore/sign/make-fetch-happen/ssri": ["ssri@13.0.1", "", { "dependencies": { "minipass": "^7.0.3" } }, "sha512-QUiRf1+u9wPTL/76GTYlKttDEBWV1ga9ZXW8BG6kfdeyyM8LGPix9gROyg9V2+P0xNyF3X2Go526xKFdMZrHSQ=="], - "npm/cross-spawn/which/isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="], + "npm/cacache/glob/minimatch": ["minimatch@11.0.9", "", { "dependencies": { "@isaacs/nonrecursive-glob-match": "^1.1.0", "brace-expansion": "^5.0.12" } }, "sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q=="], - "npm/ignore-walk/minimatch/brace-expansion": ["brace-expansion@5.0.12", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ=="], + "npm/cacache/glob/path-scurry": ["path-scurry@3.0.3", "", { "dependencies": { "lru-cache": "^11.0.0", "minipass": "^7.1.2" } }, "sha512-Ie3c3F+7WJOUCr0r8V8uEunY5Sj4PGFDoBZvFw7JmHJs/+H5GZK+GsIM8tHMcZy7c27Zj+U1NOcVzqlC7tBJpg=="], "npm/minipass-flush/minipass/yallist": ["yallist@4.0.0", "", {}, "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="], "npm/minipass-pipeline/minipass/yallist": ["yallist@4.0.0", "", {}, "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="], - "npm/minipass-sized/minipass/yallist": ["yallist@4.0.0", "", {}, "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="], - "npm/pacote/@npmcli/git/ini": ["ini@6.0.0", "", {}, "sha512-IBTdIkzZNOpqm7q3dRqJvMaldXjDHWkEDfrwGEQTs5eaQMWV+djAhR+wahyNNMAa+qpbDUhBMVt4ZKNwpPm7xQ=="], - "npm/pacote/@npmcli/git/lru-cache": ["lru-cache@11.5.3", "", {}, "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg=="], - "npm/pacote/@npmcli/git/which": ["which@6.0.1", "", { "dependencies": { "isexe": "^4.0.0" }, "bin": { "node-which": "bin/which.js" } }, "sha512-oGLe46MIrCRqX7ytPUf66EAYvdeMIZYn3WaocqqKZAxrBpkqHfL/qvTyJ/bTk5+AqHCjXmrv3CEWgy368zhRUg=="], "npm/pacote/@npmcli/installed-package-contents/npm-bundled": ["npm-bundled@5.0.0", "", { "dependencies": { "npm-normalize-package-bin": "^5.0.0" } }, "sha512-JLSpbzh6UUXIEoqPsYBvVNVmyrjVZ1fzEFbqxKkTJQkWBO3xFzFT+KDnSKQWwOQNbuWRwt5LSD6HOTLGIWzfrw=="], "npm/pacote/@npmcli/installed-package-contents/npm-normalize-package-bin": ["npm-normalize-package-bin@5.0.0", "", {}, "sha512-CJi3OS4JLsNMmr2u07OJlhcrPxCeOeP/4xq67aWNai6TNWWbTrlNDgl8NcFKVlcBKp18GPj+EzbNIgrBfZhsag=="], - "npm/pacote/@npmcli/package-json/glob": ["glob@13.0.6", "", { "dependencies": { "minimatch": "^10.2.2", "minipass": "^7.1.3", "path-scurry": "^2.0.2" } }, "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw=="], - "npm/pacote/@npmcli/package-json/hosted-git-info": ["hosted-git-info@9.0.3", "", { "dependencies": { "lru-cache": "^11.1.0" } }, "sha512-Hc+ghLoSt6QaYZUv0WBiIvmMDZuZZ7oaDvdH8MbfOO4lOsxdXLEvuC6ePoGs9H1X9oCLyq6+NVN0MKqD+ydxyg=="], "npm/pacote/@npmcli/package-json/json-parse-even-better-errors": ["json-parse-even-better-errors@5.0.0", "", {}, "sha512-ZF1nxZ28VhQouRWhUcVlUIN3qwSgPuswK05s/HIaoetAoE/9tngVmCHjSxmSQPav1nd+lPtTL0YZ/2AFdR/iYQ=="], @@ -1137,10 +1075,6 @@ "npm/pacote/cacache/@npmcli/fs": ["@npmcli/fs@5.0.0", "", { "dependencies": { "semver": "^7.3.5" } }, "sha512-7OsC1gNORBEawOa5+j2pXN9vsicaIOH5cPXxoR6fJOmH6/EXpJB2CajXOu1fPRFun2m1lktEFX11+P89hqO/og=="], - "npm/pacote/cacache/glob": ["glob@13.0.6", "", { "dependencies": { "minimatch": "^10.2.2", "minipass": "^7.1.3", "path-scurry": "^2.0.2" } }, "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw=="], - - "npm/pacote/cacache/lru-cache": ["lru-cache@11.5.3", "", {}, "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg=="], - "npm/pacote/npm-package-arg/hosted-git-info": ["hosted-git-info@9.0.3", "", { "dependencies": { "lru-cache": "^11.1.0" } }, "sha512-Hc+ghLoSt6QaYZUv0WBiIvmMDZuZZ7oaDvdH8MbfOO4lOsxdXLEvuC6ePoGs9H1X9oCLyq6+NVN0MKqD+ydxyg=="], "npm/pacote/npm-package-arg/validate-npm-package-name": ["validate-npm-package-name@7.0.2", "", {}, "sha512-hVDIBwsRruT73PbK7uP5ebUt+ezEtCmzZz3F59BSr2F6OVFnJ/6h8liuvdLrQ88Xmnk6/+xGGuq+pG9WwTuy3A=="], @@ -1157,81 +1091,57 @@ "npm/sigstore/@sigstore/tuf/tuf-js": ["tuf-js@4.1.0", "", { "dependencies": { "@tufjs/models": "4.1.0", "debug": "^4.4.3", "make-fetch-happen": "^15.0.1" } }, "sha512-50QV99kCKH5P/Vs4E2Gzp7BopNV+KzTXqWeaxrfu5IQJBOULRsTIS9seSsOVT8ZnGXzCyx55nYWAi4qJzpZKEQ=="], - "npm/wrap-ansi/string-width/emoji-regex": ["emoji-regex@9.2.2", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="], - - "npm/wrap-ansi/strip-ansi/ansi-regex": ["ansi-regex@6.4.0", "", {}, "sha512-KzTVk2tCWAHtYrvvvaP8bJKJq2pVinhLcGEQdtLIYPbmNGNyYe8QwNaTUYQp2J7/vIsUKt5QCqAfUkYyG9DkOw=="], + "semantic-release/@semantic-release/commit-analyzer/conventional-commits-parser/@simple-libs/stream-utils": ["@simple-libs/stream-utils@2.0.0", "", {}, "sha512-fCTuZK4QBa+39Oz9l4OGfJfz+GpwCp3AqO7Zch3to99xHPgstVsRFpeQ8LNd2o1Gv8raL2mCFwiaHh7bFSp5DQ=="], - "semantic-release/execa/npm-run-path/path-key": ["path-key@4.0.0", "", {}, "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ=="], + "semantic-release/@semantic-release/release-notes-generator/conventional-changelog-writer/@simple-libs/stream-utils": ["@simple-libs/stream-utils@2.0.0", "", {}, "sha512-fCTuZK4QBa+39Oz9l4OGfJfz+GpwCp3AqO7Zch3to99xHPgstVsRFpeQ8LNd2o1Gv8raL2mCFwiaHh7bFSp5DQ=="], - "semantic-release/execa/npm-run-path/unicorn-magic": ["unicorn-magic@0.3.0", "", {}, "sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA=="], + "semantic-release/@semantic-release/release-notes-generator/conventional-commits-parser/@simple-libs/stream-utils": ["@simple-libs/stream-utils@2.0.0", "", {}, "sha512-fCTuZK4QBa+39Oz9l4OGfJfz+GpwCp3AqO7Zch3to99xHPgstVsRFpeQ8LNd2o1Gv8raL2mCFwiaHh7bFSp5DQ=="], "signale/chalk/supports-color/has-flag": ["has-flag@3.0.0", "", {}, "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw=="], - "wrap-ansi/ansi-styles/color-convert/color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], + "@semantic-release/core/read-package-up/read-pkg/normalize-package-data/hosted-git-info": ["hosted-git-info@9.0.3", "", { "dependencies": { "lru-cache": "^11.1.0" } }, "sha512-Hc+ghLoSt6QaYZUv0WBiIvmMDZuZZ7oaDvdH8MbfOO4lOsxdXLEvuC6ePoGs9H1X9oCLyq6+NVN0MKqD+ydxyg=="], "cli-highlight/chalk/ansi-styles/color-convert/color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], - "npm/@sigstore/sign/make-fetch-happen/@npmcli/agent/lru-cache": ["lru-cache@11.5.3", "", {}, "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg=="], - - "npm/@sigstore/sign/make-fetch-happen/cacache/@npmcli/fs": ["@npmcli/fs@5.0.0", "", { "dependencies": { "semver": "^7.3.5" } }, "sha512-7OsC1gNORBEawOa5+j2pXN9vsicaIOH5cPXxoR6fJOmH6/EXpJB2CajXOu1fPRFun2m1lktEFX11+P89hqO/og=="], - - "npm/@sigstore/sign/make-fetch-happen/cacache/glob": ["glob@13.0.6", "", { "dependencies": { "minimatch": "^10.2.2", "minipass": "^7.1.3", "path-scurry": "^2.0.2" } }, "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw=="], - - "npm/@sigstore/sign/make-fetch-happen/cacache/lru-cache": ["lru-cache@11.5.3", "", {}, "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg=="], + "cli-highlight/yargs/cliui/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], - "npm/@sigstore/sign/make-fetch-happen/minipass-fetch/iconv-lite": ["iconv-lite@0.7.3", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ=="], + "cli-highlight/yargs/cliui/wrap-ansi/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], - "npm/@sigstore/sign/make-fetch-happen/minipass-fetch/minipass-sized": ["minipass-sized@2.0.0", "", { "dependencies": { "minipass": "^7.1.2" } }, "sha512-zSsHhto5BcUVM2m1LurnXY6M//cGhVaegT71OfOXoprxT6o780GZd792ea6FfrQkuU4usHZIUczAQMRUE2plzA=="], + "cli-highlight/yargs/string-width/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], - "npm/ignore-walk/minimatch/brace-expansion/balanced-match": ["balanced-match@4.0.4", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="], + "npm/@sigstore/sign/make-fetch-happen/@npmcli/agent/agent-base": ["agent-base@7.1.4", "", {}, "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ=="], - "npm/pacote/@npmcli/git/which/isexe": ["isexe@4.0.0", "", {}, "sha512-FFUtZMpoZ8RqHS3XeXEmHWLA4thH+ZxCv2lOiPIn1Xc7CxrqhWzNSDzD+/chS/zbYezmiwWLdQC09JdQKmthOw=="], + "npm/@sigstore/sign/make-fetch-happen/@npmcli/agent/http-proxy-agent": ["http-proxy-agent@7.0.2", "", { "dependencies": { "agent-base": "^7.1.0", "debug": "^4.3.4" } }, "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig=="], - "npm/pacote/@npmcli/package-json/glob/minimatch": ["minimatch@10.2.6", "", { "dependencies": { "brace-expansion": "^5.0.8" } }, "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A=="], + "npm/@sigstore/sign/make-fetch-happen/@npmcli/agent/https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="], - "npm/pacote/@npmcli/package-json/glob/path-scurry": ["path-scurry@2.0.2", "", { "dependencies": { "lru-cache": "^11.0.0", "minipass": "^7.1.2" } }, "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg=="], + "npm/@sigstore/sign/make-fetch-happen/@npmcli/agent/socks-proxy-agent": ["socks-proxy-agent@8.0.5", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "^4.3.4", "socks": "^2.8.3" } }, "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw=="], - "npm/pacote/@npmcli/package-json/hosted-git-info/lru-cache": ["lru-cache@11.5.3", "", {}, "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg=="], - - "npm/pacote/@npmcli/promise-spawn/which/isexe": ["isexe@4.0.0", "", {}, "sha512-FFUtZMpoZ8RqHS3XeXEmHWLA4thH+ZxCv2lOiPIn1Xc7CxrqhWzNSDzD+/chS/zbYezmiwWLdQC09JdQKmthOw=="], + "npm/@sigstore/sign/make-fetch-happen/cacache/@npmcli/fs": ["@npmcli/fs@5.0.0", "", { "dependencies": { "semver": "^7.3.5" } }, "sha512-7OsC1gNORBEawOa5+j2pXN9vsicaIOH5cPXxoR6fJOmH6/EXpJB2CajXOu1fPRFun2m1lktEFX11+P89hqO/og=="], "npm/pacote/@npmcli/run-script/node-gyp/nopt": ["nopt@9.0.0", "", { "dependencies": { "abbrev": "^4.0.0" }, "bin": { "nopt": "bin/nopt.js" } }, "sha512-Zhq3a+yFKrYwSBluL4H9XP3m3y5uvQkB/09CwDruCiRmR/UJYnn9W4R48ry0uGC70aeTPKLynBtscP9efFFcPw=="], - "npm/pacote/@npmcli/run-script/node-gyp/which": ["which@6.0.1", "", { "dependencies": { "isexe": "^4.0.0" }, "bin": { "node-which": "bin/which.js" } }, "sha512-oGLe46MIrCRqX7ytPUf66EAYvdeMIZYn3WaocqqKZAxrBpkqHfL/qvTyJ/bTk5+AqHCjXmrv3CEWgy368zhRUg=="], - - "npm/pacote/cacache/glob/minimatch": ["minimatch@10.2.6", "", { "dependencies": { "brace-expansion": "^5.0.8" } }, "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A=="], + "npm/pacote/@npmcli/run-script/node-gyp/undici": ["undici@6.29.1", "", {}, "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA=="], - "npm/pacote/cacache/glob/path-scurry": ["path-scurry@2.0.2", "", { "dependencies": { "lru-cache": "^11.0.0", "minipass": "^7.1.2" } }, "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg=="], - - "npm/pacote/npm-package-arg/hosted-git-info/lru-cache": ["lru-cache@11.5.3", "", {}, "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg=="], + "npm/pacote/@npmcli/run-script/node-gyp/which": ["which@6.0.1", "", { "dependencies": { "isexe": "^4.0.0" }, "bin": { "node-which": "bin/which.js" } }, "sha512-oGLe46MIrCRqX7ytPUf66EAYvdeMIZYn3WaocqqKZAxrBpkqHfL/qvTyJ/bTk5+AqHCjXmrv3CEWgy368zhRUg=="], "npm/pacote/npm-registry-fetch/make-fetch-happen/@npmcli/agent": ["@npmcli/agent@4.0.2", "", { "dependencies": { "agent-base": "^7.1.0", "http-proxy-agent": "^7.0.0", "https-proxy-agent": "^7.0.1", "lru-cache": "^11.2.1", "socks-proxy-agent": "^8.0.3" } }, "sha512-EUEuWAxnL07Sp5/iC/1X6Xj+XThUvnbei9zfRWZdEXa7lss9RTHMhAHBeg+MZ5To9s/gGaSI+UwZTPdYMvKSeg=="], - "npm/pacote/npm-registry-fetch/minipass-fetch/iconv-lite": ["iconv-lite@0.7.3", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ=="], - - "npm/pacote/npm-registry-fetch/minipass-fetch/minipass-sized": ["minipass-sized@2.0.0", "", { "dependencies": { "minipass": "^7.1.2" } }, "sha512-zSsHhto5BcUVM2m1LurnXY6M//cGhVaegT71OfOXoprxT6o780GZd792ea6FfrQkuU4usHZIUczAQMRUE2plzA=="], - "npm/sigstore/@sigstore/tuf/tuf-js/@tufjs/models": ["@tufjs/models@4.1.0", "", { "dependencies": { "@tufjs/canonical-json": "2.0.0", "minimatch": "^10.1.1" } }, "sha512-Y8cK9aggNRsqJVaKUlEYs4s7CvQ1b1ta2DVPyAimb0I2qhzjNk+A+mxvll/klL0RlfuIUei8BF7YWiua4kQqww=="], "npm/sigstore/@sigstore/tuf/tuf-js/make-fetch-happen": ["make-fetch-happen@15.0.6", "", { "dependencies": { "@gar/promise-retry": "^1.0.0", "@npmcli/agent": "^4.0.0", "@npmcli/redact": "^4.0.0", "cacache": "^20.0.1", "http-cache-semantics": "^4.1.1", "minipass": "^7.0.2", "minipass-fetch": "^5.0.0", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", "negotiator": "^1.0.0", "proc-log": "^6.0.0", "ssri": "^13.0.0" } }, "sha512-Je0fLJ0F5atA7F+eIlLzk+Wkcl57JDf4kf+EW8xiP5E31xOQxkIxTbgf1Oi1Lw9tRI9UEMRdI5Vz2xTzoNU1Jw=="], - "npm/@sigstore/sign/make-fetch-happen/cacache/glob/minimatch": ["minimatch@10.2.6", "", { "dependencies": { "brace-expansion": "^5.0.8" } }, "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A=="], - - "npm/@sigstore/sign/make-fetch-happen/cacache/glob/path-scurry": ["path-scurry@2.0.2", "", { "dependencies": { "lru-cache": "^11.0.0", "minipass": "^7.1.2" } }, "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg=="], - - "npm/pacote/@npmcli/package-json/glob/minimatch/brace-expansion": ["brace-expansion@5.0.12", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ=="], - - "npm/pacote/@npmcli/package-json/glob/path-scurry/lru-cache": ["lru-cache@11.5.3", "", {}, "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg=="], + "cli-highlight/yargs/cliui/wrap-ansi/ansi-styles/color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], "npm/pacote/@npmcli/run-script/node-gyp/nopt/abbrev": ["abbrev@4.0.0", "", {}, "sha512-a1wflyaL0tHtJSmLSOVybYhy22vRih4eduhhrkcjgrWGnRfrZtovJ2FRjxuTtkkj47O/baf0R86QU5OuYpz8fA=="], - "npm/pacote/@npmcli/run-script/node-gyp/which/isexe": ["isexe@4.0.0", "", {}, "sha512-FFUtZMpoZ8RqHS3XeXEmHWLA4thH+ZxCv2lOiPIn1Xc7CxrqhWzNSDzD+/chS/zbYezmiwWLdQC09JdQKmthOw=="], + "npm/pacote/npm-registry-fetch/make-fetch-happen/@npmcli/agent/agent-base": ["agent-base@7.1.4", "", {}, "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ=="], - "npm/pacote/cacache/glob/minimatch/brace-expansion": ["brace-expansion@5.0.12", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ=="], + "npm/pacote/npm-registry-fetch/make-fetch-happen/@npmcli/agent/http-proxy-agent": ["http-proxy-agent@7.0.2", "", { "dependencies": { "agent-base": "^7.1.0", "debug": "^4.3.4" } }, "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig=="], - "npm/pacote/npm-registry-fetch/make-fetch-happen/@npmcli/agent/lru-cache": ["lru-cache@11.5.3", "", {}, "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg=="], + "npm/pacote/npm-registry-fetch/make-fetch-happen/@npmcli/agent/https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="], - "npm/sigstore/@sigstore/tuf/tuf-js/@tufjs/models/minimatch": ["minimatch@10.2.6", "", { "dependencies": { "brace-expansion": "^5.0.8" } }, "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A=="], + "npm/pacote/npm-registry-fetch/make-fetch-happen/@npmcli/agent/socks-proxy-agent": ["socks-proxy-agent@8.0.5", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "^4.3.4", "socks": "^2.8.3" } }, "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw=="], "npm/sigstore/@sigstore/tuf/tuf-js/make-fetch-happen/@npmcli/agent": ["@npmcli/agent@4.0.2", "", { "dependencies": { "agent-base": "^7.1.0", "http-proxy-agent": "^7.0.0", "https-proxy-agent": "^7.0.1", "lru-cache": "^11.2.1", "socks-proxy-agent": "^8.0.3" } }, "sha512-EUEuWAxnL07Sp5/iC/1X6Xj+XThUvnbei9zfRWZdEXa7lss9RTHMhAHBeg+MZ5To9s/gGaSI+UwZTPdYMvKSeg=="], @@ -1245,36 +1155,16 @@ "npm/sigstore/@sigstore/tuf/tuf-js/make-fetch-happen/ssri": ["ssri@13.0.1", "", { "dependencies": { "minipass": "^7.0.3" } }, "sha512-QUiRf1+u9wPTL/76GTYlKttDEBWV1ga9ZXW8BG6kfdeyyM8LGPix9gROyg9V2+P0xNyF3X2Go526xKFdMZrHSQ=="], - "npm/@sigstore/sign/make-fetch-happen/cacache/glob/minimatch/brace-expansion": ["brace-expansion@5.0.12", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ=="], + "cli-highlight/yargs/cliui/wrap-ansi/ansi-styles/color-convert/color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], - "npm/pacote/@npmcli/package-json/glob/minimatch/brace-expansion/balanced-match": ["balanced-match@4.0.4", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="], + "npm/sigstore/@sigstore/tuf/tuf-js/make-fetch-happen/@npmcli/agent/agent-base": ["agent-base@7.1.4", "", {}, "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ=="], - "npm/pacote/cacache/glob/minimatch/brace-expansion/balanced-match": ["balanced-match@4.0.4", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="], + "npm/sigstore/@sigstore/tuf/tuf-js/make-fetch-happen/@npmcli/agent/http-proxy-agent": ["http-proxy-agent@7.0.2", "", { "dependencies": { "agent-base": "^7.1.0", "debug": "^4.3.4" } }, "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig=="], - "npm/sigstore/@sigstore/tuf/tuf-js/@tufjs/models/minimatch/brace-expansion": ["brace-expansion@5.0.12", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ=="], + "npm/sigstore/@sigstore/tuf/tuf-js/make-fetch-happen/@npmcli/agent/https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="], - "npm/sigstore/@sigstore/tuf/tuf-js/make-fetch-happen/@npmcli/agent/lru-cache": ["lru-cache@11.5.3", "", {}, "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg=="], + "npm/sigstore/@sigstore/tuf/tuf-js/make-fetch-happen/@npmcli/agent/socks-proxy-agent": ["socks-proxy-agent@8.0.5", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "^4.3.4", "socks": "^2.8.3" } }, "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw=="], "npm/sigstore/@sigstore/tuf/tuf-js/make-fetch-happen/cacache/@npmcli/fs": ["@npmcli/fs@5.0.0", "", { "dependencies": { "semver": "^7.3.5" } }, "sha512-7OsC1gNORBEawOa5+j2pXN9vsicaIOH5cPXxoR6fJOmH6/EXpJB2CajXOu1fPRFun2m1lktEFX11+P89hqO/og=="], - - "npm/sigstore/@sigstore/tuf/tuf-js/make-fetch-happen/cacache/glob": ["glob@13.0.6", "", { "dependencies": { "minimatch": "^10.2.2", "minipass": "^7.1.3", "path-scurry": "^2.0.2" } }, "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw=="], - - "npm/sigstore/@sigstore/tuf/tuf-js/make-fetch-happen/cacache/lru-cache": ["lru-cache@11.5.3", "", {}, "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg=="], - - "npm/sigstore/@sigstore/tuf/tuf-js/make-fetch-happen/minipass-fetch/iconv-lite": ["iconv-lite@0.7.3", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ=="], - - "npm/sigstore/@sigstore/tuf/tuf-js/make-fetch-happen/minipass-fetch/minipass-sized": ["minipass-sized@2.0.0", "", { "dependencies": { "minipass": "^7.1.2" } }, "sha512-zSsHhto5BcUVM2m1LurnXY6M//cGhVaegT71OfOXoprxT6o780GZd792ea6FfrQkuU4usHZIUczAQMRUE2plzA=="], - - "npm/@sigstore/sign/make-fetch-happen/cacache/glob/minimatch/brace-expansion/balanced-match": ["balanced-match@4.0.4", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="], - - "npm/sigstore/@sigstore/tuf/tuf-js/@tufjs/models/minimatch/brace-expansion/balanced-match": ["balanced-match@4.0.4", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="], - - "npm/sigstore/@sigstore/tuf/tuf-js/make-fetch-happen/cacache/glob/minimatch": ["minimatch@10.2.6", "", { "dependencies": { "brace-expansion": "^5.0.8" } }, "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A=="], - - "npm/sigstore/@sigstore/tuf/tuf-js/make-fetch-happen/cacache/glob/path-scurry": ["path-scurry@2.0.2", "", { "dependencies": { "lru-cache": "^11.0.0", "minipass": "^7.1.2" } }, "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg=="], - - "npm/sigstore/@sigstore/tuf/tuf-js/make-fetch-happen/cacache/glob/minimatch/brace-expansion": ["brace-expansion@5.0.12", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ=="], - - "npm/sigstore/@sigstore/tuf/tuf-js/make-fetch-happen/cacache/glob/minimatch/brace-expansion/balanced-match": ["balanced-match@4.0.4", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="], } } diff --git a/.github/release/changelog-domains.ts b/.github/release/changelog-domains.ts new file mode 100644 index 0000000..84611e3 --- /dev/null +++ b/.github/release/changelog-domains.ts @@ -0,0 +1,899 @@ +import fs from 'node:fs'; +import process from 'node:process'; +import { execFileSync } from 'node:child_process'; + +/** + * Functional domain categorization and release notes generator for GitHub Releases. + * + * Groups items by SemVer priority ordering: + * Breaking Changes -> Features -> Bug Fixes -> Performance -> Reverts -> Refactoring -> + * Build & Dependencies -> CI & Workflows -> Tests -> Documentation. + * + * Items within each category are grouped by domain, with multiple items rendered as nested sub-bullets. + */ + +export const DOMAINS = { + OVERLAY: 'Taskbar Overlay', + LAYOUT: 'Layout Presets & Metrics', + HARDWARE: 'Hardware Telemetry & Sensors', + TRAFFIC: 'Network & Traffic Monitoring', + ALERTS: 'Alerts & Notifications', + THEME: 'Appearance & Theming', + LIFECYCLE: 'General & Application Lifecycle', + INSTALLER: 'Installation & Packaging', + BUILD: 'Build System & Dependencies', + CI: 'Continuous Integration & Workflows', + TESTS: 'Tests & Test Coverage', + DOCS: 'Documentation', +} as const; + +export const DOMAIN_RANKS: Readonly> = { + 'Taskbar Overlay': 120, + 'Layout Presets': 110, + 'Layout Presets & Metrics': 110, + 'Hardware Telemetry': 100, + 'Hardware Sensors': 100, + 'Hardware Telemetry & Sensors': 100, + 'Network Traffic': 90, + 'Network & Traffic Monitoring': 90, + 'Alerts & Notifications': 80, + 'Appearance & Themes': 70, + 'Appearance & Theming': 70, + 'General & Lifecycle': 60, + 'General & Application Lifecycle': 60, + 'Installation & Packaging': 50, + 'Dependencies': 45, + 'Build System': 40, + 'Build System & Dependencies': 40, + 'CI Workflows': 35, + 'PR Synchronization': 34, + 'Release Pipeline': 32, + 'Continuous Integration & Workflows': 30, + 'Tests & Coverage': 20, + 'Tests & Test Coverage': 20, + 'Documentation': 10, +}; + +export interface ChangeSection { + id: string; + title: string; + rank: number; +} + +export const CHANGE_SECTIONS: Record = { + BREAKING: { id: 'breaking', title: '🚨 Breaking Changes', rank: 100 }, + FEAT: { id: 'feat', title: '🚀 Features', rank: 90 }, + FIX: { id: 'fix', title: '🐛 Bug Fixes', rank: 80 }, + PERF: { id: 'perf', title: '⚡ Performance Improvements', rank: 70 }, + REVERT: { id: 'revert', title: '⏪ Reverts', rank: 60 }, + REFACTOR: { id: 'refactor', title: '♻️ Code Refactoring', rank: 50 }, + BUILD: { id: 'build', title: '📦 Build System & Dependencies', rank: 40 }, + CI: { id: 'ci', title: '🤖 Continuous Integration & Workflows', rank: 30 }, + TEST: { id: 'test', title: '🧪 Tests & Test Coverage', rank: 20 }, + DOCS: { id: 'docs', title: '📝 Documentation', rank: 10 }, +}; + +const TYPE_CATEGORY_MAP: Readonly> = { + breaking: CHANGE_SECTIONS.BREAKING, + feat: CHANGE_SECTIONS.FEAT, + feature: CHANGE_SECTIONS.FEAT, + fix: CHANGE_SECTIONS.FIX, + perf: CHANGE_SECTIONS.PERF, + performance: CHANGE_SECTIONS.PERF, + revert: CHANGE_SECTIONS.REVERT, + refactor: CHANGE_SECTIONS.REFACTOR, + build: CHANGE_SECTIONS.BUILD, + ci: CHANGE_SECTIONS.CI, + test: CHANGE_SECTIONS.TEST, + tests: CHANGE_SECTIONS.TEST, + docs: CHANGE_SECTIONS.DOCS, + documentation: CHANGE_SECTIONS.DOCS, +}; + +export const STANDARD_RELEASE_RULES = { + types: [ + { type: 'feat', section: 'Features' }, + { type: 'fix', section: 'Bug Fixes' }, + { type: 'perf', section: 'Performance Improvements' }, + { type: 'revert', section: 'Reverts' }, + { type: 'refactor', section: 'Code Refactoring' }, + { type: 'build', section: 'Build System' }, + { type: 'ci', section: 'Continuous Integration' }, + { type: 'test', section: 'Tests' }, + { type: 'style', section: 'Styles' }, + { type: 'docs', section: 'Documentation' }, + { type: 'chore', hidden: true }, + ], +}; + +export const STANDARD_COMMIT_RANKS: Readonly> = { + Features: 12, + 'Bug Fixes': 11, + 'Performance Improvements': 10, + Reverts: 9, + 'Code Refactoring': 8, + 'Build System': 7, + 'Continuous Integration': 6, + Tests: 5, + Styles: 4, + Documentation: 3, +}; + +const SCOPE_DOMAIN_RULES: ReadonlyArray<{ keywords: readonly string[]; domain: string }> = [ + { + keywords: ['overlay', 'embedder', 'taskbar', 'band', 'mousehook', 'placement', 'tray'], + domain: DOMAINS.OVERLAY, + }, + { + keywords: ['layout', 'preset', 'presets', 'metric', 'metrics', 'column', 'columns'], + domain: DOMAINS.LAYOUT, + }, + { + keywords: [ + 'hardware', 'sensor', 'sensors', 'disk', 'disks', 'nvme', 'sata', 'scsi', + 'smn', 'pawnio', 'battery', 'gpu', 'cpu', 'adl', 'nvml', 'wddm', 'igcl', + 'inventory', 'thermal', 'temp', + ], + domain: DOMAINS.HARDWARE, + }, + { + keywords: ['traffic', 'network', 'srum', 'netusage', 'bandwidth', 'importer', 'history'], + domain: DOMAINS.TRAFFIC, + }, + { + keywords: ['alerts', 'alert', 'notifier', 'notification', 'notifications', 'hysteresis', 'toast'], + domain: DOMAINS.ALERTS, + }, + { + keywords: ['appearance', 'theme', 'themes', 'color', 'colors', 'palette', 'accent', 'contrast', 'styling'], + domain: DOMAINS.THEME, + }, + { + keywords: [ + 'app', 'core', 'general', 'lifecycle', 'settings', 'diagnostics', + 'logging', 'log', 'logs', 'mutex', 'single-instance', 'portable', 'bridge', + ], + domain: DOMAINS.LIFECYCLE, + }, + { + keywords: ['installer', 'setup', 'packaging', 'package', 'winget', 'inno', 'uninstaller', 'issrc'], + domain: DOMAINS.INSTALLER, + }, + { + keywords: ['build', 'deps', 'dependabot', 'compiler', 'bundler', 'packages', 'props'], + domain: DOMAINS.BUILD, + }, + { + keywords: ['ci', 'workflows', 'workflow', 'sonar', 'codecov', 'codeql', 'security', 'scorecard', 'sync'], + domain: DOMAINS.CI, + }, + { + keywords: ['test', 'tests', 'coverage', 'unit-test', 'vitest', 'xunit'], + domain: DOMAINS.TESTS, + }, + { + keywords: ['docs', 'readme', 'documentation', 'guide', 'guides', 'manual'], + domain: DOMAINS.DOCS, + }, +]; + +const SCOPE_LABEL_MAP: Readonly> = { + deps: 'Dependencies', + dependabot: 'Dependencies', + sync: 'PR Synchronization', + release: 'Release Pipeline', + pawnio: 'Hardware Sensors', + msr: 'Hardware Sensors', + smn: 'Hardware Sensors', + layout: 'Layout Presets', + presets: 'Layout Presets', + overlay: 'Taskbar Overlay', + embedder: 'Taskbar Overlay', + taskbar: 'Taskbar Overlay', + traffic: 'Network Traffic', + network: 'Network Traffic', + theme: 'Appearance & Themes', + appearance: 'Appearance & Themes', + alerts: 'Alerts & Notifications', + notifier: 'Alerts & Notifications', + installer: 'Installation & Packaging', + setup: 'Installation & Packaging', + uninstaller: 'Installation & Packaging', + workflows: 'CI Workflows', + ci: 'CI Workflows', + actions: 'CI Workflows', + test: 'Tests & Coverage', + tests: 'Tests & Coverage', + coverage: 'Tests & Coverage', + docs: 'Documentation', + guides: 'Documentation', + readme: 'Documentation', +}; + +const CANONICAL_DOMAIN_MAP: Readonly> = { + [DOMAINS.TESTS]: 'Tests & Coverage', + [DOMAINS.CI]: 'CI Workflows', + [DOMAINS.BUILD]: 'Build System', + [DOMAINS.HARDWARE]: 'Hardware Telemetry', + [DOMAINS.TRAFFIC]: 'Network Traffic', + [DOMAINS.THEME]: 'Appearance & Themes', + [DOMAINS.LAYOUT]: 'Layout Presets', + [DOMAINS.OVERLAY]: 'Taskbar Overlay', + [DOMAINS.ALERTS]: 'Alerts & Notifications', + [DOMAINS.INSTALLER]: 'Installation & Packaging', + [DOMAINS.LIFECYCLE]: 'General & Lifecycle', + [DOMAINS.DOCS]: 'Documentation', +}; + +const KNOWN_SCOPE_PREFIXES = new Set([ + 'overlay', 'taskbar', 'embedder', 'layout', 'preset', 'presets', 'metric', 'metrics', + 'hardware', 'sensor', 'sensors', 'disk', 'nvme', 'sata', 'gpu', 'cpu', 'battery', 'pawnio', + 'traffic', 'network', 'srum', 'alerts', 'alert', 'notifier', 'appearance', 'theme', 'themes', + 'app', 'core', 'general', 'settings', 'lifecycle', 'diagnostics', 'installer', 'setup', + 'packaging', 'ci', 'workflows', 'build', 'deps', 'sonar', 'quality', 'test', 'tests', 'docs', + 'guides', 'bridge', 'release', 'sync', +]); + +const KEYWORD_TYPE_MAP: Readonly> = { + add: 'feat', + implement: 'feat', + support: 'feat', + introduce: 'feat', + fix: 'fix', + repair: 'fix', + resolve: 'fix', + detect: 'fix', + prevent: 'fix', + eliminate: 'fix', + adjust: 'fix', + shrink: 'fix', + refactor: 'refactor', + decompose: 'refactor', + simplify: 'refactor', + optimize: 'perf', + tune: 'perf', + increase: 'perf', + test: 'test', + assert: 'test', + mock: 'test', + doc: 'docs', + docs: 'docs', + document: 'docs', + update: 'docs', +}; + +const ENGINEERING_TYPE_DOMAINS: Readonly> = { + test: DOMAINS.TESTS, + build: DOMAINS.BUILD, + ci: DOMAINS.CI, + docs: DOMAINS.DOCS, +}; + +export function resolveGitBinary(): string { + if (process.platform === 'win32') { + const candidates = [ + String.raw`C:\Program Files\Git\cmd\git.exe`, + String.raw`C:\Program Files\Git\bin\git.exe`, + String.raw`C:\Program Files (x86)\Git\cmd\git.exe`, + ]; + for (const candidate of candidates) { + if (fs.existsSync(candidate)) return candidate; + } + } else { + const candidates = ['/usr/bin/git', '/usr/local/bin/git', '/bin/git']; + for (const candidate of candidates) { + if (fs.existsSync(candidate)) return candidate; + } + } + return 'git'; +} + +function textContainsKeyword(text: string, keywords: readonly string[]): boolean { + if (!text) return false; + const tokenSet = new Set(text.toLowerCase().split(/[^a-z0-9_-]+/)); + return keywords.some((kw) => tokenSet.has(kw)); +} + +function findDomainByKeywords(text?: string): string | null { + if (!text) return null; + for (const rule of SCOPE_DOMAIN_RULES) { + if (textContainsKeyword(text, rule.keywords)) { + return rule.domain; + } + } + return null; +} + +function isReleaseChore(type: string, scope: string, subject: string): boolean { + if (scope !== 'release') return false; + return type === 'chore' || /^\d+\.\d+\.\d+/.test(subject); +} + +export function cleanRepoUrl(rawUrl?: string | null): string { + let url = (rawUrl ?? '').trim(); + url = url.replace(/^git@github\.com:/i, 'https://github.com/'); + url = url.replace(/\.git$/i, ''); + if (!url.startsWith('http://') && !url.startsWith('https://')) { + url = 'https://github.com/Nicconike/LocalTelemetry'; + } + return url; +} + +export function resolveDomain( + type?: string | null, + scope?: string | null, + subject?: string | null, +): string | null { + const rawType = (type ?? '').toLowerCase().trim(); + const rawScope = (scope ?? '').toLowerCase().trim(); + const rawSubject = (subject ?? '').toLowerCase().trim(); + + if (isReleaseChore(rawType, rawScope, rawSubject)) return null; + + const engineeringDomain = ENGINEERING_TYPE_DOMAINS[rawType]; + if (engineeringDomain) return engineeringDomain; + + const scopeDomain = findDomainByKeywords(rawScope); + if (scopeDomain) return scopeDomain; + + if (rawType === 'chore') return null; + + const subjectDomain = findDomainByKeywords(rawSubject); + if (subjectDomain) return subjectDomain; + + if (rawType === 'style') return null; + + return DOMAINS.LIFECYCLE; +} + +export function resolveDomainLabel( + type?: string | null, + scope?: string | null, + subject?: string | null, +): string { + const rawScope = (scope ?? '').toLowerCase().trim(); + + if (rawScope.includes('deps')) return 'Dependencies'; + const labelFromScope = SCOPE_LABEL_MAP[rawScope]; + if (labelFromScope) return labelFromScope; + + const domain = resolveDomain(type, scope, subject); + if (domain) { + return CANONICAL_DOMAIN_MAP[domain] || domain; + } + + if (rawScope) { + return rawScope.charAt(0).toUpperCase() + rawScope.slice(1); + } + + return 'General'; +} + +export function resolveChangeCategory( + type?: string | null, + isBreaking = false, + scope?: string | null, + subject?: string | null, +): ChangeSection | null { + if (isBreaking) return CHANGE_SECTIONS.BREAKING; + + const rawType = (type ?? '').toLowerCase().trim(); + const rawScope = (scope ?? '').toLowerCase().trim(); + const rawSubject = (subject ?? '').toLowerCase().trim(); + + if (isReleaseChore(rawType, rawScope, rawSubject)) return null; + + if (rawType === 'chore') { + if (rawScope === 'deps' || rawScope === 'dependabot' || rawScope.includes('deps')) { + return CHANGE_SECTIONS.BUILD; + } + return null; + } + + if (rawType === 'style') return null; + + return TYPE_CATEGORY_MAP[rawType] || null; +} + +export function cleanSubject(subject: string): string { + let clean = (subject ?? '').trim(); + + const dependabotMatch = /^bump the ([\w-]+) group across \d+ director\w+ with \d+ updates?$/i.exec(clean); + if (dependabotMatch) { + const groupName = dependabotMatch[1].replace(/-deps$/, '').replaceAll('-', ' '); + return `Bump ${groupName} dependencies`; + } + + const colonIdx = clean.indexOf(':'); + if (colonIdx > 0 && colonIdx < 30) { + const potentialScope = clean.substring(0, colonIdx).trim().toLowerCase(); + if (KNOWN_SCOPE_PREFIXES.has(potentialScope)) { + clean = clean.substring(colonIdx + 1).trim(); + } + } + + if (!clean) return clean; + + clean = clean.charAt(0).toUpperCase() + clean.slice(1); + return clean.replace(/\.$/, ''); +} + +export function formatReleaseDate(rawDate?: string | Date | number | null): string { + if (!rawDate) return ''; + if (typeof rawDate === 'string' && /^\d{2}-\d{2}-\d{4}$/.test(rawDate)) { + return rawDate; + } + const d = new Date(rawDate); + if (Number.isNaN(d.getTime())) return String(rawDate); + const day = String(d.getUTCDate()).padStart(2, '0'); + const month = String(d.getUTCMonth() + 1).padStart(2, '0'); + const year = d.getUTCFullYear(); + return `${day}-${month}-${year}`; +} + +export interface DomainEntry { + category: ChangeSection; + domain: string; + subject: string; + hash: string; + shortHash: string; +} + +const BULLET_CONVENTIONAL_REGEX = /^[-*]\s+([a-z]+)(?:\(([^)]+)\))?!?:\s*/i; +const BULLET_KEYWORD_REGEX = /^[-*]\s+([A-Za-z]+)(?::\s*|\s+)/; +const HEADER_REGEX = /^([a-z]+)(?:\(([^)]+)\))?!?:\s*/i; + +function parseConventionalBullet( + line: string, + parentScope: string, + fullHash: string, + shortHash: string, +): DomainEntry | null { + const convMatch = BULLET_CONVENTIONAL_REGEX.exec(line); + if (!convMatch) return null; + + const rawType = convMatch[1]; + const rawScope = convMatch[2] || parentScope; + const rawSubject = line.slice(convMatch[0].length).trim(); + if (!rawSubject) return null; + const isBreaking = line.includes('BREAKING CHANGE:') || rawType.endsWith('!') || line.startsWith('- breaking:') || line.startsWith('* breaking:'); + + const category = resolveChangeCategory(rawType, isBreaking, rawScope, rawSubject); + if (!category) return null; + + return { + category, + domain: resolveDomainLabel(rawType, rawScope, rawSubject), + subject: cleanSubject(rawSubject), + hash: fullHash, + shortHash, + }; +} + +function parseKeywordBullet( + line: string, + parentType: string, + parentScope: string, + fullHash: string, + shortHash: string, +): DomainEntry | null { + const kwMatch = BULLET_KEYWORD_REGEX.exec(line); + if (!kwMatch) return null; + + const verb = kwMatch[1].toLowerCase(); + let rawType = KEYWORD_TYPE_MAP[verb] || parentType; + + if (/\b(?:unit\s+)?tests?\b|\bcoverage\b/i.test(line)) { + rawType = 'test'; + } else if (/\b(?:docs?|documentation|readme|guide)\b/i.test(line)) { + rawType = 'docs'; + } + + if (!rawType) return null; + + const remainder = line.slice(kwMatch[0].length).trim(); + if (!remainder) return null; + const fullSubject = `${kwMatch[1]} ${remainder}`; + const category = resolveChangeCategory(rawType, false, parentScope, fullSubject); + if (!category) return null; + + return { + category, + domain: resolveDomainLabel(rawType, parentScope, fullSubject), + subject: cleanSubject(fullSubject), + hash: fullHash, + shortHash, + }; +} + +function extractSubBullets( + bodyLines: string[], + fullHash: string, + shortHash: string, + parentType = '', + parentScope = '', +): DomainEntry[] { + const entries: DomainEntry[] = []; + for (const rawLine of bodyLines) { + const line = rawLine.trim(); + const convEntry = parseConventionalBullet(line, parentScope, fullHash, shortHash); + if (convEntry) { + entries.push(convEntry); + continue; + } + + const kwEntry = parseKeywordBullet(line, parentType, parentScope, fullHash, shortHash); + if (kwEntry) { + entries.push(kwEntry); + } + } + return entries; +} + +function parseSingleHeaderEntry( + headerLine: string, + bodyText: string, + fullHash: string, + shortHash: string, +): DomainEntry[] { + const isBreaking = bodyText.includes('BREAKING CHANGE:') || headerLine.includes('!:'); + const headerMatch = HEADER_REGEX.exec(headerLine); + if (headerMatch) { + const rawType = headerMatch[1]; + const rawScope = headerMatch[2] || ''; + const rawSubject = headerLine.slice(headerMatch[0].length).trim(); + if (rawSubject) { + const category = resolveChangeCategory(rawType, isBreaking, rawScope, rawSubject); + if (category) { + return [ + { + category, + domain: resolveDomainLabel(rawType, rawScope, rawSubject), + subject: cleanSubject(rawSubject), + hash: fullHash, + shortHash, + }, + ]; + } + } + return []; + } + + if (!/^(?:merge|chore)\b/i.test(headerLine)) { + return [ + { + category: CHANGE_SECTIONS.FEAT, + domain: 'General', + subject: cleanSubject(headerLine), + hash: fullHash, + shortHash, + }, + ]; + } + + return []; +} + +export function parseCommitEntries(commit: { + hash: string; + shortHash?: string; + message?: string; + header?: string; + body?: string; +}): DomainEntry[] { + const fullHash = commit.hash; + const shortHash = commit.shortHash || fullHash.substring(0, 7); + const fullMessage = (commit.message || [commit.header, commit.body].filter(Boolean).join('\n\n')).trim(); + + if (!fullMessage) return []; + + const lines = fullMessage.split(/\r?\n/); + const headerLine = lines[0].trim(); + const bodyLines = lines.slice(1); + const bodyText = bodyLines.join('\n'); + + const headerMatch = HEADER_REGEX.exec(headerLine); + const parentType = headerMatch ? headerMatch[1].toLowerCase() : ''; + const parentScope = headerMatch ? (headerMatch[2] || '') : ''; + + const subBulletEntries = extractSubBullets(bodyLines, fullHash, shortHash, parentType, parentScope); + if (subBulletEntries.length > 0) { + return subBulletEntries; + } + + return parseSingleHeaderEntry(headerLine, bodyText, fullHash, shortHash); +} + +export function getCommitsFromGit( + fromRef: string, + toRef = 'HEAD', + cwd: string = process.cwd(), +): Array<{ hash: string; shortHash: string; message: string; committerDate: string; authorDate: string }> { + try { + const gitBin = resolveGitBinary(); + const raw = execFileSync( + gitBin, + ['log', `${fromRef}..${toRef}`, '--format=COMMIT_START%x00%H%x00%h%x00%cI%x00%aI%x00%B%x00COMMIT_END'], + { cwd, encoding: 'utf-8' }, + ); + + const commits: Array<{ hash: string; shortHash: string; message: string; committerDate: string; authorDate: string }> = []; + const chunks = raw.split('COMMIT_START\0'); + + for (const chunk of chunks) { + if (!chunk.trim()) continue; + const endIdx = chunk.indexOf('\0COMMIT_END'); + const content = endIdx >= 0 ? chunk.substring(0, endIdx) : chunk; + const parts = content.split('\0'); + const hash = parts[0]?.trim(); + const shortHash = parts[1]?.trim() || hash?.substring(0, 7) || ''; + const committerDate = parts[2]?.trim() || ''; + const authorDate = parts[3]?.trim() || ''; + const message = parts.slice(4).join('\0').trim(); + + if (hash && message) { + commits.push({ hash, shortHash, message, committerDate, authorDate }); + } + } + + return commits; + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + process.stderr.write(`[release-notes] Warning: unable to retrieve git commits between ${fromRef} and ${toRef}: ${message}\n`); + return []; + } +} + +export interface CommitInput { + hash: string; + shortHash?: string; + message?: string; + header?: string; + body?: string; + committerDate?: string; + authorDate?: string; +} + +export interface GenerateNotesOptions { + fromTag?: string; + toRef?: string; + version?: string; + date?: string; + repositoryUrl?: string; + commits?: CommitInput[]; + cwd?: string; +} + +function getTagAuthorDate(tag: string, cwd: string): string | null { + try { + const gitBin = resolveGitBinary(); + return execFileSync(gitBin, ['log', '-1', '--format=%aI', tag], { cwd, encoding: 'utf-8' }).trim(); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + process.stderr.write(`[release-notes] Warning: unable to read tag date for ${tag}: ${message}\n`); + return null; + } +} + +interface DomainItem { + subject: string; + link: string; +} + +interface CategoryGroup { + section: ChangeSection; + domainMap: Map; +} + +function isCommitEligible(commit: CommitInput, tagTimestamp: number): boolean { + if (tagTimestamp <= 0 || !commit.authorDate) return true; + return new Date(commit.authorDate).getTime() > tagTimestamp; +} + +function addEntryToCategory( + categoryGroups: Map, + entry: DomainEntry, + repoUrl: string, +): void { + const groupKey = entry.category.id; + let group = categoryGroups.get(groupKey); + if (!group) { + group = { section: entry.category, domainMap: new Map() }; + categoryGroups.set(groupKey, group); + } + + const commitLink = `[${entry.shortHash}](${repoUrl}/commit/${entry.hash})`; + const domainList = group.domainMap.get(entry.domain) || []; + const isDuplicate = domainList.some( + (item) => item.subject === entry.subject && item.link === commitLink, + ); + if (!isDuplicate) { + domainList.push({ subject: entry.subject, link: commitLink }); + group.domainMap.set(entry.domain, domainList); + } +} + +function collectCategoryGroups( + commits: CommitInput[], + repoUrl: string, + fromTagDate?: string | null, +): Map { + const categoryGroups = new Map(); + const tagTimestamp = fromTagDate ? new Date(fromTagDate).getTime() : 0; + + for (const commit of commits) { + if (!isCommitEligible(commit, tagTimestamp)) continue; + + const entries = parseCommitEntries(commit); + for (const entry of entries) { + addEntryToCategory(categoryGroups, entry, repoUrl); + } + } + + return categoryGroups; +} + +function formatCompareHeader( + version: string, + fromTag: string | undefined, + toRef: string, + date: string | undefined, + repoUrl: string, +): string { + const formattedDate = date ? formatReleaseDate(date) : formatReleaseDate(new Date()); + const targetTag = toRef.startsWith('v') ? toRef : `v${version}`; + + let compareLink: string; + if (fromTag) { + compareLink = `[${version}](${repoUrl}/compare/${fromTag}...${targetTag})`; + } else { + compareLink = `[${version}](${repoUrl}/releases/tag/v${version})`; + } + + return `## ${compareLink} (${formattedDate})\n`; +} + +function formatDomainEntries(domain: string, items: DomainItem[]): string[] { + if (items.length === 1) { + return [`* **${domain}**: ${items[0].subject} (${items[0].link})`]; + } + const lines = [`* **${domain}**`]; + for (const item of items) { + lines.push(` * ${item.subject} (${item.link})`); + } + return lines; +} + +function renderCategoryGroup(group: CategoryGroup): string[] { + const lines: string[] = [`### ${group.section.title}\n`]; + const sortedDomains = Array.from(group.domainMap.keys()).sort( + (a, b) => (DOMAIN_RANKS[b] ?? 0) - (DOMAIN_RANKS[a] ?? 0), + ); + + for (const domain of sortedDomains) { + const items = group.domainMap.get(domain); + if (items && items.length > 0) { + lines.push(...formatDomainEntries(domain, items)); + } + } + lines.push(''); + return lines; +} + +function resolveReleaseCommits( + commits: CommitInput[] | undefined, + fromTag: string | undefined, + toRef: string, + cwd: string, +): CommitInput[] { + if (commits && commits.length > 0) return commits; + if (fromTag) return getCommitsFromGit(fromTag, toRef, cwd); + return []; +} + +export function generateGitHubReleaseNotes(options: GenerateNotesOptions): string { + const { + fromTag, + toRef = 'HEAD', + version = 'Unreleased', + date, + repositoryUrl = 'https://github.com/Nicconike/LocalTelemetry', + cwd = process.cwd(), + } = options; + + const repoUrl = cleanRepoUrl(repositoryUrl); + const commits = resolveReleaseCommits(options.commits, fromTag, toRef, cwd); + if (commits.length === 0) return ''; + + const fromTagDate = fromTag ? getTagAuthorDate(fromTag, cwd) : null; + const categoryGroups = collectCategoryGroups(commits, repoUrl, fromTagDate); + if (categoryGroups.size === 0) return ''; + + const sortedGroups = Array.from(categoryGroups.values()).sort( + (a, b) => b.section.rank - a.section.rank, + ); + + const output: string[] = [formatCompareHeader(version, fromTag, toRef, date, repoUrl)]; + for (const group of sortedGroups) { + if (group.domainMap.size > 0) { + output.push(...renderCategoryGroup(group)); + } + } + + return output.join('\n').trim(); +} + +/** + * Semantic-release GitHub publish plugin wrapper + */ +export async function verifyConditions(pluginConfig: unknown, context: Record): Promise { + const gh = await import('@semantic-release/github'); + return gh.verifyConditions?.(pluginConfig, context); +} + +function resolveReleaseParameters(context: Record): { + fromTag?: string; + toRef: string; + version: string; + releaseDate?: string; + repositoryUrl: string; + cwd: string; +} { + const { nextRelease, lastRelease, options, cwd = process.cwd() } = context; + const fromTag = lastRelease?.gitTag || (lastRelease?.version ? `v${lastRelease.version}` : undefined); + const toRef = nextRelease?.gitHead || nextRelease?.gitTag || 'HEAD'; + const version = nextRelease?.version || '1.0.0'; + const repositoryUrl = cleanRepoUrl(options?.repositoryUrl); + + const existingDateMatch = /## \[.+?\]\(.+?\) \((.+?)\)/.exec(nextRelease?.notes ?? ''); + const releaseDate = existingDateMatch ? existingDateMatch[1] : undefined; + + return { fromTag, toRef, version, releaseDate, repositoryUrl, cwd }; +} + +export async function publish(pluginConfig: unknown, context: Record): Promise { + const params = resolveReleaseParameters(context); + + const domainNotes = generateGitHubReleaseNotes({ + fromTag: params.fromTag, + toRef: params.toRef, + version: params.version, + date: params.releaseDate, + repositoryUrl: params.repositoryUrl, + cwd: params.cwd, + }); + + const enrichedContext = { + ...context, + nextRelease: { + ...context.nextRelease, + notes: domainNotes?.trim() ? domainNotes : context.nextRelease.notes, + }, + }; + + const gh = await import('@semantic-release/github'); + return gh.publish?.(pluginConfig, enrichedContext); +} + +export async function addChannel(pluginConfig: unknown, context: Record): Promise { + const gh = await import('@semantic-release/github'); + return gh.addChannel?.(pluginConfig, context); +} + +export async function success(pluginConfig: unknown, context: Record): Promise { + const gh = await import('@semantic-release/github'); + return gh.success?.(pluginConfig, context); +} + +export async function fail(pluginConfig: unknown, context: Record): Promise { + const gh = await import('@semantic-release/github'); + return gh.fail?.(pluginConfig, context); +} + +export function parseOwnerAndRepo(rawUrl?: string | null): { owner: string; repo: string } | null { + if (!rawUrl?.trim()) return null; + const trimmed = rawUrl.trim(); + const match = /(?:github\.com[/:])([^/]+)\/([^/]+?)(?:\.git)?$/.exec(trimmed); + if (!match) return null; + return { owner: match[1], repo: match[2] }; +} diff --git a/.github/release/package.json b/.github/release/package.json index 01e26eb..c007c5b 100644 --- a/.github/release/package.json +++ b/.github/release/package.json @@ -2,22 +2,25 @@ "type": "module", "devDependencies": { "@octokit/rest": "^22.0.1", - "@semantic-release/changelog": "^6.0.3", + "@semantic-release/changelog": "^7.0.0", "@semantic-release/commit-analyzer": "^13.0.1", - "@semantic-release/exec": "^6.0.3", - "@semantic-release/git": "^10.0.1", - "@semantic-release/github": "^11.0.6", + "@semantic-release/exec": "^7.1.0", + "@semantic-release/git": "^11.0.1", + "@semantic-release/github": "^12.0.11", "@semantic-release/release-notes-generator": "^14.1.1", - "@types/node": "^26.6.5", - "semantic-release": "^24.2.9" + "@types/node": "^26.6.11", + "semantic-release": "^26.0.1" }, "private": true, "name": "localtelemetry-release", "scripts": { - "release": "bun ./run.ts --extends ./release.config.mjs" + "release": "bun ./run.ts --extends ./release.config.mjs", + "test": "bun test ../../tests/LocalTelemetry.Release.Tests/", + "test:coverage": "bun test --coverage --coverage-reporter=lcov --coverage-dir=coverage ../../tests/LocalTelemetry.Release.Tests/", + "changelog": "bun ./preview-changelog.ts" }, "dependencies": { - "conventional-changelog-conventionalcommits": "^8.0.0" + "conventional-changelog-conventionalcommits": "^10.4.1" }, "overrides": { "braces": "npm:@franciscosolis/braces@^3.1.1", diff --git a/.github/release/preview-changelog.ts b/.github/release/preview-changelog.ts new file mode 100644 index 0000000..71b793e --- /dev/null +++ b/.github/release/preview-changelog.ts @@ -0,0 +1,280 @@ +/** + * Standalone tool to generate and preview release notes and changelogs locally. + * + * Demonstrates: + * 1. CHANGELOG.md format: Conventional commit type groupings (Features, Bug Fixes, etc.) + * 2. GitHub Releases format: Functional domain groupings with body sub-bullet expansion. + * + * Usage: + * bun preview-changelog.ts + * bun preview-changelog.ts --from v1.3.0-beta.2 --to v1.3.0-beta.3 + * bun preview-changelog.ts --format github + * bun preview-changelog.ts --format changelog + */ +import process from 'node:process'; +import fs from 'node:fs'; +import os from 'node:os'; +import path from 'node:path'; +import { execFileSync } from 'node:child_process'; +import { generateNotes } from '@semantic-release/release-notes-generator'; +import { + cleanRepoUrl, + formatReleaseDate, + generateGitHubReleaseNotes, + resolveGitBinary, + STANDARD_COMMIT_RANKS, + STANDARD_RELEASE_RULES, +} from './changelog-domains.js'; + +function getLatestTag(): string { + try { + const gitBin = resolveGitBinary(); + return execFileSync(gitBin, ['describe', '--tags', '--abbrev=0'], { encoding: 'utf-8' }).trim(); + } catch (err) { + console.debug?.(`Failed to resolve latest tag, defaulting to HEAD~10: ${err}`); + return 'HEAD~10'; + } +} + +function getPreviousTag(tag: string): string { + const gitBin = resolveGitBinary(); + try { + return execFileSync(gitBin, ['describe', '--tags', '--abbrev=0', `${tag}^`], { encoding: 'utf-8' }).trim(); + } catch (err) { + console.debug?.(`Failed to resolve previous tag for ${tag}, defaulting to HEAD~10: ${err}`); + return 'HEAD~10'; + } +} + +function resolveGhBinary(): string { + if (process.platform === 'win32') { + const progFiles = process.env.ProgramFiles ?? String.raw`C:\Program Files`; + const candidates = [ + path.join(progFiles, 'GitHub CLI', 'gh.exe'), + String.raw`C:\Program Files\GitHub CLI\gh.exe`, + ]; + for (const candidate of candidates) { + if (fs.existsSync(candidate)) return candidate; + } + } + return 'gh'; +} + +function updateGitHubRelease(tag: string, notes: string): void { + const tempFile = path.join(os.tmpdir(), `release-notes-${tag}-${Date.now()}.md`); + fs.writeFileSync(tempFile, notes, 'utf-8'); + const ghBin = resolveGhBinary(); + try { + console.log(`Updating GitHub Release ${tag} via ${ghBin}...`); + execFileSync(ghBin, ['release', 'edit', tag, '--notes-file', tempFile], { + stdio: 'inherit', + env: process.env, + }); + console.log(`Successfully updated GitHub Release ${tag} with domain-grouped release notes.`); + } finally { + try { + if (fs.existsSync(tempFile)) { + fs.unlinkSync(tempFile); + } + } catch (err) { + console.warn(`Failed to clean temporary changelog file ${tempFile}:`, err); + } + } +} + +function getCommitDate(ref: string): string { + try { + const gitBin = resolveGitBinary(); + return execFileSync(gitBin, ['log', '-1', '--format=%cI', ref], { encoding: 'utf-8' }).trim(); + } catch (err) { + console.debug?.(`Failed to retrieve commit date for ref ${ref}: ${err}`); + return new Date().toISOString(); + } +} + +function getRepoUrl(): string { + try { + const gitBin = resolveGitBinary(); + const raw = execFileSync(gitBin, ['config', '--get', 'remote.origin.url'], { encoding: 'utf-8' }); + return cleanRepoUrl(raw); + } catch (err) { + console.debug?.(`Failed to retrieve git remote URL: ${err}`); + return 'https://github.com/Nicconike/LocalTelemetry'; + } +} + +function getCommitsBetween( + fromTag: string, + toRef: string = 'HEAD', +): Array<{ hash: string; shortHash: string; message: string; committerDate?: string; authorDate?: string }> { + const gitBin = resolveGitBinary(); + const raw = execFileSync( + gitBin, + ['log', `${fromTag}..${toRef}`, '--format=COMMIT_START%x00%H%x00%h%x00%cI%x00%aI%x00%B%x00COMMIT_END'], + { encoding: 'utf-8' }, + ); + + const commits: Array<{ hash: string; shortHash: string; message: string; committerDate?: string; authorDate?: string }> = []; + const chunks = raw.split('COMMIT_START\0'); + + for (const chunk of chunks) { + if (!chunk.trim()) continue; + const endIdx = chunk.indexOf('\0COMMIT_END'); + const content = endIdx >= 0 ? chunk.substring(0, endIdx) : chunk; + const parts = content.split('\0'); + const hash = parts[0]?.trim(); + const shortHash = parts[1]?.trim() || hash?.substring(0, 7) || ''; + const committerDate = parts[2]?.trim(); + const authorDate = parts[3]?.trim(); + const message = parts.slice(4).join('\0').trim(); + + if (hash && message) { + commits.push({ hash, shortHash, message, committerDate, authorDate }); + } + } + + return commits; +} + +interface CliOptions { + fromTag: string; + toRef: string; + format: string; + updateReleaseTag: string; +} + +function parseCliArgs(args: string[]): CliOptions { + let fromTag = ''; + let toRef = 'HEAD'; + let format = 'all'; + let updateReleaseTag = ''; + + for (let i = 0; i < args.length; i++) { + const arg = args[i]; + const next = args[i + 1]; + if (arg === '--from' && next) { + fromTag = next; + i++; + } else if (arg === '--to' && next) { + toRef = next; + i++; + } else if ((arg === '--format' || arg === '--mode') && next) { + format = next.toLowerCase(); + i++; + } else if (arg === '--update-release' && next) { + updateReleaseTag = next; + i++; + } + } + + if (updateReleaseTag) { + toRef = updateReleaseTag; + if (!fromTag) fromTag = getPreviousTag(toRef); + } else if (!fromTag) { + fromTag = getLatestTag(); + } + + return { fromTag, toRef, format, updateReleaseTag }; +} + +function createStandardConfig(releaseDateIso: string) { + return { + preset: 'conventionalcommits', + presetConfig: STANDARD_RELEASE_RULES, + writerOpts: { + commitGroupsSort: (a: { title?: string }, b: { title?: string }) => + (STANDARD_COMMIT_RANKS[b.title ?? ''] ?? 0) - (STANDARD_COMMIT_RANKS[a.title ?? ''] ?? 0), + commitsSort: (a: { scope?: string; subject?: string }, b: { scope?: string; subject?: string }) => { + const scopeDiff = (b.scope ?? '').localeCompare(a.scope ?? ''); + return scopeDiff !== 0 ? scopeDiff : (b.subject ?? '').localeCompare(a.subject ?? ''); + }, + formatDate: formatReleaseDate, + finalizeContext: (context: Record) => { + context.date = formatReleaseDate(releaseDateIso); + return context; + }, + }, + }; +} + +function displayReleaseNotes(format: string, standardNotes: string, domainNotes: string): void { + if (format === 'standard' || format === 'changelog') { + console.log(standardNotes); + return; + } + if (format === 'domains' || format === 'github' || format === 'release') { + console.log(domainNotes); + return; + } + console.log('================================================================'); + console.log('1. CHANGELOG.md Format (Commit-based Conventional Types):'); + console.log('================================================================'); + console.log(standardNotes); + console.log('================================================================'); + console.log('2. GitHub Releases Format (Functional Domains with Sub-Bullets):'); + console.log('================================================================'); + console.log(domainNotes); +} + +async function main(): Promise { + const { fromTag, toRef, format, updateReleaseTag } = parseCliArgs(process.argv.slice(2)); + + console.log(`Generating release notes: ${fromTag} -> ${toRef}\n`); + + const commits = getCommitsBetween(fromTag, toRef); + if (commits.length === 0) { + console.log(`No commits found between ${fromTag} and ${toRef}.`); + return; + } + + const version = toRef === 'HEAD' ? 'Unreleased' : toRef.replace(/^v/, ''); + const releaseDateIso = getCommitDate(toRef); + const repoUrl = getRepoUrl(); + + const domainNotes = generateGitHubReleaseNotes({ + fromTag, + toRef, + version, + date: releaseDateIso, + repositoryUrl: repoUrl, + commits, + }); + + if (updateReleaseTag) { + if (!domainNotes.trim()) { + console.warn(`No domain release notes generated for ${updateReleaseTag}.`); + return; + } + updateGitHubRelease(updateReleaseTag, domainNotes); + return; + } + + const standardConfig = createStandardConfig(releaseDateIso); + const context = { + commits, + lastRelease: { + version: fromTag.replace(/^v/, ''), + gitTag: fromTag, + gitHead: fromTag, + }, + nextRelease: { + version, + gitTag: toRef, + gitHead: toRef, + }, + options: { + repositoryUrl: repoUrl, + }, + cwd: process.cwd(), + }; + + const standardNotes = await generateNotes(standardConfig, context); + displayReleaseNotes(format, standardNotes, domainNotes); +} + +try { + await main(); +} catch (err) { + console.error('Failed to preview changelog:', err); + process.exit(1); +} diff --git a/.github/release/release.config.mjs b/.github/release/release.config.mjs index 7f9ba27..c0476ae 100644 --- a/.github/release/release.config.mjs +++ b/.github/release/release.config.mjs @@ -4,12 +4,21 @@ */ import { fileURLToPath } from 'node:url'; import { dirname, resolve } from 'node:path'; +import { + formatReleaseDate, + STANDARD_COMMIT_RANKS, + STANDARD_RELEASE_RULES, +} from './changelog-domains.ts'; const __dirname = dirname(fileURLToPath(import.meta.url)); const commitPluginPath = resolve(__dirname, 'github-commit-plugin.ts'); +const changelogDomainsPluginPath = resolve(__dirname, 'changelog-domains.ts'); export default { - branches: ['master'], + branches: [ + 'master', + { name: 'develop', prerelease: 'beta' }, + ], tagFormat: 'v${version}', plugins: [ [ @@ -36,42 +45,22 @@ export default { '@semantic-release/release-notes-generator', { preset: 'conventionalcommits', - presetConfig: { - types: [ - { type: 'feat', section: 'Features' }, - { type: 'fix', section: 'Bug Fixes' }, - { type: 'perf', section: 'Performance Improvements' }, - { type: 'revert', section: 'Reverts' }, - { type: 'refactor', section: 'Code Refactoring' }, - { type: 'build', section: 'Build System' }, - { type: 'ci', section: 'Continuous Integration' }, - { type: 'test', section: 'Tests' }, - { type: 'style', section: 'Styles' }, - { type: 'docs', section: 'Documentation' }, - { type: 'chore', hidden: true }, - ], - }, + presetConfig: STANDARD_RELEASE_RULES, writerOpts: { - commitGroupsSort: (a, b) => { - const rank = { - 'Features': 10, - 'Bug Fixes': 9, - 'Performance Improvements': 8, - 'Reverts': 7, - 'Code Refactoring': 6, - 'Build System': 5, - 'Continuous Integration': 4, - 'Tests': 3, - 'Styles': 2, - 'Documentation': 1, - }; - return (rank[b.title] ?? 0) - (rank[a.title] ?? 0); - }, + commitGroupsSort: (a, b) => + (STANDARD_COMMIT_RANKS[b.title] ?? 0) - (STANDARD_COMMIT_RANKS[a.title] ?? 0), commitsSort: (a, b) => { const scopeCompare = (b.scope ?? '').localeCompare(a.scope ?? ''); if (scopeCompare !== 0) return scopeCompare; return (b.subject ?? '').localeCompare(a.subject ?? ''); }, + formatDate: formatReleaseDate, + finalizeContext: (context) => { + if (context.date) { + context.date = formatReleaseDate(context.date); + } + return context; + }, }, }, ], @@ -91,7 +80,7 @@ export default { ], commitPluginPath, [ - '@semantic-release/github', + changelogDomainsPluginPath, { assets: [ { path: './LocalTelemetrySetup.exe', label: 'LocalTelemetry Setup' }, diff --git a/.github/release/run.ts b/.github/release/run.ts index ad4dabf..998e073 100644 --- a/.github/release/run.ts +++ b/.github/release/run.ts @@ -3,11 +3,12 @@ import { dirname, resolve } from 'node:path'; // Relax semantic-release requirement of having at least 1 non-prerelease branch // when master itself is configured as a prerelease (rc) channel. -const branchesDefsPath = resolve(dirname(fileURLToPath(import.meta.url)), 'node_modules/semantic-release/lib/definitions/branches.js'); +const baseDir = dirname(fileURLToPath(import.meta.url)); +const branchesDefsPath = resolve(baseDir, 'node_modules/@semantic-release/core/lib/definitions/branches.js'); const defs = await import(branchesDefsPath); defs.release.branchesValidator = (branches: unknown[]) => branches.length <= 3; // Execute standard semantic-release CLI -const cliPath = resolve(dirname(fileURLToPath(import.meta.url)), 'node_modules/semantic-release/cli.js'); +const cliPath = resolve(baseDir, 'node_modules/semantic-release/cli.js'); const cli = await import(cliPath); await cli.default(); diff --git a/.github/release/semantic-release.d.ts b/.github/release/semantic-release.d.ts new file mode 100644 index 0000000..28ea389 --- /dev/null +++ b/.github/release/semantic-release.d.ts @@ -0,0 +1,11 @@ +declare module '@semantic-release/release-notes-generator' { + export function generateNotes(pluginConfig: any, context: any): Promise; +} + +declare module '@semantic-release/github' { + export function verifyConditions(pluginConfig: any, context: any): Promise; + export function publish(pluginConfig: any, context: any): Promise; + export function addChannel(pluginConfig: any, context: any): Promise; + export function success(pluginConfig: any, context: any): Promise; + export function fail(pluginConfig: any, context: any): Promise; +} diff --git a/.github/release/tsconfig.json b/.github/release/tsconfig.json index d598fb8..4210416 100644 --- a/.github/release/tsconfig.json +++ b/.github/release/tsconfig.json @@ -13,7 +13,8 @@ }, "include": [ "*.ts", - "*.mjs" + "*.mjs", + "../../tests/LocalTelemetry.Release.Tests/**/*.ts" ], "exclude": [ "node_modules" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 91a9dc6..ac6fe2e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,10 +2,11 @@ name: CI on: push: - branches: [master] + branches: [master, develop] paths: - "src/**" - "tests/**" + - ".github/release/**" - "Directory.Build.props" - "global.json" - "LocalTelemetry.sln" @@ -13,10 +14,11 @@ on: - "codecov.yml" - "commitlint.config.mjs" pull_request: - branches: [master] + branches: [master, develop] paths: - "src/**" - "tests/**" + - ".github/release/**" - "Directory.Build.props" - "global.json" - "LocalTelemetry.sln" @@ -46,9 +48,12 @@ jobs: ln -s src/LocalTelemetry.App/Settings/wwwroot/node_modules ./node_modules - name: Verify Commits - uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6.2.1 - with: - configFile: commitlint.config.mjs + run: | + if [ "${{ github.event_name }}" = "pull_request" ]; then + ./node_modules/.bin/commitlint --from "${{ github.event.pull_request.base.sha }}" --to "${{ github.event.pull_request.head.sha }}" --config commitlint.config.mjs --verbose + else + ./node_modules/.bin/commitlint --from "${{ github.event.before }}" --to "${{ github.sha }}" --config commitlint.config.mjs --verbose + fi test-frontend: name: Frontend Tests @@ -64,7 +69,7 @@ jobs: run: bun install --frozen-lockfile --ignore-scripts working-directory: src/LocalTelemetry.App/Settings/wwwroot - - name: Run Vitest + - name: Frontend Tests run: | bun install --frozen-lockfile --ignore-scripts bun run test:coverage @@ -80,6 +85,34 @@ jobs: disable_search: true plugins: noop + test-release: + name: Release Tests + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + + - name: Setup Bun + uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 + + - name: Release Tests + run: | + bun install --frozen-lockfile --ignore-scripts + bun run test:coverage + working-directory: .github/release + + - name: Upload Release Coverage + uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: Nicconike/LocalTelemetry + files: .github/release/coverage/lcov.info + flags: release + disable_search: true + plugins: noop + test-windows: name: .NET Tests runs-on: windows-latest @@ -111,9 +144,9 @@ jobs: restore-keys: ${{ runner.os }}-nuget- - name: Setup .NET - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 + uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 with: - dotnet-version: 10.0.x + dotnet-version: 11.0.x - name: Format Check run: dotnet format --verify-no-changes @@ -122,40 +155,40 @@ jobs: run: dotnet build --configuration Debug - name: Test Core - run: dotnet test tests/LocalTelemetry.Core.Tests/LocalTelemetry.Core.Tests.csproj --configuration Debug --no-build --verbosity minimal --collect:"XPlat Code Coverage" --results-directory TestResults/core -p:Platform=x64 - - - name: Test Notifier - run: dotnet test tests/LocalTelemetry.Notifier.Tests/LocalTelemetry.Notifier.Tests.csproj --configuration Debug --no-build --verbosity minimal --collect:"XPlat Code Coverage" --results-directory TestResults/notifier -p:Platform=x64 - - - name: Test App - run: dotnet test tests/LocalTelemetry.App.Tests/LocalTelemetry.App.Tests.csproj --configuration Debug --no-build --verbosity minimal --collect:"XPlat Code Coverage" --results-directory TestResults/app -p:Platform=x64 + run: dotnet test --project tests/LocalTelemetry.Core.Tests/LocalTelemetry.Core.Tests.csproj --configuration Debug --no-build -p:Platform=x64 -- --coverlet --coverlet-output-format cobertura --results-directory TestResults/core - name: Upload Core Coverage uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 with: token: ${{ secrets.CODECOV_TOKEN }} slug: Nicconike/LocalTelemetry - files: TestResults/core/**/coverage.cobertura.xml + files: TestResults/core/**/coverage.cobertura*.xml flags: core disable_search: true plugins: noop + - name: Test Notifier + run: dotnet test --project tests/LocalTelemetry.Notifier.Tests/LocalTelemetry.Notifier.Tests.csproj --configuration Debug --no-build -p:Platform=x64 -- --coverlet --coverlet-output-format cobertura --results-directory TestResults/notifier + - name: Upload Notifier Coverage uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 with: token: ${{ secrets.CODECOV_TOKEN }} slug: Nicconike/LocalTelemetry - files: TestResults/notifier/**/coverage.cobertura.xml + files: TestResults/notifier/**/coverage.cobertura*.xml flags: notifier disable_search: true plugins: noop + - name: Test App + run: dotnet test --project tests/LocalTelemetry.App.Tests/LocalTelemetry.App.Tests.csproj --configuration Debug --no-build -p:Platform=x64 -- --coverlet --coverlet-output-format cobertura --coverlet-include "[LocalTelemetry]*" --coverlet-exclude "[LocalTelemetry.Core]*" --results-directory TestResults/app + - name: Upload App Coverage uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 with: token: ${{ secrets.CODECOV_TOKEN }} slug: Nicconike/LocalTelemetry - files: TestResults/app/**/coverage.cobertura.xml + files: TestResults/app/**/coverage.cobertura*.xml flags: app disable_search: true plugins: noop diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 8d5edf3..a9e377a 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -2,7 +2,7 @@ name: CodeQL on: push: - branches: [master] + branches: [master, develop] paths: - "src/**" - "Directory.Build.props" @@ -10,7 +10,7 @@ on: - "LocalTelemetry.sln" - ".github/workflows/codeql.yml" pull_request: - branches: [master] + branches: [master, develop] paths: - "src/**" - "Directory.Build.props" @@ -35,7 +35,7 @@ jobs: uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Init CodeQL - uses: github/codeql-action/init@6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee # v4.39.0 + uses: github/codeql-action/init@915412ff23e8b7659517e607487dbeae018f2934 # v4.39.5 with: languages: "csharp" build-mode: "manual" @@ -50,12 +50,12 @@ jobs: working-directory: src/LocalTelemetry.App/Settings/wwwroot - name: Setup .NET - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 + uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 with: - dotnet-version: 10.0.x + dotnet-version: 11.0.x - name: Build Solution run: dotnet build --configuration Debug - name: Analyze CodeQL - uses: github/codeql-action/analyze@6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee # v4.39.0 + uses: github/codeql-action/analyze@915412ff23e8b7659517e607487dbeae018f2934 # v4.39.5 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 2a63e8e..cd167c4 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -2,7 +2,7 @@ name: Deploy Docs on: push: - branches: [master] + branches: [master, develop] paths: - ".github/workflows/docs.yml" - "docs/**" @@ -41,7 +41,7 @@ jobs: run: bun run docs:build working-directory: docs env: - GA_MEASUREMENT_ID: ${{ secrets.GA_MEASUREMENT_ID }} + UMAMI_WEBSITE_ID: ${{ secrets.UMAMI_WEBSITE_ID }} VITE_BASE: ${{ steps.pages.outputs.base_path }} - name: Upload Pages Artifact diff --git a/.github/workflows/project.yml b/.github/workflows/project.yml index 20f4da6..d4f9726 100644 --- a/.github/workflows/project.yml +++ b/.github/workflows/project.yml @@ -4,7 +4,16 @@ on: issues: types: [opened, closed, reopened, assigned, unassigned] pull_request_target: - types: [opened, synchronize, reopened, closed, ready_for_review, converted_to_draft, review_requested] + types: + [ + opened, + synchronize, + reopened, + closed, + ready_for_review, + converted_to_draft, + review_requested, + ] workflow_dispatch: permissions: @@ -24,7 +33,7 @@ jobs: env: PROJECTS: ${{ secrets.PROJECTS }} with: - github-token: ${{ secrets.PROJECTS || secrets.GITHUB_TOKEN }} + github-token: ${{ secrets.PROJECTS }} script: | const action = context.payload.action; const isIssue = !!context.payload.issue; @@ -87,6 +96,45 @@ jobs: return; } + // Fetch Repository Issue Types + let availableIssueTypes = []; + try { + const repoQuery = ` + query($owner: String!, $repo: String!) { + repository(owner: $owner, name: $repo) { + issueTypes(first: 10) { + nodes { id name } + } + } + } + `; + const repoData = await graphqlWithPat(repoQuery, { owner, repo: context.repo.repo }); + availableIssueTypes = repoData.repository?.issueTypes?.nodes || []; + } catch (err) { + console.warn(`Issue types fetch skipped: ${err.message}`); + } + + // Helper: Update Native GitHub Issue Type + const updateNativeIssueType = async (issueId, targetTypeName) => { + if (!issueId || !targetTypeName || availableIssueTypes.length === 0) return; + const matchedType = availableIssueTypes.find(t => t.name.toLowerCase() === targetTypeName.toLowerCase()); + if (matchedType) { + try { + const mutation = ` + mutation($issueId: ID!, $issueTypeId: ID!) { + updateIssue(input: { id: $issueId, issueTypeId: $issueTypeId }) { + issue { id issueType { name } } + } + } + `; + await graphqlWithPat(mutation, { issueId, issueTypeId: matchedType.id }); + console.log(`Updated issue ${issueId} -> native issueType: ${matchedType.name}`); + } catch (err) { + console.warn(`Native issueType update skipped: ${err.message}`); + } + } + }; + // Helper: Update Single-Select Field (Status, Priority, Scope, Kind) const updateSingleSelectField = async (targetItemId, fieldName, targetOptionName) => { const field = allFields.find(f => f.name && f.name.toLowerCase() === fieldName.toLowerCase()); @@ -185,16 +233,20 @@ jobs: } }; - // Helper: Compute metadata based on title and PR diff - const computeMetadata = (rawTitle, isPr, author, additions, deletions) => { + // Helper: Compute metadata based on title, labels and PR diff + const computeMetadata = (rawTitle, isPr, author, additions, deletions, existingLabels = []) => { const title = (rawTitle || '').toLowerCase(); + const labelsLower = existingLabels.map(l => (typeof l === 'string' ? l : l.name || '').toLowerCase()); let labelsToAdd = new Set(); let kindName = ""; let scopeName = ""; let priorityName = "🟡 Medium"; let effortValue = 2; - if (author === 'dependabot[bot]' || author.includes('bot') || title.includes('(deps)')) { + const hasLabel = (lbl) => labelsLower.includes(lbl.toLowerCase()); + + // 1. Author and Dependency Detection + if (author === 'dependabot[bot]' || author.includes('bot') || title.includes('(deps)') || hasLabel('dependabot') || hasLabel('dependencies')) { if (author === 'dependabot[bot]') labelsToAdd.add('dependabot'); labelsToAdd.add('dependencies'); labelsToAdd.add('scope:ci'); @@ -203,50 +255,51 @@ jobs: priorityName = "🔵 Low"; effortValue = 1; } else { - if (title.includes('breaking') || title.includes('!') || title.startsWith('breaking')) { + // 2. Kind Detection (Prefix, Natural Language Keywords, or Existing Labels) + if (title.startsWith('breaking') || title.includes('breaking change') || title.startsWith('feat!') || title.startsWith('fix!') || hasLabel('breaking')) { labelsToAdd.add('enhancement'); kindName = "💥 Breaking"; priorityName = "🔴 Urgent"; effortValue = 5; - } else if (title.startsWith('feat')) { + } else if (title.startsWith('feat') || /\b(add|support|implement|new|feature|allow|provide|introduce)\b/.test(title) || hasLabel('enhancement') || hasLabel('feature')) { labelsToAdd.add('enhancement'); kindName = "✨ Feature"; - priorityName = "🟠 High"; + priorityName = (title.includes('major') || title.includes('critical') || title.includes('core')) ? "🟠 High" : "🟡 Medium"; effortValue = 3; - } else if (title.startsWith('fix')) { + } else if (title.startsWith('fix') || /\b(fix|bug|defect|crash|error|fail|leak|broken|exception|wrong|fault)\b/.test(title) || hasLabel('bug')) { labelsToAdd.add('bug'); kindName = "🐛 Bug"; - priorityName = title.includes('critical') || title.includes('security') ? "🔴 Urgent" : "🟠 High"; - effortValue = 2; - } else if (title.startsWith('perf')) { + priorityName = (title.includes('critical') || title.includes('security') || title.includes('crash') || title.includes('freeze')) ? "🔴 Urgent" : "🟠 High"; + effortValue = (priorityName === "🔴 Urgent") ? 5 : 2; + } else if (title.startsWith('perf') || /\b(perf|performance|speed|slow|lag|optimize|optimise|fps|ram|trim)\b/.test(title) || hasLabel('perf')) { labelsToAdd.add('perf'); labelsToAdd.add('enhancement'); kindName = "⚡ Perf"; priorityName = "🟡 Medium"; effortValue = 3; - } else if (title.startsWith('refactor')) { + } else if (title.startsWith('refactor') || /\b(refactor|clean|cleanup|reorganize|restructure|simplify)\b/.test(title) || hasLabel('refactor')) { labelsToAdd.add('refactor'); kindName = "♻️ Refactor"; priorityName = "🟡 Medium"; effortValue = 2; - } else if (title.startsWith('test')) { + } else if (title.startsWith('test') || /\b(test|tests|testing|coverage|unit test|assert)\b/.test(title) || hasLabel('testing')) { labelsToAdd.add('testing'); kindName = "🧪 Test"; priorityName = "🟡 Medium"; effortValue = 2; - } else if (title.startsWith('docs')) { + } else if (title.startsWith('docs') || /\b(docs|doc|documentation|readme|guide|comment|typo)\b/.test(title) || hasLabel('documentation')) { labelsToAdd.add('documentation'); kindName = "📚 Docs"; priorityName = "🔵 Low"; effortValue = 1; - } else if (title.startsWith('build')) { + } else if (title.startsWith('build') || /\b(build|package|installer|setup|publish)\b/.test(title) || hasLabel('build')) { labelsToAdd.add('dependencies'); labelsToAdd.add('scope:ci'); kindName = "📦 Build"; scopeName = "CI"; priorityName = "🔵 Low"; effortValue = 1; - } else if (title.startsWith('ci')) { + } else if (title.startsWith('ci') || /\b(ci|workflow|pipeline|actions|github action|action)\b/.test(title) || hasLabel('ci')) { labelsToAdd.add('ci'); labelsToAdd.add('actions'); labelsToAdd.add('scope:ci'); @@ -254,50 +307,82 @@ jobs: scopeName = "CI"; priorityName = "🔵 Low"; effortValue = 1; - } else if (title.startsWith('chore')) { + } else if (title.startsWith('chore') || /\b(chore|bump|license|gitignore)\b/.test(title) || hasLabel('chore')) { labelsToAdd.add('chore'); kindName = "🔧 Chore"; priorityName = "🔵 Low"; effortValue = 1; - } else if (title.startsWith('style')) { + } else if (title.startsWith('style') || /\b(style|formatting|whitespace|lint|prettier)\b/.test(title)) { kindName = "🎨 Style"; priorityName = "🔵 Low"; effortValue = 1; - } else if (title.startsWith('revert')) { + } else if (title.startsWith('revert') || /\b(revert|rollback)\b/.test(title)) { labelsToAdd.add('bug'); kindName = "🐛 Bug"; priorityName = "🟠 High"; effortValue = 2; + } else { + // Generic fallback for plain titles + kindName = "✨ Feature"; + priorityName = "🟡 Medium"; + effortValue = 2; } - if (isPr && additions !== undefined && deletions !== undefined) { - const totalDiff = additions + deletions; - if (totalDiff < 30) effortValue = 1; - else if (totalDiff <= 100) effortValue = 2; - else if (totalDiff <= 300) effortValue = 3; - else if (totalDiff <= 600) effortValue = 5; - else effortValue = 8; + // 3. Effort Story Points Calculation (Standardized Complexity Model) + if (kindName === "💥 Breaking" || priorityName === "🔴 Urgent") { + effortValue = 5; + } else if (kindName === "✨ Feature" || kindName === "⚡ Perf") { + effortValue = 3; + } else if (kindName === "🐛 Bug" || kindName === "♻️ Refactor" || kindName === "🧪 Test") { + effortValue = 2; + } else { + effortValue = 1; } - if (title.includes('(core)')) labelsToAdd.add('scope:core'); - if (title.includes('(app)')) labelsToAdd.add('scope:app'); - if (title.includes('(overlay)')) labelsToAdd.add('scope:overlay'); - if (title.includes('(monitor)')) labelsToAdd.add('scope:monitor'); - if (title.includes('(config)')) labelsToAdd.add('scope:config'); - if (title.includes('(ci)') || title.includes('(actions)')) labelsToAdd.add('scope:ci'); - - if (title.includes('(core)') || title.includes('(config)') || title.includes('(monitor)')) labelsToAdd.add('csharp'); - if (title.includes('(app)') || title.includes('(overlay)')) labelsToAdd.add('frontend'); - - if (title.includes('(core)')) scopeName = "Core"; - else if (title.includes('(app)')) scopeName = "App"; - else if (title.includes('(overlay)')) scopeName = "Overlay"; - else if (title.includes('(monitor)')) scopeName = "Monitor"; - else if (title.includes('(config)')) scopeName = "Config"; - else if (title.includes('(ci)') || title.includes('(actions)')) scopeName = "CI"; + // 4. Scope Detection (Tags, Natural Language Keywords, or Existing Labels) + if (title.includes('(overlay)') || /\b(overlay|taskbar|display|monitor|screen|dpi|downsize|position|clock|tray|column|columns|explorerpatcher|weather|overlap|overlapping)\b/.test(title) || hasLabel('scope:overlay')) { + labelsToAdd.add('scope:overlay'); + scopeName = "Overlay"; + } else if (title.includes('(core)') || title.includes('(tests)') || title.includes('(test)') || /\b(core|hardware|nvml|adl|igcl|wddm|pawnio|msr|driver|sensor|gpu|cpu|xunit)\b/.test(title) || hasLabel('scope:core')) { + labelsToAdd.add('scope:core'); + scopeName = "Core"; + } else if (title.includes('(notifier)') || /\b(notifier|toast|toastform|pipe)\b/.test(title) || hasLabel('scope:notifier')) { + labelsToAdd.add('scope:notifier'); + scopeName = "Notifier"; + } else if (title.includes('(monitor)') || /\b(telemetry|frequency|temperature|temp|load|metric|usage)\b/.test(title) || hasLabel('scope:monitor')) { + labelsToAdd.add('scope:monitor'); + scopeName = "Monitor"; + } else if (title.includes('(config)') || /\b(config|settings\.json|appsettings|configuration)\b/.test(title) || hasLabel('scope:config')) { + labelsToAdd.add('scope:config'); + scopeName = "Config"; + } else if (title.includes('(app)') || /\b(app|window|shell|settings|ui|svelte|wpf|frontend)\b/.test(title) || hasLabel('scope:app')) { + labelsToAdd.add('scope:app'); + scopeName = "App"; + } else if (title.includes('(docs)') || /\b(docs|vitepress|markdown)\b/.test(title) || hasLabel('documentation')) { + scopeName = "Docs"; + } else if (title.includes('(ci)') || title.includes('(actions)') || /\b(ci|pipeline|workflow|workflow_dispatch)\b/.test(title) || hasLabel('scope:ci')) { + labelsToAdd.add('scope:ci'); + scopeName = "CI"; + } + + // Tech Stack Labels + if (['Core', 'Config', 'Monitor'].includes(scopeName) || title.includes('c#') || title.includes('.net') || hasLabel('csharp')) { + labelsToAdd.add('csharp'); + } + if (['App', 'Overlay'].includes(scopeName) || title.includes('svelte') || title.includes('css') || title.includes('frontend') || hasLabel('frontend')) { + labelsToAdd.add('frontend'); + } } - return { labelsToAdd, kindName, scopeName, priorityName, effortValue }; + // 5. Determine Native GitHub Issue Type (Bug, Feature, Task) + let nativeIssueTypeName = "Task"; + if (kindName.includes("Bug")) { + nativeIssueTypeName = "Bug"; + } else if (kindName.includes("Feature") || kindName.includes("Perf") || kindName.includes("Breaking")) { + nativeIssueTypeName = "Feature"; + } + + return { labelsToAdd, kindName, scopeName, priorityName, effortValue, nativeIssueTypeName }; }; // --- WORKFLOW_DISPATCH AUDIT & RECONCILIATION --- @@ -313,12 +398,15 @@ jobs: content { __typename ... on Issue { + id number title state stateReason author { login } assignees(first: 5) { totalCount } + labels(first: 10) { nodes { name } } + issueType { id name } } ... on PullRequest { number @@ -329,6 +417,7 @@ jobs: author { login } additions deletions + labels(first: 10) { nodes { name } } } } fieldValues(first: 20) { @@ -391,7 +480,13 @@ jobs: // Populate missing metadata const authorLogin = content.author ? content.author.login : ''; - const meta = computeMetadata(content.title, isPr, authorLogin, content.additions, content.deletions); + const contentLabels = (content.labels && content.labels.nodes) ? content.labels.nodes.map(l => l.name) : []; + const meta = computeMetadata(content.title, isPr, authorLogin, content.additions, content.deletions, contentLabels); + + // Ensure native GitHub Issue Type is assigned + if (content.__typename === 'Issue' && !content.issueType && meta.nativeIssueTypeName) { + await updateNativeIssueType(content.id, meta.nativeIssueTypeName); + } if (!currentEffort && meta.effortValue !== undefined) { await updateNumberField(pItem.id, 'Effort', meta.effortValue); @@ -416,7 +511,7 @@ jobs: const number = item.number; const contentId = item.node_id; - // 2. Add Item to Project #7 if not present + // 2. Add Item to Project #7 if not present (idempotent) let itemId; try { const addItemMutation = ` @@ -434,22 +529,17 @@ jobs: } // 3. Determine Lifecycle Stage (Status lane) + // Note: Initial 'Todo' on open, and 'Done' on PR merge are automatically handled by Project #7 built-in workflows. let targetStatus = ''; if (action === 'closed') { - if (isIssue) { - targetStatus = (item.state_reason === 'not_planned') ? 'Cancelled' : 'Done'; - } else { - targetStatus = item.merged ? 'Done' : 'Cancelled'; + if (isIssue && item.state_reason === 'not_planned') { + targetStatus = 'Cancelled'; } } else if (isIssue) { if (action === 'assigned') { targetStatus = 'In Progress'; } else if (action === 'unassigned') { targetStatus = (item.assignees && item.assignees.length > 0) ? 'In Progress' : 'Todo'; - } else if (action === 'reopened') { - targetStatus = (item.assignees && item.assignees.length > 0) ? 'In Progress' : 'Todo'; - } else if (action === 'opened') { - targetStatus = title.toLowerCase().includes('backlog') ? 'Backlog' : 'Todo'; } } else { // Pull Request Lifecycle Stages @@ -457,7 +547,7 @@ jobs: targetStatus = 'In Progress'; } else if (action === 'ready_for_review' || action === 'review_requested') { targetStatus = 'In Review'; - } else if (action === 'opened' || action === 'synchronize' || action === 'reopened') { + } else if (action === 'opened' || action === 'synchronize') { targetStatus = item.draft ? 'In Progress' : 'In Review'; } } @@ -468,10 +558,19 @@ jobs: } // 4. Compute and Assign Item Metadata - const meta = computeMetadata(title, !isIssue, author, item.additions, item.deletions); + const existingLabels = (item.labels || []).map(l => (typeof l === 'string' ? l : l.name || '')); + const meta = computeMetadata(title, !isIssue, author, item.additions, item.deletions, existingLabels); + + // Set Native GitHub Issue Type if missing + if (isIssue && meta.nativeIssueTypeName) { + const currentNativeType = item.issue_type || item.issueType; + if (!currentNativeType) { + await updateNativeIssueType(contentId, meta.nativeIssueTypeName); + } + } - // Apply Labels - const finalLabels = Array.from(meta.labelsToAdd); + // Apply Labels (filter out already existing labels) + const finalLabels = Array.from(meta.labelsToAdd).filter(l => !existingLabels.map(el => el.toLowerCase()).includes(l.toLowerCase())); if (finalLabels.length > 0) { try { await github.rest.issues.addLabels({ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b365d3b..41f836f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ name: Release on: push: - branches: [master] + branches: [master, develop] paths: - ".github/release/**" - ".github/workflows/release.yml" @@ -31,7 +31,7 @@ jobs: steps: - name: Generate App Token id: app_token - uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 + uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0 with: client-id: ${{ secrets.APP_CLIENT_ID }} private-key: ${{ secrets.APP_PRIVATE_KEY }} @@ -46,16 +46,20 @@ jobs: uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 - name: Setup .NET - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 + uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 with: - dotnet-version: 10.0.x + dotnet-version: 11.0.x - name: Install Release Dependencies run: bun install --frozen-lockfile working-directory: .github/release + - name: Run Release Tests + run: bun run test + working-directory: .github/release + - name: Install Cosign - uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2 + uses: sigstore/cosign-installer@881c63bd87e38389154debd8331404ce7ca8a3ab # v4.1.4 - name: Install Inno Setup 7 shell: pwsh @@ -122,7 +126,7 @@ jobs: bun run ./.github/release/run.ts --extends ./.github/release/release.config.mjs - name: Submit to WinGet Community Repo - if: env.RELEASE_TAG != '' + if: env.RELEASE_TAG != '' && github.ref == 'refs/heads/master' continue-on-error: true shell: pwsh env: diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 1437ea0..176c90a 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -34,13 +34,13 @@ jobs: persist-credentials: false - name: Run Scorecard - uses: ossf/scorecard-action@fa7117db83c52d787ae5a89f350999701505d78e # v2.5.0 + uses: ossf/scorecard-action@23f22cd43608bae7a1f1fa2603d7314dee9538a5 # v2.6.0 with: results_file: results.sarif results_format: sarif publish_results: true - name: Upload SARIF - uses: github/codeql-action/upload-sarif@6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee # v4.39.0 + uses: github/codeql-action/upload-sarif@915412ff23e8b7659517e607487dbeae018f2934 # v4.39.5 with: sarif_file: results.sarif diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index b46c4f6..615c777 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -6,6 +6,7 @@ on: paths: - "src/**" - "tests/**" + - ".github/release/**" - "Directory.Build.props" - "global.json" - "LocalTelemetry.sln" @@ -15,6 +16,7 @@ on: paths: - "src/**" - "tests/**" + - ".github/release/**" - "Directory.Build.props" - "global.json" - "LocalTelemetry.sln" @@ -37,15 +39,15 @@ jobs: fetch-depth: 0 - name: Setup Java - uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0 + uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0 with: java-version: 21 distribution: "zulu" - name: Setup .NET - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 + uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 with: - dotnet-version: "10.0.x" + dotnet-version: "11.0.x" - name: Setup Bun uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 @@ -62,12 +64,20 @@ jobs: ${{ runner.os }}-sonar-v1- ${{ runner.os }}-sonar- - - name: Build Frontend + - name: Build & Test Frontend run: | bun install --frozen-lockfile --ignore-scripts bun run build + bun install --frozen-lockfile --ignore-scripts --cwd ../../../../tests/LocalTelemetry.App.Tests/Settings/wwwroot + bun run --cwd ../../../../tests/LocalTelemetry.App.Tests/Settings/wwwroot test:coverage working-directory: src/LocalTelemetry.App/Settings/wwwroot + - name: Test Release Tooling + run: | + bun install --frozen-lockfile --ignore-scripts + bun run test:coverage + working-directory: .github/release + - name: Install SonarScanner shell: pwsh run: dotnet tool update --global dotnet-sonarscanner @@ -85,12 +95,15 @@ jobs: /o:"nicconike" ` /d:sonar.host.url="https://sonarcloud.io" ` /d:sonar.token="$env:SONAR_TOKEN" ` - /d:sonar.cs.cobertura.reportsPaths="**/TestResults/**/coverage.cobertura.xml" ` + /d:sonar.cs.cobertura.reportsPaths="**/TestResults/**/coverage.cobertura*.xml" ` + /d:sonar.javascript.lcov.reportPaths="tests/LocalTelemetry.App.Tests/Settings/wwwroot/coverage/lcov.info,.github/release/coverage/lcov.info" ` /d:sonar.scanner.scanAll=false ` /d:sonar.exclusions="**/wwwroot/dist/**,**/bin/**,**/obj/**" dotnet build --configuration Debug - dotnet test --configuration Debug --no-build --verbosity minimal --collect:"XPlat Code Coverage" --results-directory TestResults -p:Platform=x64 + dotnet test --project tests/LocalTelemetry.Core.Tests/LocalTelemetry.Core.Tests.csproj --configuration Debug --no-build -p:Platform=x64 -- --coverlet --coverlet-output-format cobertura --results-directory TestResults/core + dotnet test --project tests/LocalTelemetry.Notifier.Tests/LocalTelemetry.Notifier.Tests.csproj --configuration Debug --no-build -p:Platform=x64 -- --coverlet --coverlet-output-format cobertura --results-directory TestResults/notifier + dotnet test --project tests/LocalTelemetry.App.Tests/LocalTelemetry.App.Tests.csproj --configuration Debug --no-build -p:Platform=x64 -- --coverlet --coverlet-output-format cobertura --coverlet-include "[LocalTelemetry]*" --coverlet-exclude "[LocalTelemetry.Core]*" --results-directory TestResults/app dotnet-sonarscanner end /d:sonar.token="$env:SONAR_TOKEN" diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index f2931d4..c174a1d 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -2,7 +2,7 @@ name: Sync PRs on: push: - branches: [master] + branches: [master, develop] paths: - ".github/**" - "src/**" @@ -14,14 +14,15 @@ on: pull_request_target: types: [opened, synchronize, reopened] workflow_run: - workflows: ["CI", "SonarQube Analysis", "CodeQL"] + workflows: ["CI"] types: [completed] branches-ignore: [master] + workflow_dispatch: permissions: contents: read - pull-requests: write - issues: write + pull-requests: read + issues: read jobs: sync: @@ -29,6 +30,7 @@ jobs: runs-on: ubuntu-latest if: >- github.event_name == 'push' || + github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request_target' || (github.event_name == 'workflow_run' && github.event.workflow_run.event == 'pull_request' && @@ -36,18 +38,24 @@ jobs: steps: - name: Generate App Token id: app_token - uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 + uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0 with: client-id: ${{ secrets.APP_CLIENT_ID }} private-key: ${{ secrets.APP_PRIVATE_KEY }} - name: Sync Open PRs on Push - if: github.event_name == 'push' + if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' env: - GH_TOKEN: ${{ secrets.PROJECTS || steps.app_token.outputs.token || secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ steps.app_token.outputs.token }} REPO: ${{ github.repository }} run: | - prs=$(gh pr list --repo "$REPO" --state open --json number,headRefName,author,title --jq '.[]') + base_branch="${{ github.ref_name }}" + if [ -z "$base_branch" ] || [ "$base_branch" = "HEAD" ]; then + base_branch="develop" + fi + + echo "Checking for open pull requests targeting $base_branch..." + prs=$(gh pr list --repo "$REPO" --base "$base_branch" --state open --json number,headRefName,author,title --jq '.[]') if [ -z "$prs" ]; then echo "No open pull requests found." exit 0 @@ -60,14 +68,8 @@ jobs: pr_title=$(echo "$pr" | jq -r '.title') echo "Processing PR #$pr_num (branch: $pr_branch, author: $pr_author)..." - - if [ "$pr_author" = "app/dependabot" ] || [ "$pr_author" = "dependabot" ] || [ "$pr_author" = "dependabot[bot]" ]; then - echo "Triggering Dependabot rebase for PR #$pr_num..." - gh pr comment "$pr_num" --repo "$REPO" --body "@dependabot rebase" || true - else - echo "Updating branch for PR #$pr_num..." - gh api --method PUT "repos/$REPO/pulls/$pr_num/update-branch" --silent || true - fi + echo "Updating branch for PR #$pr_num with latest $base_branch..." + gh api --method PUT "repos/$REPO/pulls/$pr_num/update-branch" --silent || true clean_title="$pr_title" if [[ "$clean_title" =~ ^([a-zA-Z0-9_()-]+:\ )([Bb]ump the ([a-zA-Z0-9_-]+)-deps group.*)$ ]]; then @@ -88,7 +90,7 @@ jobs: - name: Configure PR on Event if: github.event_name == 'pull_request_target' env: - GH_TOKEN: ${{ secrets.PROJECTS || steps.app_token.outputs.token || secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ steps.app_token.outputs.token }} REPO: ${{ github.repository }} PR_NUMBER: ${{ github.event.pull_request.number }} PR_TITLE: ${{ github.event.pull_request.title }} @@ -109,13 +111,10 @@ jobs: gh api --method PATCH "repos/$REPO/pulls/$PR_NUMBER" -f title="$clean_title" || true fi - echo "Enabling auto-merge for PR #$PR_NUMBER (requires owner approval and passing checks)..." - gh pr merge "$PR_NUMBER" --repo "$REPO" --auto --squash --subject "$clean_title" --body "" || true - - name: Verify and Merge Passing PR on Workflow Completion if: github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' env: - GH_TOKEN: ${{ secrets.PROJECTS || steps.app_token.outputs.token || secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ steps.app_token.outputs.token }} REPO: ${{ github.repository }} run: | pr_number="${{ github.event.workflow_run.pull_requests[0].number }}" @@ -132,6 +131,13 @@ jobs: exit 0 fi + merge_state=$(gh pr view "$pr_number" --repo "$REPO" --json mergeStateStatus --jq '.mergeStateStatus') + if [ "$merge_state" = "BEHIND" ]; then + echo "PR #$pr_number is behind base branch. Updating branch..." + gh api --method PUT "repos/$REPO/pulls/$pr_number/update-branch" --silent || true + exit 0 + fi + echo "Checking required status checks for PR #$pr_number..." if ! gh pr checks "$pr_number" --repo "$REPO" --required; then echo "Required status checks for PR #$pr_number are still pending or failed. Will not merge." @@ -155,11 +161,19 @@ jobs: gh api --method PATCH "repos/$REPO/pulls/$pr_number" -f title="$clean_title" || true fi - echo "Checking if PR #$pr_number has required code owner approval..." - review_decision=$(gh pr view "$pr_number" --repo "$REPO" --json reviewDecision --jq '.reviewDecision') - if [ "$review_decision" != "APPROVED" ]; then - echo "PR #$pr_number is not approved yet (reviewDecision: $review_decision). Waiting for code owner review." - exit 0 + pr_author=$(gh pr view "$pr_number" --repo "$REPO" --json author --jq '.author.login') + echo "PR #$pr_number author: $pr_author" + + if [ "$pr_author" = "app/dependabot" ] || [ "$pr_author" = "dependabot" ] || [ "$pr_author" = "dependabot[bot]" ]; then + echo "Dependabot PR verified. Auto-approving..." + gh pr review "$pr_number" --repo "$REPO" --approve --body "Dependabot checks verified successfully." || true + else + echo "Checking if PR #$pr_number has required code owner approval..." + review_decision=$(gh pr view "$pr_number" --repo "$REPO" --json reviewDecision --jq '.reviewDecision') + if [ "$review_decision" != "APPROVED" ]; then + echo "PR #$pr_number is not approved yet (reviewDecision: $review_decision). Waiting for code owner review." + exit 0 + fi fi echo "Merging approved and verified PR #$pr_number..." diff --git a/.gitignore b/.gitignore index d795ad6..8e9d71f 100644 --- a/.gitignore +++ b/.gitignore @@ -434,6 +434,7 @@ internet_usage.jsonl # VitePress docs build output docs/.vitepress/cache docs/.vitepress/dist +docs/public/mermaid.min.js docs/v*/ # Bun diff --git a/CHANGELOG.md b/CHANGELOG.md index df96d3a..906c804 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,86 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org) & [Conventional Commits](https://conventionalcommits.org). +## [1.3.0-beta.9](https://github.com/Nicconike/LocalTelemetry/compare/v1.3.0-beta.8...v1.3.0-beta.9) (27-11-2026) + +### Features + +* **telemetry:** expand storage telemetry, taskbar space clamping, and deduplicate themes ([05ba754](https://github.com/Nicconike/LocalTelemetry/commit/05ba7544aa4cfb285373aacd080e2951b8900ea7)) + +## [1.3.0-beta.8](https://github.com/Nicconike/LocalTelemetry/compare/v1.3.0-beta.7...v1.3.0-beta.8) (24-11-2026) + +### Bug Fixes + +* **overlay:** apply placement offset and avoid ExplorerPatcher weather overlap on Win10 ([ec1b5d1](https://github.com/Nicconike/LocalTelemetry/commit/ec1b5d15b96b785f49bdf0f57c38a070e8117b64)), closes [#28](https://github.com/Nicconike/LocalTelemetry/issues/28) + +## [1.3.0-beta.7](https://github.com/Nicconike/LocalTelemetry/compare/v1.3.0-beta.6...v1.3.0-beta.7) (24-11-2026) + +### Bug Fixes + +* **hardware:** decouple dedicated GPU VRAM ceiling from host system RAM ([3be84f7](https://github.com/Nicconike/LocalTelemetry/commit/3be84f7f0c43591fb1b7f33dfb256698c4842578)) + +## [1.3.0-beta.6](https://github.com/Nicconike/LocalTelemetry/compare/v1.3.0-beta.5...v1.3.0-beta.6) (23-11-2026) + +### Features + +* **overlay:** add multi-monitor overlays, power resume guards and layout presets ([e471e59](https://github.com/Nicconike/LocalTelemetry/commit/e471e59d0b9531c23bd5cfcb04f3fab562b7535f)), closes [#28](https://github.com/Nicconike/LocalTelemetry/issues/28) [#29](https://github.com/Nicconike/LocalTelemetry/issues/29) + +## [1.3.0-beta.5](https://github.com/Nicconike/LocalTelemetry/compare/v1.3.0-beta.4...v1.3.0-beta.5) (17-11-2026) + +### Bug Fixes + +* **hardware:** enable telemetry metrics for integrated graphics and unify adapter logging ([e812a43](https://github.com/Nicconike/LocalTelemetry/commit/e812a43fbc9faf70fce029f915a44342abc59969)) + +### Code Refactoring + +* **release:** nest changelog domain entries, reduce complexity and harden sync workflow ([0780dfa](https://github.com/Nicconike/LocalTelemetry/commit/0780dfa75f58a7fb148c763ca55a3f95ef417cc1)) + +### Build System + +* **deps:** bump frontend dependencies ([4776e00](https://github.com/Nicconike/LocalTelemetry/commit/4776e005af20c24f880b83a71234b747fcd2b389)) +* **deps:** Bump @lucide/svelte from 1.61.0 to 1.63.0 ([#27](https://github.com/Nicconike/LocalTelemetry/issues/27)) ([db6322b](https://github.com/Nicconike/LocalTelemetry/commit/db6322bda1d3df48bc4fb826dddf2d15d53aab60)) + +## [1.3.0-beta.4](https://github.com/Nicconike/LocalTelemetry/compare/v1.3.0-beta.3...v1.3.0-beta.4) (15-11-2026) + +### Features + +* **release:** automate domain-grouped GitHub release notes with sub-bullet expansion ([946f4a1](https://github.com/Nicconike/LocalTelemetry/commit/946f4a1256f8c1c0e4895a6b3e697e6c5691544e)) +* **layout,traffic,overlay:** add layout presets, traffic import, and themes ([b8fe8e0](https://github.com/Nicconike/LocalTelemetry/commit/b8fe8e0b9ba16d1197d7df602accd1a16e4dfc05)) + +## [1.3.0-beta.3](https://github.com/Nicconike/LocalTelemetry/compare/v1.3.0-beta.2...v1.3.0-beta.3) (14-11-2026) + +### Features + +* **layout,traffic,overlay:** add layout presets, JSONL network traffic import, unique high-contrast themes, and resilient taskbar embedding ([20507fd](https://github.com/Nicconike/LocalTelemetry/commit/20507fdd629ed5a2e5205b7bfaf871bfd0ad98a6)) + +### Continuous Integration + +* **workflows:** restrict auto-approval to dependabot and sync develop ([fed8a04](https://github.com/Nicconike/LocalTelemetry/commit/fed8a049b0b086c6732d292ee117b707c96ef376)) +* **workflows:** enforce app token attribution and target develop in dependabot ([d4dd765](https://github.com/Nicconike/LocalTelemetry/commit/d4dd76546b5ea72ab755467d3d7e7b2532881f2d)) +* **sonar:** restrict push trigger to master and feed frontend coverage ([35596c7](https://github.com/Nicconike/LocalTelemetry/commit/35596c779f0274475c983b90c732cd80644a7b11)) +* **release:** prevent duplicate trailing newlines and expand test coverage ([20d84ca](https://github.com/Nicconike/LocalTelemetry/commit/20d84cac557822e51f29ca9689be20970f7c3788)) + +## [1.3.0-beta.2](https://github.com/Nicconike/LocalTelemetry/compare/v1.3.0-beta.1...v1.3.0-beta.2) (2026-10-31) + +### Bug Fixes + +* **overlay:** dismiss context menu on outside click and purge floating fallback code ([bb672c2](https://github.com/Nicconike/LocalTelemetry/commit/bb672c28fde60aa5c785f12a76f671ce43199162)) + +## [1.3.0-beta.1](https://github.com/Nicconike/LocalTelemetry/compare/v1.2.0...v1.3.0-beta.1) (2026-10-31) + +### Features + +* **release:** add develop pre-release channel and overlay space auto-recovery ([572b12e](https://github.com/Nicconike/LocalTelemetry/commit/572b12e2996e790dba8e53db67cdeca5bec63203)) + +### Code Refactoring + +* **quality:** decompose complex methods and resolve Sonar code smells ([9f1a58e](https://github.com/Nicconike/LocalTelemetry/commit/9f1a58e83d523b8d6d1c069c12673b1edff47492)) + +### Tests + +* **taskbar:** assert simulated automation exception in button coverage test ([0064ecd](https://github.com/Nicconike/LocalTelemetry/commit/0064ecd5a9cfd7268e456343f8290fbb31f20685)) +* **hardware:** isolate pawnio installer seams and disable test parallelization ([31a6487](https://github.com/Nicconike/LocalTelemetry/commit/31a6487104f10edbdd1abddb46d62da575eb65a5)) + ## [1.2.0](https://github.com/Nicconike/LocalTelemetry/compare/v1.1.0...v1.2.0) (2026-10-26) ### Features diff --git a/Directory.Build.props b/Directory.Build.props index 004849c..0b72aeb 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -14,4 +14,7 @@ v rc.0 + + + diff --git a/README.md b/README.md index a871c39..a40d4c3 100644 --- a/README.md +++ b/README.md @@ -2,270 +2,214 @@ LocalTelemetry Banner

-

- - CI - - - Release - - - Deploy Docs - - - Quality gate status - - - codecov - -

- -

- - GitHub Release - - - GitHub Downloads - -

- -

- - Platform - - - .NET 10 - - - Svelte 5 - -

- -

- - OpenSSF Best Practices - - - OpenSSF Scorecard - -

- -

- - Discord - - - AlternativeTo - - - GitHub License - - - wakatime - -

+

- Explore the Official Documentation & Guides - » -
-
- Quickstart Guide + Documentation & Guides » · - Supported Sensors - · - Customization Guide + Quickstart · - Discord Server + Supported Sensors · - Report Bug + Customization

--- -## Key Features +## Why LocalTelemetry? -- 🪟 **Live Taskbar Overlay**: Embeds real-time system telemetry directly into the Windows taskbar, automatically adapting to centered and left-aligned taskbar layouts. -- ⚡ **Deep Hardware Telemetry**: Monitors CPU clocks, wattage, and thermals via Intel MSR and AMD SMN registers with ACPI fallback, alongside GPU, RAM, Disks, and Battery. -- 🌐 **Continuous Traffic History**: Measures real-time network speeds, records daily upload and download totals, and imports past data from Windows SRUM records. -- 🎨 **Adaptive OEM Brand Themes**: Detects installed hardware vendors (Intel, AMD, NVIDIA, Samsung, Corsair) and applies authentic manufacturer color palettes. -- 🔔 **Game-Safe Alerts**: Delivers custom threshold warnings via background toasts that never steal keyboard focus or minimize full-screen games. -- 🔒 **Private & Offline Logging**: Stores bandwidth history locally in lightweight JSON Lines (`internet_usage.jsonl`) with complete offline privacy and zero analytics. -- 🛡️ **Verified Supply-Chain Security**: Ships with cryptographic SLSA provenance attestations, clean Windows Defender scans, and zero adware. +Typical vendor software suites consume hundreds of megabytes of RAM across multiple background services. Windows 11 also removed support for legacy taskbar deskbands. ---- - -## System Requirements +LocalTelemetry provides hardware monitoring in the taskbar: lightweight, native, and completely offline. -| Requirement | Minimum Specification | Recommended Specification | -| :------------------- | :------------------------------------------------------------------- | :------------------------------------------------------------------- | -| **Operating System** | **Windows 10** (64-bit, v2004+ / build 19041) | **Windows 11** (64-bit, v22H2+) | -| **Architecture** | **x86-64 / AMD64** (Intel / AMD) | **x86-64 / AMD64** | -| **Permissions** | **Administrator (UAC)** *(For hardware sensor drivers)* | **Administrator (UAC)** | -| **RAM** | **2 GB** | **4 GB or higher** | -| **Disk Space** | **200 MB** free space | **200 MB** | -| **Runtimes** | **.NET 10 Desktop Runtime** & **WebView2 Runtime** | **.NET 10 Desktop Runtime** & **WebView2 Runtime** *(Pre-installed on Win 11)* | +### Feature Comparison -*Note: 32-bit (x86) Windows editions and ARM processors are not supported.* +| Capability | LocalTelemetry | Typical Vendor Suites | +| :--- | :---: | :---: | +| **Windows 11 Taskbar Integration** | Embedded next to clock (no floating windows) | Floating overlay or tray tooltip only | +| **Background Memory Footprint** | **~15–20 MB RAM** (~40–60 MB when Settings window is active) | 400–100 MB RAM across helper processes | +| **Low-Level Hardware Access** | Direct Intel MSR & AMD SMN registers via PawnIO | Proprietary services or high-latency queries | +| **Layout Customization** | 8 curated presets with column swapping & drag-and-drop ordering | Fixed vendor window layouts | +| **Network Traffic Accounting** | Daily upload & download history with calendar heatmap | None | +| **Privacy & Connectivity** | 100% offline with zero telemetry or tracking | Mandatory accounts & cloud telemetry | +| **Game-Safe Alerts** | Non-focus-stealing toasts with 10°C thermal hysteresis | Minimizes or interrupts full-screen games | --- -## Download & Installation +## Key Features -### Option 1: Standard Installer (Recommended) +- **Native Taskbar Overlay**: Embeds live metrics next to your clock. Automatically supports both centered and left-aligned Windows 11 taskbars. +- **Overlay Layout Presets**: Switch instantly between 8 curated presets (Default, Gaming, Compact, Micro, Thermals, Workstation, Network, Full Telemetry) or build custom arrangements with interactive column swapping, live preview, and drag-and-drop ordering. +- **Deep Kernel Telemetry**: Direct CPU clocks, wattage, and thermals via Intel MSR and AMD SMN registers with ACPI fallback. Full support for NVIDIA (NVML), AMD (ADL), and Intel (IGCL) GPUs, including shared memory and package thermal fallbacks for integrated graphics. +- **Real-Time Network Speed & History**: Track live upload and download speeds with local daily history logging, JSONL backup imports, and Windows network usage backfilling. +- **Adaptive OEM Brand Themes**: Detects installed hardware vendors (Intel, AMD, NVIDIA, Samsung, Corsair) and applies authentic manufacturer color palettes. +- **100% Offline & Private**: Zero telemetry collection, zero trackers, and zero cloud calls. All metrics stay strictly on your local PC. +- **Smart Game-Safe Alerts**: Anti-spike sustained breach filtering, 10°C thermal hysteresis, taskbar warning highlights, and non-intrusive focus-safe desktop toasts. -1. Download the latest `LocalTelemetrySetup.exe` from [**GitHub Releases**](https://github.com/Nicconike/LocalTelemetry/releases). -2. Run the installer and follow the setup wizard instructions. -3. LocalTelemetry starts automatically after installation. +--- -> [!IMPORTANT] -> **First-Time Setup Runtime Check**: The installer verifies the presence of the **Microsoft .NET 10 Desktop Runtime (x64)**. If missing, Setup downloads and installs it automatically (~55 MB). The installer includes the **PawnIO** kernel sensor driver (~3.4 MB) and installs it offline. All subsequent application operations run completely offline. -> -> **Administrator Privileges**: LocalTelemetry requires Administrator privileges to read low-level hardware sensors (PawnIO driver for CPU MSR/SMU registers and disk IOCTLs). Manual launches show a standard Windows UAC prompt. Enabling **Start with Windows** creates an elevated Windows Task Scheduler task that starts the application at boot without prompts. +## Visual Overview -### Option 2: Windows Package Manager (WinGet) +

+ LocalTelemetry Application Walkthrough +

-Install via [WinGet](https://learn.microsoft.com/en-us/windows/package-manager/winget/): +--- -```powershell -winget install --id Nicconike.LocalTelemetry -``` +## Installation Options + +### Option 1: Setup Wizard Installer (Recommended) -### Option 3: Scoop Package Manager (Direct Repository Bucket) +1. Download `LocalTelemetrySetup.exe` from [**GitHub Releases**](https://github.com/Nicconike/LocalTelemetry/releases). +2. Run the installer. Setup automatically verifies the .NET 11 Desktop Runtime and installs the required PawnIO kernel sensor driver. +3. LocalTelemetry starts immediately and runs quietly in your taskbar. -If you prefer installing via CLI without manually downloading executable installers or ZIP files, install directly from this repository via [Scoop](https://scoop.sh/): +### Option 2: Scoop Package Manager ```powershell -# Add this repository as a bucket and install scoop bucket add localtelemetry https://github.com/Nicconike/LocalTelemetry scoop install localtelemetry ``` -To update LocalTelemetry to the latest release at any time: - -```powershell -scoop update localtelemetry -``` - -### Option 4: Portable ZIP +### Option 3: Portable ZIP 1. Ensure the required runtimes are installed: - - [**Microsoft .NET 10 Desktop Runtime (x64)**](https://aka.ms/dotnet/10.0/windowsdesktop-runtime-win-x64.exe) - - [**Microsoft Edge WebView2 Runtime (x64)**](https://go.microsoft.com/fwlink/p/?LinkId=2124703) + - [**Microsoft .NET 11 Desktop Runtime (x64)**](https://aka.ms/dotnet/11.0/windowsdesktop-runtime-win-x64.exe) + - [**Microsoft Edge WebView2 Runtime (x64)**](https://go.microsoft.com/fwlink/p/?LinkId=2124703) *(pre-installed on Windows 11)* 2. Download `LocalTelemetry-win-x64.zip` from [**GitHub Releases**](https://github.com/Nicconike/LocalTelemetry/releases). -3. Extract the archive contents to a local folder. -4. Run `LocalTelemetry.exe` as Administrator. - -### Verifying Your Download - -Every release ships with cryptographic hashes in `checksums.txt`, Sigstore Cosign signature bundles, and [SLSA](https://slsa.dev/) build attestations: - -```pwsh -# 1. Compare the SHA-256 hashes against checksums.txt -Get-FileHash .\LocalTelemetrySetup.exe, .\LocalTelemetry-win-x64.zip -Algorithm SHA256 - -# 2. Verify keyless signatures with Cosign -cosign verify-blob --bundle .\LocalTelemetrySetup.exe.sigstore.json ` - --certificate-identity-regexp "https://github.com/Nicconike/LocalTelemetry/.*" ` - --certificate-oidc-issuer "https://token.actions.githubusercontent.com" ` - .\LocalTelemetrySetup.exe - -# 3. Verify the SLSA build provenance attestations -gh attestation verify .\LocalTelemetrySetup.exe --repo Nicconike/LocalTelemetry -gh attestation verify .\LocalTelemetry-win-x64.zip --repo Nicconike/LocalTelemetry -``` - -The signatures and attestations confirm that the official [**Release workflow**](https://github.com/Nicconike/LocalTelemetry/actions/workflows/release.yml) built the binaries without tampering. +3. Extract and run `LocalTelemetry.exe` as Administrator. --- -## Quick Start - -### 1. Taskbar Overlay - -LocalTelemetry displays a real-time hardware telemetry overlay directly on the Windows taskbar: - -LocalTelemetry taskbar overlay showing live hardware metrics - -### 2. System Tray Controls - -Right-click the **LocalTelemetry** icon in the system tray to access application controls: - -System tray context menu +## Verifying Downloads & Checksums -- **Show / Hide Taskbar Overlay**: Toggle the taskbar overlay visibility. -- **Open Settings**: Launch the settings configuration panel. -- **Quit**: Exit LocalTelemetry. +Every GitHub Release includes cryptographic SHA-256 hashes (`checksums.txt`), Sigstore Cosign signature bundles (`.sigstore.json`), and SLSA build provenance attestations. -### 3. Settings & Customization +### 1. SHA-256 Checksum Verification -Double-click the system tray icon to open the settings interface: +Download `checksums.txt` and your binary into the same folder. Compute the file hash in PowerShell: -**General Settings** - Configure Windows autostart, minimized startup, polling intervals, and temperature units: - -General settings page - -**Taskbar Layout** - Reorder metrics by drag-and-drop to customize the overlay display: +```powershell +Get-FileHash .\LocalTelemetrySetup.exe -Algorithm SHA256 +``` -Taskbar layout settings page +Or verify all release binaries automatically against `checksums.txt`: -**Hardware Monitoring** - Enable or disable hardware sensors and toggle debug logging: +```powershell +Get-Content .\checksums.txt | ForEach-Object { + $expectedHash, $filename = -split $_ + if (Test-Path $filename) { + $actualHash = (Get-FileHash $filename -Algorithm SHA256).Hash + [PSCustomObject]@{ File = $filename; Valid = ($actualHash -eq $expectedHash) } + } +} +``` -Monitoring settings page +### 2. Sigstore Cosign Keyless Signatures -**Traffic History Calendar** - View daily bandwidth consumption per network interface: +Verify release binaries using keyless OpenID Connect (OIDC) signatures: -Traffic history calendar settings page +```powershell +cosign verify-blob --bundle .\LocalTelemetrySetup.exe.sigstore.json ` + --certificate-identity-regexp "https://github.com/Nicconike/LocalTelemetry/.*" ` + --certificate-oidc-issuer "https://token.actions.githubusercontent.com" ` + .\LocalTelemetrySetup.exe +``` -### 4. Threshold Alerts +### 3. SLSA Build Provenance -Set warning limits for hardware metrics (for example, CPU at 90°C). When values exceed limits, the overlay flashes and a desktop notification appears without stealing keyboard focus: +Verify supply chain build attestations using the GitHub CLI: -Threshold alert toast notification +```powershell +gh attestation verify .\LocalTelemetrySetup.exe --repo Nicconike/LocalTelemetry +gh attestation verify .\LocalTelemetry-win-x64.zip --repo Nicconike/LocalTelemetry +``` --- -## Getting Help & Support +## System Requirements -- 📖 **Documentation**: Read the [**User & Developer Guides**](https://nicconike.github.io/LocalTelemetry/). -- 💬 **Discord Community**: Join our [**Discord Server**](https://discord.gg/M2QevSgW3S) for direct discussions and support. -- 💡 **Discussions**: Start a discussion on [**GitHub Discussions**](https://github.com/Nicconike/LocalTelemetry/discussions). -- 🐛 **Issue Tracker**: Report bugs and request features through [**GitHub Issues**](https://github.com/Nicconike/LocalTelemetry/issues). -- 🆘 **Support Guidelines**: Review [**SUPPORT.md**](.github/SUPPORT.md) for troubleshooting steps. -- 🔒 **Security Policy**: Report security vulnerabilities through [**SECURITY.md**](.github/SECURITY.md). -- 🛠️ **Contributing**: Read [**CONTRIBUTING.md**](.github/CONTRIBUTING.md) for coding and pull request guidelines. +| Requirement | Specification | +| :--- | :--- | +| **Operating System** | **Windows 10** (64-bit, v2004+ / build 19041) or **Windows 11** (64-bit, v22H2+) | +| **Architecture** | **x86-64 / AMD64** (Intel / AMD) | +| **Permissions** | **Administrator** *(Required for PawnIO MSR kernel driver)* | +| **System RAM** | **2 GB RAM** minimum (**4 GB RAM or higher** recommended) | +| **App Footprint** | **~15–30 MB RAM** (background taskbar monitoring) / **~40–60 MB RAM** (when Settings window is active) | +| **Runtimes** | **.NET 11 Desktop Runtime** & **WebView2** | --- -## Support the Project +## Support & Community -If LocalTelemetry improves your daily desktop experience, consider supporting the project: +If LocalTelemetry makes your desktop experience better, here is how you can support the project: -- ⭐ **Star the Repository**: Star [**LocalTelemetry on GitHub**](https://github.com/Nicconike/LocalTelemetry) to help others discover it. -- 💙 **Like on AlternativeTo**: Upvote and recommend [**LocalTelemetry on AlternativeTo**](https://alternativeto.net/software/localtelemetry/about/?utm_source=badge&utm_medium=referral). -- 💬 **Join the Discord Community**: Chat with the developer and fellow users on [**Discord**](https://discord.gg/M2QevSgW3S). -- 📢 **Spread the Word**: Share LocalTelemetry with friends, colleagues, or PC enthusiast forums. +- **Star the Repository**: Star [**LocalTelemetry on GitHub**](https://github.com/Nicconike/LocalTelemetry) to help other users discover it. +- **Join the Discord Community**: Chat with the developer and get help on [**Discord**](https://discord.gg/M2QevSgW3S). +- **Suggest Features**: Share ideas or feature suggestions on [**GitHub Discussions**](https://github.com/Nicconike/LocalTelemetry/discussions). +- **Report Issues**: Found a bug or driver error? Open an issue on [**GitHub Issues**](https://github.com/Nicconike/LocalTelemetry/issues). +- **Upvote on AlternativeTo**: Recommend [**LocalTelemetry on AlternativeTo**](https://alternativeto.net/software/localtelemetry/about/?utm_source=badge&utm_medium=referral). --- ## License -LocalTelemetry is free and open-source software licensed under the **GNU General Public License v3.0**. See [`LICENSE`](LICENSE) for full license terms. +This project is licensed under the terms described in the [LICENSE](LICENSE) file. diff --git a/codecov.yml b/codecov.yml index 483ba76..39e33fc 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,6 +1,6 @@ codecov: notify: - after_n_builds: 4 + after_n_builds: 5 ignore: - "**/*.xaml" @@ -46,6 +46,10 @@ flags: paths: - src/LocalTelemetry.Notifier/** carryforward: true + release: + paths: + - .github/release/** + carryforward: true component_management: individual_components: @@ -61,3 +65,7 @@ component_management: name: Notifier paths: - src/LocalTelemetry.Notifier/** + - component_id: release + name: Release Tooling + paths: + - .github/release/** diff --git a/commitlint.config.mjs b/commitlint.config.mjs index 078628f..10af233 100644 --- a/commitlint.config.mjs +++ b/commitlint.config.mjs @@ -1,5 +1,5 @@ const DEPENDABOT = /Signed-off-by: dependabot\[bot\]/ -const HUMAN_LIMIT = 200 +const HUMAN_LIMIT = 150 const DEPENDABOT_LIMIT = 400 const bodyMaxLineLength = (parsed) => { @@ -18,7 +18,9 @@ export default { plugins: ['commitlint-plugin-function-rules'], rules: { 'subject-case': [2, 'never', ['upper-case']], + 'header-max-length': [2, 'always', HUMAN_LIMIT], 'body-max-line-length': [0], + 'footer-max-line-length': [2, 'always', HUMAN_LIMIT], 'function-rules/body-max-line-length': [2, 'always', bodyMaxLineLength], }, } diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index cbce94d..b63c197 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -1,32 +1,11 @@ -import { execFileSync } from 'node:child_process'; -import { join } from 'node:path'; import { defineConfig, type HeadConfig } from 'vitepress'; import type { DefaultTheme } from 'vitepress/theme'; -import { withMermaid } from 'vitepress-plugin-mermaid'; -import { version as packageVersion } from '../package.json'; +import { MermaidMarkdown } from 'vitepress-plugin-mermaid'; import { lucideMarkdownPlugin, lucideFrontmatterPlugin } from './markdown-lucide.js'; import { versions } from './versions.mjs'; -const gitCandidates = - process.platform === 'win32' - ? [join(process.env.ProgramFiles ?? String.raw`C:\Program Files`, 'Git', 'cmd', 'git.exe')] - : ['/usr/bin/git', '/usr/local/bin/git']; - -const version = (() => { - for (const git of gitCandidates) { - try { - const tag = execFileSync(git, ['describe', '--tags', '--abbrev=0'], { encoding: 'utf-8' }).trim(); - return tag.startsWith('v') ? tag.slice(1) : tag; - } catch { - continue; // Try next candidate; fall back below if none resolves. - } - } - return packageVersion || 'dev'; -})(); -const isPrerelease = /[-+]/.test(version); - -// Retrieve Measurement ID from environment variable -const gaId = process.env.GA_MEASUREMENT_ID; +// Retrieve Umami Website ID from environment variable +const umamiWebsiteId = process.env.UMAMI_WEBSITE_ID; // Subpath base for GitHub Pages project sites (e.g. /LocalTelemetry/) const rawBase = process.env.VITE_BASE || '/'; @@ -40,20 +19,15 @@ const headConfigs: HeadConfig[] = [ ['meta', { name: 'og:description', content: 'Real-time hardware telemetry displayed on the Windows taskbar' }] ]; -if (gaId && gaId !== 'GA-MEASUREMENT_ID') { - headConfigs.push( - ['script', { async: '', src: `https://www.googletagmanager.com/gtag/js?id=${gaId}` }], - [ - 'script', - {}, - ` - window.dataLayer = window.dataLayer || []; - function gtag(){dataLayer.push(arguments);} - gtag('js', new Date()); - gtag('config', '${gaId}'); - ` - ] - ); +if (umamiWebsiteId && umamiWebsiteId !== 'UMAMI_WEBSITE_ID') { + headConfigs.push([ + 'script', + { + defer: '', + src: 'https://cloud.umami.is/script.js', + 'data-website-id': umamiWebsiteId + } + ]); } // Sidebar definitions with page links relative to each guide root @@ -108,7 +82,7 @@ const developerGuideSidebar = [ items: [ { text: 'C# Core API & Models', link: 'reference/core-api' }, { text: 'WebView2 & Named Pipe IPC Protocol', link: 'reference/ipc-protocol' }, - { text: 'settings.json Configuration Schema', link: 'reference/settings-schema' } + { text: 'Configuration Settings Schema', link: 'reference/settings-schema' } ] }, { @@ -160,131 +134,108 @@ function buildSidebar(): DefaultTheme.Sidebar { return sidebar; } -export default withMermaid( - defineConfig({ - title: 'LocalTelemetry', - description: 'Real-time hardware telemetry displayed on the Windows taskbar', - lang: 'en-US', - base, - cleanUrls: true, - lastUpdated: true, - head: headConfigs, - - markdown: { - headers: { - level: [2, 3] - }, - config: (md) => { - md.use(lucideMarkdownPlugin); - } +export default defineConfig({ + title: 'LocalTelemetry', + description: 'Real-time hardware telemetry displayed on the Windows taskbar', + lang: 'en-US', + base, + cleanUrls: true, + lastUpdated: true, + head: headConfigs, + + markdown: { + headers: { + level: [2, 3] }, + config: (md) => { + md.use(lucideMarkdownPlugin); + md.use(MermaidMarkdown); + } + }, - rewrites: { - 'latest/index.md': 'index.md', - 'latest/about/:path': 'about/:path', - 'latest/user-guide/:path': 'user-guide/:path', - 'latest/developer-guide/:path': 'developer-guide/:path', - 'latest/developer-guide/reference/:path': 'developer-guide/reference/:path' - }, + rewrites: { + 'latest/index.md': 'index.md', + 'latest/about/:path': 'about/:path', + 'latest/user-guide/:path': 'user-guide/:path', + 'latest/developer-guide/:path': 'developer-guide/:path', + 'latest/developer-guide/reference/:path': 'developer-guide/reference/:path' + }, - mermaid: { - theme: 'dark', - themeVariables: { - fontFamily: 'Inter, system-ui, sans-serif', - fontSize: '13px' + vite: { + plugins: [lucideFrontmatterPlugin()], + build: { + chunkSizeWarningLimit: 3000, + reportCompressedSize: false, + target: 'esnext' + } + }, + + themeConfig: { + siteTitle: 'LocalTelemetry', + logo: '/app.ico', + + nav: [ + { text: 'Home', link: '/' }, + { + text: 'User Guide', + link: '/user-guide/', + activeMatch: String.raw`^/(?:v\d[^/]+/)?user-guide` }, - flowchart: { - useMaxWidth: false, - htmlLabels: true, - padding: 16, - subGraphTitleMargin: { - top: 12, - bottom: 20 - } + { + text: 'Developer Guide', + link: '/developer-guide/', + activeMatch: String.raw`^/(?:v\d[^/]+/)?developer-guide` }, - sequence: { - useMaxWidth: false, - showSequenceNumbers: true - } - }, - - vite: { - plugins: [lucideFrontmatterPlugin()], - optimizeDeps: { - include: ['fastdom', 'mermaid', 'debug', 'dayjs'] + { + text: 'About', + link: '/about/', + activeMatch: String.raw`^/(?:v\d[^/]+/)?about` }, - build: { - chunkSizeWarningLimit: 3000 + { + component: 'VersionNavDropdown' } - }, - - themeConfig: { - siteTitle: 'LocalTelemetry', - logo: '/app.ico', - - nav: [ - { text: 'Home', link: '/' }, - { - text: 'User Guide', - link: '/user-guide/', - activeMatch: String.raw`^/(?:v\d[^/]+/)?user-guide` - }, - { - text: 'Developer Guide', - link: '/developer-guide/', - activeMatch: String.raw`^/(?:v\d[^/]+/)?developer-guide` - }, - { - text: 'About', - link: '/about/', - activeMatch: String.raw`^/(?:v\d[^/]+/)?about` - }, - { - component: 'VersionNavDropdown' - } - ], + ], - sidebar: buildSidebar(), + sidebar: buildSidebar(), - editLink: { - pattern: 'https://github.com/Nicconike/LocalTelemetry/edit/master/docs/:path', - text: 'Edit this page on GitHub' - }, + editLink: { + pattern: 'https://github.com/Nicconike/LocalTelemetry/edit/master/docs/:path', + text: 'Edit this page on GitHub' + }, - docFooter: { - prev: 'Previous page', - next: 'Next page' - }, + docFooter: { + prev: 'Previous page', + next: 'Next page' + }, - lastUpdated: { - text: 'Last updated', - formatOptions: { - dateStyle: 'medium', - timeStyle: 'short' - } - }, + lastUpdated: { + text: 'Last updated', + formatOptions: { + dateStyle: 'medium', + timeStyle: 'short' + } + }, - search: { - provider: 'local' - }, + search: { + provider: 'local' + }, - outline: { - level: [2, 3], - label: 'On this page' - }, + outline: { + level: [2, 3], + label: 'On this page' + }, - returnToTopLabel: 'Return to top', - externalLinkIcon: true, + returnToTopLabel: 'Return to top', + externalLinkIcon: true, - socialLinks: [ - { icon: 'discord', link: 'https://discord.gg/M2QevSgW3S' }, - { icon: 'github', link: 'https://github.com/Nicconike/LocalTelemetry' } - ], + socialLinks: [ + { icon: 'discord', link: 'https://discord.gg/M2QevSgW3S' }, + { icon: 'github', link: 'https://github.com/Nicconike/LocalTelemetry' } + ], - footer: { - message: 'Released under the GNU General Public License v3.0', - copyright: 'Copyright © 2026 Nicconike' - } + footer: { + message: 'Released under the GNU General Public License v3.0', + copyright: 'Copyright © 2026 Nicconike' } - }) -); + } +}); diff --git a/docs/.vitepress/theme/Mermaid.vue b/docs/.vitepress/theme/Mermaid.vue new file mode 100644 index 0000000..591f117 --- /dev/null +++ b/docs/.vitepress/theme/Mermaid.vue @@ -0,0 +1,144 @@ + + + diff --git a/docs/.vitepress/theme/MermaidViewer.vue b/docs/.vitepress/theme/MermaidViewer.vue index 8d94c57..22a92bb 100644 --- a/docs/.vitepress/theme/MermaidViewer.vue +++ b/docs/.vitepress/theme/MermaidViewer.vue @@ -181,8 +181,8 @@ function handlePointerUp(e: PointerEvent) { isDragging.value = false; try { (e.currentTarget as HTMLElement)?.releasePointerCapture(e.pointerId); - } catch { - // Ignored + } catch (err) { + console.debug('[MermaidViewer] Failed to release pointer capture:', err); } } } diff --git a/docs/.vitepress/theme/PageFeedback.vue b/docs/.vitepress/theme/PageFeedback.vue index 0f1f664..745dd22 100644 --- a/docs/.vitepress/theme/PageFeedback.vue +++ b/docs/.vitepress/theme/PageFeedback.vue @@ -1,6 +1,7 @@ diff --git a/docs/.vitepress/theme/VersionBanner.vue b/docs/.vitepress/theme/VersionBanner.vue index ee7ca93..cc912dd 100644 --- a/docs/.vitepress/theme/VersionBanner.vue +++ b/docs/.vitepress/theme/VersionBanner.vue @@ -88,7 +88,8 @@ watch( } try { isDismissed.value = sessionStorage.getItem(`lt_dismissed_version_${newTag}`) === 'true'; - } catch { + } catch (err) { + console.debug('[VersionBanner] Failed to read sessionStorage:', err); isDismissed.value = false; } }, @@ -100,8 +101,8 @@ function dismiss() { if (typeof window !== 'undefined' && versionInfo.value?.tag) { try { sessionStorage.setItem(`lt_dismissed_version_${versionInfo.value.tag}`, 'true'); - } catch { - // Ignore sessionStorage errors (e.g. private browsing restrictions) + } catch (err) { + console.debug('[VersionBanner] Failed to set sessionStorage:', err); } } } diff --git a/docs/.vitepress/theme/custom.css b/docs/.vitepress/theme/custom.css index ab8be89..bebcd26 100644 --- a/docs/.vitepress/theme/custom.css +++ b/docs/.vitepress/theme/custom.css @@ -126,13 +126,14 @@ margin: 32px 0; padding: 44px 20px 24px 20px; overflow-x: auto; - overflow-y: hidden; + overflow-y: visible; border-radius: 12px; background: #090a0f; border: 1px solid rgba(255, 255, 255, 0.08); box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4); scrollbar-width: thin; scrollbar-color: rgba(56, 189, 248, 0.3) rgba(255, 255, 255, 0.04); + text-align: center; } @media (min-width: 960px) { @@ -155,7 +156,7 @@ .mermaid>svg { max-width: 100%; height: auto; - display: block; + display: inline-block; margin: 0 auto; overflow: visible; filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35)); @@ -181,19 +182,44 @@ font-weight: 600; fill: #cbd5e1; color: #cbd5e1; + white-space: nowrap; +} + +/* Universal SVG ForeignObject overflow visibility to prevent any text clipping */ +.vp-doc .mermaid foreignObject, +.mermaid-modal-content foreignObject, +.vp-doc .mermaid foreignObject > div, +.mermaid-modal-content foreignObject > div, +.vp-doc .mermaid .cluster-label, +.vp-doc .mermaid .cluster-label foreignObject, +.mermaid-modal-content .cluster-label foreignObject { + overflow: visible !important; } /* Node Text Resets - Both In-page and Modal Lightbox */ +.vp-doc .mermaid .node rect, +.mermaid-modal-content .node rect { + rx: 8px; + ry: 8px; +} + .vp-doc .mermaid .node foreignObject, .mermaid-modal-content .node foreignObject { - overflow: visible; + overflow: visible !important; } .vp-doc .mermaid .node foreignObject>div, .mermaid-modal-content .node foreignObject>div { - overflow: visible; - line-height: 1.3; + overflow: visible !important; + line-height: 1.25; text-align: center; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + white-space: normal; + word-break: normal; + padding: 0 6px; } .vp-doc .mermaid .node p, @@ -206,24 +232,38 @@ .mermaid-modal-content .node * { margin: 0; padding: 0; - line-height: 1.3; + line-height: 1.25; font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; } -/* Edge Labels: Seamless text along arrows - cleanly masks arrow line beneath without any visible box */ +/* Edge Labels: Solid background masks arrow lines beneath without line cutting through text */ .vp-doc .mermaid g.edgeLabel foreignObject, .mermaid-modal-content g.edgeLabel foreignObject { overflow: visible; } .vp-doc .mermaid g.edgeLabel, +.mermaid-modal-content g.edgeLabel { + background: transparent; +} + .vp-doc .mermaid g.edgeLabel span, .vp-doc .mermaid g.edgeLabel p, -.mermaid-modal-content g.edgeLabel, .mermaid-modal-content g.edgeLabel span, .mermaid-modal-content g.edgeLabel p { - background: transparent; - background-color: transparent; + background: #090a0f !important; + background-color: #090a0f !important; + color: #94a3b8 !important; + font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important; + font-size: 11px !important; + font-weight: 500 !important; + line-height: 1.25 !important; + padding: 2px 8px !important; + border-radius: 4px !important; + border: 1px solid rgba(255, 255, 255, 0.12) !important; + box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6) !important; + display: inline-block !important; + margin: 0 !important; } .vp-doc .mermaid g.edgeLabel .labelBkg, @@ -238,19 +278,6 @@ padding: 1px 6px; } -.vp-doc .mermaid g.edgeLabel p, -.vp-doc .mermaid g.edgeLabel span, -.mermaid-modal-content g.edgeLabel p, -.mermaid-modal-content g.edgeLabel span { - color: #94a3b8; - font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; - font-size: 11px; - font-weight: 500; - line-height: 1.25; - margin: 0; - padding: 0; -} - /* Custom scrollbars for wide diagrams */ .mermaid::-webkit-scrollbar { height: 6px; @@ -310,6 +337,20 @@ box-shadow: 0 12px 32px rgba(56, 189, 248, 0.12); } +@media (prefers-reduced-motion: reduce) { + :root .VPHomeHero .actions .VPButton.brand, + :root .VPHomeHero .actions .VPButton.alt, + :root .VPFeatures .VPFeature { + transition: none; + } + + :root .VPHomeHero .actions .VPButton.brand:hover, + :root .VPHomeHero .actions .VPButton.alt:hover, + :root .VPFeatures .VPFeature:hover { + transform: none; + } +} + :root .VPFeatures .VPFeature .icon { display: flex; align-items: center; @@ -491,6 +532,12 @@ } } +@media (prefers-reduced-motion: reduce) { + .home-cta-dot { + animation: none; + } +} + .vp-doc p.home-cta-text { font-size: 0.9rem; color: var(--vp-c-text-2); @@ -533,6 +580,18 @@ transition: transform 0.2s ease; } +@media (prefers-reduced-motion: reduce) { + .home-cta-box .home-cta-actions .VPButton, + .home-cta-box .home-cta-actions .VPButton svg { + transition: none; + } + + .home-cta-box .home-cta-actions .VPButton:hover, + .home-cta-box .home-cta-actions .VPButton:hover svg { + transform: none; + } +} + /* Discord Primary Button (Top Centered, Compact) */ .home-cta-actions a.home-cta-discord-btn { grid-column: 1 / -1; diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts index 376eac8..87b5799 100644 --- a/docs/.vitepress/theme/index.ts +++ b/docs/.vitepress/theme/index.ts @@ -1,13 +1,34 @@ -import { h } from 'vue'; +import { h, nextTick } from 'vue'; import DefaultTheme from 'vitepress/theme'; import { inBrowser, type EnhanceAppContext } from 'vitepress'; import PageFeedback from './PageFeedback.vue'; import BackToTop from './BackToTop.vue'; import VersionBanner from './VersionBanner.vue'; import MermaidViewer from './MermaidViewer.vue'; +import Mermaid from './Mermaid.vue'; import VersionNavDropdown from './VersionNavDropdown.vue'; +import { initTelemetryListeners, resetScrollTracking, track404, trackEvent } from './telemetry.js'; import './custom.css'; +function extractDocVersion(pathname: string): string { + const match = /(?:^|\/)(v\d[\w.-]*)(?:\/|$)/.exec(pathname); + return match ? match[1] : 'Latest'; +} + +let currentDocVersion = typeof window !== 'undefined' ? extractDocVersion(window.location.pathname) : 'Latest'; + +async function checkAndTrack404(path: string): Promise { + await nextTick(); + const is404 = + document.title.includes('404') || + document.title.toLowerCase().includes('page not found') || + document.querySelector('.VPNotFound') !== null; + + if (is404) { + track404(path || window.location.pathname, document.referrer); + } +} + export default { extends: DefaultTheme, Layout() { @@ -18,40 +39,31 @@ export default { }); }, enhanceApp({ app, router }: EnhanceAppContext) { + app.component('Mermaid', Mermaid); app.component('VersionNavDropdown', VersionNavDropdown); if (inBrowser) { - // Track page views on client-side route changes via Google Analytics (GA4) + initTelemetryListeners(); + + // Check 404 state on initial page load after DOM hydration + void checkAndTrack404(window.location.pathname); + + // Track client-side route transitions router.onAfterRouteChange = (to: string) => { - if (typeof window !== 'undefined' && (window as any).gtag) { - (window as any).gtag('event', 'page_view', { + resetScrollTracking(); + + const newVersion = extractDocVersion(to); + if (newVersion !== currentDocVersion) { + trackEvent('version_switch', { + from_version: currentDocVersion, + to_version: newVersion, page_path: to }); + currentDocVersion = newVersion; } - }; - // Global event tracking for external outbound clicks (GitHub, Releases, Discord) - window.addEventListener('click', (e: MouseEvent) => { - const target = (e.target as HTMLElement).closest('a'); - if (!target?.href) return; - - const url = target.href; - if (url.includes('github.com/Nicconike/LocalTelemetry/releases')) { - if ((window as any).gtag) { - (window as any).gtag('event', 'download_click', { - event_category: 'outbound', - event_label: url - }); - } - } else if (url.includes('discord.gg')) { - if ((window as any).gtag) { - (window as any).gtag('event', 'discord_click', { - event_category: 'outbound', - event_label: url - }); - } - } - }); + void checkAndTrack404(to); + }; } } }; diff --git a/docs/.vitepress/theme/telemetry.ts b/docs/.vitepress/theme/telemetry.ts new file mode 100644 index 0000000..eba9202 --- /dev/null +++ b/docs/.vitepress/theme/telemetry.ts @@ -0,0 +1,188 @@ +/** + * Telemetry and analytics helper for Umami Analytics. + * Captures user actions and interaction metrics without storing sensitive personal data. + */ + +declare global { + interface Window { + umami?: { + track: { + (eventName: string, eventData?: Record): void; + (customFunction: (props: Record) => Record): void; + }; + }; + } +} + +function withUmami(action: (umami: NonNullable) => void, attempts = 0): void { + try { + if (window.umami && typeof window.umami.track === 'function') { + action(window.umami); + return; + } + } catch (err) { + console.debug('[telemetry] Dispatch failed:', err); + return; + } + + if (attempts < 10) { + setTimeout(() => withUmami(action, attempts + 1), 250); + } +} + +/** + * Dispatches a named custom event to Umami with automatic retries for deferred script loading. + */ +export function trackEvent(eventName: string, eventData: Record = {}): void { + if (typeof window === 'undefined') return; + withUmami((umami) => umami.track(eventName, eventData)); +} + +/** + * Dispatches a manual page view event to Umami if needed. + */ +export function trackPageView(pagePath: string, pageTitle: string): void { + if (typeof window === 'undefined') return; + withUmami((umami) => + umami.track((props: Record) => ({ + ...props, + url: pagePath, + title: pageTitle + })) + ); +} + +/** + * Dispatches a 404 Not Found event without inflating regular page view counts. + */ +export function track404(brokenPath: string, referrer: string): void { + trackEvent('page_not_found', { + broken_path: brokenPath, + referrer: referrer || '(direct)' + }); +} + +let scroll50Tracked = false; +let scroll90Tracked = false; + +/** + * Resets scroll tracking thresholds when changing routes. + */ +export function resetScrollTracking(): void { + scroll50Tracked = false; + scroll90Tracked = false; +} + +function handleScroll(): void { + if (scroll90Tracked) return; + + const scrollElement = document.documentElement; + const totalHeight = scrollElement.scrollHeight - window.innerHeight; + if (totalHeight <= 0) return; + + const progress = (window.scrollY / totalHeight) * 100; + + if (!scroll50Tracked && progress >= 50) { + scroll50Tracked = true; + trackEvent('scroll_depth', { + depth: 50, + page_path: window.location.pathname + }); + } + + if (!scroll90Tracked && progress >= 90) { + scroll90Tracked = true; + trackEvent('scroll_depth', { + depth: 90, + page_path: window.location.pathname + }); + } +} + +let searchDebounceTimer: ReturnType | null = null; + +function handleInput(e: Event): void { + const target = e.target as HTMLInputElement | null; + if (!target) return; + + // Detect search input field in VitePress local search modal + const isSearchInput = + target.classList.contains('search-input') || + target.classList.contains('DocSearch-Input') || + target.closest('.VPLocalSearchBox') !== null; + + if (isSearchInput) { + const query = target.value.trim(); + if (query.length >= 3) { + if (searchDebounceTimer) clearTimeout(searchDebounceTimer); + searchDebounceTimer = setTimeout(() => { + trackEvent('search_query', { + query, + page_path: window.location.pathname + }); + }, 800); + } + } +} + +function handleClick(e: MouseEvent): void { + const target = e.target as HTMLElement | null; + if (!target) return; + + // 1. Code copy button click + const copyButton = target.closest('button.copy'); + if (copyButton) { + const codeBlock = copyButton.closest('div[class*="language-"]'); + const languageClass = codeBlock?.className + .split(' ') + .find((cls) => cls.startsWith('language-')); + const language = languageClass ? languageClass.replace('language-', '') : 'plaintext'; + + trackEvent('code_copy', { + language, + page_path: window.location.pathname + }); + return; + } + + // 2. Outbound / External link clicks + const anchor = target.closest('a'); + if (!anchor?.href) return; + + const url = anchor.href; + if (url.includes('github.com/Nicconike/LocalTelemetry/releases')) { + trackEvent('download_click', { + target_url: url, + page_path: window.location.pathname + }); + } else if (url.includes('discord.gg')) { + trackEvent('discord_click', { + target_url: url, + page_path: window.location.pathname + }); + } else if (url.includes('github.com/Nicconike/LocalTelemetry')) { + trackEvent('github_click', { + target_url: url, + page_path: window.location.pathname + }); + } else if (anchor.target === '_blank' || anchor.rel.includes('external')) { + trackEvent('outbound_click', { + target_url: url, + page_path: window.location.pathname + }); + } +} + +let listenersInitialized = false; + +/** + * Initializes global browser event listeners for user action telemetry. + */ +export function initTelemetryListeners(): void { + if (typeof window === 'undefined' || listenersInitialized) return; + listenersInitialized = true; + + window.addEventListener('click', handleClick, { capture: true }); + window.addEventListener('input', handleInput, { passive: true }); + window.addEventListener('scroll', handleScroll, { passive: true }); +} diff --git a/docs/.vitepress/versions.mjs b/docs/.vitepress/versions.mjs index 7fe6796..c3d1d99 100644 --- a/docs/.vitepress/versions.mjs +++ b/docs/.vitepress/versions.mjs @@ -1,9 +1,8 @@ // Auto-generated by scripts/build-versions.mjs. Do not edit by hand. // Each entry maps a dropdown label to the site path for that docs version. -export const latestReleaseTag = 'v1.2.0'; +export const latestReleaseTag = 'v1.3.0-beta.9'; export const versions = [ { text: 'Latest', link: '/' }, + { text: 'v1.3.0-beta.9', link: '/v1.3.0-beta.9/' }, { text: 'v1.2.0', link: '/v1.2.0/' }, - { text: 'v1.1.0', link: '/v1.1.0/' }, - { text: 'v1.0.0', link: '/v1.0.0/' }, ]; diff --git a/docs/bun.lock b/docs/bun.lock index f8beed7..da12301 100644 --- a/docs/bun.lock +++ b/docs/bun.lock @@ -5,12 +5,12 @@ "": { "name": "localtelemetry-docs", "devDependencies": { - "@iconify-json/lucide": "^1.2.143", - "@types/node": "^26.6.5", + "@iconify-json/lucide": "^1.2.161", + "@types/node": "^26.6.11", "dayjs": "^1.11.23", "debug": "^4.4.3", "fastdom": "^1.0.12", - "mermaid": "^12.2.0", + "mermaid": "^12.4.0", "typescript": "^7.0.2", "vitepress": "^1.6.4", "vitepress-plugin-mermaid": "^2.0.17", @@ -37,7 +37,7 @@ "vue": "3.5.44", }, "packages": { - "@algolia/abtesting": ["@algolia/abtesting@1.22.0", "", { "dependencies": { "@algolia/client-common": "5.56.0", "@algolia/requester-browser-xhr": "5.56.0", "@algolia/requester-fetch": "5.56.0", "@algolia/requester-node-http": "5.56.0" } }, "sha512-BFR6zNowNKcY7Ou7TaJc9QWexES4YKPbmf/OTFofpdsdhz4x6q0lbxp3duO0EHnyrN7rE4ba/TSXuY+BDGu4+g=="], + "@algolia/abtesting": ["@algolia/abtesting@1.31.0", "", { "dependencies": { "@algolia/client-common": "5.65.0", "@algolia/requester-browser-xhr": "5.65.0", "@algolia/requester-fetch": "5.65.0", "@algolia/requester-node-http": "5.65.0" } }, "sha512-6ii6y4Anj91i/O9RqHndwgAXzE7XPn9VJt7JhW5fM0u3DSKFzP8vX02GR5m41BIojGmItF3w9kDbqorLPl5gwQ=="], "@algolia/autocomplete-core": ["@algolia/autocomplete-core@1.17.7", "", { "dependencies": { "@algolia/autocomplete-plugin-algolia-insights": "1.17.7", "@algolia/autocomplete-shared": "1.17.7" } }, "sha512-BjiPOW6ks90UKl7TwMv7oNQMnzU+t/wk9mgIDi6b1tXpUek7MW0lbNOUHpvam9pe3lVCf4xPFT+lK7s+e+fs7Q=="], @@ -47,41 +47,41 @@ "@algolia/autocomplete-shared": ["@algolia/autocomplete-shared@1.17.7", "", { "peerDependencies": { "@algolia/client-search": ">= 4.9.1 < 6", "algoliasearch": ">= 4.9.1 < 6" } }, "sha512-o/1Vurr42U/qskRSuhBH+VKxMvkkUVTLU6WZQr+L5lGZZLYWyhdzWjW0iGXY7EkwRTjBqvN2EsR81yCTGV/kmg=="], - "@algolia/client-abtesting": ["@algolia/client-abtesting@5.56.0", "", { "dependencies": { "@algolia/client-common": "5.56.0", "@algolia/requester-browser-xhr": "5.56.0", "@algolia/requester-fetch": "5.56.0", "@algolia/requester-node-http": "5.56.0" } }, "sha512-7r4Z3NC7yU1oAQVWJNA2HX7tX481F3pJvCGyLIXiTdBcthz4Q/o21jwcMYDFkuI92UWTNBQQmHYgwHo1zS5dzg=="], + "@algolia/client-abtesting": ["@algolia/client-abtesting@5.65.0", "", { "dependencies": { "@algolia/client-common": "5.65.0", "@algolia/requester-browser-xhr": "5.65.0", "@algolia/requester-fetch": "5.65.0", "@algolia/requester-node-http": "5.65.0" } }, "sha512-oucECT3zn6/dg8IaUlB/VtLemCC5WEYQSe1c8epFu2CCXluAaDOXop0tHTCVzA11UReSy2/HST4+0ImW4KjNMA=="], - "@algolia/client-analytics": ["@algolia/client-analytics@5.56.0", "", { "dependencies": { "@algolia/client-common": "5.56.0", "@algolia/requester-browser-xhr": "5.56.0", "@algolia/requester-fetch": "5.56.0", "@algolia/requester-node-http": "5.56.0" } }, "sha512-avmjXQSq+jadFO8Xl2em05/uQdQnEmHsJyOAdVbZkmVgpMfxL12aJwVVfGNwYr9nulcpuJN1X0lTaQ5wxuNGcA=="], + "@algolia/client-analytics": ["@algolia/client-analytics@5.65.0", "", { "dependencies": { "@algolia/client-common": "5.65.0", "@algolia/requester-browser-xhr": "5.65.0", "@algolia/requester-fetch": "5.65.0", "@algolia/requester-node-http": "5.65.0" } }, "sha512-xtCoO8qPX0vEjHLtvHBX5H/eGemWi4pd25nHvxyvE0lJW6UAXsMulTmYR6LQDRe11P7TehYNRxQyNGRfsl9sUw=="], - "@algolia/client-common": ["@algolia/client-common@5.56.0", "", {}, "sha512-v2TPStUhY//ripPjIVclZ8AWc7DEGooXULZGFlFu37zNatgHjw34oZZ+OSbbc/YHO+xZwPl62I1k8xH1m4S2eg=="], + "@algolia/client-common": ["@algolia/client-common@5.65.0", "", {}, "sha512-HKsPz1ez+iCQPvCnp/LAc6tvHDOZbgYqmEBBIzT/ypqcVxuSiVjefS49dtdUCIBLFQx82G952YwuQRer3FkT8g=="], - "@algolia/client-insights": ["@algolia/client-insights@5.56.0", "", { "dependencies": { "@algolia/client-common": "5.56.0", "@algolia/requester-browser-xhr": "5.56.0", "@algolia/requester-fetch": "5.56.0", "@algolia/requester-node-http": "5.56.0" } }, "sha512-P0ehROpM4Sem3Sqo5x2cKPgj67D3G3jy0rh1Amwkcvsfr6tkvIcdCmerieanqTF7NxUMPNFLkpIFeMO8Rpa50w=="], + "@algolia/client-insights": ["@algolia/client-insights@5.65.0", "", { "dependencies": { "@algolia/client-common": "5.65.0", "@algolia/requester-browser-xhr": "5.65.0", "@algolia/requester-fetch": "5.65.0", "@algolia/requester-node-http": "5.65.0" } }, "sha512-sK60DDwXgMBxSmwouWtO+7+kiZBLeR3p7HYpua19GvD5SjhUaT//NhV2zBYv+nEyMAWkZz2WwnJP1hrh2Byzfg=="], - "@algolia/client-personalization": ["@algolia/client-personalization@5.56.0", "", { "dependencies": { "@algolia/client-common": "5.56.0", "@algolia/requester-browser-xhr": "5.56.0", "@algolia/requester-fetch": "5.56.0", "@algolia/requester-node-http": "5.56.0" } }, "sha512-SXK3Vn3WVxyzbm31oePZBJkp1wpOyuWdd4B/Pv7n0aXDxmeSWhC1R1FC1517mMrFAIaPH4Rt0x6RUe7ZNjz8FA=="], + "@algolia/client-personalization": ["@algolia/client-personalization@5.65.0", "", { "dependencies": { "@algolia/client-common": "5.65.0", "@algolia/requester-browser-xhr": "5.65.0", "@algolia/requester-fetch": "5.65.0", "@algolia/requester-node-http": "5.65.0" } }, "sha512-AFNZWZ8sxNIXJX24se0zQQIGtdlv1NzLDL8VBd7UG4MWyxVdG01ltekAliZhuoauUaKpCEMR+ZnMlFSbEYnvJA=="], - "@algolia/client-query-suggestions": ["@algolia/client-query-suggestions@5.56.0", "", { "dependencies": { "@algolia/client-common": "5.56.0", "@algolia/requester-browser-xhr": "5.56.0", "@algolia/requester-fetch": "5.56.0", "@algolia/requester-node-http": "5.56.0" } }, "sha512-5+ZdX8garFnmycnZgKhtXHePEaLj5zqDxI/0lkhhluzCcvTn0/PvvTirTg8hHYetQHvn7GDyeAiqTAieMvMW4A=="], + "@algolia/client-query-suggestions": ["@algolia/client-query-suggestions@5.65.0", "", { "dependencies": { "@algolia/client-common": "5.65.0", "@algolia/requester-browser-xhr": "5.65.0", "@algolia/requester-fetch": "5.65.0", "@algolia/requester-node-http": "5.65.0" } }, "sha512-szXK38E7vTF5cI7BtgK1wSQVHuZ9o2ZF0AwEDAcHVr92m+g1Gwk7QkpbtV4pat6k5Ea8iTZNi6xk91se7tD+Ew=="], - "@algolia/client-search": ["@algolia/client-search@5.56.0", "", { "dependencies": { "@algolia/client-common": "5.56.0", "@algolia/requester-browser-xhr": "5.56.0", "@algolia/requester-fetch": "5.56.0", "@algolia/requester-node-http": "5.56.0" } }, "sha512-+mKUdYvqOi0BcvpAEyCEw49vSBptufIcfibtHz2bdr1pI789M46Yt0uQEk/sxtK3teh71OQvVFHaTDzShUWewQ=="], + "@algolia/client-search": ["@algolia/client-search@5.65.0", "", { "dependencies": { "@algolia/client-common": "5.65.0", "@algolia/requester-browser-xhr": "5.65.0", "@algolia/requester-fetch": "5.65.0", "@algolia/requester-node-http": "5.65.0" } }, "sha512-ve+54en+XDMy7pwpdsN70aeMBwKvVyglJPYTuWnhN8RTvskxRPwPMllBiFSApP+QKzzHAuFZGRujzGO+mAhzXQ=="], - "@algolia/ingestion": ["@algolia/ingestion@1.56.0", "", { "dependencies": { "@algolia/client-common": "5.56.0", "@algolia/requester-browser-xhr": "5.56.0", "@algolia/requester-fetch": "5.56.0", "@algolia/requester-node-http": "5.56.0" } }, "sha512-9g/zj+AZx5moFcdFIrYQoVrueXivjUcc3MQHtCYT8WhIuk1lUh1AyEhvJCS0XBZld09cLvd1AZ3BvDBpVpX2UA=="], + "@algolia/ingestion": ["@algolia/ingestion@1.65.0", "", { "dependencies": { "@algolia/client-common": "5.65.0", "@algolia/requester-browser-xhr": "5.65.0", "@algolia/requester-fetch": "5.65.0", "@algolia/requester-node-http": "5.65.0" } }, "sha512-exDdxCEGZHyMH/dOEkJZVx8KVvU7MITUl9CNcyYI4cqfgDo37b8Xzcvcsp3k/aHcZxTwwtroIZgp45VlEBMzKQ=="], - "@algolia/monitoring": ["@algolia/monitoring@1.56.0", "", { "dependencies": { "@algolia/client-common": "5.56.0", "@algolia/requester-browser-xhr": "5.56.0", "@algolia/requester-fetch": "5.56.0", "@algolia/requester-node-http": "5.56.0" } }, "sha512-Qf3Sr6f9A9uxCZUf3MXS0d2b877uYzEB5yxqpVGXAhcJnBCQjrRRon0KvefpGkxy+BshrIJs96OUoMtGqXTFDA=="], + "@algolia/monitoring": ["@algolia/monitoring@1.65.0", "", { "dependencies": { "@algolia/client-common": "5.65.0", "@algolia/requester-browser-xhr": "5.65.0", "@algolia/requester-fetch": "5.65.0", "@algolia/requester-node-http": "5.65.0" } }, "sha512-kDxmwvY7sHf/xNP9ztXJ3UdQLDW+24zh0lDS5ZQOUxA0xOknt0ayYI3rS4RHKqWzUDl284WBCRreMhbpY387Wg=="], - "@algolia/recommend": ["@algolia/recommend@5.56.0", "", { "dependencies": { "@algolia/client-common": "5.56.0", "@algolia/requester-browser-xhr": "5.56.0", "@algolia/requester-fetch": "5.56.0", "@algolia/requester-node-http": "5.56.0" } }, "sha512-GXWG1rWc5wu8hY4N33Y3b6ernY6sAdAvmKWN/zHAiACOx40WnpG0TVX5YazCAr/9gOYGInSiM2A0y2jy2xbiDA=="], + "@algolia/recommend": ["@algolia/recommend@5.65.0", "", { "dependencies": { "@algolia/client-common": "5.65.0", "@algolia/requester-browser-xhr": "5.65.0", "@algolia/requester-fetch": "5.65.0", "@algolia/requester-node-http": "5.65.0" } }, "sha512-AOjncjDyAl82z9Hb7+4moiNH/222YpX/X1OU5ShsXVX4gVxFZFK9ro+d+ArxmiAsRhPyH0xc+P8CHZGgs2S11w=="], - "@algolia/requester-browser-xhr": ["@algolia/requester-browser-xhr@5.56.0", "", { "dependencies": { "@algolia/client-common": "5.56.0" } }, "sha512-7t24cBxaInS3mZb7ddEaZT/tp6q+/aR4YttsQVyP1/i+LmwPR34atO35KjaLFCcRVrlP7sYOAqkCfg6lIRB+ew=="], + "@algolia/requester-browser-xhr": ["@algolia/requester-browser-xhr@5.65.0", "", { "dependencies": { "@algolia/client-common": "5.65.0" } }, "sha512-57OdxaUZ3GS/NbdMIkDB93qy019zz2sZ+Awet+zNe9wo5/b/tObR9Seq/hsieFHYLxpjvpPF4pmctr9l3mAQJg=="], - "@algolia/requester-fetch": ["@algolia/requester-fetch@5.56.0", "", { "dependencies": { "@algolia/client-common": "5.56.0" } }, "sha512-R7ePHgVYmDFjZpvrsVAfbDz/d4RxKAYZ5/vgLfIsCVRZRryjWl/3INOxpOICzitehQ5FjNtNjcLQTrmHPTcHBQ=="], + "@algolia/requester-fetch": ["@algolia/requester-fetch@5.65.0", "", { "dependencies": { "@algolia/client-common": "5.65.0" } }, "sha512-x5jvVRt44N25elrCBDTFG8+iM0/pFxE9Z/sjg1eCeSjXb1SwhLhkqTVpG+yqkPoDOFRjD02S0WtmeQkiGX/LQw=="], - "@algolia/requester-node-http": ["@algolia/requester-node-http@5.56.0", "", { "dependencies": { "@algolia/client-common": "5.56.0" } }, "sha512-PIOUXlSnrqM0S+WOgDRb4RzotydJH7ZoT6tOyL7tAO7qJOfvX5wsEW8Pe+PMKMwvuI4/gIyK9cg2H7lJXqnc4Q=="], + "@algolia/requester-node-http": ["@algolia/requester-node-http@5.65.0", "", { "dependencies": { "@algolia/client-common": "5.65.0" } }, "sha512-+3RUs4gm83CAuBmQZO3oSSc6dCywiOpb83W7NTKW+Ex6dIAfHp/XtUFMmsPU33OsT+2sZ/SpCNQwvDAOdPBprw=="], - "@antfu/install-pkg": ["@antfu/install-pkg@1.1.0", "", { "dependencies": { "package-manager-detector": "^1.3.0", "tinyexec": "^1.0.1" } }, "sha512-MGQsmw10ZyI+EJo45CdSER4zEb+p31LpDAFp2Z3gkSd1yqVZGi0Ebx++YTEMonJy4oChEMLsxZ64j8FH6sSqtQ=="], + "@antfu/install-pkg": ["@antfu/install-pkg@2.1.0", "", { "dependencies": { "package-manager-detector": "^1.8.0", "tinyexec": "^1.3.1" } }, "sha512-sdg9NxU3zR4Mnawfbc/x6GB5Wf17WYud5qOuEuxXjaKpYpMkISSJEjItGebXJ2bQ4DIcly4NYH23mtkGJjvKUw=="], - "@babel/helper-string-parser": ["@babel/helper-string-parser@7.29.7", "", {}, "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw=="], + "@babel/helper-string-parser": ["@babel/helper-string-parser@7.29.15", "", {}, "sha512-C2FuapQ2Kh1OnVHAoLi5rD3GBJ8COb9Q609T6HEpLqaBAo560PDP5OxBE5dCI/h951MBO/+bCUYU5SZ+8ZlV+w=="], "@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.29.7", "", {}, "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg=="], - "@babel/parser": ["@babel/parser@7.29.9", "", { "dependencies": { "@babel/types": "^7.29.8" }, "bin": "./bin/babel-parser.js" }, "sha512-CjXrNHTnvqBVqHgdBysY3vk2T8tpJHb5/RMeHJBTyVa9xgugCB0CJTx/3oO8RV2QRQP391RWpB7D6hLjm8V9uA=="], + "@babel/parser": ["@babel/parser@7.29.15", "", { "dependencies": { "@babel/types": "^7.29.15" }, "bin": "./bin/babel-parser.js" }, "sha512-RpKWyisHoP81twtSCgmE02iU0RnPcq1DN5bBEbpUePrjA9Q3wXhufnCJrrayPpoZieqFh3zyZQqwtSK0gGccRA=="], - "@babel/types": ["@babel/types@7.29.8", "", { "dependencies": { "@babel/helper-string-parser": "^7.29.7", "@babel/helper-validator-identifier": "^7.29.7" } }, "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg=="], + "@babel/types": ["@babel/types@7.29.15", "", { "dependencies": { "@babel/helper-string-parser": "^7.29.15", "@babel/helper-validator-identifier": "^7.29.7" } }, "sha512-/XKpKDakL//LZ66bq1XsZOswuqeI5MZqPLDu18o3XdkU1fNJ7bdPtzgnc4ZNS+bBGHV0FJG8jjb8SwcC3nNVQQ=="], "@braintree/sanitize-url": ["@braintree/sanitize-url@7.1.2", "", {}, "sha512-jigsZK+sMF/cuiB7sERuo9V7N9jx+dhmHHnQyDSVdpZwVutaBu7WvNYqMDLSgFgfB30n452TP3vjDAvFC973mA=="], @@ -153,71 +153,71 @@ "@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.12", "", { "os": "win32", "cpu": "x64" }, "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA=="], - "@iconify-json/lucide": ["@iconify-json/lucide@1.2.143", "", { "dependencies": { "@iconify/types": "*" } }, "sha512-YSggiBVmSY5IvLoKS5pUBoNYkon5g5bac0/JvYCIaFbhTfsTfkIHG2nCXWSk03tu5C4IEmyZ4qwfwbO9CXqLag=="], + "@iconify-json/lucide": ["@iconify-json/lucide@1.2.161", "", { "dependencies": { "@iconify/types": "*" } }, "sha512-vqnIm6PfUnSnfD1boZSS74iJbYOL+ckFczHNIGFKUQTIynz7E4RH8szrehBPjGIUe1SioCaXsRNgnamDeSAmDg=="], - "@iconify-json/simple-icons": ["@iconify-json/simple-icons@1.2.92", "", { "dependencies": { "@iconify/types": "*" } }, "sha512-hR0ozxR97t1dzWw+esoxFijZ15gagt7EIgF3CNifu2yICXhS7gnun4Y+j+odJQtNSl7wvqMdoLbViIShwe/fdw=="], + "@iconify-json/simple-icons": ["@iconify-json/simple-icons@1.2.104", "", { "dependencies": { "@iconify/types": "*" } }, "sha512-WBozLa9oBsb6XuY+lnH7maIiYmabee0k276PvVVw+34oGAXNRnfJeilEOB4iQs2wFNU/8M/vQFVy66SHGJaDRw=="], "@iconify/types": ["@iconify/types@2.0.0", "", {}, "sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg=="], - "@iconify/utils": ["@iconify/utils@3.1.4", "", { "dependencies": { "@antfu/install-pkg": "^1.1.0", "@iconify/types": "^2.0.0", "import-meta-resolve": "^4.2.0" } }, "sha512-b1S7B1k9ohZ+iNTi2ATxbRYG9fTrJmUT0rc46bvVnNxqNRGW7dyo/vRREwyniI5IRN2RSJHDcm+s3BjWrSAjHw=="], + "@iconify/utils": ["@iconify/utils@3.1.7", "", { "dependencies": { "@antfu/install-pkg": "^2.0.1", "@iconify/types": "^2.0.0", "import-meta-resolve": "^4.2.0" } }, "sha512-JZHlwdID+dy+lTgbYC8NEC4zeugqeYsc6jewvzb4c58kHauJn+X7rNwQjxz5p2qSjqaEeQoLkCIQ9v/H4PK0/w=="], - "@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.5", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="], + "@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.6.0", "", {}, "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw=="], "@mermaid-js/mermaid-mindmap": ["@mermaid-js/mermaid-mindmap@9.3.0", "", { "dependencies": { "@braintree/sanitize-url": "^6.0.0", "cytoscape": "^3.23.0", "cytoscape-cose-bilkent": "^4.1.0", "cytoscape-fcose": "^2.1.0", "d3": "^7.0.0", "khroma": "^2.0.0", "non-layered-tidy-tree-layout": "^2.0.2" } }, "sha512-IhtYSVBBRYviH1Ehu8gk69pMDF8DSRqXBRDMWrEfHoaMruHeaP2DXA3PBnuwsMaCdPQhlUUcy/7DBLAEIXvCAw=="], "@mermaid-js/parser": ["@mermaid-js/parser@2.0.1", "", { "dependencies": { "@chevrotain/types": "~13.2.0" } }, "sha512-j37dj/h6p6pots1L7pLPPNuABEEu9WP4OYg9pW1g+nYG331j0+3canE9OagtYdytYvdSAMG+2fKU5cxep6LgjA=="], - "@napi-rs/lzma-linux-x64-gnu": ["@napi-rs/lzma-linux-x64-gnu@1.5.1", "", { "os": "linux", "cpu": "x64" }, "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ=="], + "@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.69.0", "", { "os": "android", "cpu": "arm" }, "sha512-LS/9cUA2Mta5bc6DznbN/drFwfcXwq6Qbdrm6AwTPtwybWcVHDleuguLlS9dVJU6r32JCX4nAHEuVj4N1BnARw=="], - "@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.62.4", "", { "os": "android", "cpu": "arm" }, "sha512-RrPokAb7dmbxFoeO3TloqHyOjgye8RkBhSqmp4aJMIex4c9r46ZstPnleDQOq1t46VOVjwIuwNogIqbodV1Vvg=="], + "@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.69.0", "", { "os": "android", "cpu": "arm64" }, "sha512-L/4XomHpL50RpOngeXXzAb8SFWodQCJFvwoAFHwfAi3j35m2vIAUwLeJbV+0kn1mRD0/SPRLLf5E1S4bPYBCsQ=="], - "@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.62.4", "", { "os": "android", "cpu": "arm64" }, "sha512-JKuJc+pnpks2pjy7L/N3v/cAkZxYlnmuZoD840ldbMI5KDbC4iO9NKwPKYdjYFCMAIIlBzYSFHxIJVYzRo2/8A=="], + "@rollup/rollup-android-x64": ["@rollup/rollup-android-x64@4.69.0", "", { "os": "android", "cpu": "x64" }, "sha512-6l/H/6Plf1miy95hN1+XuwFf9D45RwR3J0bIypZYVTpJ4t7TeeGbjGoHdJsw6NYIn3CjbDljV8jciLUD0Kv66Q=="], - "@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.62.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-krw5uS2STmvJ02x0uTXHbqQNuz+9eZ1iw+qXk9dmW2gvV4jV7O2hEoOnuhFrpOPiel1mBFtqbxYZZtC46hXLOw=="], + "@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.69.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-kWjfWswYf8Kytdw2lFfN4D6pSFNh7zSnYHN52f534Mnekn/6JyzTcf6htRqshVwE0BiCQmIF5f04fDJBiTOi8A=="], - "@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.62.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-wsTxtgApb4PrOsNJIm0FZ1h3WvCC+k9uxLJ4ad75hgoS4NiRes2SoJFlDAyMwiUY8IssDqGcHbXuN0sx1tfF1A=="], + "@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.69.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-pnIgSStdhDkgslWZFoN9fuhZ7SOeGN11z/gPTYlqHu/gmOFG1b0goqEhwJQJIJdSCsxymUjwQrt83qkJriSFEg=="], - "@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.62.4", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-GUOnQlyZe3yAXhWOtOMsn5Qkrv5E5mZXa0thbARWi5Ei2szlVXJFQhddZ4HbAzh8q92w5twp+CQvs/eFanz9YQ=="], + "@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.69.0", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-fCRnvzz9pxrdSvGIdd6NUNbg6ib2u1cRjEQmVVRXvCWeW/ljqm5qEf+Zk7GpY23xuZhNu9AfgYRWEMJXnkUVEQ=="], - "@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.62.4", "", { "os": "freebsd", "cpu": "x64" }, "sha512-/Y7f3QuxjzPKsjA/rfEDa3+0vXqyjmJ50Ln8dPpCmWkKTrUoWHG1cWhTqaAMLob2m2nESWuC7yGrREz019Ztqg=="], + "@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.69.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-uQQv6dfKNqeaWRoUjKhzLM9H/u41volv+SvHlmAgplzz5GV8P8AEnEoY9ALWnGzUVQw2d80PIelaBjHPaXfrlA=="], - "@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.62.4", "", { "os": "linux", "cpu": "arm" }, "sha512-81wiiX3v7aqy+T+bT61TJ78yJjRquqFFTTbAPt08imfQQzkPIW8t6aJbkTagtCCrXMNc9D66+geqlK7ydLPNqA=="], + "@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.69.0", "", { "os": "linux", "cpu": "arm", "libc": "glibc" }, "sha512-q+a/Qv4l7aYhIWktCepgXDwyOK8QA71AbvvtMYdzyvhCI39koTQWuZiDIzgtwVH5ynLz6N3pm/5ASXGYpF8YQw=="], - "@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.62.4", "", { "os": "linux", "cpu": "arm" }, "sha512-9kmDIvNZqdoHOBZgNtpTBeLWYO/LVipM3H/j62P8848/l/VPEQL6N3uxU9pvP1oZAsXyC2MEnFP3ovRjo7WYNQ=="], + "@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.69.0", "", { "os": "linux", "cpu": "arm", "libc": "musl" }, "sha512-KhuX6eiqtiALUVv9UH50Aq/5L0orR4IxbNA3whhHJ+XCQfGKpJvBMESP2zP8kcHakEDg0cZuuoWn0SQVle+Z4g=="], - "@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.62.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-CcnXHWnXg69g+DX5VWL3FHts3qMRN2uVEHX+BZvGLdd07/gXkn3ePjYtO1LDJvxkGKVHMclKBRa1QUTH+6toYQ=="], + "@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.69.0", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-Dsh+pONAwDmC5Xs44EPRPKdcPK/YvfGoEEyBnYOGHcvf0YZg1f+jg8yARYUY/7Ehqn4T99VIp4rZxG6ikAouQQ=="], - "@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.62.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-iFOibiHnTRuhrWLlRsOQFdZJJIa7S8OwkneJr4ocALP16u5yk6lWLINFwhHaEqBFMsKDUZofLkGos7+CPzGB3g=="], + "@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.69.0", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-1Pg/gw3o3wIUzshideAc6W0kR4Drexp/VIww+Fal0LRmgvReN9aWF5VsDk8N5CDvwSAL/sRJmEehFvQJ++f0cA=="], - "@rollup/rollup-linux-loong64-gnu": ["@rollup/rollup-linux-loong64-gnu@4.62.4", "", { "os": "linux", "cpu": "none" }, "sha512-XnWYMI7euHlb5a871xPja+Gm7DRCFU+FGRrtS2sMq9N8FvqtpagUy6gD4YOemC5MRk9xbh8+jYMEJbigFQwsgA=="], + "@rollup/rollup-linux-loong64-gnu": ["@rollup/rollup-linux-loong64-gnu@4.69.0", "", { "os": "linux", "cpu": "none", "libc": "glibc" }, "sha512-aClGNdaCEkSn/0eF+xniOoLmv/8MKvXutMhyJjZmHt6e+9SUZJuZ4kENPIm/w6Vgzkm8+Q4Q54TxeQeE40lqQw=="], - "@rollup/rollup-linux-loong64-musl": ["@rollup/rollup-linux-loong64-musl@4.62.4", "", { "os": "linux", "cpu": "none" }, "sha512-qGDAlO0U8xedCcsdRm9oaoQY8DAx/QT7uIxJWhCdx0ceIWX783UC9QSYkdpzAe29wNiVfp24+bZdQmn49o45SQ=="], + "@rollup/rollup-linux-loong64-musl": ["@rollup/rollup-linux-loong64-musl@4.69.0", "", { "os": "linux", "cpu": "none", "libc": "musl" }, "sha512-AOcqa4bSdNJacCC8nuOWF3Jl10nVFWnugp5fK6h9KT1n7ODXXOJJwLf5BIOXgd2J7nZTDkOM8FSQjjOYYOzpvw=="], - "@rollup/rollup-linux-ppc64-gnu": ["@rollup/rollup-linux-ppc64-gnu@4.62.4", "", { "os": "linux", "cpu": "ppc64" }, "sha512-ru4H6ezD7ysA5EiEK6qkkaEb4modH8CTej6kUy/gQi20u3kB3G7Zn8snXXkeJSCOFKG/rbPPtM/+9Wgas1961w=="], + "@rollup/rollup-linux-ppc64-gnu": ["@rollup/rollup-linux-ppc64-gnu@4.69.0", "", { "os": "linux", "cpu": "ppc64", "libc": "glibc" }, "sha512-mu7CnOikcPE6sb471PYnUTJi8lKkQDq8lCx56+nOpXj04HsNbzbOIbbdVv5ZWBmBRPBLgxarW1ZN+BfKpOeSMQ=="], - "@rollup/rollup-linux-ppc64-musl": ["@rollup/rollup-linux-ppc64-musl@4.62.4", "", { "os": "linux", "cpu": "ppc64" }, "sha512-2W4MO5WQVJnbJaZdvDb9rhBDuFU1nKIepPFpJUBsTh2k1YY2g+ODViaWuyOAjQ5cOP7NvrvLzt3wvHOoiAvc7w=="], + "@rollup/rollup-linux-ppc64-musl": ["@rollup/rollup-linux-ppc64-musl@4.69.0", "", { "os": "linux", "cpu": "ppc64", "libc": "musl" }, "sha512-zQfVWkHGjzshZ9Vxhx29xaNwuqOwIj/q2DHDJaHGFMHwuuVJbW2XRCiZlpkOaAgCCOGpMHG8aB8ZBw7dzCMvAQ=="], - "@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.62.4", "", { "os": "linux", "cpu": "none" }, "sha512-+fxjfuoAmVMCYV5QyjoIpu0cp5DOiOTeqYFk1AVaxGr+/ravWLX89XfQmptsoWcaVy/TGf2hexzbUOrCQIL1CQ=="], + "@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.69.0", "", { "os": "linux", "cpu": "none", "libc": "glibc" }, "sha512-aJV99mmNaFMKnoDbD8gGQrNoMl9oXERJ7m1D7GMZGfkql6C7Jgv9cr1aXudFvNXVsLz1fOP0dtX2YemaCpQUKw=="], - "@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.62.4", "", { "os": "linux", "cpu": "none" }, "sha512-jTn8JfHGL4djjFxPuM06LmNUJDsst2jeVlsd9OmIH6zc5sC9K6rIuO4YajXatLUpBmBKl6b35ro1QZocLi+tcA=="], + "@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.69.0", "", { "os": "linux", "cpu": "none", "libc": "musl" }, "sha512-8FA5xqZYZFo7fCCqP+sqdvrRhNAcRQaS0lhH/z0i/InJ+F10c63bZYdkahz/J4p4Y/Z5DrqtX1DlhPB2kS7EWg=="], - "@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.62.4", "", { "os": "linux", "cpu": "s390x" }, "sha512-oCJCJL4pXsoDcP2QZ+JVlPTIRc6266zsIaeJJsWImmF7HO0W8nb6HuSgZlMWxJwaPf8ehbSw8yo0EUw925hKsA=="], + "@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.69.0", "", { "os": "linux", "cpu": "s390x", "libc": "glibc" }, "sha512-ixLvYO2Th2Vj0cBYph8Z3I9SvMUFXpg68AHtanp2CmVQ4AsCxRggSH9ZDA13pRJ5dxOBrhzNOWEBixD7q2KQ1A=="], - "@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.62.4", "", { "os": "linux", "cpu": "x64" }, "sha512-W69hukhZ3KKNRCaMIEzKvcFye42hh0FE1+YoYaf5+Ikacuftoco6yO/xouz0hc5d5W/s3yBro5jRiuEE/Q5vUw=="], + "@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.69.0", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-Y1be0IFy5Bsr8wz66HxGfqe9gjnoy8/ha7a5KMBNlIWdrV8wLB+afVUgOQfEGPCIPuoCataDmBze7x+32Pkipg=="], - "@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.62.4", "", { "os": "linux", "cpu": "x64" }, "sha512-qiXbGG2jkjXhzXpsFZSR2Xpb8DN/UaxYsbb/STbuR/6fpaDgRmmaq1B/LmtF2wQFOFOSsK2jdE0RZ3a0zHn4QA=="], + "@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.69.0", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-OZvUPL9jw0IZL2+BKo7XFlc2x2IJ+tTRyUH4suMYLKa667o7LR3//67haU1r3pyNiZhyVhdLdHCW8RMYCAnuqA=="], - "@rollup/rollup-openbsd-x64": ["@rollup/rollup-openbsd-x64@4.62.4", "", { "os": "openbsd", "cpu": "x64" }, "sha512-nWeM//hxv8mIo6jD7Hu4o48DVmV9pbV6gsKaWU+4NFyqHoPKwrkRiZGLKUhOBk8qNmDmpwFtPKg80Bo/Tn4xiQ=="], + "@rollup/rollup-openbsd-x64": ["@rollup/rollup-openbsd-x64@4.69.0", "", { "os": "openbsd", "cpu": "x64" }, "sha512-RrQ8J+DS+gmPzqNzVuz7v0jkeR7dBSaVd9Z3fIL7TUYJys8adGlsLRPn2tNRHr0lNNYLFa/DiIoMCpoIEufy/A=="], - "@rollup/rollup-openharmony-arm64": ["@rollup/rollup-openharmony-arm64@4.62.4", "", { "os": "none", "cpu": "arm64" }, "sha512-s62SQ/vgsRSvMwDkOEfTqfgASF0f26ZNaQuTA6Aok5lrikf89yI2W0gFHvZb2Jpgc6N8JnOKZgCK2iciO3CsxQ=="], + "@rollup/rollup-openharmony-arm64": ["@rollup/rollup-openharmony-arm64@4.69.0", "", { "os": "none", "cpu": "arm64" }, "sha512-ZMta5nna7orn3QWUI9dP5l8QGUkLl738HlqLRbjOnr6CKwyn+yvV+7slATplAjiXKG1HOnq4201O5y3HviM5fQ=="], - "@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.62.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-J6wGf8TVGbXJq+HH+ttTvrcfNKPbuZecV6KT1B8I18BC5IURUh5kl4Yl5OEP5eFIUoI5BWxCsyYMhFsDx8kekw=="], + "@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.69.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-UW4lXCyt53+f0GcLdSlI3lWkDcC12TNA8TcEJWs3/tZt/Iaf4FGXuXSu3rMY+LJcMlg7SPTatF7ZGaqudSfBbA=="], - "@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.62.4", "", { "os": "win32", "cpu": "ia32" }, "sha512-zmfrQd/0wu6oJs8Vq8KwY/YtsKSsLtKe/HwAP4Wqy8LhWjeT55fHRAkOhYQ12wI3ayS4Tt12d5CDRD7N96SAYQ=="], + "@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.69.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-6EsWWEUEocw7bsA1ktWlM5pfR4TGI/yKG3HORAbuKCvpY83+Bgbmvj4DAkmTs9Y9T97muOo42nTvTYxfPjz3Hg=="], - "@rollup/rollup-win32-x64-gnu": ["@rollup/rollup-win32-x64-gnu@4.62.4", "", { "os": "win32", "cpu": "x64" }, "sha512-qPzHqdj9rfUD+w79dtE07zi/kFwKyCJqplp5K5ygeLTp7jLpAoc16OAH39HSmRC9UpozaecsleI8uAdEj6v2yw=="], + "@rollup/rollup-win32-x64-gnu": ["@rollup/rollup-win32-x64-gnu@4.69.0", "", { "os": "win32", "cpu": "x64" }, "sha512-62EZHqPKiTWGcWATgZnFqQ90n1s6U7tHE789VQMMPeWuZGNZzT6q096XTJI1fmMdMHvr5SqHwpT9cL+3GhAg7g=="], - "@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.62.4", "", { "os": "win32", "cpu": "x64" }, "sha512-zD6NdeWEByGE9QF9vCrlJ5YQB4oq9q91kPZS37Jwj5hOkvR1lTBSpsKhKDw4IJtbQ35LsTS1HD9DZYGKIshU1Q=="], + "@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.69.0", "", { "os": "win32", "cpu": "x64" }, "sha512-abgfCvv47pWhokHJVs/2b8vsAsW9eqFh90jeSzCBV1XGNqI8FWXhi+uZgtnkImMdsFD/N9g5m/Ow9Yb65YeF/g=="], "@shikijs/core": ["@shikijs/core@2.5.0", "", { "dependencies": { "@shikijs/engine-javascript": "2.5.0", "@shikijs/engine-oniguruma": "2.5.0", "@shikijs/types": "2.5.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4", "hast-util-to-html": "^9.0.4" } }, "sha512-uu/8RExTKtavlpH7XqnVYBrfBkUc20ngXiX9NSrBhOVZYv/7XQRKUyhtkeflY5QsxC0GbJThCerruZfsUaSldg=="], @@ -233,7 +233,7 @@ "@shikijs/types": ["@shikijs/types@2.5.0", "", { "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "sha512-ygl5yhxki9ZLNuNpPitBWvcy9fsSKKaRuO4BAlMyagszQidxcpLAr0qiW/q43DtSIDxO6hEbtYLiFZNXO/hdGw=="], - "@shikijs/vscode-textmate": ["@shikijs/vscode-textmate@10.0.2", "", {}, "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg=="], + "@shikijs/vscode-textmate": ["@shikijs/vscode-textmate@10.1.0", "", {}, "sha512-cVBuhDQjBZaNMTwBquYfPydrUP+E3hE6oYGasx8h6ZrODIM7/r+gxLDXdd66oszbrggZHEntdE6j+5gYIVyMWQ=="], "@types/d3": ["@types/d3@7.4.3", "", { "dependencies": { "@types/d3-array": "*", "@types/d3-axis": "*", "@types/d3-brush": "*", "@types/d3-chord": "*", "@types/d3-color": "*", "@types/d3-contour": "*", "@types/d3-delaunay": "*", "@types/d3-dispatch": "*", "@types/d3-drag": "*", "@types/d3-dsv": "*", "@types/d3-ease": "*", "@types/d3-fetch": "*", "@types/d3-force": "*", "@types/d3-format": "*", "@types/d3-geo": "*", "@types/d3-hierarchy": "*", "@types/d3-interpolate": "*", "@types/d3-path": "*", "@types/d3-polygon": "*", "@types/d3-quadtree": "*", "@types/d3-random": "*", "@types/d3-scale": "*", "@types/d3-scale-chromatic": "*", "@types/d3-selection": "*", "@types/d3-shape": "*", "@types/d3-time": "*", "@types/d3-time-format": "*", "@types/d3-timer": "*", "@types/d3-transition": "*", "@types/d3-zoom": "*" } }, "sha512-lZXZ9ckh5R8uiFVt8ogUNf+pIrK4EsWrx2Np75WvF/eTpJ0FMHNhjXk8CKEx/+gpHbNQyJWehbFaTvqmHWB3ww=="], @@ -283,9 +283,9 @@ "@types/d3-scale-chromatic": ["@types/d3-scale-chromatic@3.1.0", "", {}, "sha512-iWMJgwkK7yTRmWqRB5plb1kadXyQ5Sj8V/zYlFGMUBbIPKQScw+Dku9cAAMgJG+z5GYDoMjWGLVOvjghDEFnKQ=="], - "@types/d3-selection": ["@types/d3-selection@3.0.11", "", {}, "sha512-bhAXu23DJWsrI45xafYpkQ4NtcKMwWnAC/vKrd2l+nxMFuvOT3XMYTIj2opv8vq8AO5Yh7Qac/nSeP/3zjTK0w=="], + "@types/d3-selection": ["@types/d3-selection@3.0.13", "", {}, "sha512-oXz0iHVpWOhurycj7P8KehdevbbwQfdOyYPd6u5TUcrk6ofXeQfY0e4Ow+0/35arZ24gs6ubpjJX0CuZHV5fdw=="], - "@types/d3-shape": ["@types/d3-shape@3.1.8", "", { "dependencies": { "@types/d3-path": "*" } }, "sha512-lae0iWfcDeR7qt7rA88BNiqdvPS5pFVPpo5OfjElwNaT2yyekbM0C9vK+yqBqEmHr6lDkRnYNoTBYlAgJa7a4w=="], + "@types/d3-shape": ["@types/d3-shape@3.2.0", "", { "dependencies": { "@types/d3-path": "*" } }, "sha512-kVd74ta9eof3eJOvbNd1vGKS/XERRyQbT26Og63hIsvDO84cjD5gEOhsXf26w3FSoNlPVz84DOFcKv/oou+fMw=="], "@types/d3-time": ["@types/d3-time@3.0.4", "", {}, "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g=="], @@ -295,9 +295,9 @@ "@types/d3-transition": ["@types/d3-transition@3.0.9", "", { "dependencies": { "@types/d3-selection": "*" } }, "sha512-uZS5shfxzO3rGlu0cC3bjmMFKsXv+SmZZcgp0KD22ts4uGXp5EVYGzu/0YdwZeKmddhcAccYtREJKkPfXkZuCg=="], - "@types/d3-zoom": ["@types/d3-zoom@3.0.8", "", { "dependencies": { "@types/d3-interpolate": "*", "@types/d3-selection": "*" } }, "sha512-iqMC4/YlFCSlO8+2Ii1GGGliCAY4XdeG748w5vQUbevlbDu0zSjH/+jojorQVBK/se0j6DUFNPBGSqD3YWYnDw=="], + "@types/d3-zoom": ["@types/d3-zoom@3.0.9", "", { "dependencies": { "@types/d3-interpolate": "*", "@types/d3-selection": "*" } }, "sha512-0sE1406XBYJGiqD3AusTl9ZqC//2mIXix51tbom25gDCA8ri4xnSZg28CaSE8Srl6FClqABUKfsn0qghgdepMA=="], - "@types/estree": ["@types/estree@1.0.9", "", {}, "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg=="], + "@types/estree": ["@types/estree@1.0.11", "", {}, "sha512-YBdNe5JcjYR0sPhJW1QIeRCmI11YhYvaRuGCs9+WCeTTb+Yhb2BE2XMe5/wAqF10FK5g3+q1PDhQABfT7aX0gg=="], "@types/geojson": ["@types/geojson@7946.0.16", "", {}, "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg=="], @@ -305,13 +305,13 @@ "@types/linkify-it": ["@types/linkify-it@5.0.0", "", {}, "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q=="], - "@types/markdown-it": ["@types/markdown-it@14.1.2", "", { "dependencies": { "@types/linkify-it": "^5", "@types/mdurl": "^2" } }, "sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog=="], + "@types/markdown-it": ["@types/markdown-it@14.2.0", "", { "dependencies": { "@types/linkify-it": "^5", "@types/mdurl": "^2" } }, "sha512-NoQ2yGlLWj4wpxMs+TYmRKk3thDrQ97agr7sFqfLsAlvoS8SNQuTrlObhFqG9iugdTtgOE9jpJ6FNM4ZGsa5xQ=="], "@types/mdast": ["@types/mdast@4.0.4", "", { "dependencies": { "@types/unist": "*" } }, "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA=="], "@types/mdurl": ["@types/mdurl@2.0.0", "", {}, "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg=="], - "@types/node": ["@types/node@26.6.5", "", { "dependencies": { "undici-types": "~8.9.0" } }, "sha512-uMzsv9stDdofIZBx4UGh4Z9ZgXnGC9seRDscilBcTHAeOFk67MZg/k9bWVfO+bk4qZmG+l52hRnLwUiH2LnJTg=="], + "@types/node": ["@types/node@26.6.11", "", { "dependencies": { "undici-types": "~8.9.0" } }, "sha512-uUyQ2XLEz+EXh34lmS3GhKrkqn/8FU7KUiKRpk347At2bmnMVWss45yz8b4FG/tUtmV1tV/+TVkITItPROyeeQ=="], "@types/trusted-types": ["@types/trusted-types@2.0.7", "", {}, "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw=="], @@ -359,7 +359,7 @@ "@typescript/typescript-win32-x64": ["@typescript/typescript-win32-x64@7.0.2", "", { "os": "win32", "cpu": "x64" }, "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g=="], - "@ungap/structured-clone": ["@ungap/structured-clone@1.3.3", "", {}, "sha512-60YRaenCQcVjYEKOcG824+DRGGIQ3VKErcBoAEDJZz5bKIs2ZG+X/H9Nk+Q6EVkwJk5QNApxbrc5QtBSwtrXAg=="], + "@ungap/structured-clone": ["@ungap/structured-clone@1.4.0", "", {}, "sha512-1mEZtMKPM09vDmQt5y7YvmN2+DFTP7Tg0EWXdic8/C6VRnpb33e4ghisCIE3WZjsE2N8mf+QV1Zqh7ZFYLWInQ=="], "@upsetjs/venn.js": ["@upsetjs/venn.js@2.0.0", "", { "optionalDependencies": { "d3-selection": "^3.0.0", "d3-transition": "^3.0.1" } }, "sha512-WbBhLrooyePuQ1VZxrJjtLvTc4NVfpOyKx0sKqioq9bX1C1m7Jgykkn8gLrtwumBioXIqam8DLxp88Adbue6Hw=="], @@ -397,7 +397,7 @@ "@vueuse/shared": ["@vueuse/shared@12.8.2", "", { "dependencies": { "vue": "^3.5.13" } }, "sha512-dznP38YzxZoNloI0qpEfpkms8knDtaoQ6Y/sfS0L7Yki4zh40LFHEhur0odJC6xTHG5dxWVPiUWBXn+wCG2s5w=="], - "algoliasearch": ["algoliasearch@5.56.0", "", { "dependencies": { "@algolia/abtesting": "1.22.0", "@algolia/client-abtesting": "5.56.0", "@algolia/client-analytics": "5.56.0", "@algolia/client-common": "5.56.0", "@algolia/client-insights": "5.56.0", "@algolia/client-personalization": "5.56.0", "@algolia/client-query-suggestions": "5.56.0", "@algolia/client-search": "5.56.0", "@algolia/ingestion": "1.56.0", "@algolia/monitoring": "1.56.0", "@algolia/recommend": "5.56.0", "@algolia/requester-browser-xhr": "5.56.0", "@algolia/requester-fetch": "5.56.0", "@algolia/requester-node-http": "5.56.0" } }, "sha512-PrqppUmhT4ENdas2pH9caE7efUcxy6EcSFhWzosiVuQBzu2tQ5yLTI6jwomT/1cuBnivzGfxiJCqDNN9FRRh+Q=="], + "algoliasearch": ["algoliasearch@5.65.0", "", { "dependencies": { "@algolia/abtesting": "1.31.0", "@algolia/client-abtesting": "5.65.0", "@algolia/client-analytics": "5.65.0", "@algolia/client-common": "5.65.0", "@algolia/client-insights": "5.65.0", "@algolia/client-personalization": "5.65.0", "@algolia/client-query-suggestions": "5.65.0", "@algolia/client-search": "5.65.0", "@algolia/ingestion": "1.65.0", "@algolia/monitoring": "1.65.0", "@algolia/recommend": "5.65.0", "@algolia/requester-browser-xhr": "5.65.0", "@algolia/requester-fetch": "5.65.0", "@algolia/requester-node-http": "5.65.0" } }, "sha512-W6pp+0u2lJ6/4XeGGmtjLgHBxd+pKEGW0IcAyhBlk42y+nZLdsPM0w80R83zt6FZCdPLIjdTVxBn24E727wM+Q=="], "birpc": ["birpc@2.9.0", "", {}, "sha512-KrayHS5pBi69Xi9JmvoqrIgYGDkD6mcSe/i6YKi3w5kekCLzrX4+nawcXqrj2tIp50Kw/mT/s3p+GVK0A0sKxw=="], @@ -411,83 +411,83 @@ "comma-separated-tokens": ["comma-separated-tokens@2.0.3", "", {}, "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg=="], - "commander": ["commander@15.0.0", "", {}, "sha512-z67u4ZhzCL/Tydu1lJARtEZYWbWaN7oYLHbsuzocr6y4N6WZAagG3RQ4FW61V1/0+jImpj293XfrcYnd1qxtPg=="], + "commander": ["commander@15.1.0", "", {}, "sha512-cgnQ88TRrWcC7pVq46RzJVRMktu3W2RcbnoidnfBsl1bmDCBwJS/udcIZpKoCrbAYYaCqsz1yZCVIgbIaU3ddQ=="], - "copy-anything": ["copy-anything@4.0.5", "", { "dependencies": { "is-what": "^5.2.0" } }, "sha512-7Vv6asjS4gMOuILabD3l739tsaxFQmC+a7pLZm02zyvs8p977bL3zEgq3yDk5rn9B0PbYgIv++jmHcuUab4RhA=="], + "copy-anything": ["copy-anything@4.1.5", "", {}, "sha512-vePst2VLTSqPglW7Q98VwFpGiGpOHTyXIo81MO5VyLecA5zMbZw/P/V1vmwD1jksa2iJpn/YkDrJ3XhTfzUyhQ=="], "cose-base": ["cose-base@1.0.3", "", { "dependencies": { "layout-base": "^1.0.0" } }, "sha512-s9whTXInMSgAp/NVXVNuVxVKzGH2qck3aQlVHxDCdAEPgtMKwc4Wq6/QKhgdEdgbLSi9rBTAcPoRa6JpiG4ksg=="], - "csstype": ["csstype@3.2.3", "", {}, "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ=="], + "csstype": ["csstype@3.2.4", "", {}, "sha512-PoKaoPzQapnEoqUSnHx1u6W6ku8CVEgKsnpmmzU3m1nwkidpPBQ8V/Zq2+bWNrsOKoKLwTGdbx6xF7BXP1zLVQ=="], - "cytoscape": ["cytoscape@3.34.0", "", {}, "sha512-62rNSrioXw93uliKFBwjukeQyeWwH2PqDrTac31r2P6464u3AUvTk0xS4LVvT251g7IgkFunrI48ZEZGjywSOg=="], + "cytoscape": ["cytoscape@3.35.0", "", {}, "sha512-sMvBIXiGMnhkCaWz2R06FwF/27MNlS+Tqvi17foO9UhnUg3XGZccKjxsvEqQFAQYMSSZmN5SxYzUYlQ0DOJJ3g=="], "cytoscape-cose-bilkent": ["cytoscape-cose-bilkent@4.1.0", "", { "dependencies": { "cose-base": "^1.0.0" }, "peerDependencies": { "cytoscape": "^3.2.0" } }, "sha512-wgQlVIUJF13Quxiv5e1gstZ08rnZj2XaLHGoFMYXz7SkNfCDOOteKBE6SYRfA9WxxI/iBc3ajfDoc6hb/MRAHQ=="], "cytoscape-fcose": ["cytoscape-fcose@2.2.0", "", { "dependencies": { "cose-base": "^2.2.0" }, "peerDependencies": { "cytoscape": "^3.2.0" } }, "sha512-ki1/VuRIHFCzxWNrsshHYPs6L7TvLu3DL+TyIGEsRcvVERmxokbf5Gdk7mFxZnTdiGtnA4cfSmjZJMviqSuZrQ=="], - "d3": ["d3@7.9.0", "", { "dependencies": { "d3-array": "3", "d3-axis": "3", "d3-brush": "3", "d3-chord": "3", "d3-color": "3", "d3-contour": "4", "d3-delaunay": "6", "d3-dispatch": "3", "d3-drag": "3", "d3-dsv": "3", "d3-ease": "3", "d3-fetch": "3", "d3-force": "3", "d3-format": "3", "d3-geo": "3", "d3-hierarchy": "3", "d3-interpolate": "3", "d3-path": "3", "d3-polygon": "3", "d3-quadtree": "3", "d3-random": "3", "d3-scale": "4", "d3-scale-chromatic": "3", "d3-selection": "3", "d3-shape": "3", "d3-time": "3", "d3-time-format": "4", "d3-timer": "3", "d3-transition": "3", "d3-zoom": "3" } }, "sha512-e1U46jVP+w7Iut8Jt8ri1YsPOvFpg46k+K8TpCb0P+zjCkjkPnV7WzfDJzMHy1LnA+wj5pLT1wjO901gLXeEhA=="], + "d3": ["d3@7.9.2", "", { "dependencies": { "d3-array": "^3.2.5", "d3-axis": "^3.0.1", "d3-brush": "^3.0.1", "d3-chord": "^3.0.2", "d3-color": "^3.1.1", "d3-contour": "^4.0.3", "d3-delaunay": "^6.0.6", "d3-dispatch": "^3.0.2", "d3-drag": "^3.0.1", "d3-dsv": "^3.0.2", "d3-ease": "^3.0.2", "d3-fetch": "^3.0.2", "d3-force": "^3.0.1", "d3-format": "^3.1.3", "d3-geo": "^3.1.2", "d3-hierarchy": "^3.1.3", "d3-interpolate": "^3.0.2", "d3-path": "^3.1.1", "d3-polygon": "^3.0.2", "d3-quadtree": "^3.0.2", "d3-random": "^3.0.2", "d3-scale": "^4.0.3", "d3-scale-chromatic": "^3.1.1", "d3-selection": "^3.0.1", "d3-shape": "^3.2.1", "d3-time": "^3.1.1", "d3-time-format": "^4.1.1", "d3-timer": "^3.0.2", "d3-transition": "^3.0.2", "d3-zoom": "^3.0.1" } }, "sha512-ZKb/mONPVKzaO5UlcWcwN8bS4ezvQaYu+bsou+XgNABdGC800kwH651ADTbbTxMPHW13UlvbQafdmJQDk1w7Mg=="], - "d3-array": ["d3-array@3.2.4", "", { "dependencies": { "internmap": "1 - 2" } }, "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg=="], + "d3-array": ["d3-array@3.2.5", "", { "dependencies": { "internmap": "1 - 2" } }, "sha512-Th8qGXoBalmWsstpkuhmBuTsBQIFqYOJtjlBvNVvBfJ8E3uYusBUwUR8HU20U0qKKQkgCvKyR1YjiozWadk5QA=="], - "d3-axis": ["d3-axis@3.0.0", "", {}, "sha512-IH5tgjV4jE/GhHkRV0HiVYPDtvfjHQlQfJHs0usq7M30XcSBvOotpmH1IgkcXsO/5gEQZD43B//fc7SRT5S+xw=="], + "d3-axis": ["d3-axis@3.0.1", "", {}, "sha512-E5QCXfaf/uJZEHHiqoWRq+bQEm2PzoVFv2rDC7CZ3wwI0MjfMW3w83J3ubobG4IJj3lShAI5eiPJhOu/8wHofA=="], - "d3-brush": ["d3-brush@3.0.0", "", { "dependencies": { "d3-dispatch": "1 - 3", "d3-drag": "2 - 3", "d3-interpolate": "1 - 3", "d3-selection": "3", "d3-transition": "3" } }, "sha512-ALnjWlVYkXsVIGlOsuWH1+3udkYFI48Ljihfnh8FZPF2QS9o+PzGLBslO0PjzVoHLZ2KCVgAM8NVkXPJB2aNnQ=="], + "d3-brush": ["d3-brush@3.0.1", "", { "dependencies": { "d3-dispatch": "1 - 3", "d3-drag": "2 - 3", "d3-interpolate": "1 - 3", "d3-selection": "3", "d3-transition": "3" } }, "sha512-L5Glqa/Gb7LU3ndIOMtA5mDzlJ0aXKp5ELP2X09ctWF23jO7+faIUVDbmaIi+D6k3EemXFWn1F3lkfguExoVhA=="], - "d3-chord": ["d3-chord@3.0.1", "", { "dependencies": { "d3-path": "1 - 3" } }, "sha512-VE5S6TNa+j8msksl7HwjxMHDM2yNK3XCkusIlpX5kwauBfXuyLAtNg9jCp/iHH61tgI4sb6R/EIMWCqEIdjT/g=="], + "d3-chord": ["d3-chord@3.0.2", "", { "dependencies": { "d3-path": "1 - 3" } }, "sha512-cGmADo5M2PTi3ewJZ2lcE32eURd4JmHtQ5JwRIUcas5L1SXqufG9yPyjWp8fW0gRi7aZi9bgbZPFZO1eyZ+1CQ=="], - "d3-color": ["d3-color@3.1.0", "", {}, "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA=="], + "d3-color": ["d3-color@3.1.1", "", {}, "sha512-lfab8x0Bj0UO7SNsY8dZSbNIA6ipbkE3X0NG9nqjCu6CfCHZseuDnOSJY7hidKrjpP++i1M2qT+FlAdPKYRilA=="], - "d3-contour": ["d3-contour@4.0.2", "", { "dependencies": { "d3-array": "^3.2.0" } }, "sha512-4EzFTRIikzs47RGmdxbeUvLWtGedDUNkTcmzoeyg4sP/dvCexO47AaQL7VKy/gul85TOxw+IBgA8US2xwbToNA=="], + "d3-contour": ["d3-contour@4.0.3", "", { "dependencies": { "d3-array": "^3.2.4" } }, "sha512-5DYURc8KwXPOhSUBblU0P9rVcArsSPxPOxsfO0Eud0s28oU0sB2e80aRHRL9AZW3usT8ikFKyIHpHHLNWLdRVA=="], - "d3-delaunay": ["d3-delaunay@6.0.4", "", { "dependencies": { "delaunator": "5" } }, "sha512-mdjtIZ1XLAM8bm/hx3WwjfHt6Sggek7qH043O8KEjDXN40xi3vx/6pYSVTwLjEgiXQTbvaouWKynLBiUZ6SK6A=="], + "d3-delaunay": ["d3-delaunay@6.0.6", "", { "dependencies": { "delaunator": "5" } }, "sha512-DMQIEvSJhZCB6pwedcXaAlQ+MeKU5LlM2XakKtc73b/VM+RBiI1SRXycOEOKg2jsKj4zZ9F0KGYG6nCGwwWu/g=="], - "d3-dispatch": ["d3-dispatch@3.0.1", "", {}, "sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg=="], + "d3-dispatch": ["d3-dispatch@3.0.2", "", {}, "sha512-sAzH4Y4nsLo8eSqw5jKiZt+LU2wZmL/qS+OkxQGjhwazB/D7TY34R/QK1eshfGr7cZEKymKZ/Haem7m+lu98Sg=="], - "d3-drag": ["d3-drag@3.0.0", "", { "dependencies": { "d3-dispatch": "1 - 3", "d3-selection": "3" } }, "sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg=="], + "d3-drag": ["d3-drag@3.0.1", "", { "dependencies": { "d3-dispatch": "1 - 3", "d3-selection": "3" } }, "sha512-OWeoayCq8J69hUIjvL+Mb6Q6Oaj/fyHV5XaXByEUAG+JUjIfTGDnk3qGpcXrD3VmQ3BSV96fcbM6fqq7C0tbPA=="], - "d3-dsv": ["d3-dsv@3.0.1", "", { "dependencies": { "commander": "7", "iconv-lite": "0.6", "rw": "1" }, "bin": { "csv2json": "bin/dsv2json.js", "csv2tsv": "bin/dsv2dsv.js", "dsv2dsv": "bin/dsv2dsv.js", "dsv2json": "bin/dsv2json.js", "json2csv": "bin/json2dsv.js", "json2dsv": "bin/json2dsv.js", "json2tsv": "bin/json2dsv.js", "tsv2csv": "bin/dsv2dsv.js", "tsv2json": "bin/dsv2json.js" } }, "sha512-UG6OvdI5afDIFP9w4G0mNq50dSOsXHJaRE8arAS5o9ApWnIElp8GZw1Dun8vP8OyHOZ/QJUKUJwxiiCCnUwm+Q=="], + "d3-dsv": ["d3-dsv@3.0.2", "", { "dependencies": { "commander": "7", "iconv-lite": "0.6", "rw": "1" }, "bin": { "csv2tsv": "bin/dsv2dsv.js", "dsv2dsv": "bin/dsv2dsv.js", "tsv2csv": "bin/dsv2dsv.js", "csv2json": "bin/dsv2json.js", "dsv2json": "bin/dsv2json.js", "json2csv": "bin/json2dsv.js", "json2dsv": "bin/json2dsv.js", "json2tsv": "bin/json2dsv.js", "tsv2json": "bin/dsv2json.js" } }, "sha512-FUnXhX7I4/AXyRCZzwfZTDGSq8PGZ4oR0tiCBqNGOZMsDrQ+6sIWNQnBzcCGhzJKZ6uCvCezTwflUqI209RRiQ=="], - "d3-ease": ["d3-ease@3.0.1", "", {}, "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w=="], + "d3-ease": ["d3-ease@3.0.2", "", {}, "sha512-B5znKqRmKROAN4oHWQ50W/qisVjA9GXh2WMsVKdFVp4DxWmcrOsweqgUOUVsv5th96kwaZlokU6SlV4J3gak1w=="], - "d3-fetch": ["d3-fetch@3.0.1", "", { "dependencies": { "d3-dsv": "1 - 3" } }, "sha512-kpkQIM20n3oLVBKGg6oHrUchHM3xODkTzjMoj7aWQFq5QEM+R6E4WkzT5+tojDY7yjez8KgCBRoj4aEr99Fdqw=="], + "d3-fetch": ["d3-fetch@3.0.2", "", { "dependencies": { "d3-dsv": "1 - 3" } }, "sha512-1wGF62bgjMRbF6mqbD+6rRWBL2hwWVYQjFO2UP3Wm1nIAvJZKaQxXM5caVY7athoCa8wIq9lCf7g44lPWFk50g=="], - "d3-force": ["d3-force@3.0.0", "", { "dependencies": { "d3-dispatch": "1 - 3", "d3-quadtree": "1 - 3", "d3-timer": "1 - 3" } }, "sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg=="], + "d3-force": ["d3-force@3.0.1", "", { "dependencies": { "d3-dispatch": "1 - 3", "d3-quadtree": "1 - 3", "d3-timer": "1 - 3" } }, "sha512-kAaaHLFebBYwgi5cYBXAI8vKrQFMCD2MEswj2QuPKKbdU1wYLc8WXtS7O8F/b6POCIe3gJjY6hkDstHi1yMETQ=="], - "d3-format": ["d3-format@3.1.2", "", {}, "sha512-AJDdYOdnyRDV5b6ArilzCPPwc1ejkHcoyFarqlPqT7zRYjhavcT3uSrqcMvsgh2CgoPbK3RCwyHaVyxYcP2Arg=="], + "d3-format": ["d3-format@3.1.3", "", {}, "sha512-+F+/49swqmGuQJmSKnVMIDH/QkEFV5li9QRj0xm/KhyAUBv099O5PrvpQFxBp24PYph17Mnvt9mjKQV0ii0nMA=="], - "d3-geo": ["d3-geo@3.1.1", "", { "dependencies": { "d3-array": "2.5.0 - 3" } }, "sha512-637ln3gXKXOwhalDzinUgY83KzNWZRKbYubaG+fGVuc/dxO64RRljtCTnf5ecMyE1RIdtqpkVcq0IbtU2S8j2Q=="], + "d3-geo": ["d3-geo@3.1.2", "", { "dependencies": { "d3-array": "2.5.0 - 3" } }, "sha512-5R8ZgDQorIxmauv7R6gpE/ndz+Z0qAZssigq0aXFdvPHdY41RqtW02jrRUQAL724NdPABYXo1+gQEGBBr7uKNg=="], - "d3-hierarchy": ["d3-hierarchy@3.1.2", "", {}, "sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA=="], + "d3-hierarchy": ["d3-hierarchy@3.1.3", "", {}, "sha512-GRajN5ZcnEwYFWqqdzhG1qJ3+fDg6WWzk47TJg7ePY7yvYAgRfD2r1mUx+wviBOWuCwamCUzjwMSdato43jbGA=="], - "d3-interpolate": ["d3-interpolate@3.0.1", "", { "dependencies": { "d3-color": "1 - 3" } }, "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g=="], + "d3-interpolate": ["d3-interpolate@3.0.2", "", { "dependencies": { "d3-color": "1 - 3" } }, "sha512-IRzGU62DtxhvsnSTWMQIdnoZ6gA+BCWwBon1EJI6SjoN595799b6z/QRBzXfFhE8iupUPp3042yBNo0STPqnzQ=="], - "d3-path": ["d3-path@3.1.0", "", {}, "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ=="], + "d3-path": ["d3-path@3.1.1", "", {}, "sha512-jsbgV8zIT38ReB9O7X7gcLndTQRONSqNNd+oGIaTBdUug4r5jFmp0N6RY9R5GWbdUDucn0qoTGyfjapT4tDhcg=="], - "d3-polygon": ["d3-polygon@3.0.1", "", {}, "sha512-3vbA7vXYwfe1SYhED++fPUQlWSYTTGmFmQiany/gdbiWgU/iEyQzyymwL9SkJjFFuCS4902BSzewVGsHHmHtXg=="], + "d3-polygon": ["d3-polygon@3.0.2", "", {}, "sha512-WAUvPudGU1Dn4mDPfb6+JnnbeVEV53hG/BoT+bxts6AkZsOpTEiV1jHYX+2vtwCICNFG9Wxv8QS+eW1zE/Dwfg=="], - "d3-quadtree": ["d3-quadtree@3.0.1", "", {}, "sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw=="], + "d3-quadtree": ["d3-quadtree@3.0.2", "", {}, "sha512-9Lu9mqJKRbIk0d6mKDjpvPURaPdwHVK5CYbcdd0/4vBgz4ldz/7TIOse3kNERsByGNfld58KEco507AztJWyTQ=="], - "d3-random": ["d3-random@3.0.1", "", {}, "sha512-FXMe9GfxTxqd5D6jFsQ+DJ8BJS4E/fT5mqqdjovykEB2oFbTMDVdg1MGFxfQW+FBOGoB++k8swBrgwSHT1cUXQ=="], + "d3-random": ["d3-random@3.0.2", "", {}, "sha512-PxJi9LNV+7mulaYO77nd+oGurXGL1fhedXjHnB3pWLUcqDnQtF4VASoqnQGHgoXLByVdv5QJ/2kfwkGn5HTS8g=="], "d3-sankey": ["d3-sankey@0.12.3", "", { "dependencies": { "d3-array": "1 - 2", "d3-shape": "^1.2.0" } }, "sha512-nQhsBRmM19Ax5xEIPLMY9ZmJ/cDvd1BG3UVvt5h3WRxKg5zGRbvnteTyWAbzeSvlh3tW7ZEmq4VwR5mB3tutmQ=="], - "d3-scale": ["d3-scale@4.0.2", "", { "dependencies": { "d3-array": "2.10.0 - 3", "d3-format": "1 - 3", "d3-interpolate": "1.2.0 - 3", "d3-time": "2.1.1 - 3", "d3-time-format": "2 - 4" } }, "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ=="], + "d3-scale": ["d3-scale@4.0.3", "", { "dependencies": { "d3-array": "2.10.0 - 3", "d3-format": "1 - 3", "d3-interpolate": "1.2.0 - 3", "d3-time": "2.1.1 - 3", "d3-time-format": "2 - 4" } }, "sha512-66cWobCNzcMvlfoaDHCxuIv9TBUWG1BLOWdv9kHHFuCr1JdqAWPvTmsaEYDD5NRMyWZ5+7u0GqiCDfMXMqh3hg=="], - "d3-scale-chromatic": ["d3-scale-chromatic@3.1.0", "", { "dependencies": { "d3-color": "1 - 3", "d3-interpolate": "1 - 3" } }, "sha512-A3s5PWiZ9YCXFye1o246KoscMWqf8BsD9eRiJ3He7C9OBaxKhAd5TFCdEx/7VbKtxxTsu//1mMJFrEt572cEyQ=="], + "d3-scale-chromatic": ["d3-scale-chromatic@3.1.1", "", { "dependencies": { "d3-color": "1 - 3", "d3-interpolate": "1 - 3", "d3-scale": "1 - 4" } }, "sha512-lA5gfN2yMvmChubmptnDiBfeGpHD7Yb1EbvCz0TZE0WHXhyR6W2allPuhKtzV5ILQRqeOdefF0qYtERReLUBDg=="], - "d3-selection": ["d3-selection@3.0.0", "", {}, "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ=="], + "d3-selection": ["d3-selection@3.0.1", "", {}, "sha512-ODSf35vqCrlCfp7hrm0eZjvOosSXSYLjqvIlhMBV9q9VOx7EBJG6pc+uXBswEZNJgCGJ+qnKYcWutbZDIxe/Xg=="], - "d3-shape": ["d3-shape@3.2.0", "", { "dependencies": { "d3-path": "^3.1.0" } }, "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA=="], + "d3-shape": ["d3-shape@3.2.1", "", { "dependencies": { "d3-path": "^3.1.1" } }, "sha512-dm2o+lbKdzg9tY7GEag/dB9hcbodLfwkE/DkvqbELJXaMz0yKzWWhZqhbI7CKubukA7HnRyz0avdtvi7EPxPvw=="], - "d3-time": ["d3-time@3.1.0", "", { "dependencies": { "d3-array": "2 - 3" } }, "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q=="], + "d3-time": ["d3-time@3.1.1", "", { "dependencies": { "d3-array": "2 - 3" } }, "sha512-Ze7rjrhMzdeulh0/hjcfFj7XLAHOfowtEMfsoG6DU866HPynQNW7Wfen6hzXcqKTv8XzxvF6Hzr5XD6bMHr2ug=="], - "d3-time-format": ["d3-time-format@4.1.0", "", { "dependencies": { "d3-time": "1 - 3" } }, "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg=="], + "d3-time-format": ["d3-time-format@4.1.1", "", { "dependencies": { "d3-time": "1 - 3" } }, "sha512-22XaqjyCjpqgda20erhsOjGmC3vvYwTNYniKAd45W5UWLDF43moeOuV9qYpRqobIlsnK0UhnKZjUUJm3VgORUA=="], - "d3-timer": ["d3-timer@3.0.1", "", {}, "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA=="], + "d3-timer": ["d3-timer@3.0.2", "", {}, "sha512-1Il1aliroVSErrv5aulRBxAY+7+DnaoLIWGd1C6SsBTWDeobWiP/V69vwb8vT6abR1kKwaNe1196pmaQ1fK90A=="], - "d3-transition": ["d3-transition@3.0.1", "", { "dependencies": { "d3-color": "1 - 3", "d3-dispatch": "1 - 3", "d3-ease": "1 - 3", "d3-interpolate": "1 - 3", "d3-timer": "1 - 3" }, "peerDependencies": { "d3-selection": "2 - 3" } }, "sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w=="], + "d3-transition": ["d3-transition@3.0.2", "", { "dependencies": { "d3-color": "1 - 3", "d3-dispatch": "1 - 3", "d3-ease": "1 - 3", "d3-interpolate": "1 - 3", "d3-timer": "1 - 3" }, "peerDependencies": { "d3-selection": "2 - 3" } }, "sha512-RcjCsdFgyFoDB+QXLC5m60ZkTN0k9zH+ovoLlTdJnDS1AbfbcuowiM4pCKSTOclNibS4f4J4cbv2m7O7y8NTOQ=="], - "d3-zoom": ["d3-zoom@3.0.0", "", { "dependencies": { "d3-dispatch": "1 - 3", "d3-drag": "2 - 3", "d3-interpolate": "1 - 3", "d3-selection": "2 - 3", "d3-transition": "2 - 3" } }, "sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw=="], + "d3-zoom": ["d3-zoom@3.0.1", "", { "dependencies": { "d3-dispatch": "1 - 3", "d3-drag": "2 - 3", "d3-interpolate": "1 - 3", "d3-selection": "2 - 3", "d3-transition": "2 - 3" } }, "sha512-kfjD3BDQu/FOatpZ6JdMSyIoDwTxIpI29ySTI2J5ZlDaH1WbuJGQJ2Q9oJkWTEZEW98j6idezoomSD3Cn2zwiw=="], "dagre-d3-es": ["dagre-d3-es@7.0.14", "", { "dependencies": { "d3": "^7.9.0", "lodash-es": "^4.17.21" } }, "sha512-P4rFMVq9ESWqmOgK+dlXvOtLwYg0i7u0HBGJER0LZDJT2VHIPAMZ/riPxqJceWMStH5+E61QxFra9kIS3AqdMg=="], @@ -501,15 +501,15 @@ "devlop": ["devlop@1.1.0", "", { "dependencies": { "dequal": "^2.0.0" } }, "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA=="], - "dompurify": ["dompurify@3.4.17", "", { "optionalDependencies": { "@types/trusted-types": "^2.0.7" } }, "sha512-B/pSlYVHQ58kqISD/yDjuJ1yfzI34m1gF4lAod2bwSRhiN4K5Cl3H8Af7hqB2PmTL911tdEudnnXn5FnhRoz0w=="], + "dompurify": ["dompurify@3.5.0", "", { "optionalDependencies": { "@types/trusted-types": "^2.0.7" } }, "sha512-LYC0ZkE8P1V42JsRYTwMdme/2ET8SpOc5AA2eOFjP/IadvRd2fwiT4TVz5vkfy0XUx12aS2UaRkTnfVPNOv9vw=="], - "elkjs": ["elkjs@0.9.3", "", {}, "sha512-f/ZeWvW/BCXbhGEf1Ujp29EASo/lk1FDnETgNKwJrsVvGZhUWCZyg3xLJjAsxfOmt8KjswHmI5EwCQcPMpOYhQ=="], + "elkjs": ["elkjs@0.12.2", "", {}, "sha512-YC42gyUwsOeKWB/EVTr1abEnNhDEoz+qeLshCBufNW0qrJPcxk+/s1lih4Sbke4BOgjficJGvJ2D9jL/QTC/ew=="], "emoji-regex-xs": ["emoji-regex-xs@1.0.0", "", {}, "sha512-LRlerrMYoIDrT6jgpeZ2YYl/L8EulRTt5hQcYjy5AInh7HWXKimpqx68aknBFpGL2+/IcogTcaydJEgaTmOpDg=="], "entities": ["entities@7.0.1", "", {}, "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA=="], - "es-toolkit": ["es-toolkit@1.50.0", "", {}, "sha512-OyZKhUVvEep9ITEiwHn8GKnMRQIVqoSIX7WnRbkWgJkllCujilqP2rD0u979tkl8wqyc8ICwlc1UBVv/Sl1G6w=="], + "es-toolkit": ["es-toolkit@1.53.2", "", {}, "sha512-iUqZ+NlwH4jUgRmXZUxFBsV/9762TQEa1O4IXLFBmDEjVHScBytKuseX23I0+v9ShZ5MYxEx6WKNzm6IPnex8g=="], "esbuild": ["esbuild@0.25.12", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.12", "@esbuild/android-arm": "0.25.12", "@esbuild/android-arm64": "0.25.12", "@esbuild/android-x64": "0.25.12", "@esbuild/darwin-arm64": "0.25.12", "@esbuild/darwin-x64": "0.25.12", "@esbuild/freebsd-arm64": "0.25.12", "@esbuild/freebsd-x64": "0.25.12", "@esbuild/linux-arm": "0.25.12", "@esbuild/linux-arm64": "0.25.12", "@esbuild/linux-ia32": "0.25.12", "@esbuild/linux-loong64": "0.25.12", "@esbuild/linux-mips64el": "0.25.12", "@esbuild/linux-ppc64": "0.25.12", "@esbuild/linux-riscv64": "0.25.12", "@esbuild/linux-s390x": "0.25.12", "@esbuild/linux-x64": "0.25.12", "@esbuild/netbsd-arm64": "0.25.12", "@esbuild/netbsd-x64": "0.25.12", "@esbuild/openbsd-arm64": "0.25.12", "@esbuild/openbsd-x64": "0.25.12", "@esbuild/openharmony-arm64": "0.25.12", "@esbuild/sunos-x64": "0.25.12", "@esbuild/win32-arm64": "0.25.12", "@esbuild/win32-ia32": "0.25.12", "@esbuild/win32-x64": "0.25.12" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg=="], @@ -525,7 +525,7 @@ "hachure-fill": ["hachure-fill@0.5.2", "", {}, "sha512-3GKBOn+m2LX9iq+JC1064cSFprJY4jL1jCXTcpnfER5HYE2l/4EfWSGzkPa/ZDBmYI0ZOEj5VHV/eKnPGkHuOg=="], - "hast-util-to-html": ["hast-util-to-html@9.0.5", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "ccount": "^2.0.0", "comma-separated-tokens": "^2.0.0", "hast-util-whitespace": "^3.0.0", "html-void-elements": "^3.0.0", "mdast-util-to-hast": "^13.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0", "stringify-entities": "^4.0.0", "zwitch": "^2.0.4" } }, "sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw=="], + "hast-util-to-html": ["hast-util-to-html@9.0.7", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "ccount": "^2.0.0", "comma-separated-tokens": "^2.0.0", "hast-util-whitespace": "^3.0.0", "html-void-elements": "^3.0.0", "mdast-util-to-hast": "^13.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0", "stringify-entities": "^4.0.0", "zwitch": "^2.0.4" } }, "sha512-HYNDA3qdnzUPitY/LcQm1nWs8z0cWFNH1Nz09jdI/tXifAqF7h3+jrLl4S/b9Mi4VSjn0Dsn54ctuTV6zhBthA=="], "hast-util-whitespace": ["hast-util-whitespace@3.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw=="], @@ -539,8 +539,6 @@ "internmap": ["internmap@1.0.1", "", {}, "sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw=="], - "is-what": ["is-what@5.5.0", "", {}, "sha512-oG7cgbmg5kLYae2N5IVd3jm2s+vldjxJzK1pcu9LfpGuQ93MQSzo0okvRna+7y5ifrD+20FE8FvjusyGaz14fw=="], - "katex": ["katex@0.18.11", "", { "dependencies": { "commander": "^15.0.0" }, "bin": { "katex": "cli.js" } }, "sha512-yvyz/2VMKqoho/35Hat5w37wIEdWJ5ElVMidTAlWrxr5uW4aBGsEpveTmKh18/zw08v/7lGswCPon4OhqmqrTA=="], "khroma": ["khroma@2.1.0", "", {}, "sha512-Ls993zuzfayK269Svk9hzpeGUKob/sIgZzyHYdjQoAdQetRKpOLj+k/QQQ/6Qi0Yz65mlROrfd+Ev+1+7dz9Kw=="], @@ -555,9 +553,9 @@ "marked": ["marked@16.4.2", "", { "bin": { "marked": "bin/marked.js" } }, "sha512-TI3V8YYWvkVf3KJe1dRkpnjs68JUPyEa5vjKrp1XEEJUAOaQc+Qj+L1qWbPd0SJuAdQkFU0h73sXXqwDYxsiDA=="], - "mdast-util-to-hast": ["mdast-util-to-hast@13.2.1", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/mdast": "^4.0.0", "@ungap/structured-clone": "^1.0.0", "devlop": "^1.0.0", "micromark-util-sanitize-uri": "^2.0.0", "trim-lines": "^3.0.0", "unist-util-position": "^5.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0" } }, "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA=="], + "mdast-util-to-hast": ["mdast-util-to-hast@13.2.2", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/mdast": "^4.0.0", "@ungap/structured-clone": "^1.0.0", "devlop": "^1.0.0", "micromark-util-sanitize-uri": "^2.0.0", "trim-lines": "^3.0.0", "unist-util-position": "^5.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0" } }, "sha512-l2pnmOuqs+SGLVpTVXnRLQu5v1AzvDe181404fbXzzqObVxrAnnVxapAP27pUwzLBL/ABIkgUhGlPVU7QSvIFg=="], - "mermaid": ["mermaid@12.2.0", "", { "dependencies": { "@braintree/sanitize-url": "^7.1.2", "@iconify/utils": "^3.0.2", "@mermaid-js/parser": "^2.0.1", "@types/d3": "^7.4.3", "@upsetjs/venn.js": "^2.0.0", "chevrotain": "~13.2.0", "cytoscape": "^3.34.0", "cytoscape-cose-bilkent": "^4.1.0", "cytoscape-fcose": "^2.2.0", "d3": "^7.9.0", "d3-sankey": "^0.12.3", "dagre-d3-es": "7.0.14", "dayjs": "^1.11.21", "dompurify": "^3.4.12", "elkjs": "^0.9.3", "es-toolkit": "^1.45.1", "katex": "^0.18.0", "khroma": "^2.1.0", "marked": "^16.3.0", "roughjs": "^4.6.6", "stylis": "^4.3.6", "ts-dedent": "^2.2.0", "uuid": "^11.1.0 || ^12 || ^13 || ^14.0.0" } }, "sha512-w7nr/SFrLO7BaVTs3dQTvYSV6nYSBj0Yy9DjBhsIJtAcHqRzXSq4Pg32ujHZ/AdWsAMNEvvhbm5dt9E2tOiHzw=="], + "mermaid": ["mermaid@12.4.0", "", { "dependencies": { "@braintree/sanitize-url": "^7.1.2", "@iconify/utils": "^3.0.2", "@mermaid-js/parser": "^2.0.1", "@types/d3": "^7.4.3", "@upsetjs/venn.js": "^2.0.0", "chevrotain": "~13.2.0", "cytoscape": "^3.34.0", "cytoscape-cose-bilkent": "^4.1.0", "cytoscape-fcose": "^2.2.0", "d3": "^7.9.0", "d3-sankey": "^0.12.3", "dagre-d3-es": "7.0.14", "dayjs": "^1.11.21", "dompurify": "^3.4.17", "elkjs": "^0.12.0", "es-toolkit": "^1.45.1", "katex": "^0.18.0", "khroma": "^2.1.0", "marked": "^16.3.0", "roughjs": "^4.6.6", "stylis": "^4.3.6", "ts-dedent": "^2.2.0" } }, "sha512-j2gvsGUFeS/53WdYLl9H5G2YtMZX9G/PlCvV3E5Pf4j5XSnK19DwazU6wki7OTcKeYKed7+qujRDLhy8NV2zBg=="], "micromark-util-character": ["micromark-util-character@2.1.1", "", { "dependencies": { "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q=="], @@ -567,7 +565,7 @@ "micromark-util-symbol": ["micromark-util-symbol@2.0.1", "", {}, "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q=="], - "micromark-util-types": ["micromark-util-types@2.0.2", "", {}, "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA=="], + "micromark-util-types": ["micromark-util-types@2.0.3", "", {}, "sha512-oxB2Ik03hI0gv+VNn9tnh1t1YEe9MDPptViAEgfdf3YQHsn0pzGTgCdlSCJXcwhqm8phaEuM7zeEu3QQzVBrPg=="], "minisearch": ["minisearch@7.2.0", "", {}, "sha512-dqT2XBYUOZOiC5t2HRnwADjhNS2cecp9u+TJRiJ1Qp/f5qjkeT5APcGPjHw+bz89Ms8Jp+cG4AlE+QZ/QnDglg=="], @@ -575,13 +573,13 @@ "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="], - "nanoid": ["nanoid@3.3.18", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w=="], + "nanoid": ["nanoid@3.3.20", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ=="], "non-layered-tidy-tree-layout": ["non-layered-tidy-tree-layout@2.0.2", "", {}, "sha512-gkXMxRzUH+PB0ax9dUN0yYF0S25BqeAYqhgMaLUFmpXLEk7Fcu8f4emJuOAY0V8kjDICxROIKsTAKsV/v355xw=="], "oniguruma-to-es": ["oniguruma-to-es@3.1.1", "", { "dependencies": { "emoji-regex-xs": "^1.0.0", "regex": "^6.0.1", "regex-recursion": "^6.0.2" } }, "sha512-bUH8SDvPkH3ho3dvwJwfonjlQ4R80vjyvrU8YpxuROddv55vAEJrTuCuCVUhhsHbtlD9tGGbaNApGQckXhS8iQ=="], - "package-manager-detector": ["package-manager-detector@1.8.0", "", {}, "sha512-yQA4H19AmPEoMUeavPMDIe1higySl/gH/yaQrkT/s07Qp+7pp2hYz30N3z2l5BkjVkF9Ow6o0wjJamm2y7Sn0A=="], + "package-manager-detector": ["package-manager-detector@1.9.0", "", {}, "sha512-zAMfbta9nPA8AKkA4WdmNAT8R8s6Dk0/xwPsqNnRidMFcLo1YkLuPDTgs2f64XdzS8vbLNnoJ+uUIkgbz7oRHA=="], "path-data-parser": ["path-data-parser@0.1.0", "", {}, "sha512-NOnmBpt5Y2RWbuv0LMzsayp3lVylAHLPUTut412ZA3l+C4uw4ZVkQbjShYCQ8TCpUMdPapr4YjUqLYD6v68j+w=="], @@ -595,7 +593,7 @@ "points-on-path": ["points-on-path@0.2.1", "", { "dependencies": { "path-data-parser": "0.1.0", "points-on-curve": "0.2.0" } }, "sha512-25ClnWWuw7JbWZcgqY/gJ4FQWadKxGWk+3kR/7kD0tCaDtPPMj7oHu2ToLaVhfpnHrZzYby2w6tUA0eOIuUg8g=="], - "postcss": ["postcss@8.5.25", "", { "dependencies": { "nanoid": "^3.3.16", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-DTPx3RWSSnWyzLxQnlH0rJP+EW5ekl16ZU4/psbIhA0e53kJfdgaN5vKM+xP7yJtXVu+nfdVFmlgFDEKAe4Pyw=="], + "postcss": ["postcss@8.5.34", "", { "dependencies": { "nanoid": "^3.3.20", "picocolors": "^1.1.1", "source-map-js": "^1.2.4" } }, "sha512-P1Qzj0XXZjMda74C7qiVnBG90UKNbyNUAOeQRBW8X63RsIMV57gevRqjnkELdwtZ/S2/uQFksJhmwuN8xShLPw=="], "preact": ["preact@10.29.8", "", { "peerDependencies": { "preact-render-to-string": ">=5" }, "optionalPeers": ["preact-render-to-string"] }, "sha512-ej2aVZ+vZ8WO7tvlQWRM9N63A0KzF9q4mWJfDUHgYaIofWY9hu74QdnQrjoPMmZi2/nZ5gN0bJCQF49xQqx09Q=="], @@ -611,7 +609,7 @@ "robust-predicates": ["robust-predicates@3.0.3", "", {}, "sha512-NS3levdsRIUOmiJ8FZWCP7LG3QpJyrs/TE0Zpf1yvZu8cAJJ6QMW92H1c7kWpdIHo8RvmLxN/o2JXTKHp74lUA=="], - "rollup": ["rollup@4.62.4", "", { "dependencies": { "@types/estree": "1.0.9" }, "optionalDependencies": { "@napi-rs/lzma-linux-x64-gnu": "1.5.1", "@rollup/rollup-android-arm-eabi": "4.62.4", "@rollup/rollup-android-arm64": "4.62.4", "@rollup/rollup-darwin-arm64": "4.62.4", "@rollup/rollup-darwin-x64": "4.62.4", "@rollup/rollup-freebsd-arm64": "4.62.4", "@rollup/rollup-freebsd-x64": "4.62.4", "@rollup/rollup-linux-arm-gnueabihf": "4.62.4", "@rollup/rollup-linux-arm-musleabihf": "4.62.4", "@rollup/rollup-linux-arm64-gnu": "4.62.4", "@rollup/rollup-linux-arm64-musl": "4.62.4", "@rollup/rollup-linux-loong64-gnu": "4.62.4", "@rollup/rollup-linux-loong64-musl": "4.62.4", "@rollup/rollup-linux-ppc64-gnu": "4.62.4", "@rollup/rollup-linux-ppc64-musl": "4.62.4", "@rollup/rollup-linux-riscv64-gnu": "4.62.4", "@rollup/rollup-linux-riscv64-musl": "4.62.4", "@rollup/rollup-linux-s390x-gnu": "4.62.4", "@rollup/rollup-linux-x64-gnu": "4.62.4", "@rollup/rollup-linux-x64-musl": "4.62.4", "@rollup/rollup-openbsd-x64": "4.62.4", "@rollup/rollup-openharmony-arm64": "4.62.4", "@rollup/rollup-win32-arm64-msvc": "4.62.4", "@rollup/rollup-win32-ia32-msvc": "4.62.4", "@rollup/rollup-win32-x64-gnu": "4.62.4", "@rollup/rollup-win32-x64-msvc": "4.62.4", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-RXOqwaPsBGjMNMa4sQjDjHieHEZDFoj/Rdr46l2MU5DfEs16wHJPC2RPTPHWhNl+M3aI472LLqFkFKut4SblOg=="], + "rollup": ["rollup@4.69.0", "", { "dependencies": { "@types/estree": "^1.0.10" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.69.0", "@rollup/rollup-android-arm64": "4.69.0", "@rollup/rollup-android-x64": "4.69.0", "@rollup/rollup-darwin-arm64": "4.69.0", "@rollup/rollup-darwin-x64": "4.69.0", "@rollup/rollup-freebsd-arm64": "4.69.0", "@rollup/rollup-freebsd-x64": "4.69.0", "@rollup/rollup-linux-arm-gnueabihf": "4.69.0", "@rollup/rollup-linux-arm-musleabihf": "4.69.0", "@rollup/rollup-linux-arm64-gnu": "4.69.0", "@rollup/rollup-linux-arm64-musl": "4.69.0", "@rollup/rollup-linux-loong64-gnu": "4.69.0", "@rollup/rollup-linux-loong64-musl": "4.69.0", "@rollup/rollup-linux-ppc64-gnu": "4.69.0", "@rollup/rollup-linux-ppc64-musl": "4.69.0", "@rollup/rollup-linux-riscv64-gnu": "4.69.0", "@rollup/rollup-linux-riscv64-musl": "4.69.0", "@rollup/rollup-linux-s390x-gnu": "4.69.0", "@rollup/rollup-linux-x64-gnu": "4.69.0", "@rollup/rollup-linux-x64-musl": "4.69.0", "@rollup/rollup-openbsd-x64": "4.69.0", "@rollup/rollup-openharmony-arm64": "4.69.0", "@rollup/rollup-win32-arm64-msvc": "4.69.0", "@rollup/rollup-win32-ia32-msvc": "4.69.0", "@rollup/rollup-win32-x64-gnu": "4.69.0", "@rollup/rollup-win32-x64-msvc": "4.69.0", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-EPuUg13X8CVxepomdqiQd4jepJXcXIoAqt3dJhJKzZwr6mI0MmWaK69GytKERYd/p719ZSTeMgDuQkixdyka3w=="], "roughjs": ["roughjs@4.6.6", "", { "dependencies": { "hachure-fill": "^0.5.2", "path-data-parser": "^0.1.0", "points-on-curve": "^0.2.0", "points-on-path": "^0.2.1" } }, "sha512-ZUz/69+SYpFN/g/lUlo2FXcIjRkSu3nDarreVdGGndHEBJ6cXPdKguS8JGxwj5HA5xIbVKSmLgr5b3AWxtRfvQ=="], @@ -623,7 +621,7 @@ "shiki": ["shiki@2.5.0", "", { "dependencies": { "@shikijs/core": "2.5.0", "@shikijs/engine-javascript": "2.5.0", "@shikijs/engine-oniguruma": "2.5.0", "@shikijs/langs": "2.5.0", "@shikijs/themes": "2.5.0", "@shikijs/types": "2.5.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "sha512-mI//trrsaiCIPsja5CNfsyNOqgAZUb6VpJA+340toL42UpzQlXpwRV9nch69X6gaUxrr9kaOOa6e3y3uAkGFxQ=="], - "source-map-js": ["source-map-js@1.2.2", "", {}, "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw=="], + "source-map-js": ["source-map-js@1.2.4", "", {}, "sha512-J7ZjMvHd9O1fcT/5V09QWaaSl2BbWx3F6O08spde82Namf9UB0GxRVIPiNbVsdKkoizHiSpTodo3vp2bAy91MA=="], "space-separated-tokens": ["space-separated-tokens@2.0.2", "", {}, "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q=="], @@ -631,15 +629,15 @@ "strictdom": ["strictdom@1.0.1", "", {}, "sha512-cEmp9QeXXRmjj/rVp9oyiqcvyocWab/HaoN4+bwFeZ7QzykJD6L3yD4v12K1x0tHpqRqVpJevN3gW7kyM39Bqg=="], - "stringify-entities": ["stringify-entities@4.0.4", "", { "dependencies": { "character-entities-html4": "^2.0.0", "character-entities-legacy": "^3.0.0" } }, "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg=="], + "stringify-entities": ["stringify-entities@4.0.5", "", { "dependencies": { "character-entities-html4": "^2.0.0", "character-entities-legacy": "^3.0.0" } }, "sha512-jNuI2fNNw5ecxrWmgm90R3iH0Kc/94AQwoQWoSUYphWzvmUA2pjFG34H56Z7Z3FkvH3FpYwwewKAa97oQnPFhw=="], "stylis": ["stylis@4.4.0", "", {}, "sha512-5Z9ZpRzfuH6l/UAvCPAPUo3665Nk2wLaZU3x+TLHKVzIz33+sbJqbtrYoC3KD4/uVOr2Zp+L0LySezP9OHV9yA=="], - "superjson": ["superjson@2.2.6", "", { "dependencies": { "copy-anything": "^4" } }, "sha512-H+ue8Zo4vJmV2nRjpx86P35lzwDT3nItnIsocgumgr0hHMQ+ZGq5vrERg9kJBo5AWGmxZDhzDo+WVIJqkB0cGA=="], + "superjson": ["superjson@2.2.7", "", { "dependencies": { "copy-anything": "^4" } }, "sha512-QK/H+tosbovdRvIuGqcWn8g3IxPZY7B8ZPowCAmWsV8bPvCk+bGMlZt90C4AxZjnzMO2WBRDacr1+0i1AOy/5g=="], - "tabbable": ["tabbable@6.5.0", "", {}, "sha512-wieBHXygIm7OyQOu5hQlkk62/WyCFYGlWg7L6/ZCUZwx0o398Zkn4pVmMyfYhfMG8kGrj/Krt8eIk6UKC6VzwA=="], + "tabbable": ["tabbable@6.5.2", "", {}, "sha512-XgdnB1nGU6KU4VgMnZPaZCx7M1hBrLyEiZYau2G2gq9UT0d7d4FUBlNX7vvPlm/B1vk1PjrzJBx9Lbv4fsqS9g=="], - "tinyexec": ["tinyexec@1.2.4", "", {}, "sha512-SHf/r48b7vOrjve9PxJo3MN5v5yuyjHvdUcrQffT3WXMUfnGmHDVbC4k3sHJaJTgZCwpUplIaAo5ANtMyp3YHg=="], + "tinyexec": ["tinyexec@1.4.0", "", {}, "sha512-PV6lIcJQh57aFeJDwx16JNHmgFRh5xguzallrDW1qe8nAghYgr5MKz2K5k7wEyV/ygZhdnIAP8+HZSarHPBCsg=="], "tinyglobby": ["tinyglobby@0.2.17", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" } }, "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g=="], @@ -657,17 +655,15 @@ "unist-util-stringify-position": ["unist-util-stringify-position@4.0.0", "", { "dependencies": { "@types/unist": "^3.0.0" } }, "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ=="], - "unist-util-visit": ["unist-util-visit@5.1.0", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0", "unist-util-visit-parents": "^6.0.0" } }, "sha512-m+vIdyeCOpdr/QeQCu2EzxX/ohgS8KbnPDgFni4dQsfSCtpz8UqDyY5GjRru8PDKuYn7Fq19j1CQ+nJSsGKOzg=="], - - "unist-util-visit-parents": ["unist-util-visit-parents@6.0.2", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0" } }, "sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ=="], + "unist-util-visit": ["unist-util-visit@5.2.0", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0", "unist-util-visit-parents": "^6.1.0" } }, "sha512-fpsYs/VVoZxfGY9/j3FQpZmN8wdLJaV1Pt38AaJNZu9uKIHcFU3halCdBveEq1HGKO1OEfJY65w1zvoFV1b3qQ=="], - "uuid": ["uuid@14.0.1", "", { "bin": { "uuid": "dist-node/bin/uuid" } }, "sha512-6ZxzVpzDXDa3bJWaHilVayA+BH/1zmxCJoVgvmqJnid/gPoKHxUrS/aC/T6LGQtNHT+XHG9fXPJB4d+IrU30Ew=="], + "unist-util-visit-parents": ["unist-util-visit-parents@6.1.0", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0" } }, "sha512-vKXxz6O38sKDj1mtx/k2cWvkkFBuYGx6uGrlzBkVeWCRF/F8sdI0j3Wbkz/5rVNRRuVc8UrgRdbCxNhmYXgP3w=="], "vfile": ["vfile@6.0.3", "", { "dependencies": { "@types/unist": "^3.0.0", "vfile-message": "^4.0.0" } }, "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q=="], - "vfile-message": ["vfile-message@4.0.3", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-stringify-position": "^4.0.0" } }, "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw=="], + "vfile-message": ["vfile-message@4.0.4", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-stringify-position": "^4.0.0" } }, "sha512-66ycRswIkNmHH9PHku7ADtv5RVwgIrOcuv3J8Svz6h4qgGRrKVa+9/neuKyJZUXyOpYwLTvS+whZ4R2urHHgQg=="], - "vite": ["vite@6.4.4", "", { "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", "picomatch": "^4.0.2", "postcss": "^8.5.3", "rollup": "^4.34.9", "tinyglobby": "^0.2.13" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", "jiti": ">=1.21.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-xGjU/SyjeNyb0E4KxXBvYz/1C+3JXuujvf2hXNOtnlcE+58o5ajd9N2/n2VhkiJvpCP2qQasnUpx5PXNeI+p1Q=="], + "vite": ["vite@6.4.6", "", { "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", "picomatch": "^4.0.2", "postcss": "^8.5.3", "rollup": "^4.34.9", "tinyglobby": "^0.2.13" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", "jiti": ">=1.21.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-RtsraAwEG68idOA6iUOoIpOlcSKROnf815aIq9qHTSrDNpLoBrBa12suyfcEd8qn0xwOVQI1Yhm1GbmTjF600A=="], "vitepress": ["vitepress@1.6.4", "", { "dependencies": { "@docsearch/css": "3.8.2", "@docsearch/js": "3.8.2", "@iconify-json/simple-icons": "^1.2.21", "@shikijs/core": "^2.1.0", "@shikijs/transformers": "^2.1.0", "@shikijs/types": "^2.1.0", "@types/markdown-it": "^14.1.2", "@vitejs/plugin-vue": "^5.2.1", "@vue/devtools-api": "^7.7.0", "@vue/shared": "^3.5.13", "@vueuse/core": "^12.4.0", "@vueuse/integrations": "^12.4.0", "focus-trap": "^7.6.4", "mark.js": "8.11.1", "minisearch": "^7.1.1", "shiki": "^2.1.0", "vite": "^5.4.14", "vue": "^3.5.13" }, "peerDependencies": { "markdown-it-mathjax3": "^4", "postcss": "^8" }, "optionalPeers": ["markdown-it-mathjax3", "postcss"], "bin": { "vitepress": "bin/vitepress.js" } }, "sha512-+2ym1/+0VVrbhNyRoFFesVvBvHAVMZMK0rw60E3X/5349M1GuVdKeazuksqopEdvkKwKGs21Q729jX81/bkBJg=="], @@ -679,16 +675,22 @@ "@mermaid-js/mermaid-mindmap/@braintree/sanitize-url": ["@braintree/sanitize-url@6.0.4", "", {}, "sha512-s3jaWicZd0pkP0jf5ysyHUI/RE7MHos6qlToFcGWXVp+ykHOy77OUMrfbgJ9it2C5bow7OIQwYYaHjk9XlBQ2A=="], - "@vue/compiler-sfc/postcss": ["postcss@8.5.30", "", { "dependencies": { "nanoid": "^3.3.20", "picocolors": "^1.1.1", "source-map-js": "^1.2.2" } }, "sha512-zkd+e9S1AQHhmaBKye9zlFHWjOwVgqXl1q3ECYy8561K7qxR2cREf/STLskulBFd78k6AOFeA+ff1TtEzk9bAA=="], - "cytoscape-fcose/cose-base": ["cose-base@2.2.0", "", { "dependencies": { "layout-base": "^2.0.0" } }, "sha512-AzlgcsCbUMymkADOJtQm3wO9S3ltPfYOFD5033keQn9NJzIbtnZj+UdBJe7DYml/8TdbtHJW3j58SOnKhWY/5g=="], + "d3-chord/d3-path": ["d3-path@1.0.9", "", {}, "sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg=="], + "d3-dsv/commander": ["commander@7.2.0", "", {}, "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw=="], + "d3-geo/d3-array": ["d3-array@2.12.1", "", { "dependencies": { "internmap": "^1.0.0" } }, "sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ=="], + "d3-sankey/d3-array": ["d3-array@2.12.1", "", { "dependencies": { "internmap": "^1.0.0" } }, "sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ=="], "d3-sankey/d3-shape": ["d3-shape@1.3.7", "", { "dependencies": { "d3-path": "1" } }, "sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw=="], + "d3-scale/d3-array": ["d3-array@2.12.1", "", { "dependencies": { "internmap": "^1.0.0" } }, "sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ=="], + + "d3-time/d3-array": ["d3-array@2.12.1", "", { "dependencies": { "internmap": "^1.0.0" } }, "sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ=="], + "cytoscape-fcose/cose-base/layout-base": ["layout-base@2.0.1", "", {}, "sha512-dp3s92+uNI1hWIpPGH3jK2kxE2lMjdXdr+DH8ynZHpd6PUlH6x6cbuXnoMmiNumznqaNO31xu9e79F0uuZ0JFg=="], "d3-sankey/d3-shape/d3-path": ["d3-path@1.0.9", "", {}, "sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg=="], diff --git a/docs/latest/about/index.md b/docs/latest/about/index.md index 4124b3c..f559350 100644 --- a/docs/latest/about/index.md +++ b/docs/latest/about/index.md @@ -1,72 +1,68 @@ -# :heart: Why I Built LocalTelemetry +# :heart: Why LocalTelemetry Exists -I built **LocalTelemetry** because I wanted a lightweight, reliable hardware and network monitor that lives strictly on the Windows taskbar. +**LocalTelemetry** was created out of personal necessity. Other monitoring tools only offered basic stats, lacked native Windows 11 taskbar integration, and suffered from driver false positives. + +LocalTelemetry was built to solve these problems: a **lightweight, privacy-first hardware and network monitor** docked natively into the Windows taskbar. --- -## :goal: The Initial Goal: Essentials on the Taskbar +## :goal: Limitations of Other Tools -When I started, I did not want floating widgets, desktop gadgets, or heavy overlays that obstruct the screen. +Many existing taskbar monitoring utilities offered only limited data: -I only wanted to see my essential performance vitals in one glance: +- CPU and GPU load percentages +- Basic core temperatures +- Simple network upload and download speeds -- **CPU and GPU usage** -- **Hardware temperatures** -- **Live network download and upload speeds** +When **Windows 11** removed support for legacy deskbands, existing tools broke. Some tools required third-party shell injectors. Others relied on floating desktop gadgets that obstructed games, editors, and full-screen work. -The Windows taskbar is always accessible. Placing these metrics directly on the taskbar lets me check my hardware at any moment without switching windows or interrupting my work or games. +The taskbar is the ideal location for system telemetry. It remains accessible without obstructing your workspace. --- -## :shield-alert: The Antivirus False Alarm Problem - -The biggest frustration with existing free monitoring tools was **constant antivirus false positives**. - -Almost every time my system booted, Windows Defender flagged my monitoring utilities: +## :shield-alert: Antivirus False Positives at Login -> *"Threat detected: Trojan / Vulnerable Driver Blocked"* +By late 2025, another frustrating issue appeared. Every day at Windows login, antivirus software triggered security warnings: -These alerts caused constant panic and doubt. Every reboot brought scary warnings about malware. I had to inspect logs, check file hashes, and verify that my computer was safe. +> *"Threat detected: Malware in Temp folder"* -The root cause comes down to driver signing economics: +Investigating the flagged files revealed the cause: the monitor running at startup repeatedly dropped driver files into the `%TEMP%` folder. This triggered security heuristics on every login. -1. Reading low-level processor registers requires a kernel-mode driver. -2. Official Extended Validation (EV) code-signing certificates cost **$250 to $400 every year**. An independent open-source project cannot afford this annual fee. -3. Because of this barrier, older free tools bundled unmaintained drivers like `WinRing0`. Microsoft Defender flags these legacy drivers as vulnerable and treats tools loading them as threats. +In **April 2026**, tired of daily false positives, I decided to build a clean solution from scratch. --- -## :sparkles: The Solution: PawnIO +## :sparkles: Kernel Drivers & Choosing PawnIO -I wanted a clean architecture that permanently eliminates false virus alarms. +Building LocalTelemetry required direct kernel access: -That is why I chose **[PawnIO](https://github.com/namazso/PawnIO)**. +1. **Kernel Access Is Required**: Reading CPU Model-Specific Registers (**MSR**) and AMD **SMU** vitals requires a kernel-mode driver. +2. **Code-Signing Certificates**: Microsoft requires kernel drivers to be signed with an Extended Validation (EV) certificate. These certificates cost hundreds of dollars every year. Free independent utilities often cut corners by dropping unmaintained drivers into temp folders. +3. **The Clean Solution**: While researching sustainable architectures, I adopted **[PawnIO](https://github.com/namazso/PawnIO)**. PawnIO is a modern, officially signed kernel driver trusted by established projects like LibreHardwareMonitor. -PawnIO is a modern, secure, and officially signed Windows kernel driver. Major open-source projects, including **LibreHardwareMonitor (LHM)**, use and trust PawnIO. - -With PawnIO, LocalTelemetry gets direct kernel access for temperature and power monitoring with **zero Defender false alarms**, full Secure Boot support, and clean scans on Antivirus softwares. +PawnIO installs as a verified system driver. It gives LocalTelemetry direct kernel access with **zero temporary file drops**, **zero antivirus false positives**, and **full Secure Boot and HVCI compliance**. --- -## :rocket: How LocalTelemetry Evolved - -Once the core taskbar monitor was solid, I kept improving it. +## :rocket: Complete Hardware Monitoring -What started as a simple monitor for temperatures, usage, and network speeds grew into a comprehensive utility. I added unique capabilities you will not find in other taskbar monitors: +LocalTelemetry implements a complete set of practical capabilities: -- **Real-Time Disk Activity**: Live read and write throughput directly beside CPU and GPU metrics. -- **Laptop Battery Metrics**: Live charge and discharge rates in Watts. -- **Gapless Network History**: Imports historical data from the Windows System Resource Usage Monitor (**SRUM**) database so your bandwidth history never has gaps. -- **Per-Metric Customization**: Custom colors, custom metric order, and authentic manufacturer brand palettes. -- **Focus-Safe Toast Alerts**: Alerts sent through an out-of-process helper over Named Pipes so notifications never minimize full-screen games or steal keyboard focus. +- **True Wattage**: Measures package power draw in **Watts** for CPU and GPU directly from hardware registers. +- **Disk Activity**: Live read and write throughput directly beside CPU and GPU metrics. +- **Battery Health**: Real-time charge and discharge rates in **Watts**, wear levels, and cycle counts on laptops. +- **Gapless Network History**: Imports past daily records from the Windows System Resource Usage Monitor (**SRUM**) database into local **JSON Lines** files. +- **Flexible Appearance**: Dock on either side of the taskbar, with automatic vendor brand colors (**Intel, AMD, NVIDIA, Corsair, Samsung**) and drag-and-drop layout ordering. +- **Game-Safe Alerts**: Notifications run through an isolated helper process over **Named Pipes** so toasts never minimize full-screen games. +- **Offline Privacy**: Zero analytics, zero tracking, and zero cloud calls. All data stays strictly on your computer. --- -## :heart-pulse: Support LocalTelemetry +## :heart-pulse: Support the Project -LocalTelemetry is 100% free and open source under the **GPL-3.0 license**. If LocalTelemetry improves your daily desktop experience, you can support the project: +LocalTelemetry is free and open-source under the **GNU GPLv3 license**. If LocalTelemetry improves your daily workflow: -- :star: **Star on GitHub**: Star [**LocalTelemetry on GitHub**](https://github.com/Nicconike/LocalTelemetry) to help more people discover the project. -- :heart: **Like on AlternativeTo**: Upvote and review [**LocalTelemetry on AlternativeTo**](https://alternativeto.net/software/localtelemetry/about/?utm_source=badge&utm_medium=referral) to help users find a lightweight alternative. -- :message-square: **Join the Discord**: Chat with the community and share your setup on [**Discord Server**](https://discord.gg/M2QevSgW3S). -- :bug: **Report Bugs & Suggest Features**: Open an issue on [**GitHub Issue Tracker**](https://github.com/Nicconike/LocalTelemetry/issues). +- :star: **Star on GitHub**: Star [**LocalTelemetry on GitHub**](https://github.com/Nicconike/LocalTelemetry). +- :heart: **Review on AlternativeTo**: Upvote and review [**LocalTelemetry on AlternativeTo**](https://alternativeto.net/software/localtelemetry/about/?utm_source=badge&utm_medium=referral). +- :message-square: **Join Discord**: Chat live with the developer on the [**Discord Server**](https://discord.gg/M2QevSgW3S). +- :bug: **Suggest Features**: Open an issue or suggestion on our [**GitHub Issue Tracker**](https://github.com/Nicconike/LocalTelemetry/issues). diff --git a/docs/latest/developer-guide/backend-architecture.md b/docs/latest/developer-guide/backend-architecture.md index dd49839..871bba1 100644 --- a/docs/latest/developer-guide/backend-architecture.md +++ b/docs/latest/developer-guide/backend-architecture.md @@ -4,82 +4,94 @@ This page details the architectural design of the C# backend powering **LocalTel ## :layers: Core Architecture (LocalTelemetry.Core) -`LocalTelemetry.Core` is built as a pure C# .NET 10 class library with zero UI dependencies, allowing hardware monitoring logic to remain completely decoupled, fast, and testable. +`LocalTelemetry.Core` is built as a pure .NET 11 class library with zero UI dependencies, keeping hardware monitoring logic fast, testable, and isolated. ```mermaid -%%{init: {'theme': 'dark', 'themeVariables': {'fontSize': '13px'}, 'flowchart': {'nodeSpacing': 35, 'rankSpacing': 42, 'curve': 'basis'}}}%% +%%{init: {'theme': 'dark', 'themeVariables': {'fontFamily': 'Inter, system-ui, sans-serif', 'fontSize': '13px'}, 'flowchart': {'htmlLabels': true, 'nodeSpacing': 24, 'rankSpacing': 34, 'padding': 16, 'curve': 'basis'}}}%% flowchart TD - %% 1. HARDWARE SENSING & OS EVENT LAYER - subgraph Drivers["1. Hardware Sensing & OS Lifecycle Layer"] - direction TB - subgraph DriverRow[" "] - direction LR - PawnIO{{"PawnIO Driver
(CPU MSRs & SMU)"}} - GPUApis{{"GPU APIs
(NVML • ADL • IGCL • WDDM)"}} - WinCounters{{"Windows Subsystems
(Disk • Net • Bat)"}} - end - LifecycleMgr[["HardwareLifecycleManager.cs
OS Power • Display • PnP Events"]] + %% 1. HARDWARE DRIVERS & OS SENSING + subgraph Drivers["Hardware Drivers & OS Sensing"] + PawnIO["PawnIO Driver
CPU MSRs & SMU Registers"] + GPUApis["GPU Vendor APIs
NVML • ADL • IGCL • WDDM"] + WinSensors["Windows Subsystems
Storage • Network • Battery"] + OSEvents["OS System Events
Power State • Display PnP"] end - %% 2. CORE ENGINE - subgraph CoreEngine["2. LocalTelemetry.Core Engine (.NET 10)"] - direction TB - HWCoordinator[["HardwareMonitor.cs
Sensor Polling Coordinator"]] + %% 2. CORE TELEMETRY ENGINE + subgraph CoreEngine["LocalTelemetry.Core Engine (.NET 11)"] + LifecycleMgr["HardwareLifecycleManager.cs
Power & Display Lifecycle"] + HWCoordinator["HardwareMonitor.cs
Sensor Polling Coordinator"] - HWCoordinator -->|"Polls specs"| HWInventory[["HardwareInventory.cs"]] - HWCoordinator -->|"Reads config"| AppConfig[["AppSettings.cs"]] - HWCoordinator -->|"Polls network"| TrafficStore[["TrafficHistoryStore.cs"]] + HWInventory["HardwareInventory.cs
Hardware Fingerprinting"] + AppConfig["AppSettings.cs
Configuration Engine"] + TrafficStore["TrafficHistoryStore.cs
Bandwidth History Store"] - HWInventory <--> StateCache[("hardware_state.json")] - AppConfig <--> ConfigFile[("settings.json")] - TrafficStore <--> TrafficFile[("internet_usage.jsonl")] + StateCache[("hardware_state.json")] + ConfigFile[("settings.json")] + TrafficFile[("internet_usage.jsonl")] - HWInventory ==>|"Hardware specs"| Snapshot[["TelemetrySnapshot
Immutable Data Records"]] - ConfigFile ==>|"Active settings"| Snapshot - TrafficStore ==>|"Bandwidth usage"| Snapshot + Snapshot["TelemetrySnapshot
Immutable Telemetry Record"] + + HWInventory <--> StateCache + AppConfig <--> ConfigFile + TrafficStore <--> TrafficFile + + LifecycleMgr -->|"Lifecycle triggers"| HWCoordinator + HWCoordinator -->|"Queries specs"| HWInventory + HWCoordinator -->|"Reads config"| AppConfig + HWCoordinator -->|"Updates metrics"| TrafficStore + HWCoordinator ==>|"Builds snapshot"| Snapshot end - %% 3. HOST APP & IPC - subgraph HostApp["3. LocalTelemetry.App (WPF) & IPC"] - direction TB - AppLifecycle(["App.xaml.cs
DI Host Container & App Lifecycle"]) + %% 3. HOST APPLICATION & UI SUBSYSTEM + subgraph HostApp["LocalTelemetry.App (WPF) & IPC"] + AppLifecycle["App.xaml.cs
DI Host & Event Dispatcher"] - Overlay["TaskbarOverlay.cs
GDI+ Taskbar HWND"] + OverlayMgr["TaskbarOverlayManager.cs
Multi-Monitor Coordinator"] + Alerts["AlertService.cs
Threshold Monitor"] + SettingsWnd["SettingsShell
WebView2 Window"] + + Overlay["TaskbarOverlay.cs
GDI+ Taskbar Band"] Tray["TrayIconManager.cs
NotifyIcon Tooltip"] - SettingsWnd(["SettingsShell
WebView2 Window"]) - Alerts[["AlertService.cs
Threshold Monitor"]] - UpdateChecker[["UpdateCheckService.cs
GitHub Releases Client"]] - - AppLifecycle ==>|"Updates"| Overlay - AppLifecycle ==>|"Updates"| Tray - AppLifecycle -.->|"Opens"| SettingsWnd - AppLifecycle ==>|"Evaluates"| Alerts - AppLifecycle ==>|"Checks"| UpdateChecker - - SettingsWnd <-->|"WebMessages"| SvelteUI(["Svelte 5 Settings UI
TypeScript & Runes"]) - Alerts -->|"Named Pipe"| Notifier(["LocalTelemetry.Notifier
Named Pipe Toasts"]) - UpdateChecker -->|"HTTPS API"| GitHubAPI[("GitHub Releases API")] + Notifier["LocalTelemetry.Notifier
Named Pipe Toasts"] + SvelteUI["Svelte 5 Settings UI
TypeScript & Runes"] + UpdateChecker["UpdateCheckService.cs
Release Client"] + GitHubAPI["GitHub Releases API
Version Endpoint"] + + AppLifecycle ==>|"Updates display"| OverlayMgr + AppLifecycle ==>|"Evaluates alerts"| Alerts + AppLifecycle -.->|"Hosts UI"| SettingsWnd + AppLifecycle ==>|"Checks version"| UpdateChecker + + OverlayMgr --> Overlay + OverlayMgr -.-> Tray + Alerts -->|"Named Pipe"| Notifier + SettingsWnd <-->|"WebMessage"| SvelteUI + UpdateChecker -->|"HTTPS"| GitHubAPI end - PawnIO --> HWCoordinator - GPUApis --> HWCoordinator - WinCounters --> HWCoordinator - LifecycleMgr -->|"Power & display triggers"| HWCoordinator - - Snapshot ==>|"SnapshotReady"| AppLifecycle + %% INTER-LAYER DATA FLOWS + PawnIO -->|"CPU telemetry"| HWCoordinator + GPUApis -->|"GPU telemetry"| HWCoordinator + WinSensors -->|"Disk & net telemetry"| HWCoordinator + OSEvents -->|"OS notifications"| LifecycleMgr - style DriverRow fill:none,stroke:none + LifecycleMgr -.->|"Topology change"| AppLifecycle + Snapshot ==>|"SnapshotReady(snap)"| AppLifecycle - class PawnIO,GPUApis,WinCounters driverNode - class LifecycleMgr,HWCoordinator,Snapshot,HWInventory,TrafficStore,AppConfig coreNode + %% STYLING & CLASSES + class PawnIO,GPUApis,WinSensors,OSEvents driverNode + class HWCoordinator,LifecycleMgr,HWInventory,AppConfig,TrafficStore coreNode + class Snapshot modelNode class StateCache,TrafficFile,ConfigFile,GitHubAPI dataNode class AppLifecycle,SettingsWnd,UpdateChecker appNode - class Overlay,Tray,Alerts shellNode + class Overlay,Tray,Alerts,OverlayMgr shellNode class Notifier notifierNode class SvelteUI uiNode classDef driverNode fill:#0a192f,stroke:#38bdf8,stroke-width:2px,color:#e0f2fe classDef coreNode fill:#1e1b4b,stroke:#6366f1,stroke-width:2px,color:#ffffff + classDef modelNode fill:#312e81,stroke:#818cf8,stroke-width:2px,color:#f5f3ff classDef dataNode fill:#271803,stroke:#f59e0b,stroke-width:2px,color:#fef3c7 classDef appNode fill:#0c2b4d,stroke:#3b82f6,stroke-width:2px,color:#ffffff classDef shellNode fill:#062d1f,stroke:#10b981,stroke-width:2px,color:#ecfdf5 @@ -87,116 +99,63 @@ flowchart TD classDef uiNode fill:#3b1406,stroke:#f97316,stroke-width:2px,color:#ffedd5 ``` -### :sliders-horizontal: AppSettings (Configuration Engine) - -- Manages user preferences saved in `settings.json`. -- Uses `InitPaths(exeDir)` to inspect for an `app.mode` marker file: - - If `app.mode` exists (installed mode), data directories point to `%LOCALAPPDATA%\LocalTelemetry`. - - If absent (portable mode), configuration and log files are stored directly alongside `LocalTelemetry.exe`. -- Implements schema migration (`MigrateConfig`) to cleanly upgrade older settings schemas without losing user preferences. -- Persists configuration to `settings.json`, protecting against corruption via automatic `.corrupt` backup creation and graceful fallback to defaults on load failure. - -### :activity: HardwareMonitor (Telemetry Polling Coordinator) - -- The central engine coordinating all sensor polling loops on a background worker timer (`100 ms` to `10000 ms`, configured via `AppSettings.Monitoring.PollIntervalMs`). -- Subscribes to `HardwareLifecycleManager` events for power transitions, display changes, and network topology shifts. -- Queries specialized hardware readers on each tick: - - `IntelMsrReader.cs` & `AmdMsrReader.cs` (via `PawnIo` kernel driver for temperature, clock frequency, and RAPL package power). - - `IntelPowerGadget.cs` (fallback driver for Intel core temperature and package wattage). - - `NvGpuMonitor.cs` (NVIDIA NVML P/Invoke bindings). - - `AmdGpuMonitor.cs` (AMD ADL P/Invoke bindings). - - `IntelGpuMonitor.cs` (Intel IGCL / ControlLib bindings). - - `WddmGpuMonitor.cs` (Windows WDDM GPU performance counters via `D3DKMTQueryStatistics`). - - `System.Diagnostics.PerformanceCounter` (Windows `PhysicalDisk` read/write bytes per second). - - `NetworkInterface.GetIPv4Statistics()` (Per-tick throughput delta calculation on the active physical network adapter). - - Battery charge & discharge wattage via WMI `root\wmi:BatteryStatus` and `GetSystemPowerStatus`. -- Produces immutable `TelemetrySnapshot` records dispatched via `SnapshotReady` on every refresh tick. - -### :refresh-cw: HardwareLifecycleManager (Dynamic OS & Hardware Lifecycle) - -- Implemented in `HardwareLifecycleManager.cs`. -- Listens to native Windows system events (`SystemEvents`) and network availability (`NetworkChange`): - - **Display & Graphics Resets (`DisplaySettingsChanged` / `WM_DISPLAYCHANGE`):** Debounced (3000 ms) and triggers dynamic refresh of WDDM GPU adapter state. - - **System Sleep (`PowerModes.Suspend`):** Immediately pauses the background polling timer to eliminate wakeups during standby. - - **System Resume (`PowerModes.Resume`):** Waits 3 seconds for hardware warm-up, executes `ResetGpuMonitors()` across NVML, WDDM, ADL, and IGCL backends, re-initializes network adapter counters, and resumes polling. - - **Network Topology Changes (`NetworkAddressChanged` / `NetworkAvailabilityChanged`):** Automatically detects adapter connections, disconnections, and IP address renewals. - - **PnP Device Changes (`WM_DEVICECHANGE`):** Refreshes storage drive mappings upon USB or NVMe disk hotplugging. - -### :database: MetricSnapshot & TelemetrySnapshot (State Models) - -- Represents the complete, immutable point-in-time state of all polled hardware sensors. -- Contains normalized properties for CPU, GPU, RAM, Disk, Network, and Battery telemetry, ensuring UI consumers receive thread-safe, consistent snapshots with zero race conditions. -- See the [C# Core API & Models Reference](reference/core-api.md) for complete property definitions. - -### :fingerprint-pattern: HardwareInventory (Component Fingerprinting & Cache) - -- Implemented in `HardwareInventory.cs`. -- On application launch, generates an SHA-256 system hardware fingerprint (combining motherboard serial, processor ID, GPU device IDs, RAM module serials, and disk hardware IDs). -- Compares the fingerprint against `%LOCALAPPDATA%\LocalTelemetry\hardware_state.json`: - - If identical, emits a concise single-line confirmation in diagnostic logs, minimizing disk I/O and startup delay. - - If changed or on first launch, executes a comprehensive hardware discovery audit and updates the cached state file. +--- -### :hard-drive: DiskQuery & PhysicalDisk Performance Counters +## :sliders-horizontal: Configuration Engine (`AppSettings`) -- Rather than relying on fragile kernel drivers for storage, LocalTelemetry uses a hybrid approach: - - **I/O Rates**: Queried using high-performance Windows `PhysicalDisk` Performance Counters (`\PhysicalDisk(*)\Disk Read Bytes/sec` and `Disk Write Bytes/sec`), tracking both per-disk and system total throughput. - - **Drive Metadata**: Queried via `DiskQuery.cs` using Win32 storage IOCTLs (`IOCTL_STORAGE_QUERY_PROPERTY`, `IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS`) and WMI to resolve commercial drive capacities, vendor names, boot drive flags, and bus architectures (`NVMe`, `SATA`, `SCSI`). +`AppSettings.cs` manages user preferences with atomic file persistence: -### :network: WindowsNetworkUsageProvider & TrafficHistoryStore +- **Path Initialization**: Detects `app.mode` marker file at startup. + - If `app.mode` exists (installer mode), data routes to `%LOCALAPPDATA%\LocalTelemetry`. + - If absent (portable mode), data routes to the executable directory. +- **Atomic Commits**: Writes configuration updates to a temporary file before replacing `settings.json` to prevent partial write corruption. +- **Schema Migration**: Automatically upgrades older configuration versions while preserving existing user preferences. -- Reads active network adapter traffic statistics and calculates bandwidth deltas. -- Logs daily download, upload, and total usage to `internet_usage.jsonl` via `NetUsageLogger.cs`, `TrafficHistoryFile.cs`, and `TrafficHistoryStore.cs`. -- Backfills historical bandwidth records from the Windows System Resource Usage Monitor (`SRUDB.dat`) database using the Extensible Storage Engine (ESE / `esent.dll`) via `WindowsNetworkUsageProvider.cs` and `EseNetworkUsageReader.cs`. Restores backups via `JsonlTrafficImporter.cs` and `DatImporter.cs`. +### Atomic Persistence & Crash Resilience -### :palette: BrandColorDefaults (Hardware Palette Mapper) +To guarantee data integrity during sudden power failure, `AppSettings.Save()` uses a two-phase atomic write pattern: -- Maintains canonical brand color definitions and alias maps for hardware vendors across CPUs (Intel, AMD), GPUs (NVIDIA, AMD, Intel), RAM, Disks, Network Adapters, and Battery OEMs. -- Automatically maps discovered system components to official brand hex palettes. +1. Serializes in-memory preferences to a temporary file (`settings.json.tmp`) using `System.Text.Json`. +2. Flushes file buffers to disk storage. +3. Swaps the temporary file into `settings.json` using atomic file replacement (`File.Replace` with fallback). +4. If a failure occurs mid-write, the existing `settings.json` remains intact, avoiding corrupted configurations. -### :file-text: Log (Structured Diagnostics & Rotation Engine) +--- -- Zero-external-dependency static logging architecture located in `LocalTelemetry.Core.Diagnostics`: - - **System Diagnostics Stream (`logs/lt_system.log`)**: Always active. Captures application lifecycle sessions (`SessionStart`, `SessionEnd` with elapsed uptime), driver detection, and system exceptions. - - **Automatic Size Rotation**: Automatically rolls `lt_system.log` when it reaches 5 MB (`MaxSystemLogBytes = 5MB`), retaining up to 3 numbered archive files (`.1.log`, `.2.log`, `.3.log`). - - **Midnight Rollover**: Automatically inserts visual calendar separators at midnight (`-- DD-MM-YYYY --`) and smoothly rotates daily metric files. - - **Daily Metrics Stream (`logs/lt_DD-MM-YYYY.log`)**: Gated by user configuration (`EnableFileLogging` and per-category modes). Emits periodic sensor readings on each tick without blocking the UI. - - **Thread Safety**: Fully synchronized using non-reentrant private stream locks with automatic flushing (`AutoFlush = true`). +## :vector-polygon: Hardware Coordinator (`HardwareMonitor`) -## :app-window: Application Host (LocalTelemetry.App) +`HardwareMonitor.cs` coordinates periodic polling across all hardware subsystems: -`LocalTelemetry.App` is a WPF application targeting .NET 10 Windows x64. +- Runs an asynchronous polling loop configured by `PollIntervalMs` (`1 s` to `5 s`). +- Queries CPU registers, vendor GPU APIs, network adapter deltas, and storage performance counters. +- Generates immutable `TelemetrySnapshot` records consumed by the taskbar overlay, tray tooltip, and alert service. +- Halts inactive sensor loops when components are toggled off in Settings. -### :terminal: Application Lifecycle & Dependency Injection +--- -- Application entry point implemented in [`App.xaml.cs`](https://github.com/Nicconike/LocalTelemetry/blob/master/src/LocalTelemetry.App/App.xaml.cs). Handles UAC elevation checks (`IsAdministrator()`), relaunching with `Verb = "runas"` and `--elevated` if unelevated. -- Configures the Microsoft Dependency Injection container (`IServiceCollection`). -- Subscribes to `HardwareMonitor.SnapshotReady` to dispatch immutable snapshots to `TaskbarOverlay`, `TrayIconManager`, `AlertService`, and `NetUsageLogger`. -- Manages the process lifecycle of `HardwareMonitor`, `TaskbarOverlay`, `TrayIconManager`, `NotificationClient`, and child daemon `LocalTelemetry.Notifier.exe`. +## :power: System Lifecycle Transitions (`HardwareLifecycleManager`) -### :bell: AlertService (Threshold Evaluation & Notifications) +`HardwareLifecycleManager.cs` listens for Windows power, display, and network topology events: -- Evaluates live `TelemetrySnapshot` values against threshold limits defined in `AppSettings.Alerts`. -- Dispatches visual text flashing commands to `TaskbarOverlay`. -- Sends toast notification commands to `NotificationClient.cs` to trigger `LocalTelemetry.Notifier.exe` over Named Pipe IPC. +- **Power Resume**: Pauses polling during sleep and hibernations. When the system wakes, waits a 3-second stabilization delay before polling PCIe buses. +- **Display Configuration Changes**: Re-initializes WDDM graphics handles and notifies `TaskbarOverlayManager` when resolution or monitor topology changes. +- **Network Changes**: Refreshes interface lists and rebinds performance counters when network adapters connect or disconnect. -### :layout-dashboard: SettingsShell (WebView2 Host Window) +--- -- WPF host window managing the Microsoft WebView2 control (`Microsoft.Web.WebView2.Wpf`). -- Binds Svelte 5 frontend build assets (`wwwroot/index.html`) using local virtual folder mapping (`localtelemetry.settings`). -- Implements bidirectional JSON messaging between C# and Svelte via `WebMessageReceived` handlers. -- See the [WebView2 IPC Protocol Reference](reference/ipc-protocol.md) for full message catalogs. +## :fingerprint-pattern: Hardware Fingerprinting & Traffic Store -### :refresh-cw: UpdateCheckService (GitHub Releases Client) +- **`HardwareInventory.cs`**: Queries CPU specifications, memory modules, GPU adapters, and physical storage bus descriptors. Caches results in `hardware_state.json` to speed up subsequent launches. +- **`TrafficHistoryStore.cs`**: Accumulates daily upload and download totals. Writes records to `internet_usage.jsonl` using JSON Lines format with automatic midnight date rollover. -- Implemented in `UpdateCheckService.cs`. -- Periodically checks the GitHub Releases API based on configured frequency (`weekly`, `monthly`, or `manual`). -- Parses semantic version strings using a SemVer 2.0 parser that compares major, minor, patch, and pre-release identifiers (`-rc`, `-beta`, `-alpha`). -- Dispatches `updateCheckResult` WebMessages to the Svelte 5 frontend with changelogs and direct download URLs. +### Windows SRUM Forensic Importer (`EseNetworkUsageReader`) -## :refresh-cw: Polling Interval Dynamics & Zero-Allocation Pipeline +LocalTelemetry includes a forensic backfill engine implemented in `EseNetworkUsageReader.cs` and `WindowsNetworkUsageProvider.cs`: -LocalTelemetry maintains a low CPU and memory footprint (~35-50 MB RAM) by employing a zero-allocation polling strategy: +- **Volume Shadow Copy Snapshot**: Windows locks the active System Resource Usage Monitor database (`C:\Windows\System32\sru\SRUDB.dat`). LocalTelemetry invokes `esentutl.exe /y /vss` to create a shadow copy in a temporary working folder. +- **Extensible Storage Engine (ESE) Parsing**: Uses managed `Microsoft.Isam.Esent` Jet interop APIs to attach, mount, and scan table `{973F5D5C-1D90-4944-BE8E-24B94231A174}` (Network Data Usage). +- **Date Aggregation & Deduplication**: Aggregates raw byte records into calendar-day buckets, discards loopback interfaces, and merges historical totals into `TrafficHistoryFile` without duplicating existing monitored days. -- Fixed-size reusable byte and string buffers for register and IOCTL reading. -- Double-buffered GDI+ drawing cached directly in unmanaged memory. -- Telemetry timer ticks run on background worker threads without dispatching to the UI thread unless an overlay render tick is due. +::: tip API Specifications +For complete C# class signatures, method parameters, and event contracts, see the [C# Core API Reference](./reference/core-api.md). +::: diff --git a/docs/latest/developer-guide/building-and-packaging.md b/docs/latest/developer-guide/building-and-packaging.md index fd8c327..a91b7dd 100644 --- a/docs/latest/developer-guide/building-and-packaging.md +++ b/docs/latest/developer-guide/building-and-packaging.md @@ -1,12 +1,12 @@ -# :package: Building & Packaging (Inno Setup 7, WinGet & Scoop) +# :package: Building & Packaging (Inno Setup 7 & Scoop) -This guide explains how to produce production builds of **LocalTelemetry**, compile application binaries, configure Inno Setup 7, generate WinGet and Scoop manifests, and execute uninstallation scripts. +This guide explains how to produce production builds of **LocalTelemetry**, compile application binaries, configure Inno Setup 7, generate Scoop manifests, and execute cleanup scripts. ## :hammer: Building Production Binaries -### :code-xml: Svelte 5 Frontend Build +### 1. Compile Svelte 5 Frontend -Compile the Svelte 5 settings panel single-page application: +Compile the settings panel single-page application: ```powershell cd src/LocalTelemetry.App/Settings/wwwroot @@ -15,111 +15,79 @@ bun run build cd ../../../.. ``` -### :box: Application Binary Compilation +### 2. Compile Application Binaries -`LocalTelemetry.App.csproj` includes automated MSBuild targets (`CopyNotifier` and `CopyWwwroot`) alongside `PreserveNewest` deployment of `PawnIO_setup.exe` and `Uninstall.bat`: +`LocalTelemetry.App.csproj` automatically copies `LocalTelemetry.Notifier.exe`, embedded frontend assets from `wwwroot/dist`, `PawnIO_setup.exe`, and `Uninstall.bat`: ```powershell -# Framework-dependent build (.NET 10 Desktop Runtime required, used in release pipeline) +# Framework-dependent build (requires .NET 11 Desktop Runtime, used in release pipeline) dotnet publish src/LocalTelemetry.App/LocalTelemetry.App.csproj -c Release -r win-x64 --no-self-contained -p:PublishSingleFile=true -o ./publish/ -# Optional: self-contained build (bundles the entire .NET 10 runtime) +# Self-contained build (bundles the full .NET 11 runtime) dotnet publish src/LocalTelemetry.App/LocalTelemetry.App.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -o ./publish/ ``` -This single command produces the following deployment files in `./publish/`: +This command outputs the deployment files to `./publish/`: -- `LocalTelemetry.exe`: Main application executable. -- `LocalTelemetry.Notifier.exe`: Standalone toast notification helper executable. +- `LocalTelemetry.exe`: Main host application. +- `LocalTelemetry.Notifier.exe`: Standalone toast notification helper. - `wwwroot/`: Embedded Svelte 5 frontend assets. -- `PawnIO_setup.exe`: Hardware kernel sensor driver setup executable. -- `Uninstall.bat`: Automated administrative driver and service cleanup script for portable mode. +- `PawnIO_setup.exe`: Sensor driver installation package. +- `Uninstall.bat`: Driver and service cleanup script for portable installations. --- ## :shield: Compiling the Inno Setup 7 Installer -LocalTelemetry uses **Inno Setup 7** to build its official installer executable (`LocalTelemetrySetup.exe`). +LocalTelemetry uses **Inno Setup 7** to compile `LocalTelemetrySetup.exe` using [`setup.iss`](https://github.com/Nicconike/LocalTelemetry/blob/master/setup.iss): -The configuration script is located at [`setup.iss`](https://github.com/Nicconike/LocalTelemetry/blob/master/setup.iss) in the root repository folder. +### Installer Automation Features -### :list-checks: Inno Setup Lifecycle Controls +- **Process Detection**: Prompts to close active `LocalTelemetry.exe` or `LocalTelemetry.Notifier.exe` processes before updating. +- **Runtime Bootstrapper**: Detects whether .NET 11 Desktop Runtime is present. If missing, downloads and installs it automatically with a progress bar. +- **Driver Provisioning**: Registers and starts the `PawnIO` service silently. +- **Scheduled Task Registration**: Uses Task Scheduler COM automation to create `LocalTelemetry Startup` with highest privileges. +- **Selective Data Cleanup**: Prompts the user during uninstallation to select whether configuration, logs, or traffic history should be deleted. -- **Running Process Detection (`CloseApplicationsFilter`)**: Inspects whether `LocalTelemetry.exe` or `LocalTelemetry.Notifier.exe` is active, prompting to terminate them before updating. -- **Automatic .NET 10 Runtime Bootstrapper**: Checks whether the .NET 10 Desktop Runtime is installed (`IsDotNet10DesktopInstalled`). If missing, it automatically downloads and installs Microsoft's official runtime package (~55 MB) with a progress bar. -- **PawnIO Driver Provisioning**: Stops and deletes any stale `PawnIO` service, executes `PawnIO_setup.exe -install -silent`, retries if Windows returns error 1072 (service marked for deletion), and flags for reboot if needed. -- **Scheduled Task Registration**: Uses the Task Scheduler COM API to create `LocalTelemetry Startup` with `TASK_RUNLEVEL_HIGHEST`, `DisallowStartIfOnBatteries = false`, `StopIfGoingOnBatteries = false`, and `ExecutionTimeLimit = "PT0S"` (infinite runtime). -- **App Mode Marker**: Creates `{app}\app.mode` so the application routes user settings to `%LOCALAPPDATA%\LocalTelemetry`. -- **Complete Driver & Registry Cleanup on Uninstall**: Closes processes, removes the scheduled task, stops the service, and invokes PowerShell with `pnputil.exe /delete-driver /uninstall /force` to purge `pawnio.inf` from the Windows DriverStore. If Windows returns code `3010`, it warns the user that a restart is required to release the driver from memory. -- **Selective User Data Cleanup**: Presents a custom cleanup form (`PromptUserDataCleanup`) to selectively remove Application Settings (`settings.json`), Cache & Diagnostic Logs (`logs/`, `webview2_data/`), and Traffic History (`internet_usage.jsonl`), preserving bandwidth history by default. +### Compiling via ISCC CLI -### :terminal: Compiling via ISCC CLI - -If Inno Setup 7 is installed on your system (via `winget install --id JRSoftware.InnoSetup.7`): +Compile the installer executable with the Inno Setup command-line compiler: ```powershell -& "C:\Program Files\Inno Setup 7\ISCC.exe" /DAppVersion=1.2.0 /DAppVersionInfoVersion=1.2.0.0 setup.iss +& "C:\Program Files\Inno Setup 7\ISCC.exe" /DAppVersion=1.3.0 /DAppVersionInfoVersion=1.3.0.0 setup.iss ``` -This compiles `LocalTelemetrySetup.exe` into the repository root folder. +This compiles `LocalTelemetrySetup.exe` into the repository root. --- -## :trash: Portable Mode Cleanup Script +## :trash: Portable Mode Cleanup (`Uninstall.bat`) -For portable installations, [`Uninstall.bat`](https://github.com/Nicconike/LocalTelemetry/blob/master/src/LocalTelemetry.App/Uninstall.bat) provides complete system cleanup: +For portable installations, `Uninstall.bat` provides complete system cleanup: -1. **UAC Auto-Elevation**: Requests administrator privileges via `powershell -Command "Start-Process '%~dpnx0' -Verb RunAs"`. -2. **Process Termination**: Terminates `LocalTelemetry.exe` and `LocalTelemetry.Notifier.exe` using `taskkill /F`. -3. **PawnIO Service Removal**: Stops and deletes the `PawnIO` service via `sc stop PawnIO` and `sc delete PawnIO`. -4. **DriverStore Purge**: Scans `pnputil.exe /enum-drivers` for `pawnio.inf` and executes `pnputil /delete-driver /uninstall /force`. If Windows returns exit code `3010`, a message box informs the user that a restart is required. -5. **Registry Cleanup**: Removes startup keys from `HKCU\Software\Microsoft\Windows\CurrentVersion\Run` and the `LocalTelemetry Startup` scheduled task. -6. **Residual Folder Removal**: Deletes `C:\Program Files\PawnIO`, `%ProgramData%\LocalTelemetry`, and `%LocalAppData%\Temp\PawnIo`. +1. **Auto-Elevation**: Requests administrator privileges via PowerShell `Start-Process -Verb RunAs`. +2. **Process Termination**: Stops `LocalTelemetry.exe` and `LocalTelemetry.Notifier.exe` via `taskkill /F`. +3. **Driver & Service Removal**: Stops and deletes the `PawnIO` service via `sc stop` and `sc delete`. +4. **DriverStore Purge**: Scans `pnputil.exe` for `pawnio.inf` and forces driver package deletion. +5. **Registry Cleanup**: Removes startup keys from Task Scheduler and `Run` registry keys. --- -## :package-check: WinGet Packaging Specifications - -The repository maintains the official multi-file Windows Package Manager manifests in `packaging/winget/`: +## :inbox: Package Manager Manifests (Scoop & WinGet) -- **Version Manifest (`Nicconike.LocalTelemetry.yaml`)**: Defines the package identifier (`Nicconike.LocalTelemetry`), version, and default locale. -- **Installer Manifest (`Nicconike.LocalTelemetry.installer.yaml`)**: Defines the Inno Setup installer type, architecture (`x64`), download URL, SHA-256 hash, and silent switches (`/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-`). -- **Locale Manifest (`Nicconike.LocalTelemetry.locale.en-US.yaml`)**: Contains package metadata, description, license, tags, and release notes URL. -- **Automated Workflow**: When a release is published via `.github/workflows/release.yml`, `build.ps1` updates all three manifest files. The release workflow then submits the update to the official Microsoft WinGet Community Repository via `wingetcreate`. +### Scoop Manifest (`bucket/localtelemetry.json`) ---- +The repository includes a Scoop manifest at `bucket/localtelemetry.json`: -## :inbox: Scoop Packaging Specifications +- Points to `LocalTelemetry-win-x64.zip` on GitHub Releases. +- Configures start menu shortcut generation and automated version tracking. +- Updates automatically during release workflows via `.github/release/build.ps1`. -The repository hosts a direct Scoop bucket manifest at `bucket/localtelemetry.json`: +### WinGet Manifests (`packaging/winget/`) -- **Manifest**: Specifies binary extraction for `LocalTelemetry-win-x64.zip`, start menu shortcut creation, and GitHub release tracking. -- **Automated Workflow**: When a release is published, `build.ps1` updates `bucket/localtelemetry.json` with the new version and SHA-256 hash, and commits the update directly to `master`. -- **Installation**: Users install directly from this repository without requiring third-party bucket approvals: +Multi-file Windows Package Manager (WinGet v1.12.0) manifests are maintained under `packaging/winget/`: - ```powershell - scoop bucket add localtelemetry https://github.com/Nicconike/LocalTelemetry - scoop install localtelemetry - ``` - ---- - -## :archive: Generating Portable ZIP Package - -The portable release package bundles the `./publish/*` directory (including `Uninstall.bat`): - -```powershell -Compress-Archive -Path ./publish/* -DestinationPath ./LocalTelemetry-win-x64.zip -Force -``` - ---- - -## :shield-check: Artifact Signing with Cosign - -Release binaries are signed keylessly with [Sigstore Cosign](https://github.com/sigstore/cosign) using GitHub Actions OIDC: - -```powershell -cosign sign-blob --yes --bundle ./checksums.txt.sigstore.json ./checksums.txt -cosign sign-blob --yes --bundle ./LocalTelemetrySetup.exe.sigstore.json ./LocalTelemetrySetup.exe -cosign sign-blob --yes --bundle ./LocalTelemetry-win-x64.zip.sigstore.json ./LocalTelemetry-win-x64.zip -``` +- `Nicconike.LocalTelemetry.yaml`: Package root metadata and schema version. +- `Nicconike.LocalTelemetry.installer.yaml`: Direct installer URL (`LocalTelemetrySetup.exe`), architecture, and SHA-256 installer hash. +- `Nicconike.LocalTelemetry.locale.en-US.yaml`: Package description, publisher details, tags, and license links. +- Updated automatically on stable releases via `.github/release/build.ps1`. diff --git a/docs/latest/developer-guide/ci-cd.md b/docs/latest/developer-guide/ci-cd.md index ae6a0a6..bb9bc9c 100644 --- a/docs/latest/developer-guide/ci-cd.md +++ b/docs/latest/developer-guide/ci-cd.md @@ -1,41 +1,43 @@ # :rocket: CI/CD Pipelines & GitHub Workflows -LocalTelemetry uses **GitHub Actions** for continuous integration, code quality scanning, automated builds, documentation deployment, project triage, and release packaging. +LocalTelemetry uses **GitHub Actions** for continuous integration, code quality analysis, documentation deployment, and automated release packaging. -All workflow actions strictly adhere to OpenSSF Scorecard supply-chain security standards by pinning 40-character commit SHAs. +All workflows pin actions to immutable 40-character commit SHAs in compliance with OpenSSF Scorecard supply-chain standards. ## :settings: Workflows Breakdown -All workflow definition files are located in `.github/workflows/`: +All workflow definitions are located in `.github/workflows/`: ```cmd .github/workflows/ -├── ci.yml # Continuous Integration build, format check & unit test pipeline -├── release.yml # Automated Semantic Release, Inno Setup & SLSA Attestation -├── docs.yml # GitHub Pages documentation build & deployment -├── sync.yml # Pull Request branch auto-sync and Dependabot rebase automation -├── project.yml # GitHub Projects v2 automation, triage, sprint & effort assignment +├── ci.yml # CI build, format check, and automated test pipeline +├── release.yml # Automated semantic release, Inno Setup, and SLSA provenance +├── docs.yml # VitePress documentation build and GitHub Pages deployment +├── sync.yml # Pull request branch auto-sync and Dependabot rebase +├── project.yml # GitHub Projects v2 automated issue triage ├── codeql.yml # CodeQL static security analysis -├── scorecard.yml # OpenSSF Scorecard supply-chain security audit -└── sonar.yml # SonarQube / SonarCloud static code quality analysis +├── scorecard.yml # OpenSSF Scorecard supply-chain audit +└── sonar.yml # SonarCloud code quality analysis ``` ```mermaid -%%{init: {'theme': 'dark', 'themeVariables': {'fontSize': '13px'}, 'flowchart': {'nodeSpacing': 30, 'rankSpacing': 36, 'subGraphTitleMargin': {'top': 12, 'bottom': 20}, 'curve': 'linear'}}}%% -flowchart TD +%%{init: {'theme': 'dark', 'themeVariables': {'fontSize': '13px'}, 'flowchart': {'nodeSpacing': 24, 'rankSpacing': 30, 'padding': 14, 'subGraphTitleMargin': {'top': 12, 'bottom': 18}, 'curve': 'linear'}}}%% +flowchart LR %% COLUMN 1: CONTINUOUS INTEGRATION subgraph TrackCI["1. Continuous Integration (ci.yml)"] direction TB - TriggerCI["Push / Pull Request
Targets master branch"] - Commitlint["1. Commitlint
Enforces Conventional Commits"] - Vitest["2. Bun Vitest
Svelte 5 Runes Unit Tests"] - DotNetBuild["3. .NET 10 Build
dotnet build & format --verify"] - DotNetTest["4. xUnit Test Suites
Core • App • Notifier Tests"] - Coverage["5. Code Coverage
XPlat Coverage Report -> Codecov"] + TriggerCI["Push / Pull Request
master & develop"] + Commitlint["1. Commitlint
Conventional Commits"] + Vitest["2. Bun Vitest
Svelte 5 Runes Tests"] + ReleaseTest["3. Release Tests
Changelog & Release Suite"] + DotNetBuild["4. .NET 11 Build
Compile & Format Check"] + DotNetTest["5. xUnit Tests
Core • App • Notifier"] + Coverage["6. Code Coverage
Codecov & SonarCloud"] TriggerCI --> Commitlint Commitlint --> Vitest - Vitest --> DotNetBuild + Vitest --> ReleaseTest + ReleaseTest --> DotNetBuild DotNetBuild --> DotNetTest DotNetTest --> Coverage end @@ -43,12 +45,12 @@ flowchart TD %% COLUMN 2: CODE QUALITY & SECURITY subgraph TrackQuality["2. Security & Quality Analysis"] direction TB - TriggerQuality["Push, PR & Schedules
Master commits & weekly cron"] - CodeQL["CodeQL Analysis
Deep semantic vulnerability scan"] - Sonar["SonarCloud Quality Gate
Static analysis & maintainability"] - Scorecard["OpenSSF Scorecard
Supply-chain security audit"] - SyncPR["PR Auto-Sync & Rebase
Automated branch synchronization"] - Triage["GitHub Projects v2 Triage
Issue & PR automated sorting"] + TriggerQuality["Push, PR & Schedules
Master commits & cron"] + CodeQL["CodeQL Analysis
Vulnerability Scanner"] + Sonar["SonarCloud Gate
Maintainability & Coverage"] + Scorecard["OpenSSF Scorecard
Supply-Chain Security"] + SyncPR["PR Auto-Sync
Branch Rebase Engine"] + Triage["Projects v2 Triage
Issue & PR Sorting"] TriggerQuality --> CodeQL CodeQL --> Sonar @@ -58,28 +60,30 @@ flowchart TD end %% COLUMN 3: AUTOMATED RELEASE PIPELINE - subgraph TrackRelease["3. Automated Release (release.yml)"] + subgraph TrackRelease["3. Automated Release
(release.yml)"] direction TB - TriggerRelease["Push to master
release/* and src/* changes"] - SemRel["Semantic Release
Analyzes commits & tags version"] - BuildPkg["Build & Inno Setup
build.ps1 publishes win-x64 & installer"] - CosignSign["Cosign Signing
Sigstore keyless OIDC bundles"] - SignedCommit["Signed Release Commit
github-commit-plugin via REST API"] - GHRelease["GitHub Release
Publishes installer, ZIP & SHA256"] - WinGet["WinGet Submission
Official wingetcreate CLI"] - Attestation["SLSA Provenance
Build provenance & release asset upload"] + TriggerRelease["Push to Branch
master & develop"] + SemRel["Semantic Release
Calculate Next Version"] + BuildPkg["Build & Inno Setup
Win-x64 & Installer"] + CosignSign["Cosign Signing
Keyless OIDC Bundles"] + SignedCommit["Signed Release Commit
Release Bot via REST API"] + GHRelease["GitHub Release
Publish ZIP & SHA-256"] + Scoop["Scoop & WinGet
Manifest Synchronization"] + Attestation["SLSA Provenance
Build Attestation Upload"] TriggerRelease --> SemRel SemRel --> BuildPkg BuildPkg --> CosignSign CosignSign --> SignedCommit SignedCommit --> GHRelease - GHRelease --> WinGet - WinGet --> Attestation + GHRelease --> Scoop + Scoop --> Attestation end + TrackCI ~~~ TrackQuality ~~~ TrackRelease + class TriggerCI,TriggerQuality,TriggerRelease triggerNode - class Commitlint,Vitest,CodeQL,Sonar,Scorecard,SyncPR,Triage,SemRel,CosignSign,SignedCommit,WinGet,Attestation stepNode + class Commitlint,Vitest,CodeQL,Sonar,Scorecard,SyncPR,Triage,SemRel,CosignSign,SignedCommit,Scoop,Attestation stepNode class DotNetBuild,DotNetTest,BuildPkg,GHRelease buildNode class Coverage dataNode @@ -91,91 +95,48 @@ flowchart TD --- -## :zap: Continuous Integration Workflow - -The continuous integration pipeline is defined in [`.github/workflows/ci.yml`](https://github.com/Nicconike/LocalTelemetry/blob/master/.github/workflows/ci.yml). It triggers on every `push` and `pull_request` targeting the `master` branch. - -### 1. Commit Linting (`commitlint`) - -Validates commit messages against Conventional Commits rules defined in `commitlint.config.mjs`. - -### 2. Frontend Unit Tests (`test-frontend`) - -- Installs dependencies using Bun. -- Executes Vitest unit tests in `tests/LocalTelemetry.App.Tests/Settings/wwwroot/`. -- Uploads JUnit test report artifacts. - -### 3. Windows Integration & Tests (`test-windows`) - -- Compiles the Svelte 5 frontend into `src/LocalTelemetry.App/Settings/wwwroot/dist/`. -- Uploads bundle size metrics to Codecov Bundle Analysis using `@codecov/vite-plugin`. -- Restores and caches NuGet packages. -- Verifies code formatting with `dotnet format --verify-no-changes`. -- Executes xUnit tests across `LocalTelemetry.Core.Tests`, `LocalTelemetry.App.Tests`, and `LocalTelemetry.Notifier.Tests`. -- Collects test coverage with Coverlet and uploads coverage across 4 targets (`app`, `core`, `notifier`, and frontend). - ---- - -## :rocket: Automated Release Pipeline - -The release pipeline is defined in [`.github/workflows/release.yml`](https://github.com/Nicconike/LocalTelemetry/blob/master/.github/workflows/release.yml). It triggers automatically on every push to the `master` branch that modifies release paths or source code: - -### Pipeline Execution Flow - -1. **GitHub App Authentication**: Generates a GitHub App installation token. The token possesses write permissions for releases, tags, and commits. -2. **Environment Setup**: Fetches all Git tags (`git fetch --tags --force`), sets up Bun and the .NET 10 SDK, and installs release dependencies. -3. **Unified `semantic-release` Runner**: - - Executes `bun run ./.github/release/run.ts --extends ./.github/release/release.config.mjs`. - - **Commit Analysis (`@semantic-release/commit-analyzer`)**: Parses Conventional Commits to calculate the next semantic release version (`patch`, `minor`, `major`). - - **Changelog Generation (`@semantic-release/release-notes-generator` & `@semantic-release/changelog`)**: Groups commits into categorized sections and prepends release notes to `CHANGELOG.md`. - - **Binary Compilation & Packaging (`@semantic-release/exec`)**: - - Executes `pwsh -File ./.github/release/build.ps1 -Version "${nextRelease.version}" -Tag "${nextRelease.gitTag}"`. - - Compiles single-file Windows x64 binaries: - - ```cmd - dotnet publish src/LocalTelemetry.App/LocalTelemetry.App.csproj -c Release -r win-x64 --no-self-contained -p:PublishSingleFile=true - ``` - - - Compiles `LocalTelemetrySetup.exe` with Inno Setup 7 (`ISCC.exe`). - - Packages the portable archive `LocalTelemetry-win-x64.zip`. - - Generates SHA-256 cryptographic hashes in `checksums.txt`. - - Signs release artifacts with Cosign (Sigstore keyless OIDC) to generate `.sigstore.json` bundles. - - Injects updated version and checksum values into `bucket/localtelemetry.json`, `docs/.vitepress/versions.mjs`, and multi-file WinGet manifests (`packaging/winget/Nicconike.LocalTelemetry.*.yaml`), and synchronizes package versions. - - **Repository State Commit (`github-commit-plugin.ts`)**: Uploads file blobs and creates a signed commit via the GitHub REST API. This step updates `master` with web-flow signing and bypasses branch protections cleanly. - - **Release Publication (`@semantic-release/github`)**: Creates the GitHub Release tag pointing to the new commit. Attaches `LocalTelemetrySetup.exe`, `LocalTelemetry-win-x64.zip`, `checksums.txt`, and Cosign bundles. - - **WinGet Package Submission (`wingetcreate`)**: - - Updates `Nicconike.LocalTelemetry` in the official Microsoft WinGet Community Repository using `wingetcreate update`, falling back to manifest directory submission. -4. **Cryptographic Signatures & Provenance Attestations**: - - Signs release binaries using Sigstore Cosign keyless OIDC certificates. - - Generates SLSA Level 3 build provenance attestations for `LocalTelemetrySetup.exe` and `LocalTelemetry-win-x64.zip` via `actions/attest-build-provenance`. - ---- - -## :book-open: Documentation Deployment & Version Locking Workflow - -The documentation site deployment pipeline is defined in [`.github/workflows/docs.yml`](https://github.com/Nicconike/LocalTelemetry/blob/master/.github/workflows/docs.yml). - -### Triggers - -1. Pushes to `master` affecting `docs/**` or `.github/workflows/docs.yml`. -2. Release publication events (`release: types: [published]`). -3. Manual trigger via `workflow_dispatch`. - -### Automated Version Locking Process - -1. When a new release is published, the workflow triggers automatically. -2. The `actions/checkout` step clones the repository with `fetch-depth: 0` to retrieve all Git tags. -3. The build script `docs/scripts/build-versions.mjs` scans all tags matching `v*` with version `>= v1.0.0`. -4. The script extracts immutable markdown documentation from the tagged commit tree into `docs/v/`. It skips versions that are already generated to optimize build performance. -5. It disables edit links (`editLink: false`), rewrites internal cross-references to the versioned path, and updates `docs/.vitepress/versions.mjs`. -6. Bun builds the full VitePress static site containing both the latest docs and all locked release versions. -7. The workflow uploads the artifact and deploys the site to GitHub Pages. - ---- - -## :shield-check: Security & Quality Workflows - -- **CodeQL (`codeql.yml`)**: Scans C# and JavaScript/TypeScript code for security vulnerabilities and injection risks. -- **SonarCloud (`sonar.yml`)**: Runs static code analysis and maintains the SonarCloud Clean Code quality gate. -- **OpenSSF Scorecard (`scorecard.yml`)**: Audits supply-chain security, dependency pinning, and branch protections. -- **GitHub Projects Automation (`project.yml`)**: Automates triage, status transitions, sprint planning, and effort sizing in GitHub Projects v2. +## :workflow: Workflows & Pipelines Reference + +### 1. Continuous Integration (`ci.yml`) +- **Triggers**: Pushes and pull requests targeting `master` and `develop`. +- **Validation**: Enforces Conventional Commits using `commitlint`. +- **Frontend Verification**: Executes Svelte 5 Vitest unit tests with coverage reporting via Bun. +- **Backend Verification**: Compiles `.NET 11` solution in `Debug`, validates code formatting with `dotnet format --verify-no-changes`, and executes xUnit v3 (MTP) test suites for `Core`, `App`, and `Notifier`. +- **Coverage**: Collects Coverlet MTP Cobertura coverage metrics and uploads reports to Codecov. + +### 2. Automated Release & Packaging (`release.yml`) +- **Triggers**: Pushes to `master` (stable release) and `develop` (beta release). +- **Versioning**: Calculates semantic versions automatically using conventional commit history. +- **Packaging**: Compiles single-file win-x64 binaries, downloads PawnIO setup, and builds `LocalTelemetrySetup.exe` with Inno Setup 7. +- **Signing & Attestation**: Signs release binaries using Sigstore Cosign (keyless OIDC) and generates SLSA build provenance attestations. +- **Distribution**: Publishes GitHub Releases with ZIP archives, installers, and SHA-256 hashes. Synchronizes Scoop and WinGet package manifests on stable releases. + +### 3. Documentation Site (`docs.yml`) +- **Triggers**: Pushes to `master` and pull requests affecting `docs/**`. +- **Versioning**: Snapshots releases and generates multi-version navigation with `build-versions.mjs`. +- **Deployment**: Compiles the VitePress static documentation bundle and deploys to GitHub Pages. + +### 4. Static Application Security Testing (`codeql.yml`) +- **Triggers**: Pushes and pull requests targeting `master` and `develop`. +- **Analysis**: Initializes GitHub CodeQL for C# and scans the backend telemetry engine for semantic vulnerabilities, CWE compliance, and memory safety issues. +- **Reporting**: Uploads SARIF security scan results directly to GitHub Security Advisories. + +### 5. Code Quality & Maintainability (`sonar.yml`) +- **Triggers**: Pushes to `master` and opened/synchronized pull requests. +- **Inspection**: Analyzes C# and Svelte code with SonarCloud, evaluating test coverage, cognitive complexity, code duplication, and architectural code smells. +- **Quality Gate**: Enforces a strict Zero Suppressions policy and blocks pull requests that fail Quality Gate thresholds. + +### 6. Supply-Chain Security Audit (`scorecard.yml`) +- **Triggers**: Branch protection events, scheduled weekly crons, and pushes to `master`. +- **Supply-Chain Verification**: Executes OpenSSF Scorecard to evaluate repository security hygiene, including 40-character commit SHA action pinning, branch protection rules, and dependency security policies. +- **Provenance**: Publishes signed results to the OpenSSF public REST API. + +### 7. Branch Auto-Sync & Dependabot Rebase (`sync.yml`) +- **Triggers**: Pushes to `master`/`develop`, pull request lifecycle events, and completed upstream CI workflows. +- **Automation**: Synchronizes open pull request branches against latest base branch commits using fast-forward merges or automated rebase operations. +- **Dependabot**: Automatically rebases Dependabot dependency upgrade PRs when conflicts occur. + +### 8. GitHub Projects v2 Triage Automation (`project.yml`) +- **Triggers**: Issues and pull requests opened, closed, reopened, or converted. +- **Triage**: Automatically attaches incoming issues, bug reports, feature requests, and pull requests to the LocalTelemetry GitHub Projects v2 roadmap board. +- **Status Tracking**: Updates item status fields through active development, review, and resolution phases. diff --git a/docs/latest/developer-guide/contributing.md b/docs/latest/developer-guide/contributing.md index eb5fb95..1bc6c75 100644 --- a/docs/latest/developer-guide/contributing.md +++ b/docs/latest/developer-guide/contributing.md @@ -1,149 +1,148 @@ # :git-branch: Contributing & Coding Standards -Contributions to **LocalTelemetry** are welcome! As an independently developed open-source project, community input is appreciated. Whether you are fixing bugs, improving documentation, or implementing new hardware sensors, please adhere to these coding standards. - -## :file-text: Coding Standards & Guidelines - -### :file-code: C# Backend Guidelines (.NET 10 / C# 13) - -- **Class Sealing**: Use `sealed` by default on all concrete C# classes unless the class is explicitly designed for inheritance -- **Type Inference**: Avoid excessive `var` usage. Only use `var` when the right-hand side type is explicitly obvious -- **Exception Handling**: **Never swallow exceptions**. Every `catch` block must log via `Log.Error(...)`, handle the error visibly, or rethrow -- **XML Documentation**: Provide XML documentation comments (`/// `) on all public classes, methods, and properties -- **Formatting**: Run Microsoft official `dotnet format --verify-no-changes` before opening a pull request - -```csharp -/// Reads CPU core temperature via PawnIO MSR registers. -public sealed class CpuTemperatureReader -{ - public double GetTemperatureCelsius() - { - try - { - // Hardware query logic - } - catch (Exception ex) - { - Log.Error(ex, "Failed to query CPU temperature register"); - return 0; - } - } -} +Contributions to **LocalTelemetry** are welcome. Follow these coding standards, development workflows, and pull request requirements when contributing. + +--- + +## :monitor-pc: Development Prerequisites & Setup + +Ensure the following tools are installed before contributing: + +- **Operating System**: Windows 10 or Windows 11 (64-bit x64). +- **Runtime & SDK**: [.NET 11 SDK](https://dotnet.microsoft.com/download) (latest release). +- **Frontend Runtime**: [Bun](https://bun.sh/) (exclusive package manager for Svelte assets). +- **IDE**: Visual Studio 2022+ (with desktop workload) or VS Code (with C# Dev Kit). + +### Initial Environment Setup + +```powershell +# 1. Install frontend dependencies and build UI bundle +cd src/LocalTelemetry.App/Settings/wwwroot +bun install +bun run build +cd ../../../.. + +# 2. Build the full .NET 11 solution +dotnet build --configuration Debug + +# 3. Verify tests pass +dotnet test --configuration Debug ``` -### :code-xml: Svelte 5 Frontend Guidelines +--- -- **Bun Only**: Always use **Bun** for managing JavaScript/TypeScript dependencies. Never run `npm install` or `yarn install` -- **Svelte 5 Runes**: Use `$state()`, `$derived()`, `$effect()`. Do NOT use legacy `$:` reactive statements or `export let` +## :file-text: Coding Standards -```svelte - +- **File-Scoped Namespaces**: Use file-scoped namespaces for all C# files (`namespace LocalTelemetry.Core;`). +- **Class Sealing**: Mark all internal and concrete classes as `sealed` unless designing explicitly for inheritance. +- **Primary Constructors**: Use primary constructors where appropriate for DI service injection. +- **Structured Logging**: Use `ILogger` for structured diagnostic output. Never write bare console messages. +- **Configuration Pattern**: Use `IOptions` models for reading application configuration. +- **Exception Handling**: Never swallow exceptions silently. Log via `Log.Error(...)`, handle the failure, or rethrow. +- **XML Documentation**: Provide XML comments (`/// `) on all public types, methods, and properties. +- **Zero Suppressions Policy**: Never use ``, `#pragma warning disable`, or `[SuppressMessage]`. Fix the underlying code directly. +- **Code Formatting**: Verify formatting before pushing changes: + +```powershell +dotnet format --verify-no-changes ``` -## :palette: Contributing Hardware Brand Colors +### :test-tube-diagonal: Hardware Mocking & Test Infrastructure -LocalTelemetry automatically detects installed hardware components (CPUs, GPUs, RAM, Disks, Network Adapters, Batteries, and OEMs) and styles their metrics using official vendor brand colors defined in `BrandColorDefaults.cs`. +Physical hardware sensors (MSRs, SMU mailboxes, discrete GPUs, batteries) cannot run inside continuous integration runners. `LocalTelemetry.Core` provides `internal static` test seams to simulate hardware states deterministically: -If your hardware component uses a generic fallback color because its manufacturer is not yet in the database, community pull requests are welcome! +- **Timer Control**: Set `HardwareMonitor.SuppressTimerForTesting = true` to prevent automatic polling in unit tests. +- **Hardware Fault Injection**: + - `ThrowInReadGpuPctForTesting = true`: Simulates driver timeouts or GPU TDR resets. + - `ThrowInReadBatteryForTesting = true`: Simulates missing or failed battery telemetry. + - `ThrowInNetworkChangeForTesting = true`: Simulates network interface disconnects. +- **Synthetic Sensor Readings**: + - `MockBatteryRatesForTesting = (chargeRate, dischargeRate)`: Supplies mock charge and discharge values in Watts. +- **Cleanup**: Always reset test flags in an `IDisposable` fixture or `finally` block to prevent test pollution across suites. -### :shield-check: Contribution Guardrails & Standards +### :squares-subtract: Svelte 5 Frontend Standards -To maintain high data accuracy and visual quality, all brand color additions must adhere to the following guardrails: +- **Bun Package Manager**: Always use **Bun** (`bun install`, `bun run build`, `bun run test`). Never use npm, yarn, or pnpm. +- **Svelte 5 Runes**: Build state using runes (`$state`, `$derived`, `$effect`, `$props`). Never use legacy reactive syntax (`$:`) or `export let`. +- **TypeScript Strict Mode**: Enforce complete type annotations. Avoid `any` types. +- **Frontend Testing**: Write unit tests using Vitest in `tests/LocalTelemetry.App.Tests/Settings/wwwroot/`. -1. :shield-check: **Authoritative Source Required**: - - The hex code must originate from an official brand portal, press kit, SVG logo asset, or brand guidelines (e.g. brand style guides, official vector files). - - In your Pull Request description, **provide a direct citation link** or reference verifying the color code. -2. :sun-medium: **Contrast & Taskbar Legibility**: - - The overlay renders against dark and light taskbar themes. - - Avoid near-black tones (e.g. `#000000` or `#0a0a0a`) or low-contrast muted pastels that become invisible on default taskbars. -3. :file-code: **Codebase Implementation (`BrandColorDefaults.cs`)**: - - **`_brand` Dictionary**: Register the canonical manufacturer name and upper-case 6-character hex code (`["BrandName"] = "#RRGGBB"`). - - **`_category` Lists**: Add the brand key into the appropriate hardware category array (`cpu`, `gpu`, `ram`, `disk`, `nic`, `oem`, or `battery`). - - **`_alias` Map (If Applicable)**: If Windows WMI or vendor query APIs return common abbreviations (e.g. `WD` or `WDC` for `Western Digital`, `SKHYNIX` for `SK Hynix`), map the alias to the canonical name. +### :book-open: Documentation Standards -```csharp -// Example: Adding a new storage manufacturer in BrandColorDefaults.cs -private static readonly Dictionary _brand = new(StringComparer.OrdinalIgnoreCase) -{ - ["Solidigm"] = "#7F35B2", // Official Solidigm Violet -}; +- Keep sentences short, direct, and unambiguous (maximum 20-25 words per sentence). +- Use active voice and consistent technical terms. One instruction per sentence. -private static readonly Dictionary _category = new(StringComparer.OrdinalIgnoreCase) -{ - ["disk"] = ["Solidigm", ...], -}; -``` +--- -1. :test-tube: **Verification & Testing**: - - Run the unit test suite before opening your PR: +## :git-pull-request: Branching & Pull Request Lifecycle - ```powershell - dotnet test tests/LocalTelemetry.Core.Tests - ``` +### Branch Naming Conventions - - Verify that `BrandColorDefaultsTests` passes cleanly. +Prefix branch names with the category of change: -## :git-commit-horizontal: Commit Message Convention +- `feature/`: New capabilities or hardware drivers. +- `fix/`: Defect repairs in production code. +- `refactor/`: Code structure updates without behavior changes. +- `docs/`: Documentation additions and corrections. +- `test/`: Test suite additions and coverage improvements. -This repository enforces the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard: +### Pull Request Checklist -```bash -(): -``` +Before submitting a pull request: -### :list-tree: Commit Types +1. Verify that `dotnet build` succeeds without compiler warnings. +2. Run `dotnet format --verify-no-changes` to confirm code style compliance. +3. Run all unit tests with `dotnet test` and ensure all test cases pass. +4. Run Svelte tests with `bun run test` in the test directory. +5. Provide a descriptive title and fill out the pull request template completely. -- `feat`: New feature -- `fix`: Bug fix -- `docs`: Documentation updates -- `style`: Formatting, missing semicolons, UI layout tweaks -- `refactor`: Refactoring code without changing behavior -- `perf`: Performance optimizations -- `test`: Adding or updating tests -- `ci`: CI/CD pipeline changes -- `build`: Build system or dependency changes -- `chore`: Maintenance +--- -### :crosshair: Scopes +## :palette: Contributing Hardware Brand Colors -`core`, `app`, `overlay`, `monitor`, `config`, `ci`, `docs` +LocalTelemetry detects installed hardware components and applies official vendor brand colors in [BrandColorDefaults.cs](file:///f:/Software/Codebase/LocalTelemetry/src/LocalTelemetry.Core/Models/BrandColorDefaults.cs). -### :code: Commit Message Examples +If your hardware uses a generic fallback color, you can contribute official vendor colors: -```powershell -feat(overlay): add GPU VRAM usage indicator -fix(core): handle missing PawnIo driver initialization failure gracefully -build(deps): bump NuGet packages -``` +1. **Authoritative Source**: The hex code must originate from an official brand portal, press kit, or official SVG asset. Provide a verification link in your pull request. +2. **Contrast & Legibility**: Avoid near-black tones or low-contrast pastels that become invisible on default Windows taskbars. +3. **Implementation (`BrandColorDefaults.cs`)**: + - Add the canonical vendor name and 6-character hex code to `_brand`. + - Add the vendor key into the appropriate hardware category array (`cpu`, `gpu`, `ram`, `disk`, `nic`, `oem`, or `battery`). + - If Windows WMI returns abbreviations (e.g. `WD` for `Western Digital`), map the alias in `_alias`. +4. **Verification**: Run `dotnet test tests/LocalTelemetry.Core.Tests` to verify that `BrandColorDefaultsTests` passes. -## :git-pull-request: Pull Request Process +--- + +## :git-commit-horizontal: Commit Message Conventions + +This repository strictly enforces the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification: + +```text +(): +``` -1. Fork the repository and create a feature branch (`feature/my-cool-sensor`). -2. Verify frontend builds and tests: +### Commit Types - ```powershell - cd src/LocalTelemetry.App/Settings/wwwroot - bun install - bun run build - cd ../../../../tests/LocalTelemetry.App.Tests/Settings/wwwroot - bun install - bun run test - cd ../../../.. - ``` +- `feat`: New features or capabilities in production code. +- `fix`: Runtime defect repairs in production code only. +- `test`: Adding, updating, or expanding tests. +- `refactor`: Production code changes that do not fix defects or add features. +- `build` / `chore`: Dependency updates, build configurations, or tooling changes. +- `docs`: Documentation updates only. +- `style`: Formatting, whitespace, or lint styling without logic changes. -3. Verify backend builds and tests: +### Order of Importance - ```powershell - dotnet format --verify-no-changes - dotnet build LocalTelemetry.sln - dotnet test LocalTelemetry.sln - ``` +When drafting combined commit messages, changelogs, or summaries, order changes strictly by importance in descending order: -4. Open a Pull Request on GitHub. Keep PRs focused on one logical change. +1. Breaking Changes +2. Features (`feat`) +3. Bug Fixes (`fix`) +4. Architecture & Code Refactoring (`refactor`) +5. Build System & Dependencies (`build`) +6. Continuous Integration & Workflows (`ci`) +7. Code Quality, Lints, & Tests (`test`) +8. Documentation & Housekeeping (`docs`, `style`, `chore`) diff --git a/docs/latest/developer-guide/frontend-webview.md b/docs/latest/developer-guide/frontend-webview.md index f09364d..dc3569d 100644 --- a/docs/latest/developer-guide/frontend-webview.md +++ b/docs/latest/developer-guide/frontend-webview.md @@ -1,29 +1,32 @@ # :palette: Svelte 5 Frontend & WebView2 Bridge -LocalTelemetry's settings interface is built using **Svelte 5 Runes**, **Vite**, **TypeScript**, and **Bun** hosted inside a native Microsoft WebView2 control. +LocalTelemetry's settings panel is built with **Svelte 5 Runes**, **TypeScript**, and **Vite**, hosted inside Microsoft WebView2. ## :settings: Tech Stack & Tooling -- **Framework**: Svelte 5 (using modern runes: `$state()`, `$derived()`, `$effect()`) -- **Build Tool**: Vite (`vite.config.js`) -- **Package Manager**: **Bun** (`bun install`, `bun run build`) -- **CSS**: Scoped CSS custom properties & dark theme tokens (`app.css`, `themes.ts`) +- **Framework**: Svelte 5 using runes (`$state`, `$derived`, `$effect`). +- **Build Tool**: Vite (`vite.config.js`). +- **Package Manager**: **Bun** (`bun install`, `bun run build`). +- **CSS**: Scoped CSS custom properties and theme tokens (`app.css`, `themes.ts`). > [!CAUTION] -> **No Legacy Svelte Syntax**: Always use Svelte 5 runes (`$state`, `$derived`, `$effect`). Do NOT use legacy Svelte 3/4 reactive declarations (`$:`) or `export let` syntax. +> Always use Svelte 5 runes (`$state`, `$derived`, `$effect`). Do not use legacy Svelte 3/4 reactive syntax (`$:`) or `export let`. --- -## :radio: WebView2 Bidirectional IPC Bridge +## :radio: WebView2 IPC Bridge Architecture -Communication between the C# WPF host (`SettingsShell.xaml.cs`) and the Svelte 5 frontend occurs asynchronously via WebView2 JSON WebMessages. +Communication between the C# WPF host (`SettingsShell.xaml.cs`) and the Svelte frontend occurs asynchronously using JSON WebMessages: + +- **Inbound (JavaScript -> C#)**: `window.chrome.webview.postMessage(JSON.stringify(envelope))` +- **Outbound (C# -> JavaScript)**: `CoreWebView2.PostWebMessageAsJson(jsonString)` ```mermaid %%{init: {'theme': 'dark', 'themeVariables': {'fontSize': '13px'}, 'sequence': {'useMaxWidth': false, 'showSequenceNumbers': true}}}%% sequenceDiagram autonumber - box "WPF Host Process (.NET 10)" #0c2b4d + box "WPF Host Process (.NET 11)" #0c2b4d participant CSharp as SettingsShell.xaml.cs
(C# WPF Controller) end @@ -45,7 +48,7 @@ sequenceDiagram Svelte->>+WebView: postMessage({ type: 'getSystemInfo' }) WebView->>+CSharp: OnWebMessageReceived("getSystemInfo") CSharp->>-WebView: PostWebMessageAsJson(systemInfoDto) - WebView->>-Svelte: Populate CPU, GPU, Disk, Network & System Specs + WebView->>-Svelte: Populate Hardware & System Specs end rect rgba(99, 102, 241, 0.08) @@ -54,113 +57,27 @@ sequenceDiagram WebView->>+CSharp: OnWebMessageReceived("checkForUpdates") CSharp->>CSharp: Query GitHub Releases API CSharp->>-WebView: PostWebMessageAsJson(updateCheckResultDto) - WebView->>-Svelte: Update Status Badge & Show Download Button + WebView->>-Svelte: Show Update Badge & Download Button end rect rgba(245, 158, 11, 0.08) Note over CSharp, Svelte: Phase 3: Preference Persistence & Atomic Commit Svelte->>+WebView: postMessage({ type: 'saveSettings', payload }) WebView->>+CSharp: OnWebMessageReceived("saveSettings") - CSharp->>CSharp: Validate Schema, Diff Audit Log & Atomic File Swap + CSharp->>CSharp: Validate Schema, Diff Audit Log & Atomic Commit CSharp->>-WebView: PostWebMessageAsJson({ type: 'saved' }) - WebView->>-Svelte: Save Confirmation Banner & Clear Dirty Flags + WebView->>-Svelte: Show Save Confirmation Banner end ``` --- -## :bridge: IPC Bridge Message Catalog Summary - -The WebView2 bridge supports 11 inbound requests from JavaScript and 10 outbound responses/events from C#: - -### :log-in: Inbound Messages (Frontend `postMessage` -> C# Host) - -| Message Type | Payload Structure | Description | -| :--- | :--- | :--- | -| `getSettings` | None | Requests the current application settings DTO. | -| `saveSettings` | `SettingsDto` | Submits modified settings for diff logging and persistence to `settings.json`. | -| `getNics` | None | Requests the list of active physical network adapters. | -| `getTrafficMonths` | None | Requests distinct months available in the bandwidth database. | -| `getSystemInfo` | None | Requests hardware specifications and diagnostic details. | -| `openUrl` | `{ url: string }` | Safely opens an HTTP/HTTPS URL or `ms-settings:` URI. | -| `openFolder` | `{ target: "app" \| "data" \| "logs" }` | Opens the install folder, data folder, or logs folder in Explorer. | -| `getTrafficHistoryAll` | None | Requests all historical network usage records and today's total. | -| `importDat` | `{ content: string }` | Imports `.jsonl` backup files or legacy plaintext `.dat` bandwidth logs. | -| `importWindowsUsage` | `{ startDate: string, endDate: string }` | Direct JET/ESE database extraction from Windows `SRUDB.dat`. | -| `checkForUpdates` | `{ force: boolean }` | Triggers a GitHub Releases update query (forced or cached). | - -### :log-out: Outbound Messages (C# Host `PostWebMessageAsJson` -> Frontend) - -| Message Type | Payload Structure | Description | -| :--- | :--- | :--- | -| `settings` | `SettingsDto` | Supplies current configuration and runtime taskbar slot constraint status to the Svelte store. | -| `saved` | `{ error?: string }` | Confirms successful settings persistence or reports an error. | -| `nics` | `string[]` | Active network adapter names and hardware descriptions. | -| `systemInfo` | `SystemInfoDto` | Full CPU, GPU, RAM, Disk, PSU, and Battery specifications (including health, wear, cycles, and RAM SPD rating). | -| `trafficHistoryAll` | `{ records, todayDown, todayUp }` | Full historical bandwidth records and live daily totals. | -| `trafficToday` | `{ downBytes, upBytes }` | Real-time 5-second bandwidth counter update. | -| `trafficMonths` | `string[]` | Available month strings formatted as `YYYY-MM`. | -| `importDatResult` | `{ daysImported, error? }` | Reports count of imported records or error message. | -| `windowsUsageImportResult` | `{ success, daysImported, downBytes, upBytes, message }` | Reports count of imported ESE database records and byte totals. | -| `updateCheckResult` | `UpdateCheckResultDto` | Update availability status, latest version tag, and release URL. | - -::: tip Protocol Reference -For full JSON schema payloads, field-by-field definitions, and TypeScript interfaces, see the [WebView2 & Named Pipe IPC Protocol Reference](reference/ipc-protocol.md). -::: - ---- - -## :terminal: SettingsShell WPF Host Integration +## :bridge: Bridge Messaging Workflow -The WPF host (`SettingsShell.xaml.cs`) initializes WebView2 with a virtual host mapping to isolate frontend assets: +1. **State Hydration**: On mount, `bridge.ts` dispatches `getSettings` and `getSystemInfo`. The C# host responds with serialized DTOs that hydrate Svelte `$state` stores. +2. **Settings Persistence**: When the user edits preferences, `saveSettings` sends updated values to C#. The host validates the payload, logs differences, and performs an atomic file swap on `settings.json`. +3. **External Actions**: Specialized messages handle folder browsing (`openFolder`), URL navigation (`openUrl`), database export (`exportDatabase`), and Windows SRUM extraction (`importWindowsUsage`). -- **Virtual Host Domain**: Mapped via `SetVirtualHostNameToFolderMapping("localtelemetry.settings", wwwRoot, DenyCors)`. -- **Navigation Target**: Loaded from `https://localtelemetry.settings/index.html`. -- **Dropdown Blur Guard**: Moving or dragging the window triggers `document.activeElement?.blur()` in JavaScript to prevent detached native combobox popups. -- **Title Bar Diagnostics**: Periodically computes LocalTelemetry's own process CPU utilization and displays it in the window title. - ---- - -## :folder-tree: Frontend Component Hierarchy - -The frontend is located at `src/LocalTelemetry.App/Settings/wwwroot/`: - -```bash -src/LocalTelemetry.App/Settings/wwwroot/ -├── src/ -│ ├── components/ -│ │ ├── App.svelte # Root UI shell & WebView2 message listener -│ │ ├── Sidebar.svelte # Sidebar tab navigation menu -│ │ ├── pages/ # 10 Dedicated Settings Pages -│ │ │ ├── GeneralPage.svelte # Autostart, polling interval & units -│ │ │ ├── MonitoringPage.svelte # Hardware component sensor toggles -│ │ │ ├── OverlayPage.svelte # Taskbar overlay placement, offsets, opacity & space constraint banner -│ │ │ ├── LayoutPage.svelte # Metric drag-and-drop reordering -│ │ │ ├── NetworkPage.svelte # Active adapter selection & traffic logging toggle -│ │ │ ├── TrafficHistoryPage.svelte # Daily network calendar heatmap, .jsonl backup & .dat import -│ │ │ ├── AlertsPage.svelte # Threshold limits & toast settings -│ │ │ ├── SystemPage.svelte # Hardware summary & specs overview -│ │ │ ├── AppearancePage.svelte # Window themes & metric color pickers -│ │ │ └── AboutPage.svelte # Version info, update checker, licenses & links -│ │ └── ui/ # Reusable UI controls -│ │ ├── MetricChip.svelte # Metric badge / chip display -│ │ ├── SectionCard.svelte # Card container with section header -│ │ ├── Select.svelte # Custom themed select dropdown -│ │ ├── Slider.svelte # Range slider input -│ │ └── Toggle.svelte # Animated boolean toggle switch -│ ├── lib/ -│ │ ├── bridge.ts # WebView2 postMessage wrapper functions -│ │ ├── store.ts # Svelte 5 reactive stores ($state) -│ │ ├── themes.ts # Color themes & CSS token injector -│ │ ├── types.ts # TypeScript interfaces matching C# DTOs -│ │ └── utils.ts # Utility formatting helpers (bytes, dates) -│ ├── app.css # Global styles & theme custom properties -│ ├── main.ts # Svelte 5 application mount entry point -│ ├── vite-env.d.ts # Vite client type definitions -│ └── webview.d.ts # Microsoft WebView2 JavaScript API declarations -├── index.html # Single-page application HTML entry -├── package.json # Frontend dependencies & Bun build scripts -├── svelte.config.js # Svelte 5 compiler configuration -├── tsconfig.json # TypeScript compiler configuration -└── vite.config.js # Vite build configuration (base: './') -``` +::: tip Definitive IPC Message Specification +For complete JSON request and response payloads across all 25 bridge messages, see the [WebView2 & Named Pipe IPC Protocol Reference](./reference/ipc-protocol.md). +::: diff --git a/docs/latest/developer-guide/hardware-drivers.md b/docs/latest/developer-guide/hardware-drivers.md index c64bfdb..15a79dd 100644 --- a/docs/latest/developer-guide/hardware-drivers.md +++ b/docs/latest/developer-guide/hardware-drivers.md @@ -1,229 +1,133 @@ # :cpu: Hardware Sensor Architecture & Driver Implementation -LocalTelemetry reads low-level hardware registers directly from kernel drivers, vendor-provided dynamic link libraries, and Windows performance counters. +LocalTelemetry reads low-level hardware registers directly from kernel drivers, vendor dynamic link libraries, and Windows performance counters. ## :layers: Hardware Sensor Architecture ```mermaid -%%{init: {'theme': 'dark', 'themeVariables': {'fontSize': '13px'}, 'flowchart': {'nodeSpacing': 25, 'rankSpacing': 30, 'curve': 'basis'}}}%% +%%{init: {'theme': 'dark', 'themeVariables': {'fontFamily': 'Inter, system-ui, sans-serif', 'fontSize': '13px'}, 'flowchart': {'htmlLabels': true, 'nodeSpacing': 28, 'rankSpacing': 32, 'padding': 18, 'curve': 'basis'}}}%% flowchart TD - Lifecycle[["HardwareLifecycleManager.cs
Power & Display Reset Coordinator"]] - Core[["LocalTelemetry.Core
HardwareMonitor.cs Polling Coordinator"]] - - subgraph Processors["1. Processor Telemetry Pipelines"] - direction TB - subgraph CpuChain["CPU Telemetry (MSRs & SMU)"] - direction TB - IntelPawn{{"Intel: PawnIO IntelMSR
0x1A2 TjMax & 0x1B1 Temp"}} - IntelGadget{{"Fallback: Intel Power Gadget"}} - AmdPawn{{"AMD: PawnIO RyzenSMU
PM Table Clocks & Power"}} - AmdFallback{{"Fallback: Win32 WMI"}} - - IntelPawn -.->|Absent| IntelGadget - AmdPawn -.->|Absent| AmdFallback - end - - subgraph GpuChain["GPU Telemetry (Native Drivers & WDDM)"] - direction TB - Nvml{{"NVIDIA: NvGpuMonitor (nvml.dll)"}} - Adl{{"AMD: AmdGpuMonitor (atiadlxx.dll)"}} - Igcl{{"Intel: IntelGpuMonitor (ControlLib.dll)"}} - WddmFallback{{"Universal Windows Fallback: WddmGpuMonitor
DirectX D3DKMTQueryStatistics"}} - - Nvml -.->|Absent| WddmFallback - Adl -.->|Absent| WddmFallback - Igcl -.->|Absent| WddmFallback - end + Lifecycle["HardwareLifecycleManager.cs
Power & Display Reset Coordinator"] + Core["LocalTelemetry.Core
HardwareMonitor.cs Polling Coordinator"] + + %% 1. CPU TELEMETRY PIPELINE + subgraph CpuChain["1. CPU Telemetry Pipeline (MSRs, SMU & Kernel)"] + IntelPawn["Intel Core / Xeon
PawnIO IntelMSR (0x1A2 & 0x1B1)"] + AmdPawn["AMD Ryzen / EPYC
PawnIO RyzenSMU (PM Table)"] + WinCpu["Windows Kernel
GetSystemTimes (CPU Load %)"] + + CpuFallback["Universal CPU Fallback
WMI ACPI Thermal & Intel Power Gadget"] + + IntelPawn -.->|Absent| CpuFallback + AmdPawn -.->|Absent| CpuFallback end - subgraph SystemSensors["2. Storage, Network & Battery Telemetry"] - direction TB - DiskIO{{"PhysicalDisk PDH Counters (Bytes/sec)"}} - DiskMeta{{"DiskQuery.cs IOCTLs (Storage Bus & Boot)"}} - NetStats{{"NetworkInterface (IPv4 Rx/Tx Octets)"}} - EseReader{{"EseNetworkUsageReader.cs (SRUM DB)"}} - BatStats{{"Battery (GetSystemPowerStatus & WMI)"}} + %% 2. GPU TELEMETRY PIPELINE + subgraph GpuChain["2. GPU Telemetry Pipeline (Native Drivers & WDDM)"] + Nvml["NVIDIA GeForce / RTX
NvGpuMonitor (nvml.dll)"] + Adl["AMD Radeon
AmdGpuMonitor (atiadlxx.dll)"] + Igcl["Intel Arc / Iris
IntelGpuMonitor (ControlLib.dll)"] + + WddmFallback["Universal GPU Fallback
WddmGpuMonitor (PDH Engine & Memory)"] + + Nvml -.->|Absent| WddmFallback + Adl -.->|Absent| WddmFallback + Igcl -.->|Absent| WddmFallback + end - NetStats -.->|Backfill| EseReader + %% 3. STORAGE, NETWORK & BATTERY + subgraph SystemSensors["3. Storage, Network & Battery Telemetry"] + DiskIO["Physical Disks
PDH Bytes/sec & DiskQuery IOCTL"] + NetStats["Network Interfaces
IPv4 Octets & SRUM DB Backfill"] + BatStats["System Battery
GetSystemPowerStatus & root\wmi"] end Lifecycle -->|"Reset triggers"| Core - Core --> Processors - Processors --> SystemSensors + Core ==>|"1. Poll CPU registers"| CpuChain + CpuChain ==>|"2. Poll GPU drivers"| GpuChain + GpuChain ==>|"3. Poll storage & network"| SystemSensors class Core,Lifecycle coreNode - class IntelPawn,AmdPawn,Nvml,Adl,Igcl,DiskIO,DiskMeta,NetStats,EseReader,BatStats driverNode - class IntelGadget,AmdFallback,WddmFallback fallbackNode + class IntelPawn,AmdPawn,WinCpu,Nvml,Adl,Igcl,DiskIO,NetStats,BatStats driverNode + class CpuFallback,WddmFallback fallbackNode classDef coreNode fill:#1e1b4b,stroke:#6366f1,stroke-width:2px,color:#ffffff classDef driverNode fill:#0a192f,stroke:#38bdf8,stroke-width:2px,color:#e0f2fe classDef fallbackNode fill:#1e293b,stroke:#94a3b8,stroke-width:2px,color:#f1f5f9 ``` -## :file-text: Hardware Sensor Sources Summary - -| Metric Category | Primary API Source | Fallback / Alternative | -| :--- | :--- | :--- | -| **CPU Usage** | `GetSystemTimes` (Win32 kernel32 API) | Per-core `\Processor Information(*)\% Processor Utility` (PDH) | -| **CPU Temperature** | `PawnIO IntelMSR` (MSR `0x1B1` / `0x1A2`) | `PawnIO RyzenSMU` (AMD PM Table) / `IntelPowerGadget.cs` | -| **CPU Frequency** | `PawnIO APERF/MPERF` MSR delta | `IntelPowerGadget.cs` (live clocks) / `CallNtPowerInformation` baseline | -| **CPU Package Power** | RAPL Energy Status MSRs (`0x606` / `0x611`) | `IntelPowerGadget.cs` / Estimated TDP calculation | -| **RAM Usage** | `GlobalMemoryStatusEx` (Win32 API) | N/A | -| **GPU Utilization** | `NVML` (NVIDIA) / `ADL` (AMD) / `IGCL` (Intel) | `WddmGpuMonitor.cs` (WDDM Engine Counters via D3DKMT) | -| **GPU Temperature** | `nvmlDeviceGetTemperature` | `ADL_Overdrive6_Temperature_Get` / IGCL | -| **GPU VRAM Usage** | `nvmlDeviceGetMemoryInfo` | ADL VRAM queries / WDDM VRAM Counters | -| **Disk Throughput** | `\PhysicalDisk(*)\Disk Read & Write Bytes` | `DiskQuery.cs` (Win32 IOCTLs) | -| **Network Speeds** | `NetworkInterface.GetIPv4Statistics()` delta | `EseNetworkUsageReader.cs` (Windows ESE SRUDB database) | -| **Battery Level & W** | `GetSystemPowerStatus` & `root\wmi` | N/A (Desktop systems return empty / disabled) | - ---- - -## :shield: Kernel Access with PawnIo - -### :cpu: PawnIo Driver Architecture & Micro-Scripts - -To read CPU package temperatures, MSR (Model-Specific Register) values, and AMD Ryzen SMU metrics, LocalTelemetry utilizes the **PawnIo** kernel driver interface located in [`src/LocalTelemetry.Core/Hardware/PawnIo/`](https://github.com/Nicconike/LocalTelemetry/tree/master/src/LocalTelemetry.Core/Hardware/PawnIo): - -- **Silent Elevation Setup**: `PawnIoDevice.TryInstall` executes `PawnIO_setup.exe -install -silent` and configures the `PawnIO` kernel service. Because the host process is elevated at launch via `app.manifest`, the installation runs without prompting for additional UAC confirmations. -- **Embedded Binary Scripts (`.bin` Resources)**: - `LocalTelemetry.Core` embeds pre-compiled PawnIO hardware definition micro-scripts uploaded to the driver on initialization: - - `AMDFamily0F.bin`, `AMDFamily10.bin`, `AMDFamily17.bin`: AMD CPU family models and MSR/SMU routines - - `RyzenSMU.bin`: Ryzen SMU mailbox interface for Zen 2, Zen 3, Zen 4, and Zen 5 architectures - - `IntelMSR.bin`, `IntelMCHBAR.bin`: Intel MSR and memory controller hub BAR access - - `IntelOOBMSM.bin`, `IntelPCHThermal.bin`: Intel Out-of-Band management and PCH thermal sensors - - `DellSMM.bin`: Dell System Management Mode fan and thermal controls - - `IsaBridgeEC.bin`, `LpcCrOSEC.bin`, `LpcIO.bin`: Embedded Controller (EC) and Super I/O chip access - - `SmbusI801.bin`, `SmbusIntelSkylakeIMC.bin`, `SmbusNCT6793.bin`, `SmbusPIIX4.bin`: SMBus controller interfaces - -### :binary: Driver Handle Management & IOCTL Dispatch - -- Transport communication occurs via `DeviceIoControl` with Windows kernel driver handles (`\\.\PawnIO`). -- Handles are safely wrapped in disposable abstractions (`IPawnIoTransport`) and closed during application shutdown to avoid leaving dangling driver locks. - --- -## :flame: CPU Telemetry: Intel vs AMD - -### :microchip: CPU Architecture Detection - -At startup, `HardwareMonitor.cs` inspects the processor vendor string via CPUID instruction queries to route queries to dedicated readers: - -- `GenuineIntel`: Routes to `IntelMsrReader.cs` and `IntelPowerGadget.cs` -- `AuthenticAMD`: Routes to `AmdMsrReader.cs` +## :file-text: Sensor Sources & Fallback Hierarchy -### :calculator: Intel Package Temperature & TjMax (MSR 0x1A2 & 0x1B1) - -In `IntelMsrReader.cs`, Intel processor temperatures are computed using package-level thermal status: - -1. **Target Temperature (`MSR_IA32_TEMPERATURE_TARGET` = `0x1A2`)**: - Reads target junction limit: - - ```csharp - int tjMax = (int)((tjTarget >> 16) & 0xFF); - ``` - -2. **Package Thermal Status (`MSR_IA32_PACKAGE_THERM_STATUS` = `0x1B1`)**: - Reads digital readout delta relative to TjMax: - - ```csharp - int digitalReadout = (int)((thermStatus >> 16) & 0xFF); - ``` - -3. **Current Package Temperature**: - $$\text{Temperature (°C)} = \text{tjMax} - \text{digitalReadout}$$ - -### :zap: AMD Ryzen Temperature Resolution & Fallback Hierarchy - -In `AmdMsrReader.cs` and `HardwareMonitor.cs`, AMD processor temperatures resolve across a 3-tier hierarchy: - -1. **Primary: SMN Register 0x00059800 (`THM_TCON_CUR_TMP`)**: - - Supported across AMD Zen 1 through Zen 5 architectures using `AMDFamily17.bin`. - - Dispatches `ioctl_read_smn` targeting System Management Network (SMN) register `0x00059800`. - - Decodes temperature bitfields: - - ```csharp - uint raw = (uint)(result[0] & 0xFFFFFFFF); - uint curTemp = (raw >> 21) & 0x7FF; - float temp = curTemp * 0.125f; - ``` - - - Validates that decoded temperature falls between `10°C` and `125°C`. - -2. **Secondary Fallback: SMU Power Management Table (PM Table)**: - - Falls back to `RyzenSMU.bin` on legacy Ryzen platforms or when SMN yields zero. - - Calls `ioctl_resolve_pm_table` to locate the SMU PM table structure in memory. - - Invokes `ioctl_update_pm_table` to refresh telemetry data. - - Iterates across `PM_TABLE_ENTRY_COUNT = 128` entries. Decodes valid entries using `TryDecodeTemperature` to return peak package temperature. - -3. **Tertiary Fallback: ACPI Thermal Zone WMI Query**: - - If kernel driver calls fail or return zero, `HardwareMonitor.cs` queries Windows Management Instrumentation (`root\wmi`). - - Queries `SELECT CurrentTemperature FROM MSAcpi_ThermalZoneTemperature`. - - Converts raw tenth-degree Kelvin values to Celsius: - - $$\text{Temperature (°C)} = \frac{\text{rawKelvin10} - 2732}{10.0}$$ - - - Validates that computed temperature falls between `15°C` and `125°C`. +| Metric Category | Primary API Source (by Vendor / Subsystem) | Fallback / Alternative | +| :--- | :--- | :--- | +| **CPU Usage** | `GetSystemTimes` (Win32 kernel32 API) | None (returns `0%` on failure) | +| **CPU Temperature** | **Intel:** `PawnIO IntelMSR` (MSR `0x1B1` / `0x1A2`)
**AMD:** `PawnIO RyzenSMU` (PM Table) | `MSAcpi_ThermalZoneTemperature` (WMI ACPI) | +| **CPU Frequency** | `PawnIO APERF/MPERF` MSR delta $\times$ `_maxCpuMhz` | `IntelPowerGadget` (`EnergyLib64.dll`) / None | +| **CPU Package Power** | `RAPL` Energy Status MSRs (`0x606` / `0x611`) | None (returns `0W` on failure) | +| **RAM Usage** | `GlobalMemoryStatusEx` (Win32 API) | None | +| **GPU Utilization** | **NVIDIA:** `NVML` (`nvml.dll`)
**AMD:** `ADL` (`atiadlxx.dll`)
**Intel:** `IGCL` (`ControlLib.dll`) | `WddmGpuMonitor.cs` (PDH `\GPU Engine(*)\Utilization Percentage`) | +| **GPU Temperature** | **NVIDIA:** `nvmlDeviceGetTemperature`
**AMD:** `ADL_Overdrive5_Temperature_Get`
**Intel:** `ctlEnumTemperatureSensors` | None (returns `0°C` on missing vendor API) | +| **GPU VRAM Usage** | **NVIDIA:** `nvmlDeviceGetMemoryInfo`
**AMD:** `ADL_Adapter_MemoryInfo_Get`
**Intel:** `ctlEnumMemoryModules` / `ctlMemoryGetState` | `WddmGpuMonitor.cs` (PDH `\GPU Adapter Memory(*)\Shared Usage`) | +| **GPU Power Draw** | **NVIDIA:** `nvmlDeviceGetPowerUsage`
**AMD:** `ADL_Overdrive5_PowerLimit_Get`
**Intel iGPU:** Intel RAPL PP1 MSR (`0x641`) | None (returns `0W` on missing sensor) | +| **Disk Throughput** | `\PhysicalDisk(_Total)\Disk Read & Write Bytes/sec` (PDH) | None (metadata like NVMe/SATA handled by `DiskQuery.cs`) | +| **Network Speeds** | `NetworkInterface.GetIPv4Statistics()` per-tick delta | None (ESE SRUM DB used only for historical offline backfill) | +| **Battery Level & W** | `GetSystemPowerStatus` (Level/Status) & `root\wmi` `BatteryStatus` (Watts) | None (Desktop systems without battery return empty / 0) | --- -## :refresh-cw: Dynamic GPU Reset & TDR Recovery +## :shield: Kernel Access with PawnIO -When Windows display adapters restart (e.g. driver update, GPU TDR recovery, or waking from sleep), hardware monitors must re-initialize without crashing the host process: +### Driver Provisioning & Micro-Scripts -- `HardwareMonitor.cs` implements `ResetGpuMonitors(string reason)`: - - `_nvGpu?.Reset()`: Re-initializes NVML handles and device contexts. - - `_wddmGpu?.Reset()`: Flushes cached D3DKMT adapter handles and re-queries adapter statistics. - - `_amdGpu?.Reset()`: Rebinds ADL context. - - `_intelGpu?.Reset()`: Rebinds Intel ControlLib context. -- When waking from system standby, `HardwareLifecycleManager` delays recovery by `3000 ms` to allow PCIe buses and graphics drivers to reach operational power states before querying registers. +`LocalTelemetry.Core/Hardware/PawnIo/` manages direct communication with the PawnIO kernel driver: ---- +- **Silent Setup**: `PawnIoDevice.TryInstall` executes `PawnIO_setup.exe -install -silent` during elevated setup. +- **Embedded Scripts (`.bin`)**: Uploads pre-compiled hardware definition micro-scripts to the driver on initialization: + - `IntelMSR.bin`, `IntelMCHBAR.bin`: Intel MSR and memory controller hub BAR access. + - `RyzenSMU.bin`: Ryzen SMU mailbox interface for Zen 2 through Zen 5 architectures. + - `AMDFamily17.bin`: AMD CPU family models and MSR/SMU routines. -## :hard-drive: Disk Telemetry: Performance Counters & IOCTL Storage Queries +### Kernel Security Model & Windows 11 HVCI / VBS Compliance -### :activity: PhysicalDisk Performance Counters (I/O Rates) +LocalTelemetry and PawnIO comply with strict Windows 11 security policies: -- Read and write speeds are polled directly through Windows `PhysicalDisk` Performance Counters: - - `\PhysicalDisk(_Total)\Disk Read Bytes/sec` & `Disk Write Bytes/sec` - - Per-disk instance counters: `\PhysicalDisk(0 C:)\...`, `\PhysicalDisk(1 D:)\...` -- Disks are registered dynamically in `Metrics.RegisterDisk("disk0", "DISK0")` to allow per-drive layout customization. +- **Microsoft WHQL Digital Signature**: The PawnIO driver binary carries an authentic Microsoft Windows Hardware Quality Labs (WHQL) signature. Windows loads the driver without requiring Test Signing or disabling Driver Signature Enforcement (DSE). +- **Virtualization-Based Security (VBS) & HVCI**: Hypervisor-Enforced Code Integrity (HVCI) blocks vulnerable drivers. PawnIO executes isolated micro-scripts and does not perform arbitrary physical memory writes. It complies with Microsoft Memory Integrity requirements. +- **Zero Kernel Hooking**: The driver does not hook the SSDT, patch kernel functions, or intercept system calls. It only executes specific, read-only MSR and PCI configuration queries. +- **Graceful Uninstallation**: The uninstaller invokes `pnputil.exe /delete-driver /uninstall /force` to completely remove the driver package from the Windows DriverStore. -### :hard-drive: Win32 Storage IOCTL & Boot Drive Detection (DiskQuery) +### Intel Processor Registers -- `DiskQuery.cs` queries physical drive descriptors: - - `IOCTL_STORAGE_QUERY_PROPERTY`: Queries storage bus type (`NVMe`, `SATA`, `SCSI`, `USB`), device media type (SSD vs HDD), and vendor labels. - - `IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS`: Maps logical Windows drive letters (`C:`, `D:`) to underlying physical disk indices. - - Resolves the official Windows `Boot` drive badge. - - Standardized display labels: single drive of a type displays without an index (`NVMeR`, `SATAR`), while multiple drives append a 1-based index (`NVMe1R`, `NVMe2R`, `SATA1W`). +- **TjMax (Maximum Junction Temp)**: Read from MSR `0x1A2` (`IA32_TEMPERATURE_TARGET`). Bits `[23:16]` define TjMax in °C. +- **Current Temperature**: Read from MSR `0x1B1` (`IA32_PACKAGE_THERM_STATUS`). Current temp = `TjMax - DigitalReadout`. +- **Package Energy**: Read from MSR `0x606` (`MSR_RAPL_POWER_UNIT`) and MSR `0x611` (`MSR_PKG_ENERGY_STATUS`). +- **Core Clocks**: Read from APERF (MSR `0xE8`) and MPERF (MSR `0xE7`) deltas to calculate true effective frequency. ---- +### AMD Ryzen SMU PM Table -## :network: Historical Bandwidth Extraction (EseNetworkUsageReader) +AMD Ryzen processors expose telemetry through the System Management Unit (SMU) mailbox: -- `EseNetworkUsageReader.cs` queries the Windows System Resource Usage Monitor database (`C:\Windows\System32\sru\SRUDB.dat`). -- Uses the native Windows Extensible Storage Engine (`esent.dll`) P/Invoke interface: - - Attaches to the database in read-only recovery mode. - - Scans table `{973F5D5C-1D90-4944-BE8E-24B94231A174}` for network interface data usage. - - Maps interface GUIDs to physical adapter names. - - Feeds historical daily upload and download octets into `TrafficHistoryStore.cs` for calendar display. -- **Backup Importer Subsystems**: `JsonlTrafficImporter.cs` parses line-delimited JSON usage records from `internet_usage.jsonl` backup files. `DatImporter.cs` parses legacy plaintext `.dat` files. Both merge records into `TrafficHistoryStore.cs`. +- Writes SMU commands through PCI configuration registers to request the power management (PM) table address. +- Maps physical table addresses into user-mode memory via PawnIO. +- Decodes true package power, core clock frequencies, and core temperatures for Zen architectures. --- -## :battery-charging: Battery Telemetry: Win32 & WMI Subsystems +## :gpu: GPU Hardware Interfaces -- **Charge State & Level**: Samples remaining battery percentage and AC power connection status via `GetSystemPowerStatus`. -- **Real-Time Charge / Discharge Rate**: Queries WMI `root\wmi:BatteryStatus` to sample remaining milliwatt-hours (`mWh`). Delta over time intervals calculates real-time rate in Watts (`W`). -- **Hardware Metadata Extraction**: Inspects WMI `root\wmi:BatteryStaticData` and `Win32_Battery` to extract authentic manufacturer name, device model, designed capacity, and full charge capacity. -- **Battery Health & Wear Percentage**: `SystemInfo.GetBatteryHealthPct()` computes health via `(FullChargedCapacity / DesignCapacity) * 100`. `SystemInfo.GetBatteryWearLevelPct()` calculates wear percentage. -- **Charge Cycle Count**: `SystemInfo.GetBatteryCycleCount()` queries `root\wmi:BatteryCycleCount` for total lifetime hardware charge cycles. -- **Virtual Battery Filtering**: Automatically filters out virtual battery stubs (e.g. `-Virtual Battery 0-`, `CRB Battery 0`), prioritizing physical battery hardware. +### NVIDIA (NVML) +- Dynamically loads `nvml.dll` from `C:\Windows\System32`. +- Queries `nvmlDeviceGetUtilizationRates`, `nvmlDeviceGetTemperature`, `nvmlDeviceGetMemoryInfo`, and `nvmlDeviceGetPowerUsage`. ---- +### AMD Radeon (ADL) +- Dynamically loads `atiadlxx.dll` or `atiadlxy.dll`. +- Uses ADL Overdrive 5 interfaces (`ADL_Overdrive5_Temperature_Get`, `ADL_Overdrive5_CurrentActivity_Get`, `ADL_Overdrive5_PowerLimit_Get`) for clocks, temperatures, and power limits. -## :shield-check: Driver Security & Cleanup Protocols +### Intel Arc (IGCL) +- Loads `ControlLib.dll` to query Intel discrete GPU telemetry. -- **Driver Whitelist Verification**: All binary scripts uploaded to `PawnIO` are signed embedded resources compiled directly into `LocalTelemetry.Core.dll`. -- **Driver Uninstallation & DriverStore Removal**: - - The Inno Setup uninstaller and portable `Uninstall.bat` invoke `pnputil.exe /delete-driver /uninstall /force` to purge `pawnio.inf` from the Windows DriverStore. - - If Windows reports that the kernel driver handle is locked in memory (exit code `3010`), the user is prompted to restart the system before reinstalling. +### Universal Windows Fallback (WDDM 3.x) +- When dedicated vendor libraries are absent, `WddmGpuMonitor.cs` queries the Windows Performance Data Helper (PDH) wildcard counters. +- Collects `\GPU Engine(*)\Utilization Percentage` for 3D/compute engine load and `\GPU Adapter Memory(*)\Shared Usage` for VRAM telemetry. diff --git a/docs/latest/developer-guide/index.md b/docs/latest/developer-guide/index.md index c379d03..6c89cc2 100644 --- a/docs/latest/developer-guide/index.md +++ b/docs/latest/developer-guide/index.md @@ -1,25 +1,25 @@ # :code-xml: Developer Guide & Architecture -Welcome to the **LocalTelemetry Developer Guide**. This documentation covers system architecture, hardware sensor drivers, Win32 taskbar integration, IPC protocols, and automated build pipelines. +Welcome to the **LocalTelemetry Developer Guide**. This section describes system architecture, hardware sensor drivers, Win32 taskbar integration, IPC protocols, and automated build pipelines. ## :layers: High-Level System Architecture -LocalTelemetry is composed of three main C# / .NET 10 projects, three automated test suites, and an embedded Svelte 5 frontend: +LocalTelemetry comprises three C# (.NET 11) projects, an embedded Svelte 5 frontend, and automated test suites: ```mermaid -%%{init: {'theme': 'dark', 'themeVariables': { 'fontSize': '13px' }, 'flowchart': {'nodeSpacing': 28, 'rankSpacing': 35, 'curve': 'basis'}}}%% +%%{init: {'theme': 'dark', 'themeVariables': {'fontFamily': 'Inter, system-ui, sans-serif', 'fontSize': '13px'}, 'flowchart': {'htmlLabels': true, 'nodeSpacing': 30, 'rankSpacing': 36, 'padding': 18, 'curve': 'basis'}}}%% flowchart TD %% Rank 1: Sensors - PawnIo[["PawnIO Driver
Intel & AMD MSRs / SMU"]] - GpuApis[["GPU & System APIs
NVML • ADL • WDDM • PDH"]] + PawnIo["PawnIO Driver
Intel & AMD MSRs / SMU"] + GpuApis["GPU & System APIs
NVML • ADL • WDDM • PDH"] %% Rank 2: Core - Core[["LocalTelemetry.Core (.NET 10)
Hardware Sensing Engine"]] - Storage[("Storage & System State
settings.json • hardware_state.json")] + Core["LocalTelemetry.Core (.NET 11)
Hardware Sensing Engine"] + Storage["Storage & System State
settings.json • hardware_state.json"] %% Rank 3: Apps - App(["LocalTelemetry.App (WPF)
Taskbar & Tray Host"]) - Notifier(["LocalTelemetry.Notifier
Out-of-Process Toasts"]) + App["LocalTelemetry.App (WPF)
Taskbar & Tray Host"] + Notifier["LocalTelemetry.Notifier
Out-of-Process Toasts"] %% Rank 4: Shell Integration Taskbar["Windows Taskbar Overlay
GDI+ Docked HWND Surface"] @@ -53,7 +53,6 @@ flowchart TD class SvelteUI uiNode class ToastAlerts alertNode - %% Semantically Justified Color Palette classDef driverNode fill:#0a192f,stroke:#38bdf8,stroke-width:2px,color:#e0f2fe classDef coreNode fill:#1e1b4b,stroke:#6366f1,stroke-width:2px,color:#ffffff classDef dataNode fill:#271803,stroke:#f59e0b,stroke-width:2px,color:#fef3c7 @@ -64,80 +63,45 @@ flowchart TD classDef alertNode fill:#3b0717,stroke:#f43f5e,stroke-width:2px,color:#ffe4e6 ``` -## :map: Guide Roadmap & Subsystems +## :map: Guide Subsystems ### :microchip: Hardware Sensing & Kernel Drivers - -- **Responsibility**: Low-level processor register reading via `PawnIO` (Intel MSRs, AMD Ryzen SMU PM table), vendor GPU interfaces (NVML, ADL, ControlLib), WDDM GPU counters, and Win32 disk queries (`DiskQuery.cs`). +- Low-level processor register reading via `PawnIO` (Intel MSRs, AMD Ryzen SMU PM tables). +- Vendor GPU interfaces (NVML, ADL, ControlLib) and WDDM fallbacks. +- Physical storage query interfaces via Win32 IOCTLs (`DiskQuery.cs`). +- See [Hardware Drivers Architecture](./hardware-drivers.md). ### :localtelemetry: C# Monitoring Engine - -- **Responsibility**: Hardware monitoring coordinator (`HardwareMonitor.cs`), component fingerprinting (`HardwareInventory.cs`), network traffic store (`TrafficHistoryStore.cs`), and JSON configuration persistence (`AppSettings.cs`). - -### :layout-dashboard: Win32 Taskbar Hook & Transparent Overlay - -- **Responsibility**: High-performance GDI+ render surface embedded into Windows taskbar (`Shell_TrayWnd`), 5-second watchdog timer, 200ms repositioning loop, and low-level mouse hooking (`WH_MOUSE_LL`). +- Coordinates background sensor polling (`HardwareMonitor.cs`). +- Discovers and caches system specifications (`HardwareInventory.cs`). +- Records daily network traffic (`TrafficHistoryStore.cs`). +- Manages atomic configuration persistence (`AppSettings.cs`). +- See [Backend Architecture](./backend-architecture.md). + +### :layout-dashboard: Taskbar Overlay & Win32 Interop +- GDI+ render surface embedded into native taskbar processes (`Shell_TrayWnd`). +- Repositioning loop (200 ms) and Explorer crash recovery watchdog (5 s). +- Low-level mouse hook (`WH_MOUSE_LL`) for clicks and double-click actions. +- See [Taskbar Overlay & Win32 Interop](./taskbar-overlay-interop.md). ### :globe: Svelte 5 & WebView2 Settings UI +- Single-page application built with Svelte 5 runes (`$state`, `$derived`, `$effect`), TypeScript, and Vite. +- Bidirectional JSON messaging bridge over `window.chrome.webview`. +- See [Frontend & WebView2 Architecture](./frontend-webview.md). -- **Responsibility**: Modern dark-mode configuration UI built with Svelte 5 runes (`$state`, `$derived`, `$effect`), Vite, Bun, and TypeScript. Communicates with WPF via bidirectional `window.chrome.webview` JSON WebMessages. - -### :bell: Toast Notifier IPC Pipe Subsystem +### :bell: Out-of-Process Notifier +- Standalone helper process (`LocalTelemetry.Notifier.exe`) communicating via Named Pipes. +- Displays non-activating slide-in toast windows (`WS_EX_NOACTIVATE`) that never interrupt games. +- See [Notifier IPC Subsystem](./notifier-ipc.md). -- **Responsibility**: Standalone out-of-process toast helper (`LocalTelemetry.Notifier.exe`) communicating via Named Pipes (`LocalTelemetryNotifier`) with focus-safe window styles (`WS_EX_NOACTIVATE`). - -### :package: Build System, Inno Setup & CI/CD - -- **Responsibility**: Automated MSBuild packaging, Inno Setup 7 bootstrapper installer (`setup.iss`), portable cleanup tools (`Uninstall.bat`), and 8 GitHub Actions workflows adhering to OpenSSF Scorecard standards. +--- ## :wrench: Subsystem Directory Reference -| Directory / Project | Language / Platform | Primary Responsibilities | +| Project / Directory | Target Framework | Primary Responsibilities | | :--- | :--- | :--- | -| `src/LocalTelemetry.Core` | C# 13 / .NET 10 | Hardware sensors, PawnIo MSR/SMU reader, `DiskQuery`, `HardwareInventory`, network logging | -| `src/LocalTelemetry.App` | C# 13 / WPF / WebView2 | Host window, Taskbar overlay docking, system tray icon, alerts, settings shell | -| `src/LocalTelemetry.Notifier` | C# 13 / WinForms | Out-of-process toast notifications, named pipe server, cubic ease-out slide-in animations | -| `src/.../Settings/wwwroot` | Svelte 5 / TypeScript | Single-page settings panel application, themes, stores, WebView2 IPC bridge | -| `tests/LocalTelemetry.Core.Tests` | C# / xUnit | Automated unit testing for hardware sensors, disk queries, inventory, models, and config | -| `tests/LocalTelemetry.App.Tests` | C# & Vitest | Unit tests for alert service, Win32 embedder, tray manager, and Svelte components | -| `tests/LocalTelemetry.Notifier.Tests` | C# / xUnit | Automated testing for pipe server, notifier logging, and toast forms | -| `docs/` | VitePress / Markdown | Technical documentation site, Lucide icon extensions, version switcher | - -## :lightbulb: Recommended Reading Paths - -### :cpu: Hardware & Kernel Subsystems - -1. [**Hardware Sensor Architecture & Driver Implementation**](./hardware-drivers.md): Deep dive into PawnIo MSR registers, Ryzen SMU PM table resolution, and Win32 disk IOCTLs. -2. [**Backend Architecture & Telemetry Engine**](./backend-architecture.md): Exploration of `HardwareMonitor.cs`, `SystemInfo.cs`, and `HardwareInventory.cs`. - -### :monitor: Windows UI & System Interop - -1. [**Taskbar Overlay & Win32 Interop**](./taskbar-overlay-interop.md): Win32 `SetParent` reparenting, taskband shrinking, layered floating window fallback, and Explorer crash recovery. -2. [**Toast Notifier & Inter-Process Communication (IPC)**](./notifier-ipc.md): Process isolation, named pipe IPC, and non-blocking toast animations. - -### :code-xml: Frontend & Application Configuration - -1. [**Frontend Architecture & WebView2 Integration**](./frontend-webview.md): Svelte 5 runes architecture, reactive stores, CSS variables, and bidirectional JSON message catalogs. -2. [**Contributing & Coding Standards**](./contributing.md): Pull request requirements, Conventional Commits, and brand color palettes. - -### :bookmark: Reference & Technical Specifications - -1. [**C# Core API & Telemetry Models**](./reference/core-api.md): Public types, sensor monitor interfaces, hardware inventory models, and logging APIs. -2. [**IPC Protocols & WebMessage Specifications**](./reference/ipc-protocol.md): JSON contract specifications for WebView2 communication and Named Pipe toast payloads. -3. [**settings.json Configuration Schema**](./reference/settings-schema.md): Configuration file schema, default values, and data type specifications. - -## :book-open: Developer Guide Navigation - -- [**Development Environment Setup**](./setup.md): Tools, SDKs, and step-by-step commands to build the project locally -- [**Repository Structure**](./repository-structure.md): Detailed directory map of the solution, source code, and tests -- [**Backend Architecture & Telemetry Engine**](./backend-architecture.md): In-depth look at `AppSettings.cs`, `HardwareMonitor.cs`, `HardwareInventory.cs`, and `SystemInfo.cs` -- [**Hardware Drivers & Sensor Polling**](./hardware-drivers.md): Detailed hardware register mappings, MSRs, NVML, ADL, PDH, and PawnIo -- [**Win32 Taskbar Hooking & Overlay Interop**](./taskbar-overlay-interop.md): Deep dive into `SetParent` reparenting, taskband shrinking, layered floating fallback, and Explorer recovery -- [**Svelte 5 Frontend & WebView2 Bridge**](./frontend-webview.md): Svelte 5 runes architecture and bidirectional C# <-> JS JSON messaging sequence -- [**Toast Notifier & Inter-Process Communication (IPC)**](./notifier-ipc.md): Named Pipe IPC protocol, `HiddenForm` message pump, and cubic ease-out slide-in animations -- [**C# Core API & Telemetry Models**](./reference/core-api.md): Public classes, sensor interfaces, inventory data structures, and logging methods -- [**IPC Protocols & WebMessage Specifications**](./reference/ipc-protocol.md): Complete message schemas for WebView2 RPC and Named Pipe notifications -- [**settings.json Configuration Schema**](./reference/settings-schema.md): Exhaustive JSON schema definition for application configuration -- [**Building & Packaging**](./building-and-packaging.md): Compiling single-file executables, Inno Setup 7 installer scripts, and portable ZIPs -- [**CI/CD Pipelines & GitHub Workflows**](./ci-cd.md): Breakdown of all 8 GitHub Actions workflows, OpenSSF 40-character SHA pinning, and SLSA attestations -- [**Contributing & Coding Standards**](./contributing.md): C# 13 standards, conventional commits, PR guidelines, and brand color additions +| `src/LocalTelemetry.Core` | .NET 11 | Hardware sensors, PawnIO MSR/SMU reader, SystemInfo, traffic store | +| `src/LocalTelemetry.App` | .NET 11 (WPF) | Taskbar overlay docking, system tray icon, alert service, settings window | +| `src/LocalTelemetry.Notifier` | .NET 11 (WinForms) | Out-of-process toast popups, named pipe server, non-activating window | +| `src/.../Settings/wwwroot` | Svelte 5 / TypeScript | Single-page settings UI, visual themes, WebView2 message client | +| `tests/` | xUnit & Vitest | Automated test suites for hardware, IPC, UI components, and packaging | diff --git a/docs/latest/developer-guide/notifier-ipc.md b/docs/latest/developer-guide/notifier-ipc.md index 9b89305..1b7439f 100644 --- a/docs/latest/developer-guide/notifier-ipc.md +++ b/docs/latest/developer-guide/notifier-ipc.md @@ -1,19 +1,21 @@ # :radio: Standalone Notifier IPC Subsystem -**LocalTelemetry.Notifier** is a standalone, lightweight WinForms executable (`LocalTelemetry.Notifier.exe`) targeting .NET 10 Windows x64, dedicated to rendering non-blocking desktop toast alert windows. +**LocalTelemetry.Notifier** is a standalone WinForms executable (`LocalTelemetry.Notifier.exe`) targeting .NET 11, dedicated to displaying non-blocking desktop toast windows. ## :shield-question-mark: Why a Standalone Process? -Rendering alert windows with slide-in animations and auto-dismiss timers inside the main application process carries two key risks: +Rendering alert windows with animations directly in the main host process introduces two risks: -1. **Focus Stealing**: Window activation during full-screen gaming or video playback could cause games to lose keyboard focus or minimize to desktop -2. **UI Thread Blocking**: Animation loops on the main UI thread could delay telemetry sensor polling ticks +1. **Focus Stealing**: Window activation during full-screen games or video playback can cause applications to lose keyboard focus or minimize to the desktop. +2. **UI Thread Blocking**: Animation timers on the main thread can delay hardware telemetry polling ticks. -By spinning up `LocalTelemetry.Notifier.exe` as a secondary process, notifications display smoothly without stealing foreground focus or blocking hardware monitoring threads. +Spinning up `LocalTelemetry.Notifier.exe` as an independent secondary process isolates toast windows so they never interrupt full-screen games. + +--- ## :audio-lines: Named Pipe IPC Communication -`LocalTelemetry.App` launches `LocalTelemetry.Notifier.exe` passing its **Parent Process ID (PID)** as `args[0]`. Inter-process communication takes place over an asynchronous Windows **Named Pipe** (`LocalTelemetryNotifier`). +`LocalTelemetry.App` starts `LocalTelemetry.Notifier.exe`, passing its **Parent Process ID (PID)** as `args[0]`. Communication takes place over an asynchronous Windows **Named Pipe** (`LocalTelemetryNotifier`): ```mermaid %%{init: {'theme': 'dark', 'themeVariables': {'fontSize': '13px'}, 'sequence': {'useMaxWidth': false, 'showSequenceNumbers': true}}}%% @@ -60,69 +62,39 @@ sequenceDiagram end ``` -## :recycle: On-Demand Process Lifecycle +--- -To conserve system resources, `LocalTelemetry.Notifier.exe` is **not** kept running unconditionally. `App.xaml.cs` dynamically controls the process lifecycle: +## :recycle: On-Demand Lifecycle Management -- **`EnsureNotifierLaunched()`**: Invoked on startup or when the user enables threshold alerts with toast notifications in Settings. Launches the executable with the current process ID as `args[0]`. -- **`EnsureNotifierStopped()`**: Invoked when alerts or toast notifications are disabled in Settings, or when LocalTelemetry is closing. Dispatches a `Shutdown` IPC message over the named pipe and waits up to 2 seconds for a clean shutdown before terminating the process. +`LocalTelemetry.Notifier.exe` runs only when threshold alerts and toast notifications are active: -### :file-code: JSON Message Contract (`NotificationMessage`) +- **`EnsureNotifierLaunched()`**: Starts the notifier process with the parent PID when alerts and toasts are enabled in Settings. +- **`EnsureNotifierStopped()`**: Dispatches a `Shutdown` message over the named pipe and waits up to 2 seconds for clean exit before killing the process. +- **Parent PID Watchdog**: If the main host crashes or terminates unexpectedly, the notifier's background watchdog detects parent termination and exits immediately. -`NotificationClient.cs` serializes messages over the pipe in UTF-8 JSON Lines format: +--- -```json -{ - "Action": "ShowToast", - "Title": "CPU Temperature Warning", - "Body": "CPU reached 88°C (Limit: 85°C)", - "Tag": "cpu_temp" -} -``` +## :hat-glasses: Non-Activating Window Styling (`WS_EX_NOACTIVATE`) + +`ToastForm.cs` configures Win32 window styles to prevent focus interruption: ```csharp -private sealed record NotificationMessage +protected override bool ShowWithoutActivation => true; + +protected override CreateParams CreateParams { - public string Action { get; set; } = string.Empty; - public string? Title { get; set; } - public string? Body { get; set; } - public string? Tag { get; set; } + get + { + const int WS_EX_NOACTIVATE = 0x08000000; + const int WS_EX_TOOLWINDOW = 0x00000080; + CreateParams cp = base.CreateParams; + cp.ExStyle |= WS_EX_NOACTIVATE | WS_EX_TOOLWINDOW; + return cp; + } } ``` -### :terminal: Command Actions - -- `ShowToast`: Triggers `ToastForm` rendering on screen with `Title` and `Body` -- `Shutdown`: Gracefully cancels `CancellationTokenSource` and closes `HiddenForm` - -## :hat-glasses: Hidden Message Pump (`HiddenForm`) - -Inside `Program.cs`, an invisible `HiddenForm` provides a WinForms message pump: - -- Hidden from Alt+Tab via `WS_EX_TOOLWINDOW` (`0x00000080`) extended window style -- `ShowInTaskbar = false`, `WindowState = Minimized`, `Opacity = 0` -- Receives pipe messages on a background thread (`RunPipeServerAsync`) and dispatches toast creation to the UI thread via `hiddenForm.BeginInvoke(...)` - -## :mop-sparkles: Toast Window Rendering & Animation - -Implemented in [`ToastForm.cs`](https://github.com/Nicconike/LocalTelemetry/blob/master/src/LocalTelemetry.Notifier/ToastForm.cs), the window renders a custom dark alert popup: - -- **Dimensions**: `320px` width × `90px` height. -- **Appearance**: Dark background (`Color.FromArgb(32, 32, 32)`), rounded corners (`CornerRadius = 8` via `GraphicsPath`), border pen (`Color.FromArgb(60, 60, 60)`). -- **Audio Cue**: Plays system exclamation sound (`SystemSounds.Exclamation.Play()`). -- **Ease-Out Slide-In Animation**: `OnLoad` animates the window position from below the screen working area using a cubic ease-out curve (`1.0 - Math.Pow(1.0 - t, 3)`) over `300ms`. -- **Auto-Dismiss**: A `System.Windows.Forms.Timer` automatically closes the toast window after `5000ms`. - -## :square-arrow-right-exit: Parent Process Monitoring & Auto-Exit - -When `LocalTelemetry.Notifier.exe` receives `parentPid` as `args[0]`: - -1. Launches a background worker task: `Process.GetProcessById(parentPid).WaitForExitAsync()`. -2. When the parent `LocalTelemetry.exe` process exits, the notifier process automatically logs exit and shuts down cleanly. - -## :file-text: Notifier Diagnostic Logging - -Implemented in [`NotifierLog.cs`](https://github.com/Nicconike/LocalTelemetry/blob/master/src/LocalTelemetry.Notifier/NotifierLog.cs), `LocalTelemetry.Notifier` records its operational lifecycle, named pipe connections, and toast animations directly to `lt_notifier.log`: - -- **File Location**: Uses the identical directory resolution rule as `AppSettings` (located in `%LOCALAPPDATA%\LocalTelemetry\lt_notifier.log` in standard mode, or alongside the executable in portable mode). -- **Clean Shutdown**: `NotifierLog.Shutdown()` flushes buffered log entries to disk when the message pump exits. +- `TopMost = true`: Keeps the toast visible above background windows. +- `WS_EX_TOOLWINDOW`: Hides the notification window from the Alt+Tab task switcher. +- `WS_EX_NOACTIVATE`: Prevents the window from stealing focus when displayed or animated. +- `ShowWithoutActivation`: Overrides standard WinForms focus behavior so keyboard input remains in the active game or application. diff --git a/docs/latest/developer-guide/reference/core-api.md b/docs/latest/developer-guide/reference/core-api.md index f5b722b..e045ca4 100644 --- a/docs/latest/developer-guide/reference/core-api.md +++ b/docs/latest/developer-guide/reference/core-api.md @@ -2,7 +2,7 @@ This document describes the public classes, interfaces, enums, and data contracts in `LocalTelemetry.Core`. -All components target **.NET 10** on Windows x64. +All components target **.NET 11** on Windows x64. --- @@ -25,6 +25,7 @@ public interface IHardwareLifecycleManager : IDisposable event Action? PowerResumed; event Action? NetworkTopologyChanged; event Action? DevicePnPChanged; + event Action? SessionLockStateChanged; void NotifyDisplayChanged(); void NotifyDevicePnPChanged(); @@ -36,7 +37,7 @@ public interface IHardwareLifecycleManager : IDisposable - **Namespace:** `LocalTelemetry.Core.Hardware` - **Implements:** `IHardwareLifecycleManager` -Singleton implementation that hooks Windows system events (`SystemEvents.PowerModeChanged`, `NetworkChange.NetworkAvailabilityChanged`, `NetworkChange.NetworkAddressChanged`) and processes debounced hardware state changes. +Singleton implementation that hooks Windows system events (`SystemEvents.PowerModeChanged`, `NetworkChange.NetworkAvailabilityChanged`, `NetworkChange.NetworkAddressChanged`, `SystemEvents.SessionSwitch`) and processes debounced hardware state changes. ```csharp [SupportedOSPlatform("windows")] @@ -56,6 +57,7 @@ public sealed class HardwareLifecycleManager : IHardwareLifecycleManager | `PowerResumed` | Operating system resumes from sleep or hibernation (`PowerModes.Resume`). | Waits 3 seconds for hardware warm-up, invokes `ResetGpuMonitors()` across all GPU backends, re-initializes network adapter counters, and resumes polling. | | `NetworkTopologyChanged` | IP address changes, network adapter connects/disconnects, or default gateway switches. | Refreshes NIC list and re-initializes network performance counters. | | `DevicePnPChanged` | Storage device arrival/removal or USB PnP event (`WM_DEVICECHANGE`). | Refreshes physical disk lists and SCSI/NVMe bus descriptors via `DiskQuery`. | +| `SessionLockStateChanged` | Windows workstation is locked (`SessionLock`) or unlocked (`SessionUnlock`). | Pauses polling loop during workstation lock to conserve CPU and power; resumes polling on unlock. | #### Timing Constants @@ -65,7 +67,7 @@ public sealed class HardwareLifecycleManager : IHardwareLifecycleManager --- -## :fingerprint-pattern: Hardware Inventory Subsystem +## :shelving-unit: Hardware Inventory Subsystem ### `HardwareInventory` @@ -289,15 +291,15 @@ public sealed record DiskSnapshot | `NetUpBps` | `double` | `Bytes/sec` | Current upload throughput rate across active network interfaces. | | `NetDownBytesDelta` | `double` | `Bytes` | Download byte differential transferred during the last polling interval. | | `NetUpBytesDelta` | `double` | `Bytes` | Upload byte differential transferred during the last polling interval. | -| `NetInterfaceName` | `string` | — | Display name of the network adapter currently routed. | +| `NetInterfaceName` | `string` | - | Display name of the network adapter currently routed. | | `NetTotalBytes` | `long` | `Bytes` | Cumulative bytes transferred since application launch. | -| `Disks` | `List` | — | List of individual physical disk snapshots. | +| `Disks` | `List` | - | List of individual physical disk snapshots. | | `DiskReadMbps` | `float` | `MB/s` | Aggregate disk read throughput in Megabytes per second. | | `DiskWriteMbps` | `float` | `MB/s` | Aggregate disk write throughput in Megabytes per second. | -| `PrimaryDiskType` | `string` | — | Bus interface label for the primary OS drive (`"NVMe"`, `"SATA"`, `"SSD"`, `"HDD"`). | +| `PrimaryDiskType` | `string` | - | Bus interface label for the primary OS drive (`"NVMe"`, `"SATA"`, `"SSD"`, `"HDD"`). | | `BatteryPct` | `float` | `%` | Remaining battery capacity percentage (0.0 if not installed). | -| `BatteryIsCharging` | `bool` | — | `true` when the battery is receiving active charging current. | -| `IsOnACPower` | `bool` | — | `true` when external AC line power is connected. | +| `BatteryIsCharging` | `bool` | - | `true` when the battery is receiving active charging current. | +| `IsOnACPower` | `bool` | - | `true` when external AC line power is connected. | | `BatteryChargeRateW` | `float` | `Watts` | Battery charge or discharge rate in Watts (positive = charge, negative = discharge). | | `Timestamp` | `DateTime` | `UTC` | Exact timestamp when sensor readings were captured. | diff --git a/docs/latest/developer-guide/reference/ipc-protocol.md b/docs/latest/developer-guide/reference/ipc-protocol.md index bbdf4d7..2429dda 100644 --- a/docs/latest/developer-guide/reference/ipc-protocol.md +++ b/docs/latest/developer-guide/reference/ipc-protocol.md @@ -25,7 +25,7 @@ interface WebMessageEnvelope { ## :log-in: Inbound WebMessage Catalog (Frontend -> C# Host) -The C# controller handles 11 inbound message types in `SettingsShell.xaml.cs`. +The C# controller handles 13 inbound message types in `SettingsShell.xaml.cs`. ### 1. `getSettings` @@ -157,11 +157,43 @@ Triggers an update check against the GitHub Releases API. - **Response:** Dispatches outbound `updateCheckResult` message. +### 12. `exportDatabase` + +Prompts the user with a Windows Save File Dialog to export all network usage history to a standalone `.jsonl` file. + +- **Payload:** + +```json +{ + "type": "exportDatabase", + "payload": { + "content": "raw_jsonl_records_string", + "defaultFileName": "internet_usage_backup.jsonl" + } +} +``` + +### 13. `log` + +Forwards frontend diagnostic events and caught exceptions to the C# application logger (`Log.Error` or `Log.Debug`). + +- **Payload:** + +```json +{ + "type": "log", + "payload": { + "level": "error", + "message": "Detailed error context string" + } +} +``` + --- ## :log-out: Outbound WebMessage Catalog (C# Host -> Frontend) -The C# controller emits 10 outbound event types. +The C# controller emits 12 outbound event types. ### 1. `settings` @@ -171,10 +203,49 @@ Supplies the current application settings DTO to hydrate the Svelte store. - **Payload:** `SettingsDto` ```typescript +interface SettingsDto { + runAtStartup: boolean; + showSystemTrayIcon: boolean; + enableFileLogging: boolean; + systemLogLevel: 'Off' | 'Error' | 'Warning' | 'Info' | 'Debug'; + monitoring: MonitoringDto; + overlay: OverlayDto; + alerts: AlertsDto; + netUsage: NetUsageDto; + updates: UpdateConfigDto; + windowTheme: string; +} + +interface MonitoringDto { + intervalMs: number; + useFahrenheit: boolean; + useNetBits: boolean; + preferredNic: string; + hasBattery: boolean; + trackCpu: boolean; + trackGpu: boolean; + trackRam: boolean; + trackNet: boolean; + trackDisk: boolean; + trackBattery: boolean; + cpuFreqMode: 'average' | 'max'; + cpuUsageMode: 'overall' | 'max'; + gpuUsageSource: 'driver' | 'wddm'; + logCpuMode: number; + logGpuMode: number; + logRamMode: number; + logNetMode: number; + logDiskMode: number; + logBatteryMode: number; +} + interface OverlayDto { visible: boolean; + displayMode: 'primary' | 'all' | 'secondary' | 'custom'; + enabledDisplays: string[]; + detectedDisplays?: DetectedDisplayDto[]; doubleClickAction: 'settings' | 'taskmanager' | 'none'; - position: 'left' | 'right' | 'beside_apps'; + position: 'left' | 'right'; taskbarAlignment?: 'left' | 'center'; // Dynamically detected Windows 11 alignment taskbarSpaceConstrained?: boolean; // True when available taskbar slot is narrower than overlay availableSlotWidth?: number; // Measured pixel width of available taskbar slot @@ -187,12 +258,59 @@ interface OverlayDto { metricColors: Record; groupColors: Record; followWindowsTheme: boolean; - row1: string[]; + layoutPreset: 'default' | 'gaming' | 'compact' | 'micro' | 'thermals' | 'workstation' | 'network' | 'full' | 'custom'; + columns: string[][]; +} + +interface DetectedDisplayDto { + id: string; + name: string; + isPrimary: boolean; + hasTaskbar: boolean; +} + +interface AlertsDto { + enabled: boolean; + alertCpuTemp: boolean; + cpuTempMaxC: number; + alertCpuUsage: boolean; + cpuUsageMaxPct: number; + alertCpuFreq: boolean; + cpuFreqMinMhz: number; + alertCpuPower: boolean; + cpuPowerMaxW: number; + alertGpuTemp: boolean; + gpuTempMaxC: number; + alertGpuUsage: boolean; + gpuUsageMaxPct: number; + alertGpuVram: boolean; + gpuVramMaxMb: number; + alertGpuFreq: boolean; + gpuFreqMinMhz: number; + alertGpuPower: boolean; + gpuPowerMaxW: number; + alertRamUsage: boolean; + ramUsageMaxPct: number; + alertBatteryLow: boolean; + batteryLowPct: number; + alertNetDaily: boolean; + netDailyMaxGb: number; + alertNetMonthly: boolean; + netMonthlyMaxGb: number; + showToastNotif: boolean; + flashOverlay: boolean; + sustainedSecs: number; // default: 3 + cooldownSecs: number; // default: 60 + fireOncePerSession: boolean; +} + +interface NetUsageDto { + enabled: boolean; } interface UpdateConfigDto { checkFrequency: 'manual' | 'weekly' | 'monthly'; - includePrereleases: boolean; // default: false + includePrereleases: boolean; // default: false (stable) / true (beta) lastCheckUtc: string; } ``` @@ -223,7 +341,7 @@ Supplies comprehensive hardware discovery specifications. "version": "1.2.0", "buildDate": "03-10-2026, 04:30 PM", "deploymentMode": "Standard", - "targetRuntime": ".NET 10.0.0", + "targetRuntime": ".NET 11.0.0", "deviceName": "DESKTOP-RIG", "os": "Windows 11 Pro 23H2 (Build 22631.4169)", "cpu": "Intel(R) Core(TM) i9-14900K", @@ -362,15 +480,61 @@ Dispatched upon completion of an update check. { "isUpdateAvailable": true, "isPrerelease": false, - "currentVersion": "1.0.0-rc.1", - "latestVersion": "1.0.0", - "releaseUrl": "https://github.com/Nicconike/LocalTelemetry/releases/tag/v1.0.0", + "currentVersion": "1.2.0", + "latestVersion": "1.3.0", + "releaseUrl": "https://github.com/Nicconike/LocalTelemetry/releases/tag/v1.3.0", "releaseNotes": "Official release notes markdown...", - "publishedAt": "2026-10-03T12:00:00Z", + "publishedAt": "2026-10-31T12:00:00Z", "errorMessage": null } ``` +### 11. `taskbarSlotChanged` + +Dispatched when the taskbar space constraint state or available slot width changes in real time. + +- **Type:** `"taskbarSlotChanged"` +- **Payload Schema:** + +```json +{ + "taskbarSpaceConstrained": true, + "availableSlotWidth": 320 +} +``` + +### 12. `exportDatabaseResult` + +Dispatched upon completion, cancellation, or failure of a database export operation. + +- **Type:** `"exportDatabaseResult"` +- **Payload Schema:** + +```json +{ + "success": true, + "filePath": "C:\\Users\\User\\Downloads\\internet_usage_2026-11-14.jsonl", + "fileName": "internet_usage_2026-11-14.jsonl" +} +``` + +When cancelled by the user: + +```json +{ + "cancelled": true +} +``` + +When the export encounters a file system error: + +```json +{ + "success": false, + "error": "Access to the path is denied." +} +``` + --- ## :bell: Standalone Notifier Named Pipe Protocol diff --git a/docs/latest/developer-guide/reference/settings-schema.md b/docs/latest/developer-guide/reference/settings-schema.md index fbb706c..36a8aa1 100644 --- a/docs/latest/developer-guide/reference/settings-schema.md +++ b/docs/latest/developer-guide/reference/settings-schema.md @@ -1,4 +1,4 @@ -# :file-cog: Configuration Settings Schema Reference +# :file-cog: Configuration Settings Schema This document specifies the complete configuration schema for LocalTelemetry's settings file (`settings.json`). @@ -47,10 +47,12 @@ The mode is determined at launch by checking for the `app.mode` marker file in t }, "overlay": { "visible": false, + "displayMode": "primary", + "enabledDisplays": [ + "primary" + ], "placement": "left", "placementOffset": 0, - "floatX": -1, - "floatY": -1, "doubleClickAction": "settings", "opacity": 100, "scalePct": 100, @@ -81,23 +83,35 @@ The mode is determined at launch by checking for the `app.mode` marker file in t "followWindowsTheme": true, "userCustomizedMetricColors": [], "userCustomizedGroupColors": [], - "row1": [ - "cpu_pct", - "cpu_temp", - "gpu_pct", - "gpu_temp", - "gpu_vram", - "net_total", - "ram_pct", - "ram_used", - "net_down", - "net_up" + "layoutPreset": "default", + "columns": [ + [ + "cpu_pct", + "cpu_temp" + ], + [ + "gpu_pct", + "gpu_temp" + ], + [ + "gpu_vram", + "net_total" + ], + [ + "ram_pct", + "ram_used" + ], + [ + "net_down", + "net_up" + ] ] }, "alerts": { "enabled": false, "alertCpuTemp": false, "alertGpuTemp": false, + "alertDiskTemp": false, "alertCpuUsage": false, "alertRamUsage": false, "alertGpuUsage": false, @@ -111,6 +125,7 @@ The mode is determined at launch by checking for the `app.mode` marker file in t "alertNetMonthly": false, "cpuTempMaxC": 90.0, "gpuTempMaxC": 85.0, + "diskTempMaxC": 70.0, "cpuUsageMaxPct": 95.0, "ramUsageMaxPct": 90.0, "gpuUsageMaxPct": 95.0, @@ -124,6 +139,7 @@ The mode is determined at launch by checking for the `app.mode` marker file in t "netMonthlyMaxGb": 1000.0, "showToastNotif": true, "flashOverlay": true, + "sustainedSecs": 3, "cooldownSecs": 60, "fireOncePerSession": false }, @@ -133,6 +149,7 @@ The mode is determined at launch by checking for the `app.mode` marker file in t "updates": { "checkFrequency": "manual", "includePrereleases": false, + "userExplicitlySetIncludePrereleases": false, "lastCheckUtc": "0001-01-01T00:00:00Z" } } @@ -152,7 +169,7 @@ The mode is determined at launch by checking for the `app.mode` marker file in t | `showSystemTrayIcon` | `boolean` | `true` | Controls system tray notification icon visibility. | | `enableFileLogging` | `boolean` | `true` | Enables daily metric file logging (`logs/lt_DD-MM-YYYY.log`). System diagnostics remain enabled always. | | `systemLogLevel` | `string` | `"Info"` | Threshold severity for system diagnostics (`"Off"`, `"Error"`, `"Warning"`, `"Info"`, `"Debug"`). | -| `windowTheme` | `string` | `"default"` | Sets settings UI window theme (`"default"`, `"dark"`, `"light"`). | +| `windowTheme` | `string` | `"default"` | Sets settings UI window theme (`"default"`, `"default-light"`, `"midnight"`, `"midnight-light"`, `"emerald"`, `"emerald-light"`, `"amethyst"`, `"amethyst-light"`, `"rose"`, `"rose-light"`, `"amber"`, `"amber-light"`, `"oled"`, `"oled-light"`, `"nord"`, `"nord-light"`, `"cyberpunk"`, `"cyberpunk-light"`). | --- @@ -160,7 +177,7 @@ The mode is determined at launch by checking for the `app.mode` marker file in t | Property | Type | Valid Range / Values | Default | Description | | :--- | :--- | :--- | :--- | :--- | -| `pollIntervalMs` | `integer` | `100` to `10000` | `1000` | Polling loop refresh timer in milliseconds. | +| `pollIntervalMs` | `integer` | `1000` to `10000` | `1000` | Polling loop refresh timer in milliseconds. | | `enableCpu` | `boolean` | `true`, `false` | `true` | Enables CPU telemetry polling. | | `enableGpu` | `boolean` | `true`, `false` | `true` | Enables GPU telemetry polling. | | `enableRam` | `boolean` | `true`, `false` | `true` | Enables RAM telemetry polling. | @@ -187,10 +204,8 @@ The mode is determined at launch by checking for the `app.mode` marker file in t | Property | Type | Valid Range / Values | Default | Description | | :--- | :--- | :--- | :--- | :--- | | `visible` | `boolean` | `true`, `false` | `false` | Controls taskbar overlay visibility. | -| `placement` | `string` | `"left"`, `"center"`, `"right"`, `"beside_apps"` | `"left"` | Taskbar anchor placement (`"beside_apps"` positions after app icons on left-aligned taskbars). | +| `placement` | `string` | `"left"`, `"center"`, `"right"` | `"left"` | Taskbar anchor placement (`"left"` positions beside apps on left-aligned taskbars or next to widgets on centered taskbars). | | `placementOffset` | `integer` | `-500` to `500` | `0` | Horizontal pixel offset from anchor. | -| `floatX` | `integer` | `-1` (Auto) or coordinate | `-1` | Saved drag position X coordinate for floating mode. | -| `floatY` | `integer` | `-1` (Auto) or coordinate | `-1` | Saved drag position Y coordinate for floating mode. | | `doubleClickAction` | `string` | `"none"`, `"taskmanager"`, `"settings"` | `"settings"` | Overlay double-click trigger action. | | `opacity` | `integer` | `10` to `100` | `100` | Layered window opacity percentage. | | `scalePct` | `integer` | `50` to `200` | `100` | Geometry scaling percentage. | @@ -203,14 +218,18 @@ The mode is determined at launch by checking for the `app.mode` marker file in t | `groupColors` | `object` | Key-value hex mapping | Empty `{}` | Group color overrides for entire component categories. | | `followWindowsTheme` | `boolean` | `true`, `false` | `true` | Dynamically adapts color key and luminosity to Windows theme. | | `userCustomizedMetricColors` | `array` | Metric ID strings | `[]` | Metric IDs manually recolored by the user; preserved during vendor color updates. | +| `userCustomizedGroupColors` | `array` | Group key strings | `[]` | Group keys manually recolored by the user. | +| `layoutPreset` | `string` | `"default"`, `"gaming"`, `"compact"`, `"micro"`, `"thermals"`, `"workstation"`, `"network"`, `"full"`, `"custom"` | `"default"` | Active overlay arrangement preset. | +| `columns` | `array` | 2D array of Metric ID strings (`string[][]`) | 5 default column pairs | Column list where each column contains 1 or 2 metric IDs (top and optional bottom row). | +| `displayMode` | `string` | `"primary"`, `"all"`, `"secondary"`, `"custom"` | `"primary"` | Target display mode for overlay instances. | +| `enabledDisplays` | `array` | Display ID strings | `["primary"]` | Enabled display identifiers when `displayMode` is `"custom"`. | > [!NOTE] Runtime DTO Augmentation > The settings serialization pipeline (`SettingsDtoMapping.ToDto`) augments the client DTO with runtime taskbar properties: > > - `taskbarSpaceConstrained`: `boolean` (`true` when the available taskbar slot is narrower than the overlay width). > - `availableSlotWidth`: `integer` (measured width of the available taskbar slot in pixels). -| `userCustomizedGroupColors` | `array` | Group key strings | `[]` | Group keys manually recolored by the user. | -| `row1` | `array` | Metric ID strings | 10 default IDs | Column metric layout (even indices = top, odd indices = bottom). | +> - `detectedDisplays`: `array` of `DetectedDisplayDto` (`id`, `name`, `isPrimary`, `hasTaskbar`) for display selection. --- @@ -219,35 +238,57 @@ The mode is determined at launch by checking for the `app.mode` marker file in t | Property | Type | Valid Range | Default | Description | | :--- | :--- | :--- | :--- | :--- | | `enabled` | `boolean` | `true`, `false` | `false` | Master toggle for all threshold alerts. | +| `alertCpuUsage` | `boolean` | `true`, `false` | `false` | High CPU usage alert toggle. | +| `cpuUsageMaxPct` | `float` | `10.0` to `100.0` | `95.0` | CPU usage threshold in %. | | `alertCpuTemp` | `boolean` | `true`, `false` | `false` | High CPU temperature alert toggle. | | `cpuTempMaxC` | `float` | `40.0` to `115.0` | `90.0` | CPU temperature threshold in °C. | | `alertCpuFreq` | `boolean` | `true`, `false` | `false` | Low CPU frequency (throttling) alert toggle. | | `cpuFreqMinMhz` | `float` | `200.0` to `5000.0` | `800.0` | CPU frequency low threshold in MHz. | | `alertCpuPower` | `boolean` | `true`, `false` | `false` | High CPU package power alert toggle. | | `cpuPowerMaxW` | `float` | `10.0` to `500.0` | `65.0` | CPU package power threshold in Watts. | +| `alertRamUsage` | `boolean` | `true`, `false` | `false` | High RAM usage alert toggle. | +| `ramUsageMaxPct` | `float` | `10.0` to `100.0` | `90.0` | RAM usage threshold in %. | +| `alertGpuUsage` | `boolean` | `true`, `false` | `false` | High GPU usage alert toggle. | +| `gpuUsageMaxPct` | `float` | `10.0` to `100.0` | `95.0` | GPU usage threshold in %. | +| `alertGpuVram` | `boolean` | `true`, `false` | `false` | High GPU VRAM usage alert toggle. | +| `gpuVramMaxMb` | `float` | `256.0` to `65536.0` | `6000.0` | GPU VRAM threshold in MB. | | `alertGpuTemp` | `boolean` | `true`, `false` | `false` | High GPU temperature alert toggle. | | `gpuTempMaxC` | `float` | `40.0` to `110.0` | `85.0` | GPU temperature threshold in °C. | | `alertGpuFreq` | `boolean` | `true`, `false` | `false` | Low GPU frequency (throttling) alert toggle. | | `gpuFreqMinMhz` | `float` | `100.0` to `3500.0` | `300.0` | GPU frequency low threshold in MHz. | | `alertGpuPower` | `boolean` | `true`, `false` | `false` | High GPU power alert toggle. | | `gpuPowerMaxW` | `float` | `20.0` to `700.0` | `150.0` | GPU power threshold in Watts. | +| `alertDiskTemp` | `boolean` | `true`, `false` | `false` | High disk temperature alert toggle. | +| `diskTempMaxC` | `float` | `45.0` to `90.0` | `70.0` | Disk temperature threshold in °C. | +| `alertBatteryLow` | `boolean` | `true`, `false` | `false` | Low battery charge alert toggle. | +| `batteryLowPct` | `float` | `5.0` to `50.0` | `20.0` | Low battery threshold in %. | | `alertNetDaily` | `boolean` | `true`, `false` | `false` | Daily network bandwidth quota alert toggle. | | `netDailyMaxGb` | `float` | `1.0` to `1000.0` | `50.0` | Daily data transfer limit in GB. | | `alertNetMonthly` | `boolean` | `true`, `false` | `false` | Monthly network bandwidth quota alert toggle. | | `netMonthlyMaxGb` | `float` | `10.0` to `10000.0` | `1000.0` | Monthly data transfer limit in GB. | | `showToastNotif` | `boolean` | `true`, `false` | `true` | Shows standalone desktop toast popups on alerts. | | `flashOverlay` | `boolean` | `true`, `false` | `true` | Flashes the taskbar overlay visually on alerts. | -| `cooldownSecs` | `integer` | `5` to `3600` | `60` | Minimum seconds between repeat notifications. | +| `sustainedSecs` | `integer` | `1` to `10` | `3` | Continuous breach duration in seconds before triggering notifications. | +| `cooldownSecs` | `integer` | `5` to `120` | `60` | Minimum seconds between repeat notifications. | | `fireOncePerSession` | `boolean` | `true`, `false` | `false` | Alerts trigger only once per application run when true. | --- +### `netUsage` (Network Usage Tracking Configuration) + +| Property | Type | Valid Values | Default | Description | +| :--- | :--- | :--- | :--- | :--- | +| `enabled` | `boolean` | `true`, `false` | `true` | Enables daily and monthly network bandwidth logging to `internet_usage.jsonl`. | + +--- + ### `updates` (GitHub Releases Client Configuration) | Property | Type | Valid Values | Default | Description | | :--- | :--- | :--- | :--- | :--- | | `checkFrequency` | `string` | `"manual"`, `"weekly"`, `"monthly"` | `"manual"` | Interval for automated background update checks. | -| `includePrereleases` | `boolean` | `true`, `false` | `false` | Includes Release Candidate (`-rc`) and beta builds. | +| `includePrereleases` | `boolean` | `true`, `false` | `false` (stable) / `true` (beta) | Includes pre-release and beta builds when checking for updates. | +| `userExplicitlySetIncludePrereleases` | `boolean` | `true`, `false` | `false` | Indicates whether the user manually toggled pre-release updates in settings. | | `lastCheckUtc` | `string` (ISO 8601) | Datetime string | MinValue | Timestamp of the last completed update check. | --- diff --git a/docs/latest/developer-guide/repository-structure.md b/docs/latest/developer-guide/repository-structure.md index faf1a62..f9620d8 100644 --- a/docs/latest/developer-guide/repository-structure.md +++ b/docs/latest/developer-guide/repository-structure.md @@ -6,95 +6,66 @@ An overview of the folder structure and codebase organization of **LocalTelemetr ```bash LocalTelemetry/ -├── .github/ # GitHub Actions workflows, issue templates & security policies -│ ├── release/ # Release configuration & pipeline scripts (run.ts, build.ps1, publish.ps1, github-commit-plugin.ts) -│ ├── workflows/ # CI/CD (ci.yml, release.yml, docs.yml, sync.yml, project.yml, codeql.yml, sonar.yml, scorecard.yml) -│ ├── ISSUE_TEMPLATE/ # Bug report and feature request templates -│ ├── CODEOWNERS # Repository code ownership declarations -│ ├── CODE_OF_CONDUCT.md # Contributor code of conduct -│ ├── CONTRIBUTING.md # Contribution guidelines -│ ├── FUNDING.yml # GitHub sponsorship configuration -│ ├── pull_request_template.md # PR submission checklist -│ ├── SECURITY.md # Vulnerability reporting policy -│ ├── SUPPORT.md # Community support & troubleshooting hub -│ └── dependabot.yml # Automated dependency update configuration -├── bucket/ # Scoop package bucket -│ └── localtelemetry.json # Scoop application installation manifest -├── docs/ # VitePress documentation site -│ ├── .vitepress/ # VitePress theme, Lucide markdown plugins & config -│ ├── latest/ # Versioned documentation source -│ │ ├── user-guide/ # 9 End-user guide documents (8 topics + index) -│ │ ├── developer-guide/ # 11 Developer architecture & deep-dives (10 topics + index) -│ │ │ └── reference/ # 3 Technical reference specifications (Core API, IPC, Settings) -│ │ └── index.md # Documentation portal landing page -│ ├── public/ # Static assets (images, app.ico, banner.jpg) -│ ├── scripts/ # Documentation snapshot & versioning build scripts -│ ├── package.json # Documentation dependencies (Bun runtime) -│ └── tsconfig.json # Documentation TypeScript compiler configuration -├── packaging/ # Third-party distribution manifests -│ └── winget/ # Windows Package Manager manifests (Nicconike.LocalTelemetry.*.yaml) -├── src/ # Production source code (.NET 10 + Svelte 5) -│ ├── LocalTelemetry.Core/ # Hardware polling engine, PawnIO, SystemInfo, Config -│ │ ├── Config/ # AppSettings.cs, schema migration & atomic persistence -│ │ ├── Diagnostics/ # Log.cs structured logger & file rotation -│ │ ├── Hardware/ # Sensor pollers (NVML, ADL, ControlLib, WDDM, PDH, DiskQuery, JsonlTrafficImporter, HardwareInventory, HardwareLifecycleManager) -│ │ │ └── PawnIo/ # Kernel driver transport, Intel MSR & AMD Ryzen SMU readers -│ │ └── Models/ # Metrics.cs, TelemetrySnapshot, OverlayDeploymentState, UpdateCheckResult +├── .github/ # GitHub Actions workflows, release scripts & templates +│ ├── release/ # Semantic release configuration & signing scripts +│ └── workflows/ # CI/CD, CodeQL, Sonar, and Scorecard pipelines +├── bucket/ # Scoop package manifest (localtelemetry.json) +├── docs/ # VitePress documentation portal +│ ├── .vitepress/ # Theme configuration, Lucide plugins & versions +│ ├── latest/ # Source documentation for the latest version +│ │ ├── user-guide/ # End-user feature guides +│ │ ├── developer-guide/ # Developer architecture and deep-dives +│ │ │ └── reference/ # API, IPC, and Settings specifications +│ │ └── about/ # Background and project motivation +│ └── public/ # Static images, icons, and videos +├── src/ # Production source code (.NET 11 + Svelte 5) +│ ├── LocalTelemetry.Core/ # Hardware polling, PawnIO MSR/SMU, SystemInfo, Config +│ │ ├── Config/ # AppSettings.cs and JSON persistence +│ │ ├── Diagnostics/ # Log.cs structured file logger +│ │ ├── Hardware/ # Sensor drivers (NVML, ADL, ControlLib, WDDM, DiskQuery) +│ │ │ └── PawnIo/ # Kernel driver transport and embedded .bin scripts +│ │ └── Models/ # TelemetrySnapshot, Metrics, and DTO models │ ├── LocalTelemetry.App/ # WPF Desktop host & Win32 taskbar integration -│ │ ├── Overlay/ # TaskbarOverlay.cs (GDI+ rendering, DPI scaling, watchdog) -│ │ ├── Services/ # AlertService.cs, NotificationClient.cs, UpdateCheckService.cs +│ │ ├── Overlay/ # TaskbarOverlay.cs and multi-monitor management +│ │ ├── Services/ # AlertService.cs and UpdateCheckService.cs │ │ ├── Settings/ # SettingsShell.xaml & Svelte 5 WebView2 frontend -│ │ │ └── wwwroot/ # Svelte 5 (Vite + Bun + TypeScript) settings single-page app -│ │ │ ├── src/ # Svelte components (App, Sidebar, 10 Pages, UI primitives, types, utils) -│ │ │ └── package.json # Frontend dependencies -│ │ ├── Tray/ # TrayIconManager.cs (WinForms NotifyIcon & custom dark context menus) -│ │ ├── Win32/ # TaskbarEmbedder.cs (SetParent reparenting & floating fallback) -│ │ ├── App.xaml.cs # WPF application entry point, UAC elevation & DI container -│ │ └── Uninstall.bat # Portable mode driver, service & registry cleanup script +│ │ │ └── wwwroot/ # Svelte 5 SPA (Runes + Vite + Bun + TypeScript) +│ │ ├── Tray/ # System tray icon and context menus +│ │ └── Win32/ # TaskbarEmbedder.cs, display info, and native interop │ └── LocalTelemetry.Notifier/ # Standalone toast notification helper executable -│ ├── NotifierLog.cs # Notifier diagnostic logging -│ ├── Program.cs # Entry point, parent PID watchdog, Named Pipe server -│ └── ToastForm.cs # Non-focus-stealing toast window with slide-in animation -├── tests/ # Automated test suites (.NET 10 xUnit + Vitest) -│ ├── LocalTelemetry.Core.Tests/ # Granular xUnit tests (Hardware, DiskQuery, Lifecycle, Inventory, Models, Config) -│ ├── LocalTelemetry.App.Tests/ # Granular xUnit tests (Alerts, NotificationClient, UpdateCheck, Win32, Settings) -│ │ └── Settings/wwwroot/ # Vitest component & store unit tests -│ └── LocalTelemetry.Notifier.Tests/ # xUnit tests for Notifier IPC contracts & Program logic -├── CHANGELOG.md # Project release changelog (generated by semantic-release) -├── codecov.yml # Codecov coverage threshold rules -├── commitlint.config.mjs # Conventional Commits commitlint rules -├── Directory.Build.props # Global C# build properties (.NET 10, C# 13, nullable) -├── global.json # .NET SDK version pinning -├── LICENSE # GNU General Public License v3.0 -├── LocalTelemetry.sln # Visual Studio solution file +│ ├── Program.cs # Entry point and named pipe server +│ └── ToastForm.cs # Non-activating slide-in toast window +├── tests/ # Automated test suites +│ ├── LocalTelemetry.Core.Tests/ # Unit tests for hardware, models, and config +│ ├── LocalTelemetry.App.Tests/ # Unit tests for alerts, updates, and Win32 interop +│ │ └── Settings/wwwroot/ # Vitest unit tests for Svelte components +│ └── LocalTelemetry.Notifier.Tests/ # Unit tests for notifier IPC contracts ├── setup.iss # Inno Setup 7 installer compilation script -└── README.md # GitHub repository main README +└── LocalTelemetry.sln # Visual Studio solution file ``` --- -## :layers: Project Responsibilities & Module Breakdown - -### :layout-dashboard: Host Application & UI (LocalTelemetry.App) - -Located in [`src/LocalTelemetry.App`](https://github.com/Nicconike/LocalTelemetry/tree/master/src/LocalTelemetry.App), this is the main execution target. Responsible for Win32 taskbar window reparenting (`TaskbarOverlay`), system tray management (`TrayIconManager`), threshold alerting (`AlertService`), update checking against GitHub Releases (`UpdateCheckService`), and hosting the Microsoft WebView2 control for settings management. - -### :cpu: Hardware Engine & Telemetry (LocalTelemetry.Core) - -Located in [`src/LocalTelemetry.Core`](https://github.com/Nicconike/LocalTelemetry/tree/master/src/LocalTelemetry.Core), this is the domain layer. Houses low-level hardware sensor readers, `PawnIO` kernel transport wrappers, WMI and Win32 storage IOCTL query interfaces (`DiskQuery`), hardware fingerprinting (`HardwareInventory`), lifecycle management (`HardwareLifecycleManager`), network bandwidth monitoring (`WindowsNetworkUsageProvider`), and configuration persistence (`AppSettings`). - -### :bell: Toast Notification Helper (LocalTelemetry.Notifier) - -Located in [`src/LocalTelemetry.Notifier`](https://github.com/Nicconike/LocalTelemetry/tree/master/src/LocalTelemetry.Notifier), this is a dedicated out-of-process toast notification executable. Runs in isolation to ensure hardware polling loops and full-screen games are never interrupted or de-focused when warnings trigger. Communicates exclusively over Windows Named Pipes (`LocalTelemetryNotifier`). - -### :test-tube: Automated Testing Suites - -Located in [`tests/`](https://github.com/Nicconike/LocalTelemetry/tree/master/tests), three distinct xUnit and Vitest test projects ensure regressions are prevented across hardware query logic, IPC messaging contracts, UI components, and settings serialization. - -### :book-open: Documentation Portal - -Located in [`docs/`](https://github.com/Nicconike/LocalTelemetry/tree/master/docs), the official VitePress documentation site extends standard markdown with automatic Lucide icon rendering, semantic alert callouts, and multi-version dropdown navigation. Includes a dedicated Reference & Specifications section for low-level contracts. - -### :workflow: Continuous Integration & GitHub Automation - -Located in [`.github/`](https://github.com/Nicconike/LocalTelemetry/tree/master/.github), automation workflows build, format, test, package, sign, and release LocalTelemetry in adherence with OpenSSF Scorecard supply-chain security standards. +## :layers: Module Responsibilities + +### `LocalTelemetry.Core` (.NET 11) +- Domain and hardware layer with zero UI dependencies. +- Interfaces with the `PawnIO` kernel driver for processor MSRs and AMD SMU readings. +- Discovers hardware specifications (`HardwareInventory.cs`) and manages configuration (`AppSettings.cs`). +- Tracks network usage and imports historical records from Windows SRUM (`TrafficHistoryStore.cs`). + +### `LocalTelemetry.App` (.NET 11 WPF) +- Primary application host process. +- Embeds the layered transparent overlay into the Windows taskbar shell (`TaskbarEmbedder.cs`). +- Manages the system tray icon, tooltips, and context menus (`TrayIconManager.cs`). +- Evaluates threshold alerts and dispatches warnings (`AlertService.cs`). +- Hosts the Svelte 5 settings panel inside Microsoft WebView2 (`SettingsShell.xaml.cs`). + +### `LocalTelemetry.Notifier` (.NET 11 WinForms) +- Standalone out-of-process toast notification helper. +- Communicates with the main app through an asynchronous Windows Named Pipe (`LocalTelemetryNotifier`). +- Displays non-activating slide-in windows (`WS_EX_NOACTIVATE`) to protect gaming focus. + +### `Settings/wwwroot` (Svelte 5 / TypeScript) +- Embedded single-page application built with Svelte 5 runes (`$state`, `$derived`, `$effect`). +- Communicates bidirectionally with the C# host using JSON WebMessages. diff --git a/docs/latest/developer-guide/setup.md b/docs/latest/developer-guide/setup.md index fac8501..97cbc13 100644 --- a/docs/latest/developer-guide/setup.md +++ b/docs/latest/developer-guide/setup.md @@ -1,38 +1,36 @@ # :laptop: Development Environment Setup -This guide details how to clone, set up, build, and run **LocalTelemetry** from source code on Windows. +This guide explains how to clone, configure, build, and run **LocalTelemetry** from source code on Windows. -## :wrench: Prerequisites & Toolchains +## :wrench: Prerequisites & Tools -Before building LocalTelemetry, ensure you have the following installed on your Windows machine: +Ensure the following tools are installed on your Windows machine: -1. **Operating System**: Windows 10 (v2004+ / build 19041+) or Windows 11 (64-bit x64) -2. **.NET 10 SDK**: Install the official [.NET 10.0 SDK](https://dotnet.microsoft.com/download/dotnet/10.0) +1. **Operating System**: Windows 10 (v2004+ / build 19041+) or Windows 11 (64-bit x64). +2. **.NET 11 SDK**: Install the official [.NET 11.0 SDK](https://dotnet.microsoft.com/download/dotnet/11.0). 3. **Bun JavaScript Runtime**: Install [Bun](https://bun.sh/) for building the Svelte 5 frontend: - ```powershell powershell -c "irm bun.sh/install.ps1 | iex" ``` - -4. **IDE / Editor**: - - **Visual Studio 2022+** (with *.NET Desktop Development* workload enabled) - - Or **VS Code** (with *C# Dev Kit* and *Svelte* extensions) +4. **IDE / Editor**: Visual Studio 2022+ (with *.NET Desktop Development* workload) or VS Code (with *C# Dev Kit* and *Svelte* extensions). > [!IMPORTANT] -> **Bun Package Manager**: The Svelte 5 frontend MUST be built using **Bun** (`bun install` and `bun run build`) to preserve `bun.lock` integrity. Do not use npm, yarn, or pnpm. +> The Svelte 5 frontend must be managed and built using **Bun** (`bun install` and `bun run build`) to preserve `bun.lock` integrity. Do not use npm, yarn, or pnpm. + +--- ## :terminal: Setup Instructions -### :git-branch: Cloning the Repository +### 1. Clone the Repository ```powershell git clone https://github.com/Nicconike/LocalTelemetry.git cd LocalTelemetry ``` -### :package: Installing Dependencies & Building Frontend Assets +### 2. Build the Svelte 5 Frontend -Navigate to the frontend directory inside `src/LocalTelemetry.App/Settings/wwwroot`: +Compile the frontend assets into `dist/` so WebView2 can embed them: ```powershell cd src/LocalTelemetry.App/Settings/wwwroot @@ -41,19 +39,17 @@ bun run build cd ../../../.. ``` -This compiles the Svelte 5 single-page application into `dist/`, which is embedded into the WPF binary as WebView2 assets. - -### :box: Restoring Dependencies & Building C# Backend +### 3. Build the .NET Solution -Build the backend solution from the root repository directory: +Restore dependencies and build the C# backend solution from the repository root: ```powershell dotnet build LocalTelemetry.sln --configuration Debug ``` -### :test-tube: Running the Automated Test Suites +### 4. Run the Automated Test Suites -Run both the frontend Vitest unit tests and the backend C# unit tests: +Run both frontend Vitest tests and backend C# unit tests: ```powershell # Run frontend Vitest tests @@ -62,48 +58,42 @@ bun install bun run test cd ../../../.. -# Run backend C# unit tests across all three test suites +# Run backend C# unit tests dotnet test LocalTelemetry.sln --configuration Debug ``` -## :play: Launching in Development Mode +--- -### :terminal: Running the Host Application (Administrator Required) +## :play: Running in Development Mode -Launch the application target from an **elevated (Administrator) terminal**: +### Running the Host Application + +Launch LocalTelemetry from an **elevated (Administrator) terminal**: ```powershell dotnet run --project src/LocalTelemetry.App ``` > [!IMPORTANT] -> **Administrator Privileges Mandatory**: LocalTelemetry's application manifest (`app.manifest`) specifies `` to allow communication with the `PawnIO` kernel sensor driver. Executing `dotnet run` from an unprivileged terminal will result in an elevation failure or UAC error. +> LocalTelemetry requires Administrator privileges to communicate with the `PawnIO` kernel sensor driver. Running from an unprivileged terminal will result in an elevation failure. -### :flame: Running Frontend in Hot-Reloading Mode (Optional) +### Running Frontend with Hot-Module Reloading (Optional) -During rapid UI prototyping, you can launch the Vite local dev server with hot module replacement: +During UI development, you can run the Vite dev server with hot module replacement: ```powershell cd src/LocalTelemetry.App/Settings/wwwroot bun run dev ``` -The dev server serves the frontend on `http://localhost:5173`. You can inspect and test Svelte components in your browser before compiling production assets. +The dev server runs on `http://localhost:5173`. You can inspect and test Svelte components directly in your browser. -## :monitor: Running the Documentation Site Locally +### Running the Documentation Site Locally -To run this VitePress documentation site locally: +To preview documentation changes in real time: ```powershell cd docs bun install bun run docs:dev ``` - -Open your browser to `http://localhost:5173` to preview documentation changes in real time. - -## :bug: Common Troubleshooting & Environment Fixes - -- **Missing PawnIO Driver on First Launch**: If CPU registers fail to initialize in local development, ensure the PawnIO driver is installed. The application automatically downloads and installs the driver on elevated launch when internet access is available. -- **Node vs Bun Path Conflicts**: Ensure Bun is added to your user `PATH` environment variable (`%USERPROFILE%\.bun\bin`). -- **WebView2 Runtime Missing**: On Windows 10 development machines lacking WebView2, install the Microsoft Edge WebView2 Evergreen Runtime. Windows 11 includes it natively. diff --git a/docs/latest/developer-guide/taskbar-overlay-interop.md b/docs/latest/developer-guide/taskbar-overlay-interop.md index 85216f1..49f813d 100644 --- a/docs/latest/developer-guide/taskbar-overlay-interop.md +++ b/docs/latest/developer-guide/taskbar-overlay-interop.md @@ -1,13 +1,13 @@ # :app-window: Win32 Taskbar Hooking & Overlay Interop -LocalTelemetry embeds a high-performance GDI+ render surface (`NativeWindow`) directly into the native Windows taskbar process (`Shell_TrayWnd`). +LocalTelemetry embeds a high-performance GDI+ render surface directly into native Windows taskbar processes (`Shell_TrayWnd` and `Shell_SecondaryTrayWnd`). ## :layers: Win32 Taskbar Hierarchy & State Machine -The taskbar overlay management is handled inside `TaskbarOverlay.cs` and `TaskbarEmbedder.cs`. +Taskbar overlay coordination across displays is managed by `TaskbarOverlayManager.cs`, delegating to `TaskbarOverlay.cs` and `TaskbarEmbedder.cs`: ```mermaid -%%{init: {'theme': 'dark', 'themeVariables': {'fontSize': '13px'}, 'flowchart': {'nodeSpacing': 35, 'rankSpacing': 40, 'subGraphTitleMargin': {'top': 12, 'bottom': 20}, 'curve': 'linear'}}}%% +%%{init: {'theme': 'dark', 'themeVariables': {'fontSize': '13px'}, 'flowchart': {'htmlLabels': true, 'nodeSpacing': 35, 'rankSpacing': 36, 'padding': 18, 'curve': 'basis'}}}%% flowchart TD %% 1. DESKTOP & TASKBAR ROOT Desktop["Windows Desktop
HWND 0"] --> Tray["Shell_TrayWnd
Native Windows Taskbar HWND"] @@ -17,7 +17,8 @@ flowchart TD direction TB ReBar["ReBarWindow32
Taskbar Control Container"] TaskSw["MSTaskSwWClass
Running Apps TaskBand"] - ReBar --> TaskSw + ShrinkBand["ShrinkTaskBand Interop
Reserves Pixel Space on Win10"] + ReBar --> TaskSw --> ShrinkBand end subgraph Win11Arch["Windows 11 Modern Shell"] @@ -29,17 +30,9 @@ flowchart TD Tray --> Win11Bridge %% 3. EMBEDDING STRATEGY - subgraph EmbeddingStrategy["TaskbarEmbedder Strategy Resolution"] - direction TB - ShrinkBand["ShrinkTaskBand Interop
Reserves Pixel Space on Win10"] - ChildMode["Tier 1: Child Mode (SetParent HWND)
WS_CHILD • WS_EX_TOOLWINDOW • WS_EX_LAYERED"] - FallbackMode["Tier 2: Layered Fallback Window
WS_EX_TOPMOST • WS_EX_NOACTIVATE • WS_EX_LAYERED"] - - ShrinkBand --> ChildMode - ChildMode -.->|"SetParent Fails"| FallbackMode - end + ChildMode["Native Child Window (SetParent HWND)
WS_CHILD • WS_EX_TOOLWINDOW • WS_EX_LAYERED"] - TaskSw --> ShrinkBand + ShrinkBand --> ChildMode Win11Bridge --> ChildMode %% 4. TASKBAR OVERLAY SURFACE & RUNTIME @@ -49,161 +42,117 @@ flowchart TD Watchdog["Heartbeat Watchdog (5s & 200ms)
Tracks Taskbar HWND Validity"] MouseHook["Low-Level Mouse Hook
WH_MOUSE_LL Click & DblClick"] - GdiSurface --- Watchdog - GdiSurface --- MouseHook + GdiSurface --> Watchdog + GdiSurface --> MouseHook end ChildMode --> GdiSurface - FallbackMode --> GdiSurface - - %% 5. DEPLOYMENT STATE MACHINE - subgraph DeploymentStateMachine["OverlayDeploymentState Lifecycle"] - direction LR - StateInit["Uninitialized"] - StateActive["Active"] - StateRecov["Recovering"] - StateFailed["Failed"] - - StateInit -->|"Embed OK"| StateActive - StateInit -->|"Embed Fail"| StateFailed - StateActive -->|"Explorer Restart"| StateRecov - StateRecov -->|"Re-embed OK"| StateActive - StateRecov -->|"Re-embed Fail"| StateFailed - end - - Watchdog ==>|"Drives Recovery"| StateRecov class Desktop,Tray,ReBar,TaskSw,Win11Bridge shellNode class ShrinkBand,Watchdog,MouseHook toolNode - class ChildMode,StateActive childNode - class FallbackMode,StateFailed fallbackNode - class GdiSurface,StateRecov surfaceNode - class StateInit initNode + class ChildMode childNode + class GdiSurface surfaceNode classDef shellNode fill:#0b1329,stroke:#38bdf8,stroke-width:1.5px,color:#e0f2fe classDef toolNode fill:#18181b,stroke:#a1a1aa,stroke-width:1.5px,color:#f4f4f5 classDef childNode fill:#064e3b,stroke:#34d399,stroke-width:2px,color:#ffffff - classDef fallbackNode fill:#7c2d12,stroke:#fb923c,stroke-width:2px,color:#ffffff classDef surfaceNode fill:#1e3a8a,stroke:#60a5fa,stroke-width:2px,color:#ffffff - classDef initNode fill:#374151,stroke:#9ca3af,stroke-width:1.5px,color:#f3f4f6 ``` -## :settings: Taskbar Embedding Strategies - -Implemented in [`TaskbarEmbedder.cs`](https://github.com/Nicconike/LocalTelemetry/blob/master/src/LocalTelemetry.App/Win32/TaskbarEmbedder.cs), LocalTelemetry provides a 2-tier embedding engine to guarantee compatibility across all Windows 10 and 11 builds: - -### :shield-alert: Child-Window Reparenting (`IsChildMode`) - -- **Find Taskbar HWND**: `FindWindow("Shell_TrayWnd", null)` locates the primary taskbar window handle. -- **Find ReBar / TaskBand**: `FindWindowEx(trayHwnd, IntPtr.Zero, "ReBarWindow32", null)` retrieves the control container and taskband (`MSTaskSwWClass`). -- **Reparent Window (`SetParent`)**: Calls Win32 `SetParent(overlayHwnd, parentHwnd)` to reparent the overlay window as a native child control of the taskbar. -- **Shrink TaskBand (`ShrinkTaskBand`)**: Dynamically reduces taskband width to reserve dedicated space for the overlay metrics on the taskbar. -- **Apply Window Styles (`SetWindowLong`)**: Sets `WS_CHILD`, `WS_EX_TOOLWINDOW` (hides from Alt+Tab), `WS_EX_NOACTIVATE`, and `WS_EX_LAYERED`. - -### :panel-bottom: Layered Floating Window Fallback (`IsFallback`) - -- Activated if reparenting fails due to third-party shell software or security policies. -- Restores top-level window styles (`WS_POPUP`, `WS_EX_TOPMOST`) and positions a transparent layered floating window precisely over the taskbar bounding rectangle. - ---- - -## :compass: Taskbar Alignment & Coordinate Mathematics - -LocalTelemetry dynamically adapts overlay placement based on Windows 11 taskbar alignment: - -### 1. Taskbar Alignment Detection (`IsTaskbarCentered`) +### Overlay Deployment Lifecycle State Machine -Inspects user registry configuration: +The overlay deployment lifecycle is governed by the `OverlayDeploymentState` state machine, driven by `TaskbarEmbedder.cs` and the heartbeat watchdog: -```csharp -using var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"); -int val = Convert.ToInt32(key?.GetValue("TaskbarAl") ?? 1); -return val == 1; // 1 = Centered, 0 = Left-aligned +```mermaid +%%{init: {'theme': 'dark', 'themeVariables': {'fontSize': '13px'}}}%% +stateDiagram-v2 + direction TB + [*] --> Uninitialized + Uninitialized --> Active : Taskbar found & window embedded + Uninitialized --> Failed : Taskbar handle unavailable + Active --> Recovering : Explorer restart detected (5s watchdog) + Recovering --> Active : Re-embedding succeeds + Recovering --> Failed : Re-embedding fails + Failed --> Recovering : Periodic retry cycle + Active --> [*] : User disables overlay ``` -### 2. Centered Taskbar Positioning - -On centered taskbars, the app icons occupy the center band: - -- **Left Placement (`left`)**: Anchors relative to the Windows Widgets button edge (`_leftWidgetRightEdge + PlacementOffset`). -- **Right Placement (`right`)**: Anchors directly before the system notification area (`_trayLeftEdge - Width - PlacementOffset`). +--- -### 3. Left-Aligned Taskbar Positioning +## :settings: Native Taskbar Embedding (`TaskbarEmbedder`) -On left-aligned taskbars, app icons start from the Start button and expand toward the right: +`TaskbarEmbedder.cs` anchors the overlay window directly into the taskbar hierarchy: -- **Application Band Boundary Detection (`GetAppListRightEdge` & `GetAppListLeftEdge`)**: - - Inspects UIAutomation elements for `Taskbar.TaskListButtonPanel` or native `MSTaskListWClass`. - - Determines the exact left and right boundaries of running and pinned applications. -- **Taskbar Space Congestion Detection (`IsTaskbarSpaceConstrained`)**: - - Calculates the available horizontal gap (`AvailableSlotWidth`) between running app icons and the system tray or widgets. - - Sets `IsTaskbarSpaceConstrained` to `true` when the measured slot is narrower than the overlay width (`overlayWidth > availableWidth`). - - Supplies status to the frontend settings UI via `TaskbarSlotStatusProvider`. -- **Position Next to Apps (`beside_apps` or `left`)**: - - Positions the overlay immediately following the app list: +1. **Window Identification**: Calls `FindWindow("Shell_TrayWnd", null)` to locate the primary taskbar handle. +2. **Child Reparenting**: Invokes Win32 `SetParent(overlayHwnd, taskbarHwnd)`. This makes the overlay an authentic child control of the taskbar shell. +3. **Window Styles**: + - `WS_CHILD`: Operates within parent taskbar coordinates. + - `WS_EX_TOOLWINDOW`: Hides the overlay from the Windows Alt+Tab task switcher. + - `WS_EX_NOACTIVATE`: Prevents the overlay from stealing focus when clicked. + - `WS_EX_LAYERED`: Enables GDI+ transparent color keying and alpha blending. +4. **TaskBand Space Reservation (Windows 10)**: On classic taskbars, calls `ShrinkTaskBand` to reduce the app band width and reserve space for metrics. - $$\text{X} = \text{clientAppRight} + \text{PlacementOffset}$$ +--- -- **Position Before System Tray (`right`)**: - - Positions the overlay immediately before the system notification area: +## :palette: GDI+ Render Pipeline & Typography - $$\text{X} = \text{clientRightBoundary} - \text{Width} - \text{PlacementOffset}$$ +`TaskbarOverlay.cs` uses a double-buffered memory surface to render telemetry metrics: -- **Boundary Clamping**: - - Clamps computed coordinates via `Math.Clamp(x, minX, maxX)` to keep the overlay within bounds and prevent visual overlap. +- **Sub-Pixel Typography**: Uses `TextRenderer.DrawText` and `TextRenderer.MeasureText` for crisp, sub-pixel GDI ClearType rendering. +- **Dynamic Color Keying**: In transparent layered mode, invokes `SetLayeredWindowAttributes` with `LWA_COLORKEY` using the configured background key color (`#1c1b19` default). +- **Double-Buffered Rendering**: Allocates an off-screen buffer via `BufferedGraphicsManager.Current.Allocate`, flushing to the taskbar DC via `buf.Render(hdc)` to eliminate flicker. --- -## :cloud-backup: Deployment Lifecycle State Machine - -`TaskbarEmbedder.cs` tracks overlay attachment health using `OverlayDeploymentState`: +## :square-mouse-pointer: Low-Level Mouse Monitor (`WH_MOUSE_LL`) -```csharp -public OverlayDeploymentState State { get; private set; } = OverlayDeploymentState.Uninitialized; -``` +Because native child windows on the taskbar can have mouse messages intercepted by Explorer, LocalTelemetry registers a global low-level mouse hook: -1. **`Uninitialized`**: Overlay is hidden or has not yet completed initial taskbar discovery. -2. **`Active`**: Taskbar handle verified and overlay successfully positioned (either as child or layered fallback). -3. **`Failed`**: Taskbar handle not found or `SetParent` call failed. -4. **`Recovering`**: Watchdog detected that `explorer.exe` restarted; attempting re-embedding cycle. +- Intercepts `WM_RBUTTONUP` within overlay bounds to display the custom dark-mode context menu. +- Intercepts `WM_LBUTTONDBLCLK` to trigger configured actions (`Task Manager` or `Settings`). +- Single left-clicks pass through to Windows without modifying taskbar focus. --- -## :palette: GDI+ Double-Buffered Rendering Engine +## :folder-sync: Watchdog & Recovery Loop -Implemented in [`TaskbarOverlay.cs`](https://github.com/Nicconike/LocalTelemetry/blob/master/src/LocalTelemetry.App/Overlay/TaskbarOverlay.cs), `TaskbarOverlay` inherits from `System.Windows.Forms.NativeWindow`: - -- Renders hardware metrics into an in-memory double-buffered bitmap using GDI+ (`System.Drawing.Graphics`). -- Caches font families and solid brushes to eliminate memory allocations on high-frequency polling ticks. -- Updates the layered window surface using `UpdateLayeredWindow` / `SetLayeredWindowAttributes`. -- When an alert triggers, applies a visual warning tint across the buffer (`rgba(255, 80, 0, 0.24)`). +- **5-Second Watchdog**: Monitors the taskbar handle. If Explorer restarts (`explorer.exe`), the watchdog detects the new shell handle and re-embeds the overlay. +- **200 ms Repositioning Loop**: Tracks taskbar dimension changes, screen resolution shifts, and application icon movements to keep the overlay aligned. --- -## :monitor: High-DPI Awareness & Scaling - -Queries `GetDpiForWindow` to dynamically scale font rendering, text margins, and line heights for 4K displays and custom DPI scaling settings (100%, 125%, 150%, 175%, 200%+). +## :monitor: Multi-Monitor Architecture (`TaskbarOverlayManager`) ---- +`TaskbarOverlayManager.cs` orchestrates multiple `TaskbarOverlay` instances across all active display monitors. -## :refresh-cw: Windows Explorer Restart Recovery +### Multi-Display Taskbar Identification -When `explorer.exe` crashes or restarts, all child window handles of `Shell_TrayWnd` are destroyed by the operating system: +Windows manages taskbars across separate Win32 window classes: +- **Primary Monitor**: Explorer assigns the class `Shell_TrayWnd` to the primary taskbar. +- **Secondary Monitors**: Explorer assigns the class `Shell_SecondaryTrayWnd` to every secondary taskbar. -1. **5-Second Heartbeat Watchdog (`_watchTimer`)**: - A background timer polls `TaskbarEmbedder.FindExplorerTrayWnd()` every 5 seconds. If the taskbar window handle changes or is recreated, it immediately triggers `OnTaskbarRecreated()` on the UI thread: +`DisplayInfo.EnumerateDisplays()` enumerates monitors using the Win32 `EnumDisplayMonitors` API. It matches each display device path to its corresponding taskbar handle: ```csharp -private void WatchdogTick() +// Locates all secondary taskbars owned by explorer.exe +while ((hwnd = SafeFindWindowEx(IntPtr.Zero, hwnd, "Shell_SecondaryTrayWnd", null)) != IntPtr.Zero) { - IntPtr currentTray = NativeMethods.FindWindow("Shell_TrayWnd", null); - if (currentTray != _lastKnownTray && currentTray != IntPtr.Zero) - { - Log.Info("Explorer restart detected; re-embedding taskbar overlay"); - _dispatcher.Invoke(ReembedOverlay); - } + // Associate secondary HWND with corresponding monitor rect } ``` -1. **State Transition to `Recovering`**: - During re-embedding, `State` transitions to `OverlayDeploymentState.Recovering`. Once positioning succeeds, it returns to `Active`. +### Mixed-DPI & Per-Monitor Coordinate Mapping + +Multi-monitor systems frequently combine displays with different scale factors (e.g. 150% laptop screen and 100% desktop monitor): + +1. **Per-Monitor DPI Discovery**: The overlay queries `GetDpiForWindow(hwnd)` or `GetDpiForMonitor` to determine the exact display scale factor. +2. **Independent Layout Calculation**: Each `TaskbarOverlay` calculates its font size, metric column spacing, and graph widths independently. +3. **Virtual Desktop Coordinates**: Secondary taskbars reside at non-zero virtual desktop coordinates (e.g. $X = -1920$ or $X = 2560$). The overlay anchors child coordinates relative to parent taskbar bounds rather than absolute screen origin. + +### Display Settings Synchronization + +`TaskbarOverlayManager` subscribes to the `SystemEvents.DisplaySettingsChanged` event: + +- When you connect or disconnect a monitor, Windows fires this notification. +- The manager invokes `SyncOverlays("DisplaySettingsChanged notification")`. +- It discards disposed overlay instances and instantiates new overlays based on user settings (`displayMode: "all"` or specific `enabledDisplays`). diff --git a/docs/latest/index.md b/docs/latest/index.md index 35994ed..3fd890a 100644 --- a/docs/latest/index.md +++ b/docs/latest/index.md @@ -22,26 +22,27 @@ hero: features: - icon: ":picture-in-picture-2:" title: Native Taskbar Embedding - details: Seamlessly renders live metrics inside your Windows 10 & 11 taskbar with high-DPI scaling, ClearType typography, and zero window clutter. + details: Renders live metrics directly on your Windows 10 and 11 taskbar with high-DPI scaling and ClearType typography. - icon: ":wifi-sync:" title: Gapless Network History - details: Automatically imports past daily bandwidth from Windows system records back to your OS install date, alongside live speed metering. + details: Imports daily bandwidth from Windows SRUM back to your OS install date, alongside live speed metering. - icon: ":sun-snow:" title: Kernel Hardware Sensors - details: Direct kernel driver polling for Intel, AMD, and NVIDIA. Tracks CPU/GPU temperatures, wattage, clocks, VRAM, Disk I/O and laptop battery charge rates. + details: Direct kernel polling for Intel, AMD, and NVIDIA. Tracks temperatures, wattage, clocks, VRAM, disk I/O, and battery. - icon: ":swatch-book:" - title: Hardware-Matched Metric Colors - details: Automatically identifies installed hardware from all popular manufacturers & OEMs to apply authentic brand colors to each metric. + title: Hardware Brand Colors + details: Detects installed hardware and applies authentic vendor brand colors to each metric automatically. - icon: ":bell-ring:" - title: Non-Intrusive Threshold Alerts - details: Flashing taskbar indicators and lightweight toast notifications that alert on thermal throttling or critical limits without interrupting games. + title: Non-Intrusive Alerts + details: Visual taskbar flashing and desktop toast notifications alert on thermal limits without interrupting full-screen games. + - icon: ":shield-check:" title: 100% Private & Local - details: Operates entirely offline with zero background analytics, no cloud accounts, and no phoning home. Your hardware vitals never leave your system. + details: Operates completely offline with zero analytics, no cloud accounts, and no external telemetry. ---
diff --git a/docs/latest/user-guide/alerts-and-notifications.md b/docs/latest/user-guide/alerts-and-notifications.md index 21017b2..216321f 100644 --- a/docs/latest/user-guide/alerts-and-notifications.md +++ b/docs/latest/user-guide/alerts-and-notifications.md @@ -1,85 +1,60 @@ # :bell-ring: Threshold Alerts & Toast Notifications -LocalTelemetry features a proactive alert engine designed to warn you whenever temperatures, power draw, memory limits, or bandwidth consumption exceed your safety thresholds. +LocalTelemetry warns you when temperatures, power draw, memory limits, or bandwidth consumption exceed your safety thresholds. -## :package-check: Alert Delivery Mechanisms +## :package-check: Alert Delivery Channels -When a hardware metric crosses an enabled threshold, LocalTelemetry dispatches warnings through two configurable channels: +When a hardware metric crosses an enabled threshold, LocalTelemetry dispatches warnings through three coordinated channels: -1. **Visual Taskbar Flashing**: The affected metric label and value on the taskbar overlay flash with a translucent orange warning tint (`rgba(255, 80, 0, 0.24)`). This notifies you instantly without opening windows or stealing focus. -2. **Desktop Toast Notifications**: An animated toast notification slides in near the bottom-right corner of your screen via the out-of-process notification helper (`LocalTelemetry.Notifier.exe`). +1. **In-Overlay Highlight**: The overlay displays the breached metric value in Coral Red (`#FF4444`) until the value returns to safe levels. +2. **Visual Taskbar Flashing**: The overlay flashes briefly with a translucent orange tint (`rgba(255, 80, 0, 0.24)`) without taking window focus. +3. **Desktop Toast Notifications**: An animated toast notification slides in near the bottom-right corner of your screen via the standalone notifier helper (`LocalTelemetry.Notifier.exe`). ![Standalone Toast Alert Notification](/images/toast-alert.png) -*Non-intrusive desktop toast alert notifying about elevated hardware temperature.* +*Desktop toast alert notifying about elevated hardware temperature.* -## :hat-glasses: Anti-Focus-Stealing Architecture - -Desktop toast popups are handled by a dedicated standalone process (`LocalTelemetry.Notifier.exe`) communicating with the main application via named pipes. - -### :shield-question-mark: Why is this important? +--- -- **Zero Gaming Interruptions**: Standard Windows toast popups can minimize full-screen games or steal keyboard/mouse focus. LocalTelemetry's notification windows use a non-activating desktop overlay window style so toasts never take focus, minimize games, or disrupt keyboard typing. -- **Isolated Animation Performance**: Slide-in and fade-out animations run on a separate UI thread in the helper process, preventing frame drops in the core telemetry polling loop. -- **On-Demand Process Lifecycle**: The notifier helper process (`LocalTelemetry.Notifier.exe`) is dynamically spawned only when threshold alerts and toast notifications are active in Settings. If alerts or toast popups are turned off, the process is automatically terminated to eliminate background RAM usage and idle thread overhead. - -::: tip Technical Implementation -To inspect the asynchronous Named Pipe IPC protocol, notification packet serialization, and `WS_EX_NOACTIVATE` window styling, see the [Notifier & Named Pipe IPC](/developer-guide/notifier-ipc) developer guide. -::: +## :hat-glasses: Anti-Focus-Stealing Architecture -## :monitor-cog: Configurable Hardware Thresholds +Desktop toasts are managed by a dedicated standalone process (`LocalTelemetry.Notifier.exe`): -In **Settings -> Alerts**, switch on **Enable Threshold Alerts** to customize sensor limits. +- **No Game Interruptions**: Standard Windows toasts can minimize full-screen games. LocalTelemetry uses non-activating desktop overlay windows (`WS_EX_NOACTIVATE`) so toasts never steal focus or interrupt games. +- **Independent Animations**: Slide-in and fade-out animations run on a separate UI thread, preventing frame drops in the core telemetry loop. +- **On-Demand Lifecycle**: The notifier helper launches only when alerts and toast popups are active. If alerts are disabled, the helper terminates to free system resources. -::: tip Automatic Safety Defaults -When you enable alerts without active selections, LocalTelemetry enables three sensible defaults automatically: +--- -- **CPU Temp**: Enabled at 90°C. -- **RAM Usage**: Enabled at 90%. -- **GPU Temp**: Enabled at 85°C. +## :monitor-cog: Configuring Hardware Thresholds -You can adjust or disable these defaults at any time. -::: +In **Settings -> Alerts**, toggle **Enable Threshold Alerts** to customize warning limits: ![Alerts Configuration Interface](/images/alerts-settings.png) -*Alerts configuration tab for setting hardware limits, bandwidth quotas, and delivery options.* - -### :cpu: CPU Alerts - -- **CPU Usage**: Alerts when total processor utilization exceeds the specified limit (`50%` to `100%`). -- **CPU Temp**: Alerts when package temperature exceeds safe thresholds (`60°C` to `100°C`). -- **CPU Frequency**: Low-threshold warning that triggers when core clock speed drops **below** the minimum target (`200 MHz` to `2000 MHz`) due to thermal or power throttling. -- **CPU Package Power**: Alerts when package power draw exceeds the wattage limit (`20 W` to `250 W`). - -### :memory-stick: RAM Alerts - -- **RAM Usage**: Alerts when total system memory utilization exceeds the configured limit (`50%` to `100%`). +*Configure hardware warning limits, bandwidth quotas, and notification preferences.* -### :gpu: GPU Alerts +### Supported Threshold Triggers -- **GPU Usage**: Alerts when graphics core load exceeds the specified threshold (`50%` to `100%`). -- **GPU VRAM Usage**: Alerts when dedicated video memory consumption exceeds the limit (`1,024 MB` to `32,768 MB`). -- **GPU Temp**: Alerts when GPU core temperature exceeds the safety threshold (`60°C` to `100°C`). -- **GPU Frequency**: Low-threshold warning that triggers when GPU core clocks drop **below** the minimum target (`100 MHz` to `2000 MHz`) due to graphics throttling. -- **GPU Power**: Alerts when total board power draw exceeds the wattage threshold (`20 W` to `400 W`). +- **CPU Alerts**: Usage (`50%` to `100%`), Temperature (`60°C` to `100°C`), Low Clock Frequency (`200 MHz` to `2000 MHz`), and Package Power (`20 W` to `250 W`). +- **RAM Alerts**: System memory load percentage (`50%` to `100%`). +- **GPU Alerts**: Core Usage (`50%` to `100%`), Dedicated VRAM (`1 GB` to `32 GB`), Temperature (`60°C` to `100°C`), Low Core Frequency, and Board Power (`20 W` to `400 W`). +- **Storage Alerts**: Physical drive temperature (`45°C` to `90°C`). The notification indicates the specific drive number. +- **Network Bandwidth Quotas**: Daily bandwidth limit (`5 GB` to `500 GB`) and monthly bandwidth limit (`100 GB` to `5000 GB`). +- **Battery Alerts**: Low battery charge percentage (`5%` to `50%`) while discharging on portable systems. -### :wifi: Network Bandwidth Quotas +--- -- **Daily Internet Usage**: Alerts when total transferred data across the active network adapter exceeds your daily budget (`5 GB` to `500 GB`). -- **Monthly Internet Usage**: Alerts when cumulative monthly data transfer crosses your ISP bandwidth cap (`100 GB` to `5,000 GB`). +## :shield-alert: Anti-Spike Filtering & Hysteresis -### :battery-warning: Battery Alerts +To prevent false alarms and rapid notification flashing, LocalTelemetry applies two safeguards: -::: info Hardware Dependency -The Battery alert section appears only on systems with a detected battery (`hasBattery`). Desktop computers automatically hide this section. -::: +### Sustained Breach Duration Filter -- **Battery Low**: Alerts when laptop battery charge drops below the warning level (`5%` to `50%`) while actively discharging. Warnings are automatically suppressed while connected to AC power. +Brief turbo boosts can momentarily exceed thermal targets for 1 to 2 seconds. The **Sustained breach duration** slider (`1 s` to `10 s`, default `3 s`) requires values to stay elevated before triggering notifications. -## :octagon-alert: Alert Actions & Cooldown Controls +### Thermal Normalization Hysteresis -Under the **Actions** section in **Settings -> Alerts**, you can fine-tune notification behavior: +Once an alert triggers, the warning state remains active until the sensor cools down: -- **Show Tray Notification**: Toggles desktop toast popup notifications on or off. -- **Flash Overlay Briefly**: Toggles in-place visual flashing on the taskbar overlay. -- **Cooldown between alerts**: Configures the delay before repeat notifications are sent for the same sensor (`5 s` to `120 s`, default: `60 s`). -- **Only fire once per session (ignores cooldown)**: Ignores cooldown and fires an alert only once per application run until LocalTelemetry is restarted. +- **CPU & GPU Temperatures**: 10°C hysteresis band (for example, a 90°C alert clears when cooling to 80°C or below). +- **Disk Temperatures**: 5°C hysteresis band. +- **Usage & Power Metrics**: 2-unit hysteresis band. diff --git a/docs/latest/user-guide/customization.md b/docs/latest/user-guide/customization.md index 878d50e..986cee0 100644 --- a/docs/latest/user-guide/customization.md +++ b/docs/latest/user-guide/customization.md @@ -1,137 +1,127 @@ # :settings-2: Settings & Customization -LocalTelemetry features a modern settings interface built using **Svelte 5 Runes**, **TypeScript**, and **Vite** rendered inside a native Microsoft **WebView2** window. +LocalTelemetry features a modern settings interface built with **Svelte 5 Runes**, **TypeScript**, and **Vite** rendered inside a native Microsoft **WebView2** window. -## :mouse-pointer-click: Accessing the Settings Interface +## :mouse-pointer-click: Opening the Settings Window - Double-click the **System Tray Icon**. -- Or right-click the tray icon and choose **Open Settings**. +- Or right-click the tray icon and select **Open Settings**. +- Or right-click the taskbar overlay and select **Open Settings**. -## :notebook-tabs: Comprehensive Settings Tabs +--- -The settings panel is organized into 10 dedicated tabs matching the exact navigation sequence in the application: +## :layout-grid: Layout & Metric Sequencing -### :notebook-text: General +In the **Layout** tab, you can customize which metrics appear on your taskbar and arrange their column order: -- **Start with Windows**: Automatically launches LocalTelemetry at Windows logon using a Windows Task Scheduler task (`LocalTelemetry Startup`) running with elevated rights, avoiding UAC prompts on reboot. -- **Show System Tray Icon**: Toggle whether the application icon is displayed in the Windows notification area. When disabled, LocalTelemetry operates exclusively through the taskbar overlay. This toggle is disabled if the overlay is hidden to prevent accidental interface lockout. -- **Polling Interval**: Set hardware refresh speed to `0.5 s`, `1 s`, `2 s`, or `5 s`. -- **Temperature Units**: Toggle **Show Temperatures in °F** to switch between Celsius (`°C`) and Fahrenheit (`°F`). +![Layout Settings Tab](/images/layout-settings.png) +*Customize taskbar metrics, presets, column pairs, and ordering.* -![General Settings Tab](/images/general-settings.png) -*General settings tab for configuring startup behavior, sensor polling rates, and temperature units.* +### Layout Presets -### :panel-bottom: Overlay +Select from 8 curated layout presets or build a custom arrangement: -- **Show Overlay**: Master toggle to show or hide the taskbar overlay. This toggle is disabled if the system tray icon is hidden to keep at least one entry point active. -- **Position in taskbar**: Adapts dynamically to Windows 11 taskbar alignment: - - **Centered Taskbar**: Select `Left side` (near Widgets) or `Right side` (adjacent to notification area). - - **Left-Aligned Taskbar**: Select `Next to Apps` (placed after active app icons) or `Before System Tray`. -- **Offset from Edge**: Adjust horizontal pixel offset from the selected edge (`0px` to `200px`). -- **Opacity**: Adjust overlay opacity (`20%` to `100%`). -- **Scale**: Adjust overlay scaling multiplier (`80%` to `200%`). -- **Double-Click Action**: Configure what happens when double-clicking the overlay (`None`, `Open Task Manager`, or `Open Settings`). -- **Taskbar Space Constraint Banner**: Warns when the available taskbar slot is narrower than the overlay. LocalTelemetry scales down and clamps coordinates to prevent overlap. Includes a button to open Windows Taskbar Settings (`ms-settings:taskbar`) to hide Windows Widgets. +- **Default**: Balanced 5-column layout tracking core utilization, temperatures, memory, and network throughput. +- **Gaming**: CPU metrics on top paired with GPU metrics on the bottom, alongside RAM and network speeds. +- **Compact**: Minimalist single-row layout displaying core load percentages and network speed. +- **Micro**: Ultra-compact 2-column strip for narrow taskbars. +- **Thermals & Power**: Dedicated diagnostics for CPU/GPU temperatures, wattage, and clocks. +- **Workstation**: Highlights compute load, RAM usage, network, and storage drive I/O. +- **Network & Traffic**: Emphasizes live transfer rates and cumulative bandwidth. +- **Full Telemetry**: Expanded layout displaying all available hardware metrics. -![Overlay Settings Tab](/images/overlay-settings.png) -*Overlay settings tab for configuring taskbar placement, edge offset, opacity, scaling, and double-click behavior.* +### Column Pairing & Reordering -### :activity: Monitoring +- **Swap Mode**: Click `⇅ Swap` to enter interactive swap mode, then click any two columns to exchange their positions. +- **Pairing Sensors**: Columns with an empty bottom row show a `+ Pair Metric` dropdown to add a paired sensor. +- **Shifting**: Use `◀` and `▶` buttons to move columns left or right. +- **Drag-and-Drop**: Drag metrics vertically to reorder the sequence on the overlay. +- **Reset to Defaults**: Restores the standard 5-column default layout with one click. -- **Active Trackers**: Toggle individual hardware polling components on or off (CPU, GPU, RAM, Network, Disk, and Battery on portable devices). Toggling off an unused component completely halts its background polling loop and driver queries to eliminate unnecessary CPU wakeups. -- **CPU Monitoring Mode**: - - **Clock Mode**: Choose between `Average` (mean clock frequency across all active cores) or `Max Active Core` (highest clocked core frequency). - - **Usage Source**: Choose between `Overall (Task Manager)` (average system-wide load) or `Max Thread (Gaming)` (highest loaded thread, ideal for spotting single-core bottlenecks). -- **GPU Usage Source**: Choose between `Driver (NVML/ADL)` (vendor driver engine load matching MSI Afterburner) or `WDDM (Task Manager)` (Windows display driver model engine statistics). -- **Metrics Logging**: Master toggle to log periodic sensor telemetry to daily log files (`lt_DD-MM-YYYY.log`). -- **Per-Category Log Modes**: Configure logging detail (`Off`, `Errors`, `Full`) independently for each hardware component. -- **System Logging**: Sets diagnostic logging verbosity written to `lt_system.log` (`Off`, `Error`, `Warning`, `Info`, `Debug`). Set to `Debug` only when troubleshooting hardware issues. +--- -![Monitoring Settings Tab](/images/monitoring-settings.png) -*Monitoring settings tab for enabling individual hardware sensor categories, calculation modes, and metric logging.* +## :swatch-book: Appearance & Themes -### :layout-grid: Layout +In the **Appearance** tab, choose your preferred window theme and customize taskbar metric colors: -- **Metric Drag-and-Drop Ordering**: Drag metrics (or use the up/down arrows) to change the exact column sequence on the taskbar overlay. -- **Add / Remove Metrics**: Select which hardware metrics are displayed on the overlay (such as NVMe disk I/O, laptop battery status, package wattage, and core clocks) or remove unneeded sensors. Battery metrics are automatically hidden on desktop computers without a battery. -- **Reset Layout to Defaults**: Click the **Reset Layout to Defaults** button to instantly restore the standard 5-column default layout (CPU Usage & Temp, GPU Usage & Temp, GPU VRAM & Total Transferred, RAM Usage & Used, and Download & Upload speeds). + +*Select from 18 dark and light themes and customize metric accent colors.* -![Layout Settings Tab](/images/layout-settings.png) -*Layout configuration tab for reordering and selecting hardware metrics.* +### Available Window Themes -![Customized Taskbar Overlay Result](/images/overlay.png) -*Resulting customized taskbar overlay displaying active NVMe disk throughput and battery vitals alongside core metrics.* +LocalTelemetry includes 18 curated themes across 9 Dark and Light pairs: -### :network: Network +| Theme | Background | Primary Accent | Secondary Accent | +| :--- | :--- | :--- | :--- | +| **Default Dark** | `#171614` | `#0099b8` | `#22d3ee` | +| **Default Light** | `#f5f4f0` | `#00738c` | `#0e7490` | +| **Midnight Blue** | `#0a0e17` | `#2563eb` | `#818cf8` | +| **Midnight Light** | `#f0f4f9` | `#1d4ed8` | `#6366f1` | +| **Forest Green** | `#0d1712` | `#16a34a` | `#84cc16` | +| **Forest Light** | `#f1f6f2` | `#15803d` | `#65a30d` | +| **Ocean Teal** | `#07151a` | `#0d9488` | `#2dd4bf` | +| **Ocean Light** | `#edf7f8` | `#0f766e` | `#14b8a6` | +| **Royal Purple** | `#130f1d` | `#9333ea` | `#c084fc` | +| **Royal Light** | `#f5f0fa` | `#7e22ce` | `#a855f7` | +| **Slate** | `#141517` | `#d97706` | `#ea580c` | +| **Slate Light** | `#f2f3f5` | `#b45309` | `#c2410c` | +| **OLED Black** | `#000000` | `#e11d48` | `#fb7185` | +| **OLED Light** | `#ffffff` | `#09090b` | `#71717a` | +| **Nord** | `#242933` | `#5e81ac` | `#88c0d0` | +| **Nord Light** | `#e5e9f0` | `#4c6e96` | `#81a1c1` | +| **Cyberpunk** | `#09090b` | `#ff0055` | `#e0e722` | +| **Cyberpunk Light** | `#fdf4f6` | `#c026d3` | `#ec4899` | -- **Show Speed in Bits/s**: Toggle displaying network download and upload throughput in bits per second (`b/s`, `Kb/s`, `Mb/s`, `Gb/s`) instead of bytes per second (`B/s`, `KB/s`, `MB/s`, `GB/s`). -- **Network Adapter**: Select which network adapter is used for throughput monitoring (`Auto (Best Match)` or a specific physical adapter like `Ethernet` / `Wi-Fi`). -- **Traffic History**: Toggle **Record Daily Traffic History** to record upload and download totals into `internet_usage.jsonl`. +### Metric Colors -![Network Settings Tab](/images/network-settings.png) -*Network settings tab for selecting the preferred network adapter and enabling daily traffic logging.* +- Customize colors for individual metrics or whole hardware groups. +- Enable **Follow Windows Theme** to adjust contrast automatically when Windows switches between light and dark modes. +- Click **Reset All to Defaults** to restore detected hardware manufacturer brand colors. -### :arrow-down-up: Traffic +--- -- **Usage Calendar**: View daily network download and upload totals on an interactive monthly calendar heatmap with 6 usage tiers. -- **Filter by Adapter**: Filter bandwidth totals dynamically for **All** or any individual network interface discovered in the month's records (such as **Ethernet** or **Wi-Fi**). -- **Day Detail Breakdown**: Click on any calendar day to inspect per-adapter upload and download volumes. -- **Windows Network Usage Import**: Backfill historical usage from Windows SRUM using date presets (`Last 7 Days`, `Last 14 Days`, `Last 30 Days`) or custom `From` / `To` date pickers. -- **Traffic Database & Backup Import**: Import native `internet_usage.jsonl` backups or external plaintext `.dat` logs into the database. -- **Persistent Storage**: All historical records are saved locally in `internet_usage.jsonl`. +## :computer: System Information -![Traffic History Tab](/images/traffic-settings.png) -*Traffic history calendar tab for tracking daily upload and download bandwidth.* +The **System** tab displays a comprehensive diagnostic overview of your hardware: -### :triangle-alert: Alerts +![System Information Tab](/images/system-settings.png) +*Detailed hardware discovery specs, memory timings, drive health, and driver versions.* -- **Hardware Threshold Limits**: Configure warning triggers for CPU (Usage %, Temp, Frequency throttling, Package Power), RAM (Usage %), GPU (Usage %, VRAM, Temp, Frequency throttling, Board Power), Network (Daily and Monthly bandwidth quotas), and Battery (Low charge %). -- **Network Bandwidth Quotas**: Set warnings for **Daily Internet Usage** (`5 GB` to `500 GB`) and **Monthly Internet Usage** (`100 GB` to `5000 GB`). -- **Notification Channels**: Enable desktop toast popups (**Show Tray Notification**) and in-place visual flashing on the taskbar overlay (**Flash Overlay Briefly**). -- **Cooldown & Session Rules**: Configure cooldown delay between alerts (`5 s` to `120 s`, default: `60 s`) or enable **Only fire once per session (ignores cooldown)**. +- **System & Motherboard**: Computer model, motherboard manufacturer, BIOS version, UEFI boot mode, and power supply rating. +- **Processor (CPU)**: Model, vendor brand, core/thread count, base and turbo boost clocks, socket type, and TDP. +- **Memory (RAM)**: Total capacity, module slots, manufacturer, generation (DDR4/DDR5), and rated SPD vs. configured clock speeds. +- **Graphics (GPU)**: Detected graphics adapters (Dedicated/Integrated), VRAM capacity, driver version, and board power limit. +- **Storage Drives**: Discovered physical drives with bus badges (`[NVMe]`, `[SATA]`), health status, remaining endurance %, and lifetime writes (TBW). +- **Battery (Laptops)**: Battery manufacturer, designed capacity, full charge capacity, health %, and charge cycle count. -![Alerts Settings Tab](/images/alerts-settings.png) -*Alerts settings tab for defining temperature and resource threshold limits.* +--- -### :computer: System +## :info: General Preferences & Updates -- **Hardware Specs Overview**: Displays a comprehensive diagnostic breakdown of detected system hardware organized into distinct component cards: - - **System**: Device Name (computer name), OS (Windows display version string), and System Type (`Desktop` or `Laptop`). - - **Motherboard**: System model name, Motherboard manufacturer and model, hardware version/revision, serial number, BIOS version, firmware boot mode (`UEFI` or `Legacy`), and power supply information (PSU model and wattage rating on desktop PCs). - - **Processor (CPU)**: Processor model string, CPU vendor brand, physical core count, logical thread count, base clock frequency (GHz), maximum turbo boost frequency (GHz), socket designation (e.g. `Socket LGA 1700`, `Socket AM5`), and thermal design power (TDP in Watts). - - **Memory (RAM)**: Total installed RAM (with usable capacity in GB), memory manufacturer, clock speed (e.g. `5600 MT/s` or configured speed with rated SPD speed when different, such as `4800 MT/s (rated 6000 MT/s)`), memory generation type (e.g. `DDR5`, `DDR4`), number of populated module slots, and individual capacity and speed breakdown per module (`Module 1`, `Module 2`, etc.). - - **Graphics (GPU)**: Detected graphics cards labeled as `Dedicated` or `Integrated`, GPU model name, dedicated VRAM capacity (GB), installed driver version, and board TDP power limit (W). - - **Storage**: Discovered physical drives indexed sequentially (`Disk 1`, `Disk 2`, etc.) with a blue `Boot` badge for the OS drive, drive model name, storage capacity, and connection bus type (`[NVMe]`, `[SATA]`, `[SCSI]`, or `[DISK]`). - - **Network**: Discovered active network adapters (`Adapter` name for each physical or virtual connection). - - **Battery** *(Laptops only)*: Detected battery manufacturer, device name / model identifier, factory designed capacity, current full charge capacity, battery health percentage, wear level percentage, and completed charge cycle count. +The **General** and **About** tabs manage application lifecycle, updates, and directory shortcuts: -![System Information Tab](/images/system-settings.png) -*System information tab summarizing detected hardware specifications and driver versions.* +![General Preferences Tab](/images/general-settings.png) +*Configure Windows startup registration, polling intervals, and temperature display units.* -### :swatch-book: Appearance - -- **Window Themes**: Select from built-in curated dark and light theme presets for the configuration interface. -- **Metric Color Customization**: Set individual hex colors for each hardware metric (CPU, GPU, RAM, Disks, Network, Battery) using color pickers or hex inputs. -- **Hardware Group Colors**: Apply unified color overrides across entire component sensor groups. -- **Follow Windows Theme**: Synchronize overlay transparency key color and contrast with the active Windows theme. -- **Reset All to Defaults**: Reset metric colors back to the default vendor-detected color scheme. +![About Settings Tab](/images/about-settings.png) +*View application version, check for updates, and open data folders.* -![Appearance Settings Tab](/images/appearance-settings.png) -*Appearance tab for customizing window themes, per-metric colors, and component group palettes.* +- **Start with Windows**: Registers an elevated Windows Task Scheduler task for silent launch at login without UAC prompts. +- **Polling Interval**: Adjust sensor refresh rates from `1 s` to `5 s`. +- **Temperature Scale**: Switch between Celsius (`°C`) and Fahrenheit (`°F`). +- **Software Updates**: Check for new releases on GitHub on demand or configure automatic weekly/monthly checks. +- **Directory Shortcuts**: Direct "→" buttons open the Installation, Settings Data, and Logs folders in Windows File Explorer. -### :info: About +--- -- **Software Updates**: Check for newer releases via the GitHub Releases API on demand (**Check for Updates** button), configure update check frequency (**Weekly**, **Monthly**, or **Manual**), and toggle **Include pre-release & RC builds** (disabled by default). If an update is detected, a direct **Download** button links straight to the release. -- **Application Metadata**: Displays the active version (`vX.Y.Z`), deployment mode (`Standard` vs `Portable`), build date, target runtime (.NET 10), and platform (Windows x64). -- **Application Directories**: Single-click "→" buttons open the application folders directly in Windows File Explorer: - - **Standard Mode**: Quick access to the Installation Folder (`C:\Program Files\LocalTelemetry`), Settings & Data Folder (`%LOCALAPPDATA%\LocalTelemetry`), and Logs Folder (`%LOCALAPPDATA%\LocalTelemetry\logs`). - - **Portable Mode**: Direct access to the Portable Application Folder and the dedicated `logs\` folder. -- **Resources & Links**: Quick shortcuts to report bugs on GitHub Issues, browse official releases, view online documentation, and read the GNU GPLv3 license. -- **Third-Party Software & Licenses**: Lists open-source runtime libraries and components (.NET Runtime, Svelte 5, Vite, Microsoft WebView2, PawnIo Driver, MinVer). +## :notebook-tabs: Dedicated Feature Guides -![About Settings Tab](/images/about-settings.png) -*About tab for viewing application version details, update checks, application directories, and open-source licenses.* +For in-depth configuration of functional tabs, see the dedicated guides: -::: tip Technical Implementation -To inspect the Svelte 5 component architecture, JSON message contracts, and the bidirectional WebView2 host bridge, see the [Frontend & WebView2 Architecture](/developer-guide/frontend-webview) developer guide. -::: +- **Overlay Placement & Multi-Monitor**: [System Tray & Taskbar Overlay Guide](./tray-and-overlay.md) +- **Sensor Calculation Modes**: [Telemetry Metrics & Sensors Guide](./metrics-and-sensors.md) +- **Warning Thresholds & Desktop Alerts**: [Threshold Alerts & Toast Notifications Guide](./alerts-and-notifications.md) +- **Network Adapters & Bandwidth Tracking**: [Traffic & Network History Guide](./network-history.md) diff --git a/docs/latest/user-guide/index.md b/docs/latest/user-guide/index.md index 8a6d6a1..3b1a0b7 100644 --- a/docs/latest/user-guide/index.md +++ b/docs/latest/user-guide/index.md @@ -1,54 +1,50 @@ # :book-open: Overview & Introduction -Welcome to the **LocalTelemetry User Guide**! +Welcome to the **LocalTelemetry User Guide**. -This documentation walks through installing, configuring, and getting the most out of **LocalTelemetry** on Windows. +LocalTelemetry is a native hardware monitor for Windows 10 and 11. It reads hardware sensors and displays live system vitals directly on the Windows taskbar. -## :localtelemetry: What is LocalTelemetry? +Instead of floating widgets or heavy overlays that obstruct games, LocalTelemetry docks directly into your taskbar. It operates as a lightweight background process. The embedded WebView2 engine loads only when you open the settings window. -**LocalTelemetry** is a native, privacy-first hardware monitoring utility for Windows built with .NET 10 and Svelte 5. It continuously reads low-level hardware sensors and displays real-time performance vitals directly on the Windows taskbar. +To read the motivation and philosophy behind this project, see [**Why I Built LocalTelemetry**](/about/). -Instead of running floating widgets, desktop gadgets, or heavy overlays that obstruct your workspace or full-screen games, LocalTelemetry anchors directly to the taskbar. It operates as a lightweight background process with minimal CPU overhead, only initializing the embedded WebView2 engine when you open the settings interface. - -To read the personal story, background, and engineering philosophy behind this project, see [**Why I Built LocalTelemetry**](/about/). - -![LocalTelemetry Default Taskbar Overlay](/images/overlay-default.png) -*Default out-of-the-box taskbar overlay displaying 5 dual-row columns with automatic hardware vendor brand colors applied.* + ## :zap: Core Capabilities -- :app-window: **Taskbar Overlay**: Displays live system vitals directly on the Windows 10 & 11 taskbar with high-DPI scaling, ClearType typography, and zero desktop window clutter. -- :cpu: **Kernel & Driver-Level Polling**: Direct low-level polling for Intel (RAPL MSR), AMD (Ryzen SMU / ADL), and NVIDIA (NVML) for package wattage, clock speeds, and temperatures. -- :calendar-days: **Gapless Network History**: Reconstructs daily bandwidth from your Windows installation date via Windows SRUM (`SRUDB.dat`) alongside live speed metering. -- :battery-plus: **Laptop Battery Telemetry**: Real-time battery charge percentage and charge/discharge rate in Watts directly on the taskbar overlay, plus manufacturer, device model, designed capacity, and full charge capacity in the System dashboard. -- :bell-ring: **Non-Intrusive Safety Alerts**: In-place taskbar flashing and focus-safe desktop toast notifications that warn of thermal throttling without minimizing full-screen games. -- :palette: **Svelte 5 Customization Dashboard**: Complete control over metric visibility, drag-and-drop sequencing, per-metric colors, and warning thresholds. -- :shield-check: **Privacy-First & Local Storage**: All hardware sensor metrics and bandwidth logs remain strictly on your local machine with zero analytics or tracking. Software updates check the official GitHub Releases API either on-demand or at your configured schedule without transmitting personal telemetry. +- :app-window: **Taskbar Overlay**: Displays live vitals directly on the Windows taskbar with high-DPI scaling and ClearType typography. +- :cpu: **Kernel Sensor Polling**: Reads package wattage, clock speeds, and temperatures for Intel, AMD, and NVIDIA hardware. +- :calendar-days: **Network History**: Records daily bandwidth usage and imports past records from Windows System Resource Usage Monitor. +- :battery-plus: **Battery Telemetry**: Shows real-time battery percentage, charge rate in Watts, and battery health on portable devices. +- :bell-ring: **Safety Alerts**: Provides in-place taskbar flashing and desktop toast alerts without minimizing full-screen games. +- :palette: **Settings Dashboard**: Controls metric visibility, column layouts, custom colors, and warning limits. +- :shield-check: **Local & Private**: Stores all sensor data and traffic history locally. Operates offline without user accounts or tracking. ## :book-open-text: User Guide Chapters -Explore the step-by-step guides for each feature: - -1. [**Installation & Requirements**](./installation.md) - System requirements, Inno Setup installer vs. Portable ZIP package, and Administrator (UAC) driver privileges. +1. [**Installation & Requirements**](./installation.md) + System specifications, installer options, and driver permissions. -2. [**Quickstart Guide**](./quickstart.md) - First launch setup, enabling the taskbar overlay, and basic configuration. +2. [**Quickstart Guide**](./quickstart.md) + First launch steps, enabling the overlay, and basic configuration. -3. [**System Tray & Taskbar Overlay**](./tray-and-overlay.md) - System tray controls, overlay positioning, layout modes, and Windows Explorer restart recovery. +3. [**System Tray & Taskbar Overlay**](./tray-and-overlay.md) + Tray controls, overlay positioning, mouse shortcuts, and multi-monitor setup. -4. [**Telemetry Metrics & Sensors**](./metrics-and-sensors.md) - Comprehensive reference of all supported hardware metrics, polling APIs, measurement units, and update rates. +4. [**Telemetry Metrics & Sensors**](./metrics-and-sensors.md) + Detailed list of supported hardware sensors, units, and calculation modes. -5. [**Threshold Alerts & Toast Notifications**](./alerts-and-notifications.md) - Configuring warning limits, visual taskbar flashing, and focus-safe desktop toast notifications. +5. [**Threshold Alerts & Toast Notifications**](./alerts-and-notifications.md) + Warning thresholds, taskbar flashing, and non-intrusive desktop toasts. -6. [**Settings & Customization**](./customization.md) - Detailed walkthrough of all 10 settings tabs: General preferences, sensor monitoring, overlay placement, metric layout, appearance themes, alerts, and system specs. +6. [**Settings & Customization**](./customization.md) + Walkthrough of settings tabs, layout builder, and visual themes. -7. [**Traffic & Network History**](./network-history.md) - Daily internet usage tracking, monthly calendar heatmap, Windows `SRUDB.dat` history backfill, and local JSON Lines storage. +7. [**Traffic & Network History**](./network-history.md) + Bandwidth tracking, monthly usage calendar, Windows SRUM import, and data backups. -8. [**Troubleshooting & FAQ**](./troubleshooting.md) - Frequently asked questions, sensor diagnosis, and application log locations. +8. [**Troubleshooting & FAQ**](./troubleshooting.md) + Solutions for common questions, sensor diagnostics, and log files. diff --git a/docs/latest/user-guide/installation.md b/docs/latest/user-guide/installation.md index a12ede5..c9dfd16 100644 --- a/docs/latest/user-guide/installation.md +++ b/docs/latest/user-guide/installation.md @@ -1,34 +1,23 @@ # :list-checks: Installation & Requirements -This page details system requirements, installation methods, administrative driver permissions, update procedures, and clean uninstallation for **LocalTelemetry**. +This page details system requirements, installation methods, administrative permissions, updates, and uninstallation for **LocalTelemetry**. ## :laptop-minimal-check: System Requirements -| Requirement | Minimum Specification | Recommended Specification | -| :------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------------------------------- | -| **Operating System** | [**Windows 10**](https://learn.microsoft.com/en-us/windows/release-health/release-information) (64-bit, v2004+ / build 19041) | [**Windows 11**](https://www.microsoft.com/en-in/windows/windows-11-specifications?r=1) (64-bit, v22H2 or newer) | -| **Architecture** | [**x86-64 / AMD64**](https://en.wikipedia.org/wiki/X86-64) ([x64 compatible](https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/x64-architecture)) | [**x86-64 / AMD64**](https://en.wikipedia.org/wiki/X86-64) (Intel or AMD) | -| **Permissions** | **Administrator (UAC)** *(required for hardware sensor driver)* | **Administrator (UAC)** *(silent boot via Task Scheduler)* | -| **System RAM** | **2 GB** (Windows 10) / [**4 GB**](https://www.microsoft.com/en-in/windows/windows-11-specifications?r=1) (Windows 11) | **8 GB or higher** | -| **App Footprint** | **~40-50 MB RAM** (minimized overlay) / **~100-150 MB** (Settings UI) | **~40-50 MB RAM** | -| **Disk Space** | **~70 MB** initial footprint (**37 MB** installation folder + **~30 MB** WebView2 user cache) | **100 MB+** (recommended for long-term traffic history & logs) | -| **.NET Runtime** | [**Microsoft .NET 10 Desktop Runtime (x64)**](https://aka.ms/dotnet/10.0/windowsdesktop-runtime-win-x64.exe) | [**.NET 10 Desktop Runtime**](https://aka.ms/dotnet/10.0/windowsdesktop-runtime-win-x64.exe) *(Auto-downloaded by installer)* | -| **UI Runtime** | [**Microsoft Edge WebView2 Runtime**](https://go.microsoft.com/fwlink/p/?LinkId=2124703) | [**WebView2 Runtime**](https://go.microsoft.com/fwlink/p/?LinkId=2124703) *(Pre-installed on Windows 11)* | -| **Hardware Driver** | [**PawnIO Kernel Driver**](https://github.com/namazso/PawnIO) *(bundled with app, ~3.4 MB)* | **PawnIO Kernel Driver** *(installed automatically offline)* | - -### :info: Baseline OS & Hardware Specifications - -In accordance with official [Microsoft Windows 11 Specifications](https://www.microsoft.com/en-in/windows/windows-11-specifications?r=1) and [Windows Hardware Driver Documentation](https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/x64-architecture): - -- **Processor**: 1 GHz or faster with 2 or more cores on a compatible 64-bit [x86-64 / AMD64](https://en.wikipedia.org/wiki/X86-64) processor (Intel or AMD). -- **System Memory**: Minimum **2 GB** on 64-bit Windows 10, or **4 GB** on [Windows 11](https://www.microsoft.com/en-in/windows/windows-11-specifications?r=1). LocalTelemetry maintains an ultralight footprint of **~40-50 MB RAM** during background taskbar monitoring. -- **Storage Footprint**: Minimum **~70 MB** initial disk space across the installation directory (**37 MB** in `C:\Program Files\LocalTelemetry`, as reported in Windows *Installed apps*) and user profile cache (**~30 MB** in `%LOCALAPPDATA%\LocalTelemetry` for WebView2 runtime cache, settings, and logs). Portable mode requires **~34 MB** on extraction and expands to **~65 MB** once the local WebView2 settings cache is generated. **100 MB** or more of free disk space is recommended for long-term network usage history and log files. -- **System Firmware**: UEFI with Secure Boot capability and TPM 2.0 (standard Windows 11 hardware baseline; LocalTelemetry operates seamlessly with Secure Boot enabled). -- **Display & Taskbar**: Standard Windows taskbar with support for primary or secondary display positioning at any scaling factor (100%-200% DPI). -- **Graphics Subsystem**: DirectX 11 / 12 compatible GPU with WDDM 2.0+ display driver (for GPU telemetry via `D3DKMTQueryStatistics` or vendor APIs NVML / ADL / ControlLib). +| Requirement | Minimum Specification | Recommended Specification | +| :--- | :--- | :--- | +| **Operating System** | Windows 10 (64-bit, v2004+ / build 19041) | Windows 11 (64-bit, v22H2 or newer) | +| **Architecture** | x86-64 / AMD64 (Intel or AMD) | x86-64 / AMD64 | +| **Permissions** | Administrator (required for hardware sensors) | Administrator (silent boot via Task Scheduler) | +| **Memory (RAM)** | 2 GB (Windows 10) / 4 GB (Windows 11) | 8 GB or higher | +| **App Footprint** | ~15–20 MB RAM (taskbar monitor only) | ~15–20 MB RAM | +| **Disk Space** | ~35 MB install footprint | 70 MB+ (for traffic history and logs) | +| **.NET Runtime** | Microsoft .NET 11 Desktop Runtime (x64) | .NET 11 Desktop Runtime (installed automatically) | +| **UI Runtime** | Microsoft Edge WebView2 Runtime | WebView2 Runtime (pre-installed on Windows 11) | +| **Sensor Driver** | PawnIO Kernel Driver (bundled) | PawnIO Kernel Driver (installed automatically) | > [!WARNING] -> **Unsupported Architectures**: 32-bit (x86) Windows editions and ARM processors (such as Qualcomm Snapdragon X Elite, Snapdragon Plus, Surface Pro X, etc.) are **not supported**. Under 64-bit Windows, [kernel-mode drivers cannot run under emulation](https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/x64-architecture) and must execute natively on x86-64 hardware. +> 32-bit (x86) Windows editions and ARM processors (such as Snapdragon X Elite) are **not supported**. Kernel-mode drivers cannot run under emulation on Windows. --- @@ -37,169 +26,138 @@ In accordance with official [Microsoft Windows 11 Specifications](https://www.mi ### :sparkles: Method 1: Standard Inno Setup Installer (Recommended) 1. Download `LocalTelemetrySetup.exe` from the latest [GitHub Releases](https://github.com/Nicconike/LocalTelemetry/releases). -2. Run the installer executable (Windows will present a standard UAC prompt for Administrator rights). -3. **Automatic .NET 10 Runtime Download**: Because .NET 10 is a modern runtime that is not pre-installed on most Windows PCs, the installer will automatically detect its absence, download the official **.NET 10 Desktop Runtime** from Microsoft (~55 MB), and install it silently in the background. -4. Choose your preferred installation directory (Default: `C:\Program Files\LocalTelemetry`). -5. Select your desired tasks: - - **Create a Start Menu shortcut** - - **Create a Desktop shortcut** - - **Run LocalTelemetry at Windows startup** (registers a Windows Task Scheduler job with elevated rights) -6. Click **Install**: - - Application binaries and the uninstaller are installed to `C:\Program Files\LocalTelemetry` (**~37 MB** total, as reported in Windows *Installed apps*). - - The bundled **PawnIO** kernel sensor driver (~3.4 MB) is registered and started silently offline without external downloads. - - An `app.mode` marker file (`standard`) is created in the installation folder. LocalTelemetry detects this file and routes configuration (`settings.json`), traffic history (`internet_usage.jsonl`), diagnostic logs, and WebView2 runtime cache (`webview2_data/`, **~30 MB**) to `%LOCALAPPDATA%\LocalTelemetry`. - - Upon completion, LocalTelemetry launches automatically, opening the Settings dashboard and placing an icon in your System Tray. - -> [!IMPORTANT] -> **Internet Connection for First-Time Setup**: Because most users will not have the .NET 10 Desktop Runtime installed, an active internet connection is required during initial setup so the installer can fetch the runtime package. Once installed, all subsequent launches, driver initialization, and telemetry operations run completely offline. - -### :package: Method 2: Windows Package Manager (WinGet) - -Install via [WinGet](https://learn.microsoft.com/en-us/windows/package-manager/winget/): +2. Run the installer executable and accept the Windows UAC elevation prompt. +3. If missing, the installer automatically downloads and installs the official Microsoft .NET 11 Desktop Runtime. +4. Select your installation folder (default: `C:\Program Files\LocalTelemetry`). +5. Choose shortcut options and startup preferences. +6. Click **Install**. The installer registers application files and starts the bundled PawnIO kernel driver. -```powershell -winget install --id Nicconike.LocalTelemetry -``` +User data and configuration files are saved to `%LOCALAPPDATA%\LocalTelemetry`. -### :inbox: Method 3: Scoop Package Manager (Direct Repository Bucket) +### :inbox: Method 2: Scoop Package Manager -Install directly from the GitHub repository via [Scoop](https://scoop.sh/): +Install directly from the official repository bucket via Scoop: ```powershell -# Add repository as a bucket and install scoop bucket add localtelemetry https://github.com/Nicconike/LocalTelemetry scoop install localtelemetry ``` -To update LocalTelemetry to the latest release at any time: +To update LocalTelemetry to the latest release: ```powershell scoop update localtelemetry ``` -### :folder-archive: Method 4: Portable ZIP (Zero Installation) +### :folder-archive: Method 3: Portable ZIP + +1. **Install Prerequisites**: Ensure you have installed the [.NET 11 Desktop Runtime (x64)](https://aka.ms/dotnet/11.0/windowsdesktop-runtime-win-x64.exe). On Windows 10, also install the [Microsoft Edge WebView2 Runtime](https://go.microsoft.com/fwlink/p/?LinkId=2124703) if missing (Windows 11 includes WebView2 by default). +2. **Download Archive**: Download `LocalTelemetry-win-x64.zip` from [GitHub Releases](https://github.com/Nicconike/LocalTelemetry/releases). +3. **Extract to Writable Folder**: Extract the ZIP into a user-writable folder (such as `D:\Software\LocalTelemetry`). Avoid protected folders like `C:\Program Files` because portable mode stores settings, logs, and cache directly inside the application folder. +4. **Launch Application**: Double-click `LocalTelemetry.exe` and accept the standard Windows UAC prompt. The application manifest requests elevation automatically to initialize the bundled `PawnIO` sensor driver (`PawnIO_setup.exe`). + +In portable mode, all configuration (`settings.json`), traffic history (`internet_usage.jsonl`), diagnostic logs (`logs/`), and WebView2 data remain inside the application folder. To completely remove the application and its driver later, run `Uninstall.bat` as administrator before deleting the folder. + +--- + +## :shield-check: Verifying Release Binaries + +Each GitHub release publishes official SHA-256 hashes in `checksums.txt` and Sigstore Cosign signature bundles: + +### Automated SHA-256 Checksum Verification -1. **Install Prerequisites**: Because portable mode does not include an installation wizard to auto-fetch runtimes, ensure you have installed: - - [**Microsoft .NET 10 Desktop Runtime (x64)**](https://aka.ms/dotnet/10.0/windowsdesktop-runtime-win-x64.exe) - - [**Microsoft WebView2 Runtime**](https://go.microsoft.com/fwlink/p/?LinkId=2124703) *(Included by default on Windows 11)* -2. Download `LocalTelemetry-win-x64.zip` from [GitHub Releases](https://github.com/Nicconike/LocalTelemetry/releases) (~10 MB archive). -3. Extract the ZIP archive into any folder of your choice (e.g. `D:\Software\LocalTelemetry`). The extracted application requires **~34 MB** of disk space. -4. Run `LocalTelemetry.exe` as Administrator. +Run the following commands in PowerShell from the directory where you downloaded the release file. The script downloads the official `checksums.txt` from the latest release and verifies all matching files: -> [!NOTE] -> In portable mode (when no `app.mode` file exists in the executable folder), all configuration (`settings.json`), network usage history (`internet_usage.jsonl`), diagnostic logs, and the WebView2 runtime cache (`webview2_data/`, **~30 MB**) are stored directly inside the extracted folder alongside `LocalTelemetry.exe` (**~65 MB** total once launched). The bundled PawnIO kernel sensor driver initializes silently on first elevated launch. +```powershell +# 1. Download official checksums.txt from the latest release +Invoke-WebRequest -Uri "https://github.com/Nicconike/LocalTelemetry/releases/latest/download/checksums.txt" -OutFile "checksums.txt" + +# 2. Automatically verify downloaded release binaries against checksums.txt +Get-Content .\checksums.txt | ForEach-Object { + $expectedHash, $filename = -split $_ + if (Test-Path $filename) { + $actualHash = (Get-FileHash $filename -Algorithm SHA256).Hash + [PSCustomObject]@{ + File = $filename + Status = if ($actualHash -eq $expectedHash) { "Verified (Match)" } else { "FAILED (Mismatch)" } + } + } +} +``` -### :shield-check: Verifying Downloaded Binaries (Cosign & SLSA) +### Keyless Signature Verification (Cosign) -Every release includes cryptographic checksums, Sigstore Cosign signature bundles, and SLSA provenance attestations: +To verify the release binary signature with Sigstore Cosign, download the signature bundle and verify: ```powershell -# 1. Compare the SHA-256 hashes against checksums.txt -Get-FileHash .\LocalTelemetrySetup.exe, .\LocalTelemetry-win-x64.zip -Algorithm SHA256 +# Download signature bundle for the installer +Invoke-WebRequest -Uri "https://github.com/Nicconike/LocalTelemetry/releases/latest/download/LocalTelemetrySetup.exe.sigstore.json" -OutFile "LocalTelemetrySetup.exe.sigstore.json" -# 2. Verify keyless signatures with Cosign +# Verify signature cosign verify-blob --bundle .\LocalTelemetrySetup.exe.sigstore.json ` --certificate-identity-regexp "https://github.com/Nicconike/LocalTelemetry/.*" ` --certificate-oidc-issuer "https://token.actions.githubusercontent.com" ` .\LocalTelemetrySetup.exe - -# 3. Verify SLSA build provenance attestations -gh attestation verify .\LocalTelemetrySetup.exe --repo Nicconike/LocalTelemetry -gh attestation verify .\LocalTelemetry-win-x64.zip --repo Nicconike/LocalTelemetry ``` -## :user-shield: Administrator Rights & UAC Explained +--- + +## :user-shield: Administrator Rights & Elevation -### :shield-question-mark: Why does LocalTelemetry need Administrator rights? +### Why Administrator Rights are Required -To read low-level hardware sensors (such as CPU package temperatures, MSR clock registers, and RAPL power consumption), Windows requires direct communication with kernel-level driver interfaces (via `PawnIO`). Standard user accounts cannot read these low-level hardware registers directly due to Windows operating system security boundaries. +LocalTelemetry queries low-level processor registers (MSR and SMU) via the bundled `PawnIO` kernel driver. Windows restricts direct hardware register access to administrator accounts to protect operating system security. -### :shield-alert: Sensor Privilege Breakdown +Standard user accounts can read basic counters (CPU usage %, RAM load, network throughput), but cannot read CPU package temperatures, MSR core clocks, or package wattage without elevation. -LocalTelemetry requires Administrator privileges to load the `PawnIO` kernel driver for direct processor MSR and SMU access: +### Silent Startup via Task Scheduler -| Hardware Metric | Elevated (Default) | Unelevated | Underlying Mechanism | -| :------------------------------ | :----------------: | :--------: | :---------------------------------------------------------------- | -| **CPU Usage (%)** | :check: | :check: | Windows system time counters | -| **RAM Usage (% & GB)** | :check: | :check: | Windows memory status subsystem | -| **Disk Read / Write Speeds** | :check: | :check: | Windows Performance Data Helper counters | -| **Network Speeds & Traffic** | :check: | :check: | Windows network interface subsystem | -| **Battery Level & Charge Rate** | :check: | :check: | Windows system power status & battery telemetry | -| **GPU Telemetry (Usage, VRAM)** | :check: | :check: | Vendor display libraries (NVML, ADL, ControlLib) or WDDM graphics | -| **CPU Package & Core Temp** | :check: | :x: | Direct CPU temperature registers or SMU (via `PawnIO` driver) | -| **CPU Hardware Clocks** | :check: | :x: | High-precision CPU core clock registers (via `PawnIO` driver) | -| **CPU Package Power (Watts)** | :check: | :x: | CPU package energy telemetry (RAPL / SMU via `PawnIO` driver) | +When you enable **Start with Windows**, LocalTelemetry creates a Windows Task Scheduler task (`LocalTelemetry Startup`): -### :badge-question-mark: How does elevation and driver initialization work? +- Runs with elevated privileges to load the sensor driver silently. +- Starts in the background without showing a UAC prompt on login. +- Runs without opening the Settings window. +- Functions on both AC power and laptop battery. -1. :shield-alert: **UAC Elevation Prompt**: Whenever you manually start LocalTelemetry, Windows displays a standard User Account Control (UAC) prompt to grant administrative privileges for kernel sensor drivers. -2. :bell-off: **Silent Driver Setup**: LocalTelemetry verifies that the `PawnIO` hardware driver is present. If missing, it installs the driver silently in the background using the elevated process permissions. -3. :settings: **Settings & Tray Launch**: Once hardware sensors are initialized, the Settings dashboard opens on screen and the tray icon appears in the notification area. +--- -### :monitor-cog: How does "Start with Windows" avoid UAC prompts on reboot? +## :refresh-cw: Updating LocalTelemetry -When you enable **Start with Windows** in Settings (or during installation), LocalTelemetry registers a scheduled task in the **Windows Task Scheduler** (`LocalTelemetry Startup`): +- **Installer Users**: Download and run the newer `LocalTelemetrySetup.exe`. The installer closes running processes, updates application files, and preserves your settings and network history. +- **Portable Users**: Extract the new ZIP archive over your existing folder. Replace old application binaries while keeping your `settings.json` and `internet_usage.jsonl` files. +- **In-App Update Checks**: Go to **Settings -> About** and click **Check for Updates** to query the GitHub Releases API. -- **Highest Administrative Privileges**: Runs with full elevation to load kernel sensor drivers without presenting a UAC prompt on logon. -- **Silent Launch**: Launches straight into the taskbar and system tray without opening the Settings window. -- **Laptop Battery Support**: Configured to run seamlessly on battery power when booting or unplugging laptops. -- **Infinite Runtime**: Explicitly overrides the default Windows Task Scheduler 72-hour auto-termination limit, ensuring 24/7 continuous operation. -- **Reliable Execution**: Runs immediately even if a scheduled logon was briefly delayed. +--- -::: tip Technical Implementation -To inspect the low-level kernel driver architecture, MSR register mappings (`0x1B1`, `0x1A2`, `0x606`), SMU PM tables, and Task Scheduler COM automation, see the [Hardware Drivers Architecture](/developer-guide/hardware-drivers) developer guide. -::: +## :shredder: Uninstallation & Driver Cleanup -## :refresh-cw: Updating LocalTelemetry +### Installer Uninstallation -- **Installer Users**: Download and run the new `LocalTelemetrySetup.exe`. If an existing instance of `LocalTelemetry.exe` or `LocalTelemetry.Notifier.exe` is running, the installer prompts to close it automatically, updates application binaries in `C:\Program Files\LocalTelemetry`, and preserves your existing settings and traffic history in `%LOCALAPPDATA%\LocalTelemetry`. -- **Portable Users**: Extract the new portable ZIP package into your existing portable folder, replacing the old application binaries while keeping your `settings.json` and `internet_usage.jsonl` files intact. -- **In-App Update Checks**: You can check for newer releases directly inside **Settings -> About**: - - Click **Check for Updates** to query the GitHub Releases API on demand. - - Set **Check Frequency** to `Weekly`, `Monthly`, or `Manual`. - - Toggle **Include pre-release & RC builds** (disabled by default) to receive Release Candidate versions. - - When a new version is detected, click the green **Download** button to navigate directly to the release assets. +1. Open **Windows Settings -> Installed apps**. +2. Find **LocalTelemetry** and click **Uninstall**. +3. If the application is running, the uninstaller prompts you to close it: -## :shredder: Uninstallation & Complete Driver Cleanup +![Running Process Detection Prompt](/images/uninstall.png) +*Prompt displayed if LocalTelemetry is active when uninstallation starts.* -### :trash: Standard Installer Uninstallation +4. The uninstaller terminates processes, stops the `PawnIO` service, and purges the driver package from the Windows DriverStore. +5. The uninstaller displays the user data cleanup dialog: -1. Open **Windows Settings -> Installed apps** (or Control Panel -> Programs and Features). -2. Locate **LocalTelemetry** and click **Uninstall**. -3. **Running Process Detection**: If LocalTelemetry or its notification helper is running, the uninstaller prompts you to close the application automatically before proceeding: +![Application Data Cleanup Options](/images/uninstall-options.png) +*Select which application data items to remove or preserve.* -![Running Process Detection Prompt](/images/uninstall.png) -*Prompt displayed if LocalTelemetry or the notification helper is active when uninstallation starts.* - -1. **Complete Driver & System Cleanup**: - - Shuts down running application processes and waits 2 seconds for kernel driver handles to release. - - Deletes the `LocalTelemetry Startup` scheduled task from Windows Task Scheduler (`schtasks.exe`). - - Stops and removes the `PawnIO` kernel service via Windows Service Control Manager (`sc.exe`). - - Uninstalls and removes the `pawnio.inf` driver package from the Windows DriverStore using `pnputil.exe`. - - **DriverStore Reboot Notification (Code 3010)**: If Windows reports that the kernel driver handle is locked in memory by the OS, a dialog informs you that a system restart is required to fully flush the driver before reinstalling. - - Cleans up PawnIO uninstallation registry keys and removes `C:\Program Files\LocalTelemetry`. - -2. **User Data Removal Prompt**: - - The uninstaller presents a custom cleanup dialog to select items to delete across all user profiles: - ![Uninstallation User Data Removal Prompt](/images/uninstall-settings.png) - *Selective cleanup dialog with independent toggles for configuration, traffic records, and diagnostic caches.* - - **Application Settings** (`settings.json`, `hardware_state.json`): Checked by default. - - **Traffic History** (`internet_usage.jsonl`, `internet_usage.dat`): **Unchecked by default** to prevent accidental loss of recorded network bandwidth history. - - **Cache & Diagnostic Logs** (`logs/`, `webview2_data/`, `temp/`): Checked by default. - - **Remove Selected** (Default button): Permanently deletes selected items. It cleans up empty data directories. - - **Keep All**: Preserves all data. The uninstaller displays the exact folder paths where your configuration and bandwidth database remain. - - **Silent Uninstallation**: In silent mode (`/SILENT` or `/VERYSILENT`), the dialog is skipped. All user data remains safely preserved by default. - -### :folder-x: Portable Mode Removal - -To ensure no residual kernel driver, service, or temporary driver cache remains on your system when removing the portable edition: - -1. Close LocalTelemetry (right-click the system tray icon or taskbar overlay and click **Quit**). -2. Right-click **`Uninstall.bat`** (located in your portable folder) and select **Run as administrator**: - - Automatically terminates any active `LocalTelemetry.exe` or `LocalTelemetry.Notifier.exe` processes. - - Stops and deletes the `PawnIO` kernel service via `sc stop PawnIO` and `sc delete PawnIO`. - - Forces the uninstallation and removal of the `pawnio.inf` driver package from the Windows DriverStore via `pnputil.exe /delete-driver /uninstall /force`. - - Alerts you via a Windows MessageBox if Windows requires a system restart (code `3010`) to completely purge driver memory. - - Removes leftover `PawnIO` uninstaller registry entries from `HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall`. - - Cleans up residual temporary directories (`C:\Program Files\PawnIO`, `%ProgramData%\LocalTelemetry`, and `%LocalAppData%\Temp\PawnIo`). -3. Once the batch script displays `Cleanup complete!`, delete the portable application folder from your disk. +- **Application Settings & Preferences**: Removes `settings.json`, custom layouts, and preferences. +- **Network Traffic History**: Unchecked by default to preserve recorded bandwidth usage databases. +- **Cache & Diagnostic Logs**: Removes log files and WebView2 cache. + +6. If you choose to preserve network traffic history, the uninstaller displays a confirmation notice with the preserved data path: + +![Data Preservation Notice](/images/uninstall-preserved.png) +*Notice confirming retained network history location when data preservation is selected.* + +### Portable Mode Cleanup + +1. Close LocalTelemetry (right-click the tray icon and select **Quit**). +2. Right-click **`Uninstall.bat`** in your portable folder and select **Run as administrator**. +3. The script stops and removes the `PawnIO` service, purges the driver from DriverStore, and removes temporary registry keys. +4. Delete the portable application folder from your disk. diff --git a/docs/latest/user-guide/metrics-and-sensors.md b/docs/latest/user-guide/metrics-and-sensors.md index e22e69b..fe2705e 100644 --- a/docs/latest/user-guide/metrics-and-sensors.md +++ b/docs/latest/user-guide/metrics-and-sensors.md @@ -1,34 +1,33 @@ # :thermometer-sun: Telemetry Metrics & Hardware Sensors -LocalTelemetry continuously monitors your computer's hardware vitals and displays them directly inside your Windows taskbar. Every metric can be reordered, enabled or disabled, and styled with custom colors in the Settings panel. +LocalTelemetry continuously monitors hardware sensors and displays vitals on the Windows taskbar. You can reorder, toggle, and recolor every metric in Settings. -This page explains what each metric measures, how it is labeled on the taskbar overlay, and the settings available to customize its display. +This page describes supported metrics, overlay labels, calculation modes, and sensor behavior. + +![Hardware Monitoring Configuration Interface](/images/monitoring-settings.png) +*Configure active component trackers and telemetry computation modes in Settings -> Monitoring.* --- ## :cpu: CPU Metrics -Processor vitals monitor your CPU's workload, package temperature, operating clock speeds, and real-time power draw. +Processor vitals monitor workload, package temperature, operating clock frequency, and real-time power draw. | Metric (Settings Name) | Overlay Label | Typical Display | What It Measures | -| :--------------------- | :------------ | :-------------- | :----------------------------------------------------------------- | -| **CPU Usage** | `CPU` | `42%` | Overall processor utilization percentage across all active threads | -| **CPU Temp** | `CPU` | `65°C` / `149°F`| Current CPU package temperature | -| **CPU Frequency** | `CPU` | `4.35GHz` | Operating clock speed (effective frequency) | -| **CPU Package Power** | `CPU` | `65W` | Real-time CPU power consumption in Watts | +| :--- | :--- | :--- | :--- | +| **CPU Usage** | `CPU` | `42%` | Overall processor utilization percentage across all threads | +| **CPU Temp** | `CPU` | `65°C` / `149°F` | CPU package temperature from on-die thermal sensors | +| **CPU Frequency** | `CPU` | `4.35GHz` | Operating clock speed (effective frequency) | +| **CPU Package Power** | `CPU` | `65W` | Real-time processor power consumption in Watts | -### :list-clock: CPU Options (Settings -> Monitoring) +### CPU Calculation Modes (Settings -> Monitoring) - **Clock Mode**: - `Average`: Displays the mean clock speed across all active processor cores. - - `Max Active Core`: Displays the peak frequency of the highest-clocked core (useful for observing single-core turbo boosts). + - `Max Active Core`: Displays the peak frequency of the highest clocked core. - **Usage Source**: - - `Overall (Task Manager)`: Global average CPU utilization across all threads, matching Windows Task Manager. - - `Max Thread (Gaming)`: Utilization of the single most loaded core or thread, useful for identifying single-threaded CPU bottlenecks in games. - -::: info Sensor Architecture & Fallback -On Intel systems, temperatures are read from MSR `0x1A2`/`0x1B1`. On AMD systems, temperatures are read from SMN registers (`0x00059800`) or the SMU power management table. If low-level driver calls fail, LocalTelemetry automatically falls back to Windows ACPI thermal zone queries via WMI (`root\wmi`). -::: + - `Overall (Task Manager)`: Global average utilization across all logical threads. + - `Max Thread (Gaming)`: Utilization of the single highest loaded thread (useful for spotting single-core game bottlenecks). --- @@ -37,18 +36,26 @@ On Intel systems, temperatures are read from MSR `0x1A2`/`0x1B1`. On AMD systems Graphics card telemetry tracks GPU core utilization, video memory consumption, core clocks, temperatures, and board power. | Metric (Settings Name) | Overlay Label | Typical Display | What It Measures | -| :--------------------- | :------------ | :-------------- | :--------------------------------------------- | -| **GPU Usage** | `GPU` | `78%` | Graphics processing unit utilization percentage | -| **GPU Temp** | `GPU` | `68°C` / `154°F`| GPU core temperature | -| **GPU VRAM Usage** | `GPU` | `4120MB` | Dedicated video memory (VRAM) currently in use | -| **GPU Frequency** | `GPU` | `2150MHz` | Current GPU graphics core clock speed | -| **GPU Power** | `GPU` | `120W` | Total graphics card power draw in Watts | +| :--- | :--- | :--- | :--- | +| **GPU Usage** | `GPU` | `78%` | Graphics processor utilization percentage | +| **GPU Temp** | `GPU` | `68°C` / `154°F` | GPU core temperature | +| **GPU VRAM Usage** | `GPU` | `4120MB` | Dedicated video memory (VRAM) currently in use | +| **GPU Frequency** | `GPU` | `2150MHz` | Current graphics core clock speed | +| **GPU Power** | `GPU` | `120W` | Total graphics card power draw in Watts | -### :square-activity: GPU Options (Settings -> Monitoring) +### GPU Calculation Modes (Settings -> Monitoring) - **GPU Usage Source**: - - `Driver (NVML/ADL)`: Directly queries vendor driver APIs for kernel engine busy time (matches tools like MSI Afterburner and GeForce Experience). - - `WDDM (Task Manager)`: Queries the Windows graphics engine scheduler, matching Windows Task Manager. + - `Driver (NVML/ADL)`: Queries vendor driver APIs for kernel engine busy time (matches MSI Afterburner). + - `WDDM (Task Manager)`: Queries the Windows graphics engine scheduler (matches Windows Task Manager). + +### Integrated Graphics (iGPU) Telemetry + +When no dedicated graphics card is present, LocalTelemetry activates specialized fallbacks: + +- **Shared Video Memory**: Queries the WDDM shared memory counter, reporting dynamically allocated shared RAM in MB. +- **On-Die Temperature**: Reports CPU package digital thermal sensor (DTS) temperatures. +- **Integrated GPU Power**: On Intel processors, reads power consumption via RAPL Power Plane 1 MSR (`0x641`). --- @@ -57,93 +64,56 @@ Graphics card telemetry tracks GPU core utilization, video memory consumption, c Memory telemetry tracks active system memory consumption and overall capacity utilization. | Metric (Settings Name) | Overlay Label | Typical Display | What It Measures | -| :--------------------- | :------------ | :-------------- | :---------------------------------------------------- | -| **RAM Usage** | `RAM` | `58%` | Percentage of total physical memory currently in use | -| **RAM Used** | `RAM` | `18.5GB` | Active physical memory in Gigabytes | - -### :gauge: Configured vs. Rated Clock Speeds - -LocalTelemetry queries SMBIOS and WMI for active memory clocks. If modules run below rated XMP or EXPO speeds, the System page displays both configured speed and rated SPD speed (for example, `4800 MT/s (rated 6000 MT/s)`). +| :--- | :--- | :--- | :--- | +| **RAM Usage** | `RAM` | `58%` | Percentage of total physical memory currently in use | +| **RAM Used** | `RAM` | `18.5GB` | Active physical memory in Gigabytes | --- ## :hard-drive: Storage (Disk) Metrics -LocalTelemetry automatically discovers your installed physical storage drives (NVMe SSDs, SATA SSDs, and mechanical HDDs) and tracks active read and write throughput. +LocalTelemetry detects installed physical drives (NVMe SSDs, SATA SSDs, and HDDs) and tracks active transfer rates. | Metric (Settings Name) | Overlay Label | Typical Display | What It Measures | -| :--------------------- | :------------ | :-------------- | :---------------------------------------------------------------- | -| **[Drive] Read** | `NVMeR` / `SATAR` / `HDDR` | `250KB/s` / `1.2GB/s` | Active read data throughput for the detected physical disk | -| **[Drive] Write** | `NVMeW` / `SATAW` / `HDDW` | `14.8MB/s` / `450KB/s` | Active write data throughput for the detected physical disk | - -### :tag: How Disk Labels Work on the Taskbar +| :--- | :--- | :--- | :--- | +| **[Drive] Read** | `NVMeR` / `SATAR` / `HDDR` | `250KB/s` / `1.2GB/s` | Active read data throughput for the detected disk | +| **[Drive] Write** | `NVMeW` / `SATAW` / `HDDW` | `14.8MB/s` / `450KB/s` | Active write data throughput for the detected disk | +| **[Drive] Temp** | `NVMeT` / `SATAT` / `HDDT` | `48°C` / `118°F` | Current operating temperature from drive SMART sensors | -The overlay creates concise, readable labels based on your storage drive's bus type and position: +### Overlay Disk Labels -- **Single Drive of a Type**: If your PC has one NVMe SSD, the label displays simply as `NVMeR` (Read) and `NVMeW` (Write) without unnecessary numbering. -- **Multiple Drives of the Same Type**: If you have two NVMe drives or multiple SATA drives, sequential numbers are added to distinguish them (e.g. `NVMe1R`, `NVMe2R`, `SATA1W`, `SATA2W`). -- **Auto-Scaling Speed Units**: Throughput automatically scales to the cleanest unit: `KB/s` for light background I/O, `MB/s` for active transfers, and `GB/s` for high-speed sequential transfers. +- **Single Drive of a Type**: Displays as `NVMeR`, `NVMeW`, and `NVMeT` without numbering. +- **Multiple Drives of the Same Type**: Adds sequential numbering to distinguish drives (for example, `NVMe1R`, `NVMe2R`, `NVMe1T`). +- **Auto-Scaling Speed Units**: Throughput scales automatically to `KB/s`, `MB/s`, or `GB/s`. --- ## :ethernet-port: Network Metrics -Network telemetry monitors real-time transfer rates across your primary network adapter alongside session totals. +Network telemetry monitors real-time transfer rates across your active network adapter alongside session totals. | Metric (Settings Name) | Overlay Label | Typical Display | What It Measures | -| :--------------------- | :------------ | :-------------- | :----------------------------------------------------------------------------------- | -| **Download** | `DOWN↓` | `1.2MB/s` (or `9.6Mb/s`) | Current incoming network throughput (displays `--` when disconnected) | -| **Upload** | `UP↑` | `350KB/s` (or `2.8Mb/s`) | Current outgoing network throughput (displays `--` when disconnected) | -| **Total Transferred** | `Total` | `14.25GB` | Cumulative data transferred (download + upload) during the current session (scales from `B` up to `TB`) | +| :--- | :--- | :--- | :--- | +| **Download** | `DOWN↓` | `1.2MB/s` (or `9.6Mb/s`) | Current incoming network throughput | +| **Upload** | `UP↑` | `350KB/s` (or `2.8Mb/s`) | Current outgoing network throughput | +| **Total Transferred** | `Total` | `14.25GB` | Total data transferred during the current session | -### :network: Network Options (Settings -> Network) - -- **Show Speed in Bits/s**: Toggle between bytes per second (`B/s`, `KB/s`, `MB/s`, `GB/s`) and bits per second (`b/s`, `Kb/s`, `Mb/s`, `Gb/s`) to match internet speed test conventions. -- **Adapter Selection**: Choose `Auto (Best Match)` to let LocalTelemetry track whichever adapter is currently active, or pin monitoring to a specific Ethernet or Wi-Fi interface. +Configure adapter selection and speed units (`Bytes/s` vs `Bits/s`) in **Settings -> Network**. --- ## :battery-charging: Laptop Battery Metrics -On laptops, handheld PCs, and battery-powered Windows devices, LocalTelemetry provides real-time power analytics. +On portable devices, LocalTelemetry provides real-time battery power analytics: | Metric (Settings Name) | Overlay Label | Typical Display | What It Measures | -| :--------------------- | :------------ | :-------------- | :----------------------------------------------------------------------------------- | -| **Battery** | `BAT` | `85%` | Remaining battery charge percentage | -| **Charge Rate** | `BAT` | `+45.0W` / `Full` / `-18.5W` | Real-time battery charging power or discharging rate in Watts | - -### :car-battery: Battery Display States +| :--- | :--- | :--- | :--- | +| **Battery** | `BAT` | `85%` | Remaining battery charge percentage | +| **Charge Rate** | `BAT` | `+45.0W` / `Full` / `-18.5W` | Real-time charging rate (+) or discharging draw (-) in Watts | -- **Charging on AC Power**: Displays incoming charge wattage prefixed with a plus sign (e.g. `+45.2W`). -- **Fully Charged on AC Power**: Displays `Full` once the battery reaches 100% and charging completes. -- **Running on Battery**: Displays real-time power consumption prefixed with a minus sign (e.g. `-18.5W`) so you can monitor your laptop's current energy draw. -- **Desktop Systems**: Battery metrics are automatically hidden when no physical battery is present. - -### :shield-heart: Battery Health & Wear Telemetry - -The System settings page reports additional hardware diagnostics for installed batteries: - -- **Battery Health**: Percentage of original design capacity remaining (`FullChargedCapacity / DesignCapacity * 100`). -- **Wear Level**: Percentage of capacity lost through degradation (`100% - Health`). -- **Charge Cycle Count**: Total lifetime battery charge and discharge cycles reported by battery firmware. - ---- - -## :file-cog: Display & Formatting Settings - -You can customize how metrics appear and behave across the settings pages: - -- **Polling Interval** (**Settings -> General**): Select how frequently sensors are refreshed: - - `0.5 s` (500 ms): Fast response for intensive benchmarking or gaming. - - `1 s` (1000 ms): Default balanced refresh rate. - - `2 s` (2000 ms): Lower background polling activity. - - `5 s` (5000 ms): Ultra-low CPU wakeups. -- **Temperature Scale** (**Settings -> General**): Toggle **Show Temperatures in °F** to switch between Celsius (`°C`) and Fahrenheit (`°F`). -- **Metric Order & Visibility** (**Settings -> Layout**): Drag and drop metrics to change their order on the taskbar, or remove metrics you don't need. -- **Colors & Themes** (**Settings -> Appearance**): Customize metric text colors individually, or click **Reset All to Defaults** to apply authentic hardware manufacturer brand colors automatically. - ---- +### Battery States -> [!TIP] -> **Looking for developer architecture or internal configuration keys?** -> If you are building custom plugins, inspecting raw JSON configuration files, or debugging sensor drivers, see the [**Hardware Drivers Architecture Guide**](../developer-guide/hardware-drivers.md) and [**Backend Architecture Guide**](../developer-guide/backend-architecture.md). +- **Charging on AC Power**: Displays incoming charge wattage with a plus sign (e.g. `+45.0W`). +- **Fully Charged**: Displays `Full` once the battery reaches 100% capacity. +- **Discharging on Battery**: Displays real-time power consumption with a minus sign (e.g. `-18.5W`). +- **Desktop Systems**: Battery metrics are automatically hidden when no physical battery is detected. diff --git a/docs/latest/user-guide/network-history.md b/docs/latest/user-guide/network-history.md index bcdea46..d81a620 100644 --- a/docs/latest/user-guide/network-history.md +++ b/docs/latest/user-guide/network-history.md @@ -1,190 +1,67 @@ # :arrow-up-down: Traffic & Network History -LocalTelemetry includes a built-in network tracking engine that logs daily internet data usage, monitors real-time network throughput, and provides multi-year bandwidth history through deep integration with Windows system diagnostics. +LocalTelemetry records daily internet bandwidth, tracks live throughput, and provides multi-year usage history using Windows system diagnostics. -## :microchip: Core Capabilities +## :network: Network Configuration (Settings -> Network) -- **Real-Time Speed Tracking**: Continuous live measurement of incoming (download) and outgoing (upload) network throughput. -- **Daily Bandwidth Aggregation**: Records total Megabytes (MB), Gigabytes (GB), and Terabytes (TB) uploaded and downloaded each day. -- **Interactive Calendar Heatmap**: Displays daily bandwidth usage color-coded across 6 volume tiers from under 10 GB to over 200 GB, with cell tooltips for instant inspection. -- **Lightweight Local Storage**: Saves usage logs into `internet_usage.jsonl` using JSON Lines format for zero-overhead local persistence. -- **Deep Windows SRUM History Backfill**: Queries the Windows System Resource Usage Monitor (SRUM) database directly via an Extensible Storage Engine (ESE) reader, backfilling historical bandwidth all the way back to your original Windows installation date. -- **Backup File Import (`.jsonl` & `.dat`)**: Imports native `internet_usage.jsonl` backup files and legacy plaintext `.dat` logs (`YYYY/MM/DD UpKB/DownKB`). -- **Bandwidth Quota Alerts**: Configurable daily (5 GB – 500 GB) and monthly (100 GB – 5,000 GB) internet quota thresholds with desktop toast notifications and overlay flashing. - ---- - -## :network: Network Configuration (Settings → Network) - -Real-time throughput display options and the master traffic logging engine are configured in the settings window under **Network**: +Configure real-time throughput display options and daily traffic recording under **Network**: ![Network Settings Tab](/images/network-settings.png) -*Network settings tab for selecting the preferred network adapter and enabling daily traffic logging.* - -### :sliders-horizontal: Configuration Options +*Select your preferred network adapter and enable daily traffic logging.* -- **Show Speed in Bits/s**: Toggle between bytes per second (`B/s`, `KB/s`, `MB/s`, `GB/s`) and bits per second (`b/s`, `Kb/s`, `Mb/s`, `Gb/s`) to match internet speed test conventions. -- **Network Adapter**: Choose which network interface LocalTelemetry monitors: - - `Auto (Best Match)` *(default)*: Dynamically tracks the active default gateway / internet adapter. - - Specific Adapter: Pins monitoring to a specific physical connection (e.g. `Ethernet`, `Wi-Fi`). -- **Record Daily Traffic History**: Master toggle for bandwidth tracking (`$settings.netUsage.enabled`). When enabled, LocalTelemetry accumulates daily byte deltas and writes them to `internet_usage.jsonl`. When disabled, live overlay speed monitoring continues, but daily history is not recorded. +- **Show Speed in Bits/s**: Toggle between bytes per second (`B/s`, `KB/s`, `MB/s`, `GB/s`) and bits per second (`b/s`, `Kb/s`, `Mb/s`, `Gb/s`). +- **Network Adapter**: Choose `Auto (Best Match)` to track your active default gateway, or select a specific physical adapter (`Ethernet` or `Wi-Fi`). +- **Record Daily Traffic History**: Toggle bandwidth logging. When enabled, daily upload and download totals are saved to `internet_usage.jsonl`. --- -## :calendar-days: Traffic History Calendar (Settings → Traffic) +## :calendar-days: Traffic History Calendar (Settings -> Traffic) -Historical bandwidth analytics, monthly navigation, and import tools are located under **Traffic**: +View historical bandwidth analytics, monthly navigation, and import tools under **Traffic**: ![Traffic History Calendar & Bandwidth Tracking](/images/traffic-settings.png) -*Traffic history calendar tab for viewing daily network download and upload bandwidth.* - -### :activity: Today's Live Bandwidth Card - -Displays live accumulated data transfer for the current calendar day: - -- **Incoming (`↓`)**: Today's download volume (e.g. `↓ 1.45GB`). -- **Outgoing (`↑`)**: Today's upload volume (e.g. `↑ 230.12MB`). -- **Combined (`∑`)**: Total data transfer for today (e.g. `∑ 1.68GB`). - -*All bandwidth values are formatted using decimal SI units (`B`, `KB`, `MB`, `GB`, `TB` where 1 GB = 1,000,000,000 bytes).* +*Monthly calendar heatmap showing daily upload and download totals.* -### :calendar: Monthly Calendar View & Navigation +### Monthly Calendar & Usage Tiers -- **Month Navigation**: Browse past and future months using the navigation buttons (`‹` / `›`) surrounding the centered month label (e.g. `September 2026`). -- **Month Totals Bar**: Displays aggregated sums for the selected month: - - `↓ [Total Download]` - - `↑ [Total Upload]` - - `∑ [Total Combined]` *(displayed in bold)* -- **Monday–Sunday Grid**: Calendar days are organized in a 7-column layout starting on Monday, with Sundays highlighted in red (`#ef4444`). Empty cells align the first day of the month to its correct weekday. -- **Cell Totals**: Each date cell shows the day number and its total transferred bandwidth. Days with zero traffic display only the date number on a neutral uncolored background. -- **Hover Tooltips**: Hovering over any date cell reveals a tooltip formatted with the localized date, download volume, upload volume, and combined sum: +The calendar displays daily bandwidth color-coded into six volume tiers: - ```text - DD-MM-YYYY - ↓ 2.10GB - ↑ 450.00MB - ∑ 2.55GB - ``` +- **Tier 1 (`≤ 10 GB`)**: Cyan (`#00b7ee`) +- **Tier 2 (`≤ 50 GB`)**: Light Green (`#80c269`) +- **Tier 3 (`≤ 100 GB`)**: Yellow (`#ffd83a`) +- **Tier 4 (`≤ 150 GB`)**: Orange (`#ff8844`) +- **Tier 5 (`≤ 200 GB`)**: Coral Red (`#ff5f4a`) +- **Tier 6 (`> 200 GB`)**: Crimson (`#a61300`) -### :palette: Usage Tier Color Legend +### Interface Filtering & Daily Drill-Down -Calendar cells are color-coded based on daily bandwidth consumption: - -- **`≤10 GB`**: Tier 1 (Cyan / Electric Blue `#00b7ee`) -- **`≤50 GB`**: Tier 2 (Light Green `#80c269`) -- **`≤100 GB`**: Tier 3 (Warm Yellow `#ffd83a`) -- **`≤150 GB`**: Tier 4 (Tangerine Orange `#ff8844`) -- **`≤200 GB`**: Tier 5 (Coral Red `#ff5f4a`) -- **`>200 GB`**: Tier 6 (Dark Red / Crimson `#a61300`) -- **`0 B`**: Uncolored neutral surface (`tier-none`) - -### :list-filter: Interface Breakdown Filters - -Directly above the month totals, a dynamic filter bar generates pill buttons for the selected month: - -- **All**: Displays combined bandwidth across all network adapters. -- **Per-Adapter Pills**: LocalTelemetry scans the month's records and automatically creates a dedicated filter button for every adapter discovered in that month's logs (such as `Ethernet`, `Wi-Fi`, virtual adapters, or `Dat File`). Clicking an adapter filters the calendar grid and recalculates monthly totals specifically for that interface. - -### :mouse-pointer-click: Daily Detail Drill-Down - -Clicking on any date cell opens an in-depth breakdown card displaying: - -- **Formatted Date**: `DD-MM-YYYY`. -- **Download**: Exact incoming data volume (highlighted in primary theme color). -- **Upload**: Exact outgoing data volume (highlighted in accent color). -- **Combined**: Total transfer for that day. -- **Per-Interface Breakdown**: Itemized list showing each adapter that transferred data, with its download and upload totals: - - **Source Provenance Badges**: - - `Windows` *(blue badge)*: Record backfilled from the Windows SRUM database. - - `.DAT Import` *(orange badge)*: Record imported from an external `.dat` text file. - - `JsonlImport` *(badge)*: Record imported from a JSON Lines (`.jsonl`) backup file. - - *Unbadged*: Live session data recorded directly by LocalTelemetry. - -Clicking the selected day cell a second time closes the drill-down card. +- **Per-Adapter Filter**: Filter the calendar grid by **All** or any physical adapter discovered in the month's records. +- **Daily Drill-Down**: Click any date cell to view an itemized breakdown of download and upload volumes per network interface. --- -## :file-down: Automatic Windows History Backfill & Manual Text Import - -### :rotate-cw: Automatic Startup Backfill (SRUM) +## :file-down: Windows History Backfill & Backups -On launch, LocalTelemetry automatically inspects Windows system usage history so your calendar is populated with past data even before LocalTelemetry was installed: +### Automatic Windows SRUM Backfill -1. **ESE Jet Blue Database Engine**: LocalTelemetry directly accesses the Windows System Resource Usage Monitor database (`C:\Windows\System32\sru\SRUDB.dat`) using an Extensible Storage Engine (ESE) reader. This bypasses the typical ~30-day historical limit of the Windows WinRT API. -2. **Backfill to OS Installation Date**: The engine queries the Windows registry (`HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\InstallTime` or `InstallDate`) to determine when Windows was originally installed, backfilling all daily usage up to yesterday without gaps. -3. **WinRT Fallback**: If the ESE database cannot be opened (e.g. due to system locking or permission constraints), LocalTelemetry automatically falls back to querying the WinRT `Windows.Networking.Connectivity` API. -4. **Gap Detection**: On subsequent launches, LocalTelemetry only imports missing days between the newest saved record and yesterday. -5. **Partial-Day Baseline Reconciling**: Today's partial-day usage is seeded from Windows on startup. If live data is recorded while the background import runs, the live deltas are added onto the baseline so no traffic is lost or double-counted. +On startup, LocalTelemetry reads the Windows System Resource Usage Monitor database (`SRUDB.dat`) using an Extensible Storage Engine (ESE) reader. This imports daily usage back to your original Windows installation date without third-party tools. -### :calendar-plus: On-Demand Windows Network Usage Import +### On-Demand Date Range Import -Under the **Windows Network Usage** section on the Traffic page, you can manually trigger backfill for any date range: +Under **Windows Network Usage** on the Traffic page, select quick presets (**Last 7 Days**, **Last 14 Days**, **Last 30 Days**) or custom date pickers. Click **Import from Windows** to backfill historical usage. -- **Quick Presets**: Select **Last 7 Days**, **Last 14 Days**, or **Last 30 Days** to automatically configure date boundaries. -- **Custom Date Pickers**: Specify custom **From** and **To** dates. The interface enforces real-time validation to prevent invalid, inverted, or future dates. -- **Import Execution**: Click **Import from Windows**. LocalTelemetry reads historical records from the Windows database for the requested range. -- **Status Reporting**: Displays the total days and bandwidth imported (e.g. `Imported 14 day(s): ↓ 12.45 GB, ↑ 2.10 GB`) or confirms that the period is already up to date. +### Backup Export & Import -### :import: Manual Traffic Database & Backup File Import - -Under the **Traffic Database & Backup** section on the Traffic page, click **Select .jsonl or .dat file** to restore or load external bandwidth logs: - -- **JSON Lines Format (`.jsonl`)**: Restores native LocalTelemetry backup files containing line-delimited JSON objects. Supports `date`, upload bytes (`up_bytes`, `upload_bytes`, `up`), download bytes (`down_bytes`, `download_bytes`, `down`), and `interface`. Dates support `YYYY-MM-DD`, `DD-MM-YYYY`, and `DD/MM/YYYY`. Records merge into `TrafficHistoryStore` with source `JsonlImport`. - - ```json - {"date":"2026-10-01","download_bytes":524288000,"upload_bytes":104857600,"interface":"Ethernet"} - {"date":"02-10-2026","down":1073741824,"up":209715200,"interface":"Wi-Fi"} - ``` - -- **Legacy Plaintext Format (`.dat`)**: Loads plaintext `.dat` files with a header line and daily records formatted as `YYYY/MM/DD UpKB/DownloadKB`: - - ```text - Date Upload/Download KB - 2026/08/01 1024/2048 - 2026/08/02 51200/102400 - ``` - -- **Processing & Storage**: The importer validates lines and converts values to bytes. It merges records into `TrafficHistoryStore` and saves them to `internet_usage.jsonl`. -- **Status Feedback**: Displays the number of days imported (e.g. `Imported 31 day(s)`) or an error message if parsing fails. - -::: warning Binary SRUDB.dat Files -The **Select .jsonl or .dat file** button is designed for text backups and logs. Do not select the Windows binary `SRUDB.dat` file with this button. LocalTelemetry reads Windows `SRUDB.dat` automatically in the background using its built-in ESE reader. -::: +- **Export Database Backup**: Exports all historical traffic records to a standalone `.jsonl` file via a standard Windows Save File Dialog. +- **Import Backup File**: Restores native `.jsonl` backups or legacy plaintext `.dat` logs (`YYYY/MM/DD UpKB/DownKB`). Records merge safely into your local database. --- -## :bell: Bandwidth Quotas & Threshold Alerts (Settings → Alerts) +## :shield-check: Privacy & Local Storage -LocalTelemetry can notify you when your internet consumption approaches or exceeds bandwidth limits: - -- **Daily Internet Usage** (`AlertNetDaily`): Configurable threshold from `5 GB` to `500 GB` (evaluated against today's accumulated total). -- **Monthly Internet Usage** (`AlertNetMonthly`): Configurable threshold from `100 GB` to `5,000 GB` (evaluated against the current month's total). -- **Notification Methods**: - - **Show Tray Notification**: Out-of-process toast popups in the lower-right corner of your screen. - - **Flash Overlay Briefly**: Translucent orange flash (`#FF5000`) across the taskbar overlay. - ---- - -## :shield-check: 100% Private Local Storage Architecture - -All network logs are stored **100% locally** on your machine: +All network records are stored strictly on your local machine: - **Installer Mode**: `%LOCALAPPDATA%\LocalTelemetry\internet_usage.jsonl`. -- **Portable Mode**: Saved directly in the application folder alongside `LocalTelemetry.exe`. - -### :file-code: Local Data Storage Format - -The log file uses JSON Lines (`internet_usage.jsonl`), where each line is a self-contained JSON object: - -```json -{"date":"18-09-2026","download_bytes":2147483648,"upload_bytes":524288000,"total_bytes":2671771648,"interface":"Ethernet","source":"LocalTelemetry"} -``` - -- **Descending Sort**: Records are ordered newest-first for rapid loading. -- **Deduplication**: Records are keyed on `(Year, Month, Day, Interface)`. Named-interface records automatically supersede generic unnamed records for the same date. -- **Midnight Rollover**: The background logger detects midnight date transitions, writes the previous day's final totals, clears memory counters, and begins tracking the new day. -- **Shutdown Flush**: Pending memory counters are flushed to disk when LocalTelemetry exits. - -### :shield-lock: Privacy Guarantee +- **Portable Mode**: Saved inside your application directory alongside `LocalTelemetry.exe`. -LocalTelemetry **never** tracks website URLs, visited IP addresses, DNS queries, or packet contents. Only raw numerical byte counts, network adapter names, date timestamps, and data sources are recorded. No data is ever transmitted off your device. +LocalTelemetry records numerical byte counts, interface names, and dates. It never inspects packet contents, URLs, or IP addresses. diff --git a/docs/latest/user-guide/quickstart.md b/docs/latest/user-guide/quickstart.md index 70004f0..7a005e3 100644 --- a/docs/latest/user-guide/quickstart.md +++ b/docs/latest/user-guide/quickstart.md @@ -1,74 +1,72 @@ # :rocket: Quickstart Guide -Get up and running with **LocalTelemetry** in less than 2 minutes. +Configure and run **LocalTelemetry** in less than two minutes. ## :localtelemetry: Launching LocalTelemetry -Launch LocalTelemetry using your desktop shortcut or by running `LocalTelemetry.exe`: +Start LocalTelemetry from your desktop shortcut or run `LocalTelemetry.exe`: -- The **Settings Window** opens immediately on your screen for initial configuration. -- The **LocalTelemetry icon** appears in your Windows notification area (System Tray). -- Hovering over the tray icon displays a live hardware tooltip summary with current CPU, RAM, and GPU utilization (e.g. `CPU 7% RAM 50% GPU 0%`). +- The **Settings Window** opens for initial configuration. +- The **LocalTelemetry Icon** appears in your Windows system tray. +- Hover over the tray icon to see live CPU, RAM, and GPU utilization. ![Tray Icon Tooltip](/images/tray-icon-tooltip.png) -*Live hardware summary tooltip displayed when hovering over the system tray icon.* +*Hover over the system tray icon to view quick hardware utilization.* > [!NOTE] -> LocalTelemetry requires Administrator privileges to access low-level CPU and GPU hardware sensors. When launched manually, Windows displays a standard User Account Control (UAC) prompt. To start automatically and silently at boot without a UAC prompt, enable **Start with Windows** in Settings. +> LocalTelemetry requires Administrator rights to query CPU and GPU sensors. Windows displays a standard User Account Control (UAC) prompt on manual launch. To start silently at system boot without a UAC prompt, enable **Start with Windows** in Settings or at the time of installation. ## :panel-bottom: Enabling the Taskbar Overlay -By default on a fresh installation, the taskbar overlay is hidden until enabled. You can turn it on in two ways: +The taskbar overlay is hidden by default on fresh installations. Enable the overlay using either method: -1. **Via Settings**: Navigate to **Overlay** in the settings dashboard and toggle **Show Overlay** on. -2. **Via System Tray**: Right-click the **System Tray Icon** and click **Show Overlay**. +1. **Via System Tray**: Right-click the system tray icon and select **Show Overlay**. +2. **Via Settings**: Open Settings, go to **Overlay**, and switch on **Show Overlay**. ![System Tray Context Menu](/images/tray-menu-show.png) -*System tray context menu offering quick access to show the overlay, open settings, or quit.* +*Right-click the tray icon to show the overlay, open settings, or exit.* -Once enabled, the overlay immediately anchors onto your Windows taskbar: +Once enabled, the overlay anchors directly onto your Windows taskbar. -![Default Taskbar Overlay](/images/overlay-default.png) -*Default out-of-the-box taskbar overlay displaying 5 dual-row columns with automatic hardware brand colors applied and some metrics configured with custom colors.* +## :settings: Basic Configuration -## :settings: Configuring Key Preferences +Tailor LocalTelemetry to your preferences in Settings: -Explore the key configuration tabs in the settings dashboard to tailor LocalTelemetry to your setup: +### :layout-dashboard: Layout & Sensors +- In **Layout**, choose a preset layout or drag and drop metrics to change column order. +- In **Monitoring**, toggle hardware categories on or off to adjust background polling. -### :layout-dashboard: Customize Displayed Metrics (Layout vs Monitoring) +### :proportions: Position & Display +- In **Overlay**, choose overlay positioning (`Left Side` or `Right Side` on centered taskbars; `Next to Apps` or `Before System Tray` on left-aligned taskbars). +- Adjust **Scale** and **Opacity** to match your desktop style. +- Set **Double-Click Action** to open Task Manager or Settings. -- **Layout Tab**: Drag and drop metrics to customize column order, add or remove sensors (such as NVMe disk throughput or laptop battery vitals), or click **Reset Layout to Defaults** to restore the standard 5-column layout. -- **Monitoring Tab**: Toggle individual hardware polling components (CPU, GPU, RAM, Disk, Network, Battery) on or off to eliminate unused background queries, and configure CPU calculation modes (*Average* vs *Max Active Core* clocks; *Overall* vs *Max Thread* usage). +### :paintbrush: Themes & Colors +- In **Appearance**, select a dark or light window theme. +- Customize individual metric colors or keep detected vendor brand colors. -### :proportions: Adjust Overlay Position & Scale +### :power: Silent Startup +- In **General**, enable **Start with Windows**. This registers a scheduled task that starts the app silently with elevated rights at boot. -- **Position & Offset**: Position the overlay dynamically (*Left Side* or *Right Side* on centered taskbars; *Next to Apps* or *Before System Tray* on left-aligned taskbars), and adjust horizontal offset. -- **Scale & Opacity**: Adjust overlay scaling (`80%` to `200%`) and transparency (`20%` to `100%`) to match your desktop aesthetic. -- **Double-Click Action**: Choose what happens when double-clicking the overlay (`None`, `Open Task Manager`, or `Open Settings`). +## :terminal: Command-Line Shortcuts -### :paintbrush: Personalize Colors & Themes +LocalTelemetry supports command-line arguments for scripts and Windows shortcuts: -- **Window Themes**: Switch between curated dark and light theme presets for the settings dashboard, or click **Reset to Default Theme**. -- **Metric & Group Colors**: Customize individual metric colors or entire component palettes, or click **Reset All to Defaults** to re-apply detected hardware vendor brand colors. +```powershell +# Open the Settings window directly +LocalTelemetry.exe --settings +``` -### :bell-check: Configure Threshold Warnings - -- **Threshold Limits**: Define warning triggers for CPU/GPU temperatures, memory limits, and daily/monthly bandwidth quotas. -- **Notification Channels**: Enable in-place text flashing on the taskbar overlay and non-intrusive desktop toast notifications. - -### :power: Enable Silent Startup - -- **Start with Windows**: Register an elevated Windows Task Scheduler task for silent background startup on logon without UAC prompts. -- **Show System Tray Icon**: Toggle the notification area icon on or off if you prefer running exclusively with the taskbar overlay. -- **Polling Interval & Units**: Choose your preferred sensor refresh rate (`0.5 s` to `5 s`) and toggle **Show Temperatures in °F**. +- If LocalTelemetry is running in the background, `--settings` signals the primary process to foreground the Settings window. +- If LocalTelemetry is not running, `--settings` starts an isolated out-of-process Settings shell. ## :sport-shoe: Next Steps -Continue exploring LocalTelemetry's features and architecture: +Explore the detailed feature guides: -- Explore overlay docking, context menus, and mouse controls in the [System Tray & Taskbar Overlay Guide](./tray-and-overlay.md). -- Reference all supported hardware sensors and calculation modes in the [Telemetry Metrics & Sensors Guide](./metrics-and-sensors.md). -- Track daily and monthly bandwidth usage in the [Traffic & Network History Guide](./network-history.md). -- Configure temperature and resource warning limits in the [Threshold Alerts & Toast Notifications Guide](./alerts-and-notifications.md). -- Learn about all 10 configuration tabs in the [Settings & Customization Guide](./customization.md). -- Find answers to common questions and diagnostic steps in the [Troubleshooting & FAQ Guide](./troubleshooting.md). +- Configure overlay docking and multi-monitor setup in [System Tray & Taskbar Overlay](./tray-and-overlay.md). +- Review all supported metrics and polling sources in [Telemetry Metrics & Sensors](./metrics-and-sensors.md). +- Track daily and monthly internet bandwidth in [Traffic & Network History](./network-history.md). +- Set thermal limits and alert popups in [Threshold Alerts & Toast Notifications](./alerts-and-notifications.md). +- Browse all configuration options in [Settings & Customization](./customization.md). +- Resolve common issues in [Troubleshooting & FAQ](./troubleshooting.md). diff --git a/docs/latest/user-guide/tray-and-overlay.md b/docs/latest/user-guide/tray-and-overlay.md index d9d775d..18bcc3d 100644 --- a/docs/latest/user-guide/tray-and-overlay.md +++ b/docs/latest/user-guide/tray-and-overlay.md @@ -1,142 +1,104 @@ # :panel-bottom: System Tray & Taskbar Overlay -LocalTelemetry features a dedicated `Win32` integration engine that anchors real-time hardware telemetry directly on the Windows taskbar with zero desktop obstruction. +LocalTelemetry displays real-time hardware telemetry directly on the Windows taskbar and provides quick controls through the system tray. ## :dock: The Taskbar Overlay -The taskbar overlay is a borderless, transparent window positioned directly on your Windows taskbar. +The taskbar overlay is a borderless, layered transparent window docked directly into your Windows taskbar. -![Default Taskbar Overlay](/images/overlay-default.png) -*Default out-of-the-box taskbar overlay displaying 5 dual-row columns with automatic hardware vendor brand colors applied.* +![Overlay Configuration Settings](/images/overlay-settings.png) +*Configure overlay positioning, taskbar side alignment, opacity, scale, and double-click actions.* -### :layers: Core Overlay Architecture + -- **Adaptive 1-Row / 2-Row Column Grid**: Metrics are rendered in an efficient columnar format (top metric and bottom metric per column) with aligned labels, colons, and dynamic value formatting. If configured with single metrics, the overlay automatically centers the single row vertically within the taskbar height. -- **High-Performance GDI+ Rendering**: Renders metrics with sub-pixel anti-aliasing and ClearType typography directly into a layered transparent buffer with minimal CPU overhead. -- **DPI-Aware Scaling**: Automatically detects and adapts to display scaling levels (100%, 125%, 150%, 175%, 200%, and multi-monitor mixed DPI setups). -- **Automatic Theme Contrast & Key Color Sync**: When **Follow Windows Theme** is enabled, a 2-second background timer detects Windows light/dark taskbar changes (`SystemUsesLightTheme`). It dynamically synchronizes the overlay transparency key color (`#f0f0f0` for light theme, `#1c1b19` or custom hex for dark theme) and adjusts text luminosity for high-contrast legibility against any taskbar color. -- **Visual Alert Flash Effect**: When any hardware metric crosses a critical threshold configured in **Alerts**, the overlay triggers an instantaneous translucent orange warning flash (`rgba(255, 80, 0, 0.24)`) across the buffer to alert you visually without stealing window focus. -- **Taskbar Space Congestion Detection & Clamping**: Measures available taskbar space between open apps and system widgets or notification area. If available width is narrower than the overlay, it clamps coordinates to prevent overlap and alerts in Settings. -- **Hybrid Embedding Engine**: Embeds as a native child window into the Windows taskbar shell, with an automatic fallback to a synchronized floating layered window if direct child embedding is restricted. +### Key Overlay Characteristics -## :paintbrush-vertical: Default Metric Layout & Vendor Brand Colors +- **Columnar Grid**: Metrics render in two rows per column with aligned labels, colons, and dynamic formatting. +- **ClearType Typography**: GDI+ sub-pixel rendering ensures high legibility against dark and light taskbars. +- **High-DPI Scaling**: Automatically adapts to display scaling levels (100% to 200%) and multi-monitor setups. +- **Visual Alert Highlighting**: Sustained threshold breaches highlight the affected metric in Coral Red (`#FF4444`). +- **Visual Alert Flash**: Alerts trigger an optional translucent orange flash across the overlay without stealing window focus. +- **Space Clamping**: Measures free taskbar width and clamps position to prevent overlapping open application buttons. -When you first launch LocalTelemetry, the overlay comes pre-configured with a balanced 5-column default layout designed to show the most critical performance metrics without overcrowding: +### Overlay Mouse Controls -### :columns-3: Default Column Breakdown +- **Right-Click**: Opens a dark context menu directly on the overlay. +- **Double-Click**: Triggers your configured shortcut (`None`, `Open Task Manager`, or `Open Settings`). +- **Left-Click**: Passes through safely to the Windows taskbar shell. -| Column | Top Row (Row 1) | Bottom Row (Row 2) | Default Sensor Pairing | -| :----------- | :---------------------------------- | :---------------------------------- | :------------------------------------------------ | -| **Column 1** | `cpu_pct` (CPU Usage %) | `cpu_temp` (CPU Package Temp) | **Processor Utilization & Thermal Status** | -| **Column 2** | `gpu_pct` (GPU Usage %) | `gpu_temp` (GPU Core Temp) | **Graphics Core Load & Thermal Status** | -| **Column 3** | `gpu_vram` (GPU VRAM Used) | `net_total` (Session Total Traffic) | **Video Memory & Cumulative Network Bandwidth** | -| **Column 4** | `ram_pct` (RAM Usage %) | `ram_used` (Active RAM in GB) | **System Memory Percentage & Physical Usage** | -| **Column 5** | `net_down` (Download Speed `DOWN↓`) | `net_up` (Upload Speed `UP↑`) | **Real-Time Network Ingress & Egress Throughput** | - -### :palette: Automatic Hardware Brand Detection & Default Color Schemes - -LocalTelemetry automatically inspects your hardware components at startup (`SystemInfo`) and assigns authentic vendor brand colors to the metric values: - -| Hardware Category | Detected Manufacturer / Brand | Assigned Brand Color | Default Fallback Color | -| :------------------ | :----------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------- | -| **CPU Metrics** | **Intel**, **AMD** | `#0068B5` *(Intel Blue)*, `#ED1C24` *(AMD Red)* | `#00E5FF` *(Cyan)* | -| **GPU Metrics** | **NVIDIA**, **AMD**, **Intel Arc** | `#76B900` *(GeForce Green)*, `#ED1C24` *(Radeon Red)*, `#0068B5` *(Arc Blue)* | `#88CCFF` *(Sky Blue)* | -| **RAM (Memory)** | **Samsung**, **Crucial** / **Micron**, **Corsair**, **G.Skill**, **Kingston**, **SK Hynix** | `#1428A0` *(Samsung Blue)*, `#0068FF` / `#0033A0` *(Crucial/Micron Blue)*, `#FFE500` *(Corsair Yellow)*, `#ED1C23` *(G.Skill Torch Red)*, `#ED1A3B` *(Kingston Rex Red)*, `#EA002C` *(SK Hynix Red)* | `#A78BFA` *(Soft Lavender)* | -| **Storage Disks** | **Samsung**, **Western Digital**, **Seagate**, **Crucial**, **Kioxia**, **Toshiba** | `#1428A0` *(Samsung Blue)*, `#005195` *(WD Blue)*, `#6EBE49` *(Seagate Green)*, `#0068FF` *(Crucial Blue)*, `#00A4E4` *(Kioxia Cyan)*, `#FF0000` *(Toshiba Red)* | `#AAAAAA` *(Neutral Gray)* | -| **Network (NIC)** | **Intel**, **Realtek**, **Qualcomm** / **Atheros**, **Broadcom**, **MediaTek**, **TP-Link** / **Killer** | `#0068B5` *(Intel Blue)*, `#006DB6` *(Realtek Blue)*, `#3253DC` *(Qualcomm Blue)*, `#CC092F` *(Broadcom Red)*, `#EC9430` *(MediaTek Orange)*, `#4AC7A3` / `#E50000` *(Teal / Killer Red)* | Download: `#38BDF8`, Upload: `#4ADE80`, Total: `#FBBF24` | -| **Battery Metrics** | **Laptop OEM / Battery Mfr** *(Sunwoda, Simplo, Dynapack, BYD, LG, Panasonic, Lenovo, Dell, HP, ASUS, MSI, Razer)* | Official OEM / Battery Brand Hex | `#80E080` *(Mint Green)* | - -> [!TIP] -> You can customize any of these colors at any time in **Settings -> Appearance**, or click **Reset All to Defaults** to re-apply the automatic vendor color scheme. -> If your hardware manufacturer is not yet recognized or uses a fallback color, you can contribute official brand colors by following the [Hardware Brand Color Contribution Guidelines](../developer-guide/contributing.md#palette-contributing-hardware-brand-colors). - -## :layout-dashboard: Customized & Expanded Setups - -Beyond the default 5-column layout, you can add, remove, and reorder metrics in **Settings -> Layout** to include active disk throughput, laptop battery status, CPU/GPU power consumption, and core clocks: +![Overlay Right-Click Context Menu](/images/overlay-menu.png) +*Right-click context menu on the taskbar overlay.* -![Customized Taskbar Overlay Layout](/images/overlay.png) -*Example of a customized taskbar overlay featuring active NVMe disk throughput (`NVMe1R`, `NVMe1W`), battery telemetry, and custom column sequencing.* +--- -## :square-mouse-pointer: Mouse Controls & Interactions +## :bell: System Tray Icon -### :panel-bottom: Interacting with the Taskbar Overlay +The notification area icon provides system-wide status and quick configuration controls: -To ensure reliable mouse interaction without Windows Explorer intercepting or misdirecting taskbar click events, LocalTelemetry uses an integrated low-level mouse monitor: +- **Hover Tooltip**: Displays a live summary of CPU, RAM, and GPU load when hovering over the tray icon. -- **Right-Click**: Opens a quick-access context menu directly on the overlay rendered in modern Windows 11 dark mode with rounded corners. It features a non-clickable `LocalTelemetry` status header, visibility toggle (`Hide Overlay` / `Show Overlay`), `Open Settings`, **Task Manager**, and an accent-red highlighted `Quit` option (`#FF453A`). Clicking anywhere outside immediately dismisses the menu cleanly. -- **Double-Click**: Triggers a customizable action configured in Settings (`None`, `Open Task Manager`, or `Open Settings`). Single left-clicks pass through safely to Windows to prevent accidental window moves. +![System Tray Tooltip](/images/tray-icon-tooltip.png) +*Hover over the tray icon to view quick hardware utilization.* -![Overlay Right-Click Context Menu](/images/overlay-menu.png) -*Quick-access context menu opened directly by right-clicking the taskbar overlay.* +- **Double-Click**: Opens the Settings window. +- **Right-Click Context Menu**: Toggles overlay visibility, opens settings, or exits the application cleanly. -### :mouse-pointer-click: Interacting with the System Tray Icon +![System Tray Context Menu](/images/tray-menu-show.png) +*Right-click the tray icon to toggle the overlay, open settings, or exit.* -The notification area icon provides system-wide access to LocalTelemetry. If you prefer to run exclusively with the taskbar overlay, you can hide this icon at any time in **Settings -> General** by turning off **Show System Tray Icon**. +> [!NOTE] +> You cannot hide both the system tray icon and the taskbar overlay at the same time. The application keeps at least one access point available to prevent interface lockout. -::: info Lockout Safety Guard -You cannot disable both the System Tray Icon and the Taskbar Overlay at the same time. If one entry point is disabled, the settings interface disables the toggle for the other entry point. The application core also resets the tray icon to enabled if both are off in configuration. -::: +--- -When enabled: +## :paintbrush-vertical: Default Layout & Brand Colors -- **Left Single-Click**: Ignored in accordance with Windows notification area guidelines to prevent accidental layout shifts. -- **Hover**: Displays a live tooltip summary showing current CPU, RAM, and GPU utilization (e.g. `CPU 7% RAM 50% GPU 0%`). +On first launch, LocalTelemetry provides a balanced 5-column layout: -![System Tray Tooltip](/images/tray-icon-tooltip.png) -*Live hardware summary tooltip displayed when hovering over the system tray icon.* +| Column | Top Row (Row 1) | Bottom Row (Row 2) | Telemetry Pairing | +| :--- | :--- | :--- | :--- | +| **Column 1** | `cpu_pct` (CPU Usage %) | `cpu_temp` (CPU Package Temp) | Processor utilization & thermals | +| **Column 2** | `gpu_pct` (GPU Usage %) | `gpu_temp` (GPU Core Temp) | Graphics utilization & thermals | +| **Column 3** | `gpu_vram` (GPU VRAM Used) | `net_total` (Session Total Data) | Video memory & session traffic | +| **Column 4** | `ram_pct` (RAM Usage %) | `ram_used` (Active RAM in GB) | System memory load & capacity | +| **Column 5** | `net_down` (Download Speed) | `net_up` (Upload Speed) | Network ingress & egress rates | -- **Double-Click**: Immediately opens the Svelte 5 Settings dashboard. -- **Right-Click**: Opens the notification area context menu with the `LocalTelemetry` title header, dynamic overlay toggle, settings access, and clean exit options: +### Automatic Hardware Brand Colors -| Overlay Visible | Overlay Hidden | -| :---: | :---: | -| ![Tray Context Menu - Hide Overlay](/images/tray-menu-hide.png) | ![Tray Context Menu - Show Overlay](/images/tray-menu-show.png) | -| *Clicking **Hide Overlay** hides the taskbar window.* | *Clicking **Show Overlay** anchors the overlay back to the taskbar.* | +LocalTelemetry detects installed hardware components at launch and applies official vendor colors: -- :eye: **Hide Overlay / Show Overlay**: Instantly toggles the taskbar overlay visibility on or off (the menu text dynamically updates according to overlay state). -- :sliders-horizontal: **Open Settings**: Launches the configuration window. -- :log-out: **Quit**: Completely closes LocalTelemetry and unloads the overlay from the taskbar. +| Category | Detected Vendor | Assigned Brand Color | Fallback Color | +| :--- | :--- | :--- | :--- | +| **CPU** | Intel, AMD | Intel Blue (`#0068B5`), AMD Red (`#ED1C24`) | Cyan (`#00E5FF`) | +| **GPU** | NVIDIA, AMD, Intel Arc | GeForce Green (`#76B900`), Radeon Red (`#ED1C24`), Arc Blue (`#0068B5`) | Sky Blue (`#88CCFF`) | +| **RAM** | Samsung, Crucial, Corsair, Kingston, G.Skill | Vendor brand hex | Lavender (`#A78BFA`) | +| **Storage** | Samsung, WD, Seagate, Crucial, Kioxia | Vendor brand hex | Gray (`#AAAAAA`) | +| **Network** | Intel, Realtek, Qualcomm, Broadcom | Vendor brand hex | Down: `#38BDF8`, Up: `#4ADE80` | +| **Battery** | Detected OEM / Manufacturer | Official OEM brand hex | Mint Green (`#80E080`) | -## :sliders-horizontal: Configuring Overlay Settings +You can customize metric colors or theme palettes at any time in **Settings -> Appearance**. To build custom column sequences or select alternative layout presets, see [Layout & Metric Sequencing](./customization.md#layout-grid-layout). -In the settings dashboard under the **Overlay** tab, you can customize layout, geometry, and interactions: +--- -![Overlay Settings Tab](/images/overlay-settings.png) -*Overlay configuration tab in the Svelte 5 settings dashboard.* +## :monitor: Multi-Monitor Support -- :eye: **Show Overlay**: Master toggle to show or hide the taskbar overlay. -- :arrow-left-right: **Position in taskbar**: LocalTelemetry automatically detects your Windows 11 taskbar alignment: - - **Centered Taskbar Icons**: - - `Left Side`: Anchors the overlay to the left side of the taskbar, adjacent to the Widgets button. - - `Right Side`: Anchors the overlay to the right side, directly to the left of the system tray. - - **Left-Aligned Taskbar Icons**: - - `Next to Apps` (`beside_apps`): Detects the right edge of running application icons. It places the overlay immediately after your last pinned or active app. - - `Before System Tray` (`right`): Anchors the overlay immediately to the left of the system notification area. - - *Fresh Setup Default*: On left-aligned taskbars, fresh setups default to `Before System Tray` to avoid overlapping pinned applications. -- :ruler: **Offset from Edge**: Adjust horizontal pixel distance from the chosen taskbar anchor (`0px` to `200px`). -- :blend: **Opacity**: Adjust overlay transparency from `20%` to `100%`. -- :zoom-in: **Scale**: Adjust the display scale multiplier from `80%` to `200%`. -- :triangle-alert: **Space Congestion Warning**: When open taskbar application buttons squeeze available space, a warning banner appears with a one-click shortcut to Windows Taskbar Settings (`ms-settings:taskbar`). -- :mouse-pointer-click: **Double-Click Action**: Configure what happens when double-clicking the overlay: - - `None`: Disables double-click action. - - `Open Task Manager`: Launches Windows Task Manager. - - `Open Settings`: Launches the LocalTelemetry settings dashboard. +Configure display targeting in **Settings -> Overlay**: -## :monitor: Multi-Monitor Behavior +- **Primary Display Only**: Displays only on the primary Windows taskbar (`Shell_TrayWnd`). +- **Secondary Display Only**: Displays on secondary taskbars (falls back to primary if no secondary display exists). +- **All Displays**: Renders an independent overlay instance on each connected display with an active taskbar. +- **Custom Selection**: Select specific displays from detected monitors. -LocalTelemetry anchors to your primary Windows taskbar. If you use multiple displays, the overlay sits seamlessly on your primary taskbar while secondary monitor taskbars remain clean and unobstructed. +Secondary displays require **Show my taskbar on all displays** enabled in Windows Taskbar Settings (`ms-settings:taskbar`). -Real-time display resolution changes and mixed-DPI transitions across monitors are tracked automatically, instantly scaling and repositioning the overlay without needing a restart. +--- ## :folder-sync: Windows Explorer Restart Recovery -If Windows Explorer crashes or restarts (`explorer.exe`), taskbar child windows are destroyed by the operating system. - -LocalTelemetry automatically recovers without requiring manual application restarts: - -1. :clock-alert: **5-Second Heartbeat Watchdog**: A background watchdog polls the Windows taskbar every 5 seconds. As soon as a new Explorer instance is detected, LocalTelemetry immediately re-embeds and redraws the overlay. -2. :move: **200ms Adaptive Repositioning**: A fast background timer tracks taskbar dimension shifts, display resolution changes, and taskband resizing every 200 ms, keeping the overlay accurately aligned. +If Windows Explorer crashes or restarts, taskbar child windows are destroyed by the operating system: -::: tip Technical Implementation -To inspect the Win32 P/Invoke window embedding mechanics, low-level mouse hooks (`WH_MOUSE_LL`), DWM attributes (`DWMWCP_ROUND`), and DPI message routing, see the [Taskbar Overlay & Win32 Interop](/developer-guide/taskbar-overlay-interop) developer guide. -::: +1. **Watchdog Heartbeat**: A 5-second background watchdog monitors taskbar validity. When Explorer restarts, LocalTelemetry automatically re-embeds and redraws the overlay. +2. **Repositioning Loop**: A 200 ms repositioning loop checks taskbar dimensions, screen resolution shifts, and app button movements to maintain accurate alignment. diff --git a/docs/latest/user-guide/troubleshooting.md b/docs/latest/user-guide/troubleshooting.md index e7c4ee2..3231e2c 100644 --- a/docs/latest/user-guide/troubleshooting.md +++ b/docs/latest/user-guide/troubleshooting.md @@ -1,141 +1,132 @@ # :wrench: Troubleshooting & FAQ -Answers to frequently asked questions, configuration solutions, and diagnostic steps for **LocalTelemetry**. +Solutions for common questions, configuration steps, and diagnostic procedures for **LocalTelemetry**. ## :circle-question-mark: Frequently Asked Questions -### :shield: Why does LocalTelemetry require Administrator privileges? +### Why does LocalTelemetry require Administrator privileges? -LocalTelemetry reads hardware telemetry directly from processor registers (Intel MSRs, AMD Ryzen SMU) and storage controllers. Windows restricts access to kernel-level hardware registers to administrative accounts to protect system security and kernel integrity. +LocalTelemetry requires administrative rights to communicate with the bundled `PawnIO` kernel driver. The driver reads CPU hardware registers (Intel MSRs, AMD SMU) and storage controllers. Windows prevents standard user accounts from accessing these registers. -### :shield-alert: Can LocalTelemetry run without Administrator privileges? +### Why does the overlay not appear immediately after install? -No. LocalTelemetry requires administrative privileges to load and communicate with the `PawnIO` kernel driver. Kernel driver access is necessary to read CPU package temperatures, MSR clock frequencies, and RAPL package power. If the Windows UAC elevation prompt is declined on launch, LocalTelemetry will display an elevation notice and exit. +On a fresh installation, the taskbar overlay is hidden by default: -### :app-window: Why doesn't the taskbar overlay appear immediately after installation? +1. Right-click the **LocalTelemetry system tray icon** and select **Show Overlay**. +2. Or open Settings, navigate to **Overlay**, and switch on **Show Overlay**. -On a fresh installation, LocalTelemetry launches with the Settings window open and places an icon in your Windows System Tray, but the taskbar overlay is hidden by default: +### Does LocalTelemetry impact gaming or system performance? -1. In the Settings window, go to **Overlay** and toggle **Show Overlay** on. -2. Or right-click the **LocalTelemetry System Tray icon** and select **Show Overlay**. +No. Background resource usage is minimal: -### :gamepad-2: Does LocalTelemetry impact gaming or system performance? +- Hardware sensors poll on asynchronous background worker threads. +- In background mode (overlay only), RAM usage is approximately **10–15 MB**. +- When the Settings window is open, Microsoft WebView2 loads the Svelte 5 UI with active memory trimming. +- Closing the Settings window unloads WebView2 and returns memory usage to baseline. -No. LocalTelemetry is optimized for minimal background resource consumption: +### Is LocalTelemetry compatible with Windows 11? -- Hardware polling occurs on asynchronous worker threads using non-blocking Win32 and vendor APIs. -- When minimized to the taskbar and system tray with settings closed, memory usage remains around ~40 MB RAM. -- The Svelte 5 settings panel (Microsoft WebView2) is completely disposed when closed, consuming zero GPU or rendering resources while hidden. +Yes. LocalTelemetry fully supports both **Windows 10** (build 19041+) and **Windows 11** (including 22H2, 23H2, and later). -### :monitor: Is LocalTelemetry compatible with Windows 11? +### Are competitive game anti-cheats (Vanguard, BattlEye, Easy Anti-Cheat) compatible? -Yes. LocalTelemetry is fully compatible with both **Windows 10** (v2004+ / build 19041+) and **Windows 11** (including 22H2, 23H2, and later). +Yes. LocalTelemetry operates safely alongside competitive kernel anti-cheat systems (Riot Vanguard, BattlEye, Easy Anti-Cheat, and Ricochet): -### :laptop-minimal-check: Why does CPU clock speed or GPU usage differ from Windows Task Manager? +- The bundled `PawnIO` driver holds a verified Microsoft WHQL digital signature. +- LocalTelemetry reads only standard CPU model-specific registers (MSRs) and SMU power tables. +- It never injects code into foreign game processes, modifies memory, or hooks system calls. -- **CPU Frequency**: By default, LocalTelemetry calculates the effective clock rate across all active cores using hardware APERF/MPERF MSR deltas. In **Settings → Monitoring**, you can switch the **Clock Mode** between `Average` (mean clock across all cores) and `Max Active Core` (fastest active boosted core). -- **CPU Utilization**: By default, LocalTelemetry measures overall processor utilization across all threads via `GetSystemTimes`, matching Windows Task Manager. In **Settings → Monitoring**, you can switch the **Usage Source** to `Max Thread (Gaming)` to monitor the single highest loaded core/thread, which is invaluable for spotting single-core bottlenecks in games. -- **GPU Utilization**: By default, LocalTelemetry queries vendor drivers directly (`NVML` / `ADL`), which reports actual GPU kernel busy time (matching MSI Afterburner). Windows Task Manager instead reads WDDM 3D/compute engine percentage. In **Settings → Monitoring**, you can switch the **GPU Usage Source** between `Driver (NVML/ADL)` and `WDDM (Task Manager)` to match your preference. +### Why do CPU or GPU readings differ from Task Manager? -### :laptop-minimal-check: Why does telemetry take ~3 seconds to update after waking from sleep? +- **CPU Frequency**: LocalTelemetry reads effective core clocks using APERF/MPERF MSR hardware deltas. Switch between `Average` and `Max Active Core` in **Settings -> Monitoring**. +- **CPU Utilization**: LocalTelemetry defaults to overall system utilization matching Task Manager. You can switch to `Max Thread (Gaming)` in **Settings -> Monitoring** to monitor the single highest loaded thread. +- **GPU Utilization**: LocalTelemetry defaults to reading actual GPU engine busy time from vendor drivers (NVML/ADL), matching tools like MSI Afterburner. You can switch to `WDDM (Task Manager)` in **Settings -> Monitoring**. -LocalTelemetry includes an automatic hardware stabilization delay. When your computer resumes from sleep or hibernation, `HardwareMonitor` waits 3 seconds before querying hardware sensors. This intentional delay allows PCIe buses, graphics drivers, and network adapters to reach full operational power states, preventing crashes and driver reset errors. +### Why do sensors take ~3 seconds to update after waking from sleep? + +LocalTelemetry includes an automatic hardware stabilization delay. When your computer resumes from sleep or hibernation, `HardwareMonitor` waits 3 seconds before polling. This delay allows PCIe buses and graphics drivers to reach full operational power states without crashing. --- ## :waypoints: Common Troubleshooting Steps -### :cpu: CPU Temperature, Frequency, or Power displays `--` - -- **Check Elevation**: Ensure LocalTelemetry was launched with Administrator privileges. Kernel sensor drivers cannot be accessed in unprivileged mode. -- **Check Anti-Cheat / Security Isolation**: Certain aggressive anti-cheat engines or third-party hypervisors may restrict MSR register access. -- **AMD Ryzen / Intel Processors**: Ensure you are running a supported Intel Core/Ultra or AMD Ryzen CPU (x64 architecture). +### CPU metrics display `--` -### :gpu: GPU Temperature or Usage displays `--` or `0%` +- **Check Elevation**: Ensure LocalTelemetry runs with Administrator privileges. +- **Check Anti-Cheat or Virtualization**: Aggressive anti-cheat systems or virtual machine hypervisors may block MSR register access. +- **Supported Architecture**: Verify your system uses a supported x86-64 Intel or AMD processor. ARM processors are not supported. -- **NVIDIA GeForce**: Ensure the official NVIDIA Game Ready or Studio Driver is installed (`nvml.dll` in `C:\Windows\System32`). Virtual machines without direct GPU passthrough do not support NVML. -- **AMD Radeon**: Ensure the official AMD Adrenalin software and driver (`atiadlxx.dll`) are installed. -- **Intel Arc / Discrete Graphics**: Ensure the latest Intel Graphics drivers (`ControlLib.dll`) are installed. -- **Laptops with Hybrid Graphics (Optimus / SmartAccess)**: When idle on battery or desktop, discrete GPUs enter a deep sleep power state (`0 W` / `0%`) until a 3D application or game is launched. +### GPU metrics display `--` or `0%` -### :network: Network speed or traffic history is not recording activity +- **NVIDIA GeForce**: Ensure official NVIDIA drivers are installed (`nvml.dll` in `C:\Windows\System32`). +- **AMD Radeon**: Ensure AMD Adrenalin software and drivers (`atiadlxx.dll`) are installed. +- **Intel Arc**: Ensure Intel Graphics drivers (`ControlLib.dll`) are installed. +- **Hybrid Laptops**: Discrete GPUs enter a deep sleep power state (`0 W` / `0%`) when idle on battery until a 3D application runs. -- **Check Active Trackers**: Open **Settings → Monitoring** and ensure the **Network** toggle under **Active Trackers** is switched on. If toggled off, the background network polling loop is halted entirely. -- **Select Active Network Interface**: Open **Settings → Network** and ensure the preferred adapter is set to `Auto (Best Match)` or your active connection (Ethernet or Wi-Fi) rather than an inactive virtual adapter (such as VPN, WSL, or VirtualBox virtual network cards). -- **Verify Traffic Logging Toggle**: In **Settings → Network**, confirm that **Record Daily Traffic History** is checked if you want bandwidth to be recorded into `internet_usage.jsonl` and visible on the Traffic calendar. +### Network speed or traffic history is not recording -### :bell: Toast notifications are not appearing for threshold alerts +- **Check Monitoring Toggle**: In **Settings -> Monitoring**, ensure **Network** is toggled on under **Active Trackers**. +- **Select Active Adapter**: In **Settings -> Network**, verify the preferred adapter is set to `Auto (Best Match)` or your active physical connection (`Ethernet` or `Wi-Fi`). +- **Verify Traffic Toggle**: In **Settings -> Network**, confirm that **Record Daily Traffic History** is enabled. -LocalTelemetry uses an out-of-process notifier (`LocalTelemetry.Notifier.exe`) that creates custom, non-activating TopMost windows via Named Pipes (`LocalTelemetryNotifier`) rather than Windows Action Center UWP toasts. If toasts do not appear: +### Toast notifications do not appear for threshold alerts -- **Check Notifier Process**: Open Windows Task Manager and confirm that `LocalTelemetry.Notifier.exe` is running alongside `LocalTelemetry.exe`. -- **Check Alert Settings**: In **Settings → Alerts**, verify that **Show Tray Notification** is checked. -- **10-Second Startup Grace Period**: LocalTelemetry suppresses all alerts for the first 10 seconds following application startup to avoid false alarms while hardware sensors calibrate. -- **Hysteresis & Alert Cooldown**: Once an alert triggers, it respects an alert cooldown timer (default: 60 seconds) and must drop below a hysteresis threshold buffer (e.g. 6°C, 8%, 512 MB) before re-arming. If **Only fire once per session (ignores cooldown)** is enabled, each metric will alert only once until the application is restarted. -- **Inspect Notifier Log**: Open `%LOCALAPPDATA%\LocalTelemetry\lt_notifier.log` (or `lt_notifier.log` in portable mode) to check for named pipe connection failures or toast creation errors. +- **Check Notifier Process**: Verify `LocalTelemetry.Notifier.exe` is running in Windows Task Manager. +- **Check Alert Settings**: In **Settings -> Alerts**, ensure **Show Tray Notification** is checked. +- **Startup Grace Period**: Alerts are suppressed for the first 10 seconds after application startup while sensors stabilize. +- **Cooldown & Hysteresis**: Alerts respect an alert cooldown timer (default: 60 seconds) and must drop below the hysteresis buffer before triggering again. -### :battery-warning: Battery metrics are missing from Layout or display `--` +### Battery metrics are missing or display `--` -- **Desktop Systems**: On desktop PCs without a physical battery, LocalTelemetry automatically detects the chassis type and AC power status, dynamically hiding battery metrics (`BAT %`, `Charge Rate`) from **Settings → Layout** and the overlay. -- **Laptops**: If battery metrics display `--` on a laptop, verify that **Battery** is enabled under **Settings → Monitoring → Active Trackers**. Note that low battery alerts only evaluate when running on battery power (discharging). +- **Desktop Systems**: Battery metrics are automatically hidden on desktop computers without a physical battery. +- **Laptops**: Ensure **Battery** is enabled under **Settings -> Monitoring -> Active Trackers**. Low battery alerts evaluate only when discharging on battery power. -### :move: Overlay placement, clipping, or auto-hide issues +### Taskbar Space Constrained Warning -- **Taskbar Embedding vs. Floating Fallback**: LocalTelemetry first attempts to embed directly into the Windows taskband as a child window (Approach A). If taskband embedding is blocked or fails, it automatically switches to a floating layered window positioned over the taskbar (Approach B). -- **Taskbar Space Constrained Warning**: If your taskbar has many open applications or high display scaling, LocalTelemetry detects that the available taskbar slot is narrower than the overlay. The Overlay settings tab shows a warning banner and clamps the overlay to prevent overlap. To resolve the constraint, reduce the number of enabled metrics in **Layout**, reduce the **Scale** slider, or click **Open Taskbar Settings** in the warning banner to turn off Windows Widgets. -- **Adjust Edge Offset**: If taskbar icons overlap the overlay, go to **Settings → Overlay** and adjust **Offset from Edge** (`0px` to `200px`) or switch **Position in taskbar** between `Left side` and `Right side`. -- **Explorer Restart Watchdog**: If the Windows taskbar crashes or restarts, an integrated background watchdog checks the taskbar handle every 5 seconds and automatically re-embeds the overlay. If it does not reappear immediately, right-click the system tray icon and choose **Show Overlay**. +If open application buttons fill the taskbar, the Overlay tab displays a space constraint warning: -### :file-exclamation-point: "Start with Windows" does not launch after moving folders (Portable Mode) +- Reduce displayed metrics in **Settings -> Layout**. +- Lower the **Scale** slider in **Settings -> Overlay**. +- Turn off taskbar search or widgets in Windows Taskbar Settings (`ms-settings:taskbar`). -- LocalTelemetry registers a Windows Task Scheduler task named `LocalTelemetry Startup` configured with highest privileges to launch elevated at logon without UAC prompts. -- If you move or rename the folder containing `LocalTelemetry.exe`, Task Scheduler will attempt to launch the old, non-existent file path. -- **Fix**: Open **Settings → General**, toggle **Start with Windows** off and then back on to register the updated file location. +### Settings window opens to a blank screen -### :shield-alert: Driver installation fails or requests restart (Exit Code 3010) +- **Install WebView2**: Windows 11 includes WebView2 by default. On Windows 10, install the free **Microsoft Edge WebView2 Evergreen Runtime**. +- **Clear WebView2 Cache**: + - Installer Mode: Delete `%LOCALAPPDATA%\LocalTelemetry\webview2_data\`. + - Portable Mode: Delete `webview2_data\` inside your application directory. -- If you reinstall LocalTelemetry immediately after uninstalling or running `Uninstall.bat`, Windows may report exit code `3010`. -- This occurs because the Windows kernel holds unreleased driver memory handles until a system restart. If this happens, restart your computer and run the installer again. +### Resetting corrupted settings to default -### :monitor: Settings window opens to a blank screen +If your configuration file becomes damaged: -- **Missing WebView2**: Windows 11 includes the **Microsoft WebView2 Runtime** by default. On Windows 10, if WebView2 is missing, download and install the free **Microsoft Edge WebView2 Evergreen Runtime** from Microsoft. -- **Corrupted User Data Cache**: If WebView2 fails to render despite being installed, clear its cache directory: - - **Installer Mode**: Delete `%LOCALAPPDATA%\LocalTelemetry\webview2_data\`. - - **Portable Mode**: Delete `webview2_data\` inside your application directory. - *(This clears browser cache without wiping your application configuration in `settings.json`.)* +1. Exit LocalTelemetry (right-click the tray icon and select **Quit**). +2. Open Windows File Explorer and navigate to `%LOCALAPPDATA%\LocalTelemetry` (or your portable folder). +3. Delete `settings.json`. +4. Relaunch `LocalTelemetry.exe` to generate a fresh default configuration. -### :cog: Resetting corrupted settings to default +### Windows 11 Memory Integrity (HVCI) & Driver Blocklist -If your settings file becomes damaged: +Windows 11 Memory Integrity (Hypervisor-Enforced Code Integrity) blocks known vulnerable kernel drivers: -1. Exit LocalTelemetry (right-click the tray icon and choose **Quit**). -2. Open Windows File Explorer and navigate to `%LOCALAPPDATA%\LocalTelemetry` (or the application folder if using portable mode). -3. Delete `settings.json`. -4. Relaunch `LocalTelemetry.exe`. The application will regenerate a fresh default configuration. +- LocalTelemetry uses a signed PawnIO driver compliant with Microsoft Core Isolation standards. +- If Windows displays a "Driver cannot load" warning, update LocalTelemetry to the latest release. +- Ensure your system BIOS/UEFI firmware is up to date, and verify that Virtualization Technology (Intel VT-x / AMD-V) is enabled. --- ## :logs: Log File Locations -When reporting an issue on [GitHub Issues](https://github.com/Nicconike/LocalTelemetry/issues), attach the relevant log files. You can quickly open your logs directory by clicking the arrow **→** button next to **Logs Folder** in **Settings -> About**: +Attach log files when reporting issues on GitHub. Click the **→** arrow button next to **Logs Folder** in **Settings -> About**: -- :file-cog: **System Diagnostics Log**: `%LOCALAPPDATA%\LocalTelemetry\logs\lt_system.log` (automatically rotates at 5 MB, up to 3 archive files: `.1.log`, `.2.log`, `.3.log`) -- :file-clock: **Daily Metrics Log**: `%LOCALAPPDATA%\LocalTelemetry\logs\lt_DD-MM-YYYY.log` (gated by the **Metrics Logging** toggle in Settings) -- :bell: **Notifier Process Log**: `%LOCALAPPDATA%\LocalTelemetry\lt_notifier.log` (records toast alert lifecycle and named pipe events) -- :folder-cog: **Data & Logs Directory**: - - **Installer Mode**: `%LOCALAPPDATA%\LocalTelemetry\` (with logs in `%LOCALAPPDATA%\LocalTelemetry\logs\`) - - **Portable Mode**: The application folder where `LocalTelemetry.exe` is located (with logs in `logs\`) +- **System Diagnostics**: `%LOCALAPPDATA%\LocalTelemetry\logs\lt_system.log` (rotates at 5 MB, up to 3 archive files). +- **Daily Metrics Log**: `%LOCALAPPDATA%\LocalTelemetry\logs\lt_DD-MM-YYYY.log` (when enabled in Settings). +- **Notifier Process Log**: `%LOCALAPPDATA%\LocalTelemetry\lt_notifier.log` (records toast alert lifecycle and IPC events). --- -## :heart-handshake: Getting Community Help - -Need assistance, found a bug, or have a question? - -- :server: **Discord Server**: Join the [Discord Community](https://discord.gg/M2QevSgW3S) to chat live with the developer and get troubleshooting help. -- :message-square-code: **GitHub Discussions**: Ask questions or share custom setups on [GitHub Discussions](https://github.com/Nicconike/LocalTelemetry/discussions). -- :bug: **Report a Bug**: Open a bug report with your log files on [GitHub Issues](https://github.com/Nicconike/LocalTelemetry/issues). +## :heart-handshake: Getting Help -> [!TIP] -> For advanced developer diagnostics, IPC packet tracing, and source debugging workflows, see the [**Developer Backend Architecture Guide**](../developer-guide/backend-architecture.md) and [**Hardware Drivers Architecture**](../developer-guide/hardware-drivers.md). +- **Discord Server**: Join the [Discord Community](https://discord.gg/M2QevSgW3S) for live chat and troubleshooting. +- **GitHub Discussions**: Ask questions or share custom setups on [GitHub Discussions](https://github.com/Nicconike/LocalTelemetry/discussions). +- **GitHub Issues**: Report bugs with log files on [GitHub Issues](https://github.com/Nicconike/LocalTelemetry/issues). diff --git a/docs/package.json b/docs/package.json index 4b68893..7a6bb77 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,44 +1,42 @@ -{ - "name": "localtelemetry-docs", - "version": "1.2.0", - "private": true, - "type": "module", - "scripts": { - "docs:dev": "node scripts/build-versions.mjs && vitepress dev", - "docs:build": "node scripts/build-versions.mjs && vitepress build", - "docs:preview": "vitepress preview", - "docs:snapshot": "node scripts/snapshot-docs.mjs" - }, - "devDependencies": { - "@iconify-json/lucide": "^1.2.143", - "@types/node": "^26.6.5", - "dayjs": "^1.11.23", - "debug": "^4.4.3", - "fastdom": "^1.0.12", - "mermaid": "^12.2.0", - "typescript": "^7.0.2", - "vitepress": "^1.6.4", - "vitepress-plugin-mermaid": "^2.0.17" - }, - "overrides": { - "nanoid": "^3.3.18", - "dompurify": "^3.4.17", - "esbuild": "^0.25.0", - "cross-spawn": "^7.0.6", - "body-parser": "^1.20.3", - "fast-xml-parser": "^4.5.1", - "cookie": "^0.7.0", - "send": "^0.19.0", - "express": "^4.20.0", - "vue": "3.5.44", - "@vue/server-renderer": "3.5.44", - "@vue/runtime-core": "3.5.44", - "@vue/runtime-dom": "3.5.44", - "@vue/shared": "3.5.44", - "katex": "^0.18.2", - "source-map-js": "^1.2.2", - "vite": "^6.4.4" - } -} - - +{ + "name": "localtelemetry-docs", + "version": "1.3.0-beta.9", + "private": true, + "type": "module", + "scripts": { + "docs:dev": "node scripts/build-versions.mjs --dev && vitepress dev", + "docs:build": "node scripts/build-versions.mjs && vitepress build", + "docs:preview": "vitepress preview", + "docs:snapshot": "node scripts/snapshot-docs.mjs" + }, + "devDependencies": { + "@iconify-json/lucide": "^1.2.161", + "@types/node": "^26.6.11", + "dayjs": "^1.11.23", + "debug": "^4.4.3", + "fastdom": "^1.0.12", + "mermaid": "^12.4.0", + "typescript": "^7.0.2", + "vitepress": "^1.6.4", + "vitepress-plugin-mermaid": "^2.0.17" + }, + "overrides": { + "nanoid": "^3.3.18", + "dompurify": "^3.4.17", + "esbuild": "^0.25.0", + "cross-spawn": "^7.0.6", + "body-parser": "^1.20.3", + "fast-xml-parser": "^4.5.1", + "cookie": "^0.7.0", + "send": "^0.19.0", + "express": "^4.20.0", + "vue": "3.5.44", + "@vue/server-renderer": "3.5.44", + "@vue/runtime-core": "3.5.44", + "@vue/runtime-dom": "3.5.44", + "@vue/shared": "3.5.44", + "katex": "^0.18.2", + "source-map-js": "^1.2.2", + "vite": "^6.4.4" + } +} diff --git a/docs/public/images/about-settings.png b/docs/public/images/about-settings.png index 05ba90d..2630519 100644 Binary files a/docs/public/images/about-settings.png and b/docs/public/images/about-settings.png differ diff --git a/docs/public/images/alerts-settings.png b/docs/public/images/alerts-settings.png index 10bd46e..9781bdb 100644 Binary files a/docs/public/images/alerts-settings.png and b/docs/public/images/alerts-settings.png differ diff --git a/docs/public/images/appearance-settings.png b/docs/public/images/appearance-settings.png index 7f0f390..17e625e 100644 Binary files a/docs/public/images/appearance-settings.png and b/docs/public/images/appearance-settings.png differ diff --git a/docs/public/images/general-settings.png b/docs/public/images/general-settings.png index c7865b8..2690d04 100644 Binary files a/docs/public/images/general-settings.png and b/docs/public/images/general-settings.png differ diff --git a/docs/public/images/layout-settings.png b/docs/public/images/layout-settings.png index 379b8fc..661a21f 100644 Binary files a/docs/public/images/layout-settings.png and b/docs/public/images/layout-settings.png differ diff --git a/docs/public/images/monitoring-settings.png b/docs/public/images/monitoring-settings.png index a99e181..fb7185b 100644 Binary files a/docs/public/images/monitoring-settings.png and b/docs/public/images/monitoring-settings.png differ diff --git a/docs/public/images/network-settings.png b/docs/public/images/network-settings.png index 85bece6..3e8a010 100644 Binary files a/docs/public/images/network-settings.png and b/docs/public/images/network-settings.png differ diff --git a/docs/public/images/overlay-menu.png b/docs/public/images/overlay-menu.png index 2595aa9..f173c01 100644 Binary files a/docs/public/images/overlay-menu.png and b/docs/public/images/overlay-menu.png differ diff --git a/docs/public/images/overlay-settings.png b/docs/public/images/overlay-settings.png index 57155fa..1344834 100644 Binary files a/docs/public/images/overlay-settings.png and b/docs/public/images/overlay-settings.png differ diff --git a/docs/public/images/system-settings.png b/docs/public/images/system-settings.png index f0cb4d1..9e23542 100644 Binary files a/docs/public/images/system-settings.png and b/docs/public/images/system-settings.png differ diff --git a/docs/public/images/toast-alert.png b/docs/public/images/toast-alert.png index 18f2b59..641de0d 100644 Binary files a/docs/public/images/toast-alert.png and b/docs/public/images/toast-alert.png differ diff --git a/docs/public/images/traffic-settings.png b/docs/public/images/traffic-settings.png index 2fc4462..4b4eb10 100644 Binary files a/docs/public/images/traffic-settings.png and b/docs/public/images/traffic-settings.png differ diff --git a/docs/public/images/tray-menu.png b/docs/public/images/tray-menu.png deleted file mode 100644 index 0793a32..0000000 Binary files a/docs/public/images/tray-menu.png and /dev/null differ diff --git a/docs/public/images/uninstall-options.png b/docs/public/images/uninstall-options.png new file mode 100644 index 0000000..ddc5997 Binary files /dev/null and b/docs/public/images/uninstall-options.png differ diff --git a/docs/public/images/uninstall-preserved.png b/docs/public/images/uninstall-preserved.png new file mode 100644 index 0000000..166ff1d Binary files /dev/null and b/docs/public/images/uninstall-preserved.png differ diff --git a/docs/public/images/uninstall-success.png b/docs/public/images/uninstall-success.png new file mode 100644 index 0000000..2e18a57 Binary files /dev/null and b/docs/public/images/uninstall-success.png differ diff --git a/docs/public/videos/LocalTelemetry.gif b/docs/public/videos/LocalTelemetry.gif new file mode 100644 index 0000000..54a6b40 Binary files /dev/null and b/docs/public/videos/LocalTelemetry.gif differ diff --git a/docs/public/videos/LocalTelemetry.mp4 b/docs/public/videos/LocalTelemetry.mp4 new file mode 100644 index 0000000..020fd38 Binary files /dev/null and b/docs/public/videos/LocalTelemetry.mp4 differ diff --git a/docs/public/videos/customization.gif b/docs/public/videos/customization.gif new file mode 100644 index 0000000..0240004 Binary files /dev/null and b/docs/public/videos/customization.gif differ diff --git a/docs/public/videos/customization.mp4 b/docs/public/videos/customization.mp4 new file mode 100644 index 0000000..b92cdea Binary files /dev/null and b/docs/public/videos/customization.mp4 differ diff --git a/docs/public/videos/default-overlay.gif b/docs/public/videos/default-overlay.gif new file mode 100644 index 0000000..a9bc500 Binary files /dev/null and b/docs/public/videos/default-overlay.gif differ diff --git a/docs/public/videos/default-overlay.mp4 b/docs/public/videos/default-overlay.mp4 new file mode 100644 index 0000000..7babb49 Binary files /dev/null and b/docs/public/videos/default-overlay.mp4 differ diff --git a/docs/scripts/build-versions.mjs b/docs/scripts/build-versions.mjs index 033c6b9..77d04c8 100644 --- a/docs/scripts/build-versions.mjs +++ b/docs/scripts/build-versions.mjs @@ -5,7 +5,7 @@ * and updating docs/.vitepress/versions.mjs before VitePress builds. */ import { execFileSync } from 'node:child_process'; -import { existsSync, mkdirSync, readFileSync, writeFileSync, rmSync, readdirSync } from 'node:fs'; +import { existsSync, mkdirSync, readFileSync, writeFileSync, rmSync, readdirSync, copyFileSync } from 'node:fs'; import { dirname, join, resolve } from 'node:path'; import { fileURLToPath } from 'node:url'; @@ -30,7 +30,10 @@ const gitExecutable = (() => { function runGit(args) { try { return execFileSync(gitExecutable, args, { cwd: root, encoding: 'utf-8', stdio: ['ignore', 'pipe', 'ignore'] }).trim(); - } catch { + } catch (err) { + if (process.env.DEBUG) { + console.debug(`[build-versions] Git execution failed for args '${args.join(' ')}': ${err.message}`); + } return ''; } } @@ -85,7 +88,7 @@ function compareSemVer(a, b) { return 0; } -function getValidReleaseTags() { +function getValidReleaseTags(includePrereleases = true) { const tagOutput = runGit(['tag', '-l', 'v*']); if (!tagOutput) return []; @@ -100,6 +103,7 @@ function getValidReleaseTags() { .filter((t) => { const parsed = parseSemVer(t); if (!parsed) return false; + if (!includePrereleases && parsed.prereleaseType) return false; return compareSemVer(t, MIN_VERSION) >= 0; }) .sort((a, b) => compareSemVer(b, a)); // Newest first @@ -250,15 +254,35 @@ function updateVersionsFile(validTags) { writeFileSync(versionsFile, newContent); } -function main() { - const args = process.argv.slice(2); - const force = args.includes('--force'); - const tagArgIndex = args.indexOf('--tag'); - const extraTag = tagArgIndex !== -1 && args[tagArgIndex + 1] ? args[tagArgIndex + 1] : process.env.RELEASE_TAG; +function cleanStaleVersionDirs(activeTags) { + if (!existsSync(docsDir)) return; + const activeDirs = new Set(activeTags.map((tag) => `v${tag.replace(/^v/, '')}`)); + try { + const entries = readdirSync(docsDir, { withFileTypes: true }); + for (const entry of entries) { + if (entry.isDirectory() && /^v\d+\.\d+\.\d+/.test(entry.name)) { + if (!activeDirs.has(entry.name)) { + console.log(`[build-versions] Removing stale version folder: docs/${entry.name}`); + rmSync(join(docsDir, entry.name), { recursive: true, force: true }); + } + } + } + } catch (err) { + console.warn(`[build-versions] Warning: Failed to clean stale version folders: ${err.message}`); + } +} - console.log(`[build-versions] Scanning for release tags >= v${MIN_VERSION}...`); - const validTags = getValidReleaseTags(); +function ensureMermaidBundle() { + const mermaidOut = join(docsDir, 'public', 'mermaid.min.js'); + if (!existsSync(mermaidOut)) { + const mermaidSource = join(docsDir, 'node_modules', 'mermaid', 'dist', 'mermaid.min.js'); + if (existsSync(mermaidSource)) { + copyFileSync(mermaidSource, mermaidOut); + } + } +} +function resolveTagsToBuild(validTags, extraTag) { if (extraTag) { const normalizedTag = extraTag.startsWith('v') ? extraTag : `v${extraTag}`; if (compareSemVer(normalizedTag, MIN_VERSION) >= 0 && !validTags.includes(normalizedTag)) { @@ -268,25 +292,60 @@ function main() { } if (validTags.length === 0) { - console.log(`[build-versions] No release tags >= v${MIN_VERSION} found yet. Serving Latest docs only.`); - updateVersionsFile([]); - return; + return []; } - console.log(`[build-versions] Found ${validTags.length} valid tag(s): ${validTags.join(', ')}`); + const latestStable = validTags.find((t) => !parseSemVer(t)?.prereleaseType); + const tagsToBuild = []; + if (validTags[0]) { + tagsToBuild.push(validTags[0]); + } + if (latestStable && !tagsToBuild.includes(latestStable)) { + tagsToBuild.push(latestStable); + } + return tagsToBuild; +} +function extractAllDocs(tagsToBuild, force) { + cleanStaleVersionDirs(tagsToBuild); const successfullyExtracted = []; - for (const tag of validTags) { - const ok = extractDocsFromTag(tag, force); - if (ok) { + for (const tag of tagsToBuild) { + if (extractDocsFromTag(tag, force)) { successfullyExtracted.push(tag); } else { console.warn(`[build-versions] Warning: Could not extract docs from tag ${tag}`); } } - - updateVersionsFile(successfullyExtracted); - console.log(`[build-versions] Version check complete. Ready for VitePress.`); + return successfullyExtracted; } -main(); +ensureMermaidBundle(); + +const args = process.argv.slice(2); +const force = args.includes('--force'); +const isDev = args.includes('--dev'); +const tagArgIndex = args.indexOf('--tag'); +const extraTag = tagArgIndex !== -1 && args[tagArgIndex + 1] ? args[tagArgIndex + 1] : process.env.RELEASE_TAG; + +if (isDev) { + console.log('[build-versions] Dev mode: skipping past version extractions.'); + if (!existsSync(versionsFile)) { + updateVersionsFile([]); + } + console.log('[build-versions] Version check complete. Ready for VitePress.'); +} else { + console.log(`[build-versions] Scanning for release tags >= v${MIN_VERSION}...`); + const validTags = getValidReleaseTags(true); + const tagsToBuild = resolveTagsToBuild(validTags, extraTag); + + if (tagsToBuild.length === 0) { + console.log(`[build-versions] No release tags >= v${MIN_VERSION} found yet. Serving Latest docs only.`); + cleanStaleVersionDirs([]); + updateVersionsFile([]); + } else { + console.log(`[build-versions] Release versions detected: ${tagsToBuild.join(', ')}`); + const successfullyExtracted = extractAllDocs(tagsToBuild, force); + updateVersionsFile(successfullyExtracted); + console.log('[build-versions] Version check complete. Ready for VitePress.'); + } +} diff --git a/docs/scripts/snapshot-docs.mjs b/docs/scripts/snapshot-docs.mjs index f360143..e9b21b6 100644 --- a/docs/scripts/snapshot-docs.mjs +++ b/docs/scripts/snapshot-docs.mjs @@ -6,11 +6,6 @@ * Usage: * node scripts/snapshot-docs.mjs [--force] [--dry-run] * node scripts/snapshot-docs.mjs --remove [--force] [--dry-run] - * - * Examples: - * node scripts/snapshot-docs.mjs 1.0.0-rc.1 - * node scripts/snapshot-docs.mjs v1.0.0-rc.1 - * node scripts/snapshot-docs.mjs --remove 1.0.0-rc.1 */ import { execFileSync } from 'node:child_process'; import { existsSync, mkdirSync, readFileSync, writeFileSync, readdirSync, rmSync, statSync } from 'node:fs'; diff --git a/global.json b/global.json index a96164a..0fa611b 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,9 @@ { "sdk": { - "version": "10.0.302", + "version": "11.0.100", "rollForward": "latestFeature" + }, + "test": { + "runner": "Microsoft.Testing.Platform" } } diff --git a/packaging/winget/Nicconike.LocalTelemetry.installer.yaml b/packaging/winget/Nicconike.LocalTelemetry.installer.yaml index 9b858e0..91fbbd6 100644 --- a/packaging/winget/Nicconike.LocalTelemetry.installer.yaml +++ b/packaging/winget/Nicconike.LocalTelemetry.installer.yaml @@ -1,14 +1,13 @@ # yaml-language-server: $schema=https://aka.ms/winget-manifest.installer.1.12.0.schema.json PackageIdentifier: Nicconike.LocalTelemetry -PackageVersion: 1.2.0 +PackageVersion: 1.2.0 InstallerType: inno Scope: machine UpgradeBehavior: install ElevationRequirement: elevationRequired Installers: - Architecture: x64 - InstallerUrl: https://github.com/Nicconike/LocalTelemetry/releases/download/v1.2.0/LocalTelemetrySetup.exe - InstallerSha256: ADD458A88398701F528FCA022B7FBCF303EAD5F23F964E77182AE96D1397C1EA + InstallerUrl: https://github.com/Nicconike/LocalTelemetry/releases/download/v1.2.0/LocalTelemetrySetup.exe + InstallerSha256: ADD458A88398701F528FCA022B7FBCF303EAD5F23F964E77182AE96D1397C1EA ManifestType: installer ManifestVersion: 1.12.0 - diff --git a/packaging/winget/Nicconike.LocalTelemetry.locale.en-US.yaml b/packaging/winget/Nicconike.LocalTelemetry.locale.en-US.yaml index 6416dca..a15fb34 100644 --- a/packaging/winget/Nicconike.LocalTelemetry.locale.en-US.yaml +++ b/packaging/winget/Nicconike.LocalTelemetry.locale.en-US.yaml @@ -1,6 +1,6 @@ # yaml-language-server: $schema=https://aka.ms/winget-manifest.defaultLocale.1.12.0.schema.json PackageIdentifier: Nicconike.LocalTelemetry -PackageVersion: 1.2.0 +PackageVersion: 1.2.0 PackageLocale: en-US Publisher: Nicconike PublisherUrl: https://github.com/Nicconike @@ -33,4 +33,3 @@ Tags: ReleaseNotesUrl: https://github.com/Nicconike/LocalTelemetry/releases ManifestType: defaultLocale ManifestVersion: 1.12.0 - diff --git a/packaging/winget/Nicconike.LocalTelemetry.yaml b/packaging/winget/Nicconike.LocalTelemetry.yaml index 8291cc5..39d2a86 100644 --- a/packaging/winget/Nicconike.LocalTelemetry.yaml +++ b/packaging/winget/Nicconike.LocalTelemetry.yaml @@ -1,7 +1,6 @@ # yaml-language-server: $schema=https://aka.ms/winget-manifest.version.1.12.0.schema.json PackageIdentifier: Nicconike.LocalTelemetry -PackageVersion: 1.2.0 +PackageVersion: 1.2.0 DefaultLocale: en-US ManifestType: version ManifestVersion: 1.12.0 - diff --git a/setup.iss b/setup.iss index f0346b2..ffb3650 100644 --- a/setup.iss +++ b/setup.iss @@ -51,7 +51,7 @@ Name: desktopicon; Description: "Create a &Desktop shortcut"; GroupDescription: Name: startup; Description: "Run LocalTelemetry at Windows &startup"; GroupDescription: "System options:" [Files] -Source: "publish\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Excludes: "Uninstall.bat,*.xml,*.pdb" +Source: "publish\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Excludes: "Uninstall.bat,*.xml,*.pdb,*.log,Microsoft.Windows.SDK.NET.dll,WinRT.Runtime.dll" [Icons] Name: "{group}\LocalTelemetry"; Filename: "{app}\LocalTelemetry.exe"; Tasks: startmenuicon @@ -90,6 +90,19 @@ const '}' + #13#10 + '& sc.exe stop PawnIO *>&1 | Add-Content $log' + #13#10 + '& sc.exe delete PawnIO *>&1 | Add-Content $log' + #13#10 + + '''[PawnIO cleanup] cleaning temporary directories'' | Add-Content $log' + #13#10 + + '$winTemp = Join-Path $env:windir ''Temp''' + #13#10 + + 'foreach ($entry in @(Get-ChildItem -Path $winTemp -Filter ''PawnIO_*'' -Force -ErrorAction SilentlyContinue)) {' + #13#10 + + ' if ($entry.Attributes -band [System.IO.FileAttributes]::ReparsePoint) {' + #13#10 + + ' ''[PawnIO cleanup] skipped reparse point: '' + $entry.FullName | Add-Content $log' + #13#10 + + ' continue' + #13#10 + + ' }' + #13#10 + + ' try {' + #13#10 + + ' Remove-Item -LiteralPath $entry.FullName -Recurse -Force -ErrorAction Stop' + #13#10 + + ' } catch {' + #13#10 + + ' ''[PawnIO cleanup] failed to delete '' + $entry.FullName + '': '' + $_.Exception.Message | Add-Content $log' + #13#10 + + ' }' + #13#10 + + '}' + #13#10 + 'if ($rebootNeeded) { exit 3010 } else { exit 0 }'; var @@ -123,17 +136,18 @@ begin Action.Arguments := '--minimized'; Action.WorkingDirectory := ExpandConstant('{app}'); RootFolder.RegisterTaskDefinition(StartupTaskName, Task, 6, '', '', 3, ''); + Log('CreateStartupTask succeeded: registered task ' + StartupTaskName); Result := True; finally Scheduler := Unassigned; RootFolder := Unassigned; Task := Unassigned; Trigger := Unassigned; Action := Unassigned; end; except Log('CreateStartupTask failed: ' + GetExceptionMessage); end; end; -function IsDotNet10DesktopInstalled: Boolean; +function IsDotNet11DesktopInstalled: Boolean; var FindRec: TFindRec; begin Result := False; - if FindFirst(ExpandConstant('{pf64}\dotnet\shared\Microsoft.WindowsDesktop.App\10.*'), FindRec) then + if FindFirst(ExpandConstant('{pf64}\dotnet\shared\Microsoft.WindowsDesktop.App\11.*'), FindRec) then begin try repeat @@ -149,69 +163,76 @@ begin end; end; +procedure DeleteTempPawnIoFiles(const TargetDir: string); +var + FindRec: TFindRec; +begin + if (TargetDir <> '') and DirExists(TargetDir) and FindFirst(TargetDir + '\PawnIO_*', FindRec) then + begin + try + repeat + if (FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY) <> 0 then + DelTree(TargetDir + '\' + FindRec.Name, True, True, True) + else + DeleteFile(TargetDir + '\' + FindRec.Name); + until not FindNext(FindRec); + finally + FindClose(FindRec); + end; + end; +end; + procedure InitializeWizard; begin RequiresReboot := False; - DownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), 'Downloading .NET 10 Desktop Runtime...', nil); + DownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), 'Downloading .NET 11 Desktop Runtime...', nil); DownloadPage.ShowBaseNameInsteadOfUrl := True; end; function PrepareToInstall(var NeedsRestart: Boolean): string; var - ResultCode: Integer; - Attempt: Integer; - DownloadUrl: string; + ResultCode: Integer; + DownloadUrl: string; + DownloadSha256: string; begin - Result := ''; - DotNetDownloaded := False; + Result := ''; + DotNetDownloaded := False; - if not IsDotNet10DesktopInstalled then - begin - for Attempt := 1 to 2 do + if not IsDotNet11DesktopInstalled then begin - // Attempt 1 uses aka.ms (evergreen redirect); Attempt 2 falls back directly to builds.dotnet.microsoft.com CDN - if Attempt = 1 then - DownloadUrl := 'https://aka.ms/dotnet/10.0/windowsdesktop-runtime-win-x64.exe' - else - DownloadUrl := 'https://builds.dotnet.microsoft.com/dotnet/WindowsDesktop/10.0.11/windowsdesktop-runtime-10.0.11-win-x64.exe'; - - DownloadPage.Clear; - DownloadPage.Add(DownloadUrl, 'dotnet_installer.exe', ''); - DownloadPage.Show; - try + DownloadUrl := 'https://builds.dotnet.microsoft.com/dotnet/WindowsDesktop/11.0.0/windowsdesktop-runtime-11.0.0-win-x64.exe'; + DownloadSha256 := '8c0eafd5eb480e4603aa63619aeffe378157e07b2f0f8dd3db9b5226ac890d4a'; + + DownloadPage.Clear; + DownloadPage.Add(DownloadUrl, 'dotnet_installer.exe', DownloadSha256); + DownloadPage.Show; try - DownloadPage.Download; - DotNetDownloaded := True; - Log('.NET 10 Desktop Runtime downloaded successfully on attempt ' + IntToStr(Attempt) + '.'); - Break; - except - Log('.NET 10 Desktop Runtime download failed on attempt ' + IntToStr(Attempt) + ': ' + GetExceptionMessage); - if DownloadPage.AbortedByUser then - begin - Result := 'Installation cancelled by user.'; - Break; - end; - if Attempt = 2 then - begin - Result := 'Failed to download the required .NET 10 Desktop Runtime.' + #13#10 + #13#10 + - 'Error: ' + GetExceptionMessage + #13#10 + #13#10 + - 'Please ensure you have an active internet connection and run Setup again.'; - end; + try + DownloadPage.Download; + DotNetDownloaded := True; + Log('.NET 11 Desktop Runtime downloaded successfully.'); + except + Log('.NET 11 Desktop Runtime download failed: ' + GetExceptionMessage); + if DownloadPage.AbortedByUser then + Result := 'Installation cancelled by user.' + else + Result := 'Failed to download the required .NET 11 Desktop Runtime.' + #13#10 + #13#10 + + 'Error: ' + GetExceptionMessage + #13#10 + #13#10 + + 'Please ensure you have an active internet connection and run Setup again.'; + end; + finally + DownloadPage.Hide; end; - finally - DownloadPage.Hide; - end; - end; - if DotNetDownloaded then - begin - WizardForm.StatusLabel.Caption := 'Installing .NET 10 Desktop Runtime...'; - if not Exec(ExpandConstant('{tmp}\dotnet_installer.exe'), '/install /quiet /norestart', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then - begin - Result := 'Failed to install the .NET 10 Desktop Runtime. Setup cannot continue.'; - end; + if DotNetDownloaded then + begin + WizardForm.StatusLabel.Caption := 'Installing .NET 11 Desktop Runtime...'; + if not Exec(ExpandConstant('{tmp}\dotnet_installer.exe'), '/install /quiet /norestart', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then + begin + Result := 'Failed to install the .NET 11 Desktop Runtime. Setup cannot continue.'; + end; + end; end; - end; end; procedure CurStepChanged(CurStep: TSetupStep); @@ -290,6 +311,10 @@ begin end; end; + // Clean up temporary extraction files left by PawnIO_setup.exe + DeleteTempPawnIoFiles(ExpandConstant('{win}\Temp')); + DeleteTempPawnIoFiles(ExpandConstant('{tmp}')); + // Step 3: Start the service immediately so the app can use it on first launch if not RequiresReboot then begin @@ -701,6 +726,70 @@ begin end; end; +function BuildUserDataCleanupSummary(const DataDirs: TStringList; RemoveSettings, RemoveTraffic, RemoveLogs, AnySelected: Boolean): string; +var + I: Integer; + PreservedCount: Integer; + PathsMsg, HeaderMsg, ItemsMsg: string; +begin + PathsMsg := ''; + for I := 0 to DataDirs.Count - 1 do + begin + if I > 0 then + PathsMsg := PathsMsg + #13#10; + PathsMsg := PathsMsg + DataDirs[I]; + end; + + if not AnySelected then + begin + Result := 'All application data and preferences have been preserved at:' + #13#10 + PathsMsg; + Exit; + end; + + if RemoveSettings and RemoveTraffic and RemoveLogs then + begin + Result := 'All selected application data has been removed.'; + Exit; + end; + + PreservedCount := 0; + ItemsMsg := ''; + if not RemoveSettings then + begin + PreservedCount := PreservedCount + 1; + ItemsMsg := ItemsMsg + ' - Application Settings & Preferences' + #13#10; + end; + if not RemoveTraffic then + begin + PreservedCount := PreservedCount + 1; + ItemsMsg := ItemsMsg + ' - Network Traffic History' + #13#10; + end; + if not RemoveLogs then + begin + PreservedCount := PreservedCount + 1; + ItemsMsg := ItemsMsg + ' - Cache & Diagnostic Logs' + #13#10; + end; + + if PreservedCount = 1 then + begin + if not RemoveTraffic then + HeaderMsg := 'Your preserved network traffic history has been kept at:' + else if not RemoveSettings then + HeaderMsg := 'Your preserved application settings and preferences have been kept at:' + else + HeaderMsg := 'Your preserved cache and diagnostic logs have been kept at:'; + + Result := 'The selected application data has been removed.' + #13#10 + #13#10 + + HeaderMsg + #13#10 + PathsMsg; + end + else + begin + Result := 'The selected application data has been removed.' + #13#10 + #13#10 + + 'The following preserved data has been kept at:' + #13#10 + + ItemsMsg + #13#10 + PathsMsg; + end; +end; + var UninstallDriverNeedsReboot: Boolean; @@ -752,6 +841,8 @@ begin RegDeleteKeyIncludingSubkeys(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\PawnIO'); RegDeleteKeyIncludingSubkeys(HKLM, 'SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\PawnIO'); + DeleteTempPawnIoFiles(ExpandConstant('{win}\Temp')); + DeleteTempPawnIoFiles(ExpandConstant('{tmp}')); if DirExists('C:\Program Files\PawnIO') then DelTree('C:\Program Files\PawnIO', True, True, True); @@ -793,16 +884,11 @@ begin end; end; - if (not UninstallSilent) and (not (RemoveSettings and RemoveTraffic and RemoveLogs)) then + if not UninstallSilent then begin - PreservedMsg := 'Your preserved application data has been kept at:' + #13#10; - for I := 0 to DataDirs.Count - 1 do - begin - if I > 0 then - PreservedMsg := PreservedMsg + #13#10; - PreservedMsg := PreservedMsg + DataDirs[I]; - end; - MsgBox(PreservedMsg, mbInformation, MB_OK); + PreservedMsg := BuildUserDataCleanupSummary(DataDirs, RemoveSettings, RemoveTraffic, RemoveLogs, AnySelected); + if PreservedMsg <> '' then + MsgBox(PreservedMsg, mbInformation, MB_OK); end; end; @@ -817,5 +903,3 @@ begin end; end; end; - - diff --git a/src/LocalTelemetry.App/App.xaml.cs b/src/LocalTelemetry.App/App.xaml.cs index d901e27..221498c 100644 --- a/src/LocalTelemetry.App/App.xaml.cs +++ b/src/LocalTelemetry.App/App.xaml.cs @@ -3,6 +3,7 @@ using System.Runtime.Versioning; using System.Security.Principal; using System.Windows; +using System.Windows.Interop; using LocalTelemetry.App.Overlay; using LocalTelemetry.App.Services; using LocalTelemetry.App.Settings; @@ -32,15 +33,45 @@ public sealed partial class App : WpfApplication private HardwareMonitor? _monitor; private NetUsageLogger? _netLogger; private TaskbarOverlay? _overlay; + private TaskbarOverlayManager? _overlayManager; private TrayIconManager? _tray; private AlertService? _alerts; private SettingsShell? _settingsShell; private AppSettings _cfg = new AppSettings(); - private SynchronizationContext? _uiCtx; private NotificationClient? _notifClient; private Process? _notifierProcess; private bool _notifierLaunched; private DateTime _startupUtc; + private Mutex? _singleInstanceMutex; + private EventWaitHandle? _singleInstanceEvent; + private RegisteredWaitHandle? _singleInstanceWaitHandle; + private bool _isAppSessionLocked; + private bool _isAppPowerSuspended; + internal static string SingleInstanceMutexName { get; set; } = @"Local\LocalTelemetry_App_SingleInstance"; + internal static string SingleInstanceEventName { get; set; } = @"Local\LocalTelemetry_App_ShowSettingsEvent"; + internal const string ShowSettingsMessageName = "LocalTelemetry_ShowSettingsWindow_Message"; + internal static bool EnforceSingleInstance { get; set; } = true; + + // Out-of-process Settings synchronization + private bool _isSettingsProcess; + private Mutex? _settingsMutex; + private EventWaitHandle? _settingsShowEvent; + private RegisteredWaitHandle? _settingsShowWaitHandle; + private EventWaitHandle? _settingsCloseEvent; + private RegisteredWaitHandle? _settingsCloseWaitHandle; + private EventWaitHandle? _settingsReloadEvent; + private RegisteredWaitHandle? _settingsReloadWaitHandle; + private EventWaitHandle? _settingsTrafficUpdatedEvent; + private RegisteredWaitHandle? _settingsTrafficUpdatedWaitHandle; + private Process? _settingsProcess; + + internal static string SettingsMutexName { get; set; } = @"Local\LocalTelemetry_Settings_SingleInstance"; + internal static string SettingsShowEventName { get; set; } = @"Local\LocalTelemetry_Settings_ShowEvent"; + internal static string SettingsReloadEventName { get; set; } = @"Local\LocalTelemetry_Settings_ReloadEvent"; + internal static string SettingsCloseEventName { get; set; } = @"Local\LocalTelemetry_Settings_CloseEvent"; + internal static string SettingsTrafficUpdatedEventName { get; set; } = @"Local\LocalTelemetry_Settings_TrafficUpdatedEvent"; + internal static bool LaunchSettingsOutOfProcess { get; set; } = true; + internal static Action? SettingsProcessLauncher { get; set; } // Test seams internal static Func? IsAdministratorCheck { get; set; } @@ -135,17 +166,103 @@ private static void ElevateAndExit(string[] args) Environment.Exit(0); } + private static void SignalRunningMainInstance() + { + Log.Info("Another instance of LocalTelemetry is already running. Signaling it to open Settings."); + try + { + NativeMethods.AllowSetForegroundWindow(NativeMethods.ASFW_ANY); + } + catch (Exception ex) + { + Log.Debug(ex, "AllowSetForegroundWindow failed"); + } + + try + { + if (EventWaitHandle.TryOpenExisting(SingleInstanceEventName, out var showEvent)) + { + using (showEvent) + { + showEvent.Set(); + } + } + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to signal single-instance event"); + } + } + + private void RegisterSingleInstanceWaitHandle() + { + try + { + _singleInstanceEvent = new EventWaitHandle(false, EventResetMode.AutoReset, SingleInstanceEventName); + _singleInstanceWaitHandle = ThreadPool.RegisterWaitForSingleObject( + _singleInstanceEvent, + (state, timedOut) => + { + if (!timedOut) + { + Dispatcher.InvokeAsync(OpenSettings); + } + }, + null, + -1, + false); + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to register single-instance EventWaitHandle"); + } + } + + private bool TryAcquireMainSingleInstance() + { + if (!EnforceSingleInstance) return true; + + _singleInstanceMutex = new Mutex(true, SingleInstanceMutexName, out bool isNewInstance); + if (!isNewInstance) + { + SignalRunningMainInstance(); + if (ExitHandler is not null) + ExitHandler(0); + else + Environment.Exit(0); + return false; + } + + RegisterSingleInstanceWaitHandle(); + return true; + } + + private const string VisibilityVisible = "visible"; + private const string VisibilityHidden = "hidden"; + // Startup protected override void OnStartup(WpfStartupEventArgs e) { base.OnStartup(e); + bool isSettingsMode = Array.Exists(e.Args, a => string.Equals(a, "--settings", StringComparison.OrdinalIgnoreCase)); + if (isSettingsMode) + { + StartSettingsMode(e.Args); + return; + } + if (!IsAdministrator() && !Array.Exists(e.Args, a => a == "--elevated")) { ElevateAndExit(e.Args); return; } + if (!TryAcquireMainSingleInstance()) + { + return; + } + Log.Debug("Running as administrator"); RegisterExceptionHandlers(); ShutdownMode = ShutdownMode.OnExplicitShutdown; @@ -157,6 +274,251 @@ protected override void OnStartup(WpfStartupEventArgs e) StartBackgroundInitialization(historyFile); } + private static void SignalRunningSettingsInstance() + { + Log.Info("Another instance of Settings is already running. Signaling it to foreground."); + try + { + NativeMethods.AllowSetForegroundWindow(NativeMethods.ASFW_ANY); + } + catch (Exception ex) + { + Log.Debug(ex, "AllowSetForegroundWindow failed"); + } + + try + { + if (EventWaitHandle.TryOpenExisting(SettingsShowEventName, out var showEvent)) + { + using (showEvent) + { + showEvent.Set(); + } + } + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to signal settings show event"); + } + } + + private bool TryAcquireSettingsSingleInstance() + { + if (!EnforceSingleInstance) return true; + + _settingsMutex = new Mutex(true, SettingsMutexName, out bool isNewInstance); + if (!isNewInstance) + { + SignalRunningSettingsInstance(); + if (ExitHandler is not null) + ExitHandler(0); + else + Environment.Exit(0); + return false; + } + + return true; + } + + private void ActivateSettingsShellWindow() + { + if (_settingsShell is null) return; + if (_settingsShell.WindowState == WindowState.Minimized) + { + _settingsShell.WindowState = WindowState.Normal; + } + _settingsShell.Show(); + _settingsShell.Activate(); + _settingsShell.Focus(); + var hwnd = new WindowInteropHelper(_settingsShell).Handle; + if (hwnd != IntPtr.Zero) + { + NativeMethods.ShowWindow(hwnd, NativeMethods.SW_RESTORE); + NativeMethods.SetForegroundWindow(hwnd); + } + } + + private void RegisterSettingsWaitHandles() + { + if (!EnforceSingleInstance) return; + + try + { + _settingsShowEvent = new EventWaitHandle(false, EventResetMode.AutoReset, SettingsShowEventName); + _settingsShowWaitHandle = ThreadPool.RegisterWaitForSingleObject( + _settingsShowEvent, + (state, timedOut) => + { + if (!timedOut) + { + Dispatcher.InvokeAsync(ActivateSettingsShellWindow); + } + }, + null, + -1, + false); + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to register settings show EventWaitHandle"); + } + + try + { + _settingsCloseEvent = new EventWaitHandle(false, EventResetMode.AutoReset, SettingsCloseEventName); + _settingsCloseWaitHandle = ThreadPool.RegisterWaitForSingleObject( + _settingsCloseEvent, + (state, timedOut) => + { + if (!timedOut) + { + Dispatcher.InvokeAsync(() => + { + _settingsShell?.Close(); + Shutdown(0); + }); + } + }, + null, + -1, + false); + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to register settings close EventWaitHandle"); + } + + try + { + _settingsTrafficUpdatedEvent = new EventWaitHandle(false, EventResetMode.AutoReset, SettingsTrafficUpdatedEventName); + _settingsTrafficUpdatedWaitHandle = ThreadPool.RegisterWaitForSingleObject( + _settingsTrafficUpdatedEvent, + (state, timedOut) => + { + if (!timedOut) + { + Dispatcher.InvokeAsync(() => + { + if (_settingsShell is not null) + { + Log.Debug("Settings process received cross-process traffic update notification"); + _settingsShell.RefreshTrafficHistory(); + } + }); + } + }, + null, + -1, + false); + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to register settings traffic updated EventWaitHandle"); + } + } + + private void SetupSettingsProcessMainWindow() + { + RegisterExceptionHandlers(); + ShutdownMode = ShutdownMode.OnMainWindowClose; + + string exeDir = ExeDirOverride ?? AppContext.BaseDirectory; + AppSettings.InitPaths(exeDir); + UpdateConfig.DefaultIncludePrereleases = UpdateCheckService.IsPrereleaseVersion(); + _cfg = AppSettings.Load(); + ApplyVendorColors(_cfg); + + Log.Init(AppSettings.SystemLogPath, AppSettings.MetricsLogPath, _cfg.EnableFileLogging); + Log.SystemLevel = Log.ParseLevel(_cfg.SystemLogLevel); + + var historyFile = new TrafficHistoryFile(AppSettings.NetUsagePath); + historyFile.Load(); + TrafficHistoryStore.Initialize(historyFile); + + _settingsShell = new SettingsShell(_cfg); + MainWindow = _settingsShell; + + _settingsShell.SettingsApplied += () => + { + try + { + if (EventWaitHandle.TryOpenExisting(SettingsReloadEventName, out var reloadEvent)) + { + using (reloadEvent) + { + reloadEvent.Set(); + } + Log.Debug("Signaled daemon to reload configuration"); + } + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to signal settings reload event to daemon"); + } + }; + + _settingsShell.Closed += (_, _) => + { + _settingsShell = null; + Shutdown(0); + }; + + if (!SuppressSettingsWindowForTesting) + { + _settingsShell.Show(); + _settingsShell.Activate(); + } + } + + private void StartSettingsMode(string[] args) + { + _isSettingsProcess = true; + if (!IsAdministrator() && !Array.Exists(args, a => a == "--elevated")) + { + ElevateAndExit(args); + return; + } + + if (!TryAcquireSettingsSingleInstance()) + { + return; + } + + RegisterSettingsWaitHandles(); + SetupSettingsProcessMainWindow(); + } + + private void RegisterSettingsReloadListener() + { + try + { + _settingsReloadEvent = new EventWaitHandle(false, EventResetMode.AutoReset, SettingsReloadEventName); + _settingsReloadWaitHandle = ThreadPool.RegisterWaitForSingleObject( + _settingsReloadEvent, + (state, timedOut) => + { + if (!timedOut) + { + Dispatcher.InvokeAsync(() => + { + Log.Info("Configuration change detected from Settings process; reloading."); + var reloaded = AppSettings.Load(); + _cfg.CopyFrom(reloaded); + ApplyVendorColors(_cfg); + HandleSettingsApplied(); + }); + } + }, + null, + -1, + false); + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to register settings reload EventWaitHandle"); + } + } + private void RegisterExceptionHandlers() { AppDomain.CurrentDomain.UnhandledException += HandleUnhandledException; @@ -168,10 +530,10 @@ private void RegisterExceptionHandlers() private bool InitializeConfigurationAndLogging() { _startupUtc = DateTime.UtcNow; - _uiCtx = SynchronizationContext.Current; string exeDir = ExeDirOverride ?? AppContext.BaseDirectory; AppSettings.InitPaths(exeDir); + UpdateConfig.DefaultIncludePrereleases = UpdateCheckService.IsPrereleaseVersion(); bool isFreshConfig = !File.Exists(AppSettings.ConfigPath); _cfg = AppSettings.Load(); if (isFreshConfig && !TaskbarEmbedder.IsTaskbarCentered()) @@ -201,14 +563,15 @@ private bool InitializeConfigurationAndLogging() private TrafficHistoryFile InitializeCoreServicesAndHistory(bool fileRunAtStartup) { _services = BuildContainer(); - _overlay = _services.GetRequiredService(); + _overlayManager = _services.GetRequiredService(); + _overlay = _overlayManager.PrimaryOverlay; _tray = _services.GetRequiredService(); _tray.SetTrayVisible(_cfg.ShowSystemTrayIcon); _tray.SetOverlayVisible(_cfg.Overlay.Visible); _alerts = _services.GetRequiredService(); _monitor = _services.GetRequiredService(); _notifClient = _services.GetRequiredService(); - Log.Info("Core services initialized"); + Log.Debug("Core services initialized"); var historyFile = new TrafficHistoryFile(AppSettings.NetUsagePath); historyFile.Load(); @@ -217,6 +580,7 @@ private TrafficHistoryFile InitializeCoreServicesAndHistory(bool fileRunAtStartu Log.Debug("Traffic history logger initialized"); TrafficHistoryStore.Initialize(historyFile); + TrafficHistoryStore.HistoryUpdated += SignalTrafficUpdated; Log.Debug("Traffic history store initialized"); if (fileRunAtStartup != _cfg.RunAtStartup) @@ -226,6 +590,7 @@ private TrafficHistoryFile InitializeCoreServicesAndHistory(bool fileRunAtStartu } WireEvents(); + RegisterSettingsReloadListener(); return historyFile; } @@ -234,7 +599,12 @@ private void StartUserInterface(string[] args) bool minimized = Array.Exists(args, a => a == "--minimized") || _cfg.StartMinimized; if (!SuppressOverlayForTesting && _cfg.Overlay.Visible) - _overlay?.Show(); + { + if (_overlayManager is not null) + _overlayManager.Show(); + else + _overlay?.Show(); + } if (!SuppressHardwareMonitorForTesting) _monitor?.Start(); @@ -242,7 +612,7 @@ private void StartUserInterface(string[] args) if (!minimized) OpenSettings(); - Log.Info($"Application started (overlay {(_cfg.Overlay.Visible ? "visible" : "hidden")}, mode {(minimized ? "minimized" : "normal")})"); + Log.Info($"Application started (overlay {(_cfg.Overlay.Visible ? VisibilityVisible : VisibilityHidden)}, mode {(minimized ? "minimized" : "normal")})"); } private void StartBackgroundInitialization(TrafficHistoryFile historyFile) @@ -261,13 +631,34 @@ private void StartBackgroundInitialization(TrafficHistoryFile historyFile) Log.Error(ex, "Failed to log hardware configuration"); } - ApplyVendorColors(_cfg); - LaunchNotifier(); - RunSrumPreImport(historyFile); + try + { + ApplyVendorColors(_cfg); + if (_cfg.Alerts.Enabled && _cfg.Alerts.ShowToastNotif) + { + LaunchNotifier(); + } + else + { + EnsureNotifierStopped(); + } + RunSrumPreImport(historyFile); + } + catch (Exception ex) + { + Log.Error(ex, "Background initialization encountered an error"); + } - if (_cfg.RunAtStartup) - WindowHelpers.SetStartup(true); - }); + try + { + NativeMethods.EmptyWorkingSet(Process.GetCurrentProcess().Handle); + Log.Debug("Post-startup working set trimmed successfully"); + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to trim working set after background initialization"); + } + }).ContinueWith(t => { _ = t.Exception; }, TaskContinuationOptions.OnlyOnFaulted); } private bool _metricsWasEnabled; @@ -296,7 +687,7 @@ private static void HandleUnhandledException(object sender, UnhandledExceptionEv private static void HandleUnobservedTaskException(object? sender, UnobservedTaskExceptionEventArgs e) { - Log.Error($"Unobserved Task exception: {e.Exception?.GetType().Name}: {e.Exception?.Message}"); + Log.Error(e.Exception, "Unobserved Task exception"); e.SetObserved(); } @@ -345,6 +736,14 @@ private static void RunSrumPreImport(TrafficHistoryFile historyFile) if (SrumImporterAction is not null) { SrumImporterAction(historyFile.FilePath).GetAwaiter().GetResult(); + SignalTrafficUpdated(); + return; + } + + bool hasRecords = historyFile.GetAllRecords().Any(r => r.DownBytes > 0 || r.UpBytes > 0); + if (hasRecords) + { + Log.Debug("Historical traffic records already present; skipping initial SRUM import"); return; } @@ -355,6 +754,7 @@ private static void RunSrumPreImport(TrafficHistoryFile historyFile) TaskScheduler.Default).Unwrap(); srumTask.GetAwaiter().GetResult(); Log.Debug("Historical network usage import completed"); + SignalTrafficUpdated(); } catch (Exception ex) { @@ -362,6 +762,25 @@ private static void RunSrumPreImport(TrafficHistoryFile historyFile) } } + private static void SignalTrafficUpdated() + { + try + { + if (EventWaitHandle.TryOpenExisting(SettingsTrafficUpdatedEventName, out var trafficEvent)) + { + using (trafficEvent) + { + trafficEvent.Set(); + } + Log.Debug("Signaled Settings process that traffic history was updated"); + } + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to signal traffic history updated event"); + } + } + // DI container private ServiceProvider BuildContainer() { @@ -388,8 +807,8 @@ private ServiceProvider BuildContainer() sc.AddSingleton(PawnIoManagerOverride); else sc.AddSingleton(); - sc.AddSingleton(); - sc.AddSingleton(); + sc.AddSingleton(); + sc.AddSingleton(sp => sp.GetRequiredService().PrimaryOverlay); sc.AddSingleton(); sc.AddSingleton(); sc.AddSingleton(); @@ -400,72 +819,206 @@ private ServiceProvider BuildContainer() // Event wiring private void WireEvents() { - if (_tray is null || _overlay is null || _monitor is null) return; + if (_tray is null || _monitor is null || (_overlayManager is null && _overlay is null)) return; - _tray.OpenSettingsRequested += () => OpenSettings(); - _tray.QuitRequested += () => QuitApp(); - _tray.ToggleOverlayRequested += () => - { - _cfg.Overlay.Visible = !_cfg.Overlay.Visible; - Log.Info($"User toggled overlay visibility via system tray to {(_cfg.Overlay.Visible ? "visible" : "hidden")}"); - _cfg.Save(); - HandleSettingsApplied(); - }; - _tray.TaskManagerRequested += () => + Action showCtx = ShowTrayContextMenu; + + WireTrayEvents(); + if (_overlayManager is not null) { - LaunchTaskManager(); - }; - _tray.TaskbarCreated += () => + WireOverlayManagerEvents(showCtx); + } + else if (_overlay is not null) { - if (_cfg.Overlay.Visible) - { - _overlay.RecoverTaskbar("TaskbarCreated notification from explorer"); - } - }; + WireSingleOverlay(showCtx); + } - _overlay.ShowContextMenuAction = pt => - { - try - { - if (ThrowInTrayContextMenuForTesting) - throw new InvalidOperationException("Simulated context menu failure"); - Log.Debug($"Forwarding right-click context menu display to TrayIconManager at ({pt.X}, {pt.Y})"); - _tray.ShowOverlayContextMenu(pt); - } - catch (Exception ex) - { - Log.Error(ex, $"Failed to show context menu via tray manager at ({pt.X}, {pt.Y})"); - } - }; + _monitor.SnapshotReady += HandleSnapshotReady; + WireLifecycleEvents(); + } - _overlay.IsContextMenuOpen = () => _tray.IsOverlayContextMenuOpen; - _overlay.GetContextMenuBounds = () => _tray.OverlayContextMenuBounds; - _overlay.CloseContextMenuAction = () => _tray.CloseOverlayContextMenu(); + private void WireLifecycleEvents() + { + var lifecycle = HardwareLifecycleManager.Instance; + lifecycle.PowerSuspended += HandlePowerSuspended; + lifecycle.PowerResumed += HandlePowerResumed; + lifecycle.SessionLockStateChanged += HandleSessionLockStateChanged; + } - _overlay.OnOpenSettingsRequested = () => OpenSettings(); - _overlay.OnToggleOverlayRequested = () => - { - _cfg.Overlay.Visible = !_cfg.Overlay.Visible; - Log.Info($"User toggled overlay visibility via overlay menu to {(_cfg.Overlay.Visible ? "visible" : "hidden")}"); - _cfg.Save(); - HandleSettingsApplied(); - }; - _overlay.OnExitRequested = () => QuitApp(); + private void HandlePowerSuspended() + { + _isAppPowerSuspended = true; + _overlayManager?.PauseAllTimers(); + _overlay?.PauseTimers(); + } - _overlay.OnDoubleClick += (action) => + private void HandlePowerResumed() + { + _isAppPowerSuspended = false; + if (!_isAppSessionLocked) + { + _overlayManager?.ResumeAllTimers(); + _overlay?.ResumeTimers(); + } + } + + private void HandleSessionLockStateChanged(bool isLocked) + { + _isAppSessionLocked = isLocked; + if (isLocked) + { + _overlayManager?.PauseAllTimers(); + _overlay?.PauseTimers(); + } + else if (!_isAppPowerSuspended) + { + _overlayManager?.ResumeAllTimers(); + _overlay?.ResumeTimers(); + } + } + + private void WireSingleOverlay(Action showCtx) + { + if (_overlay is null || _tray is null) return; + _overlay.ShowContextMenuAction = showCtx; + _overlay.IsContextMenuOpen = () => _tray.IsOverlayContextMenuOpen; + _overlay.IsPointInsideContextMenu = pt => _tray.IsPointInsideOverlayContextMenu(pt); + _overlay.GetContextMenuBounds = () => _tray.OverlayContextMenuBounds; + _overlay.CloseContextMenuAction = () => + { + _tray.CloseOverlayContextMenu(); + _overlay.StopMouseHook(); + }; + _overlay.OnOpenSettingsRequested = () => OpenSettings(); + _overlay.OnToggleOverlayRequested = () => + { + _cfg.Overlay.Visible = !_cfg.Overlay.Visible; + Log.Info($"User toggled overlay visibility via overlay menu to {(_cfg.Overlay.Visible ? VisibilityVisible : VisibilityHidden)}"); + _cfg.Save(); + HandleSettingsApplied(); + }; + _overlay.OnExitRequested = () => QuitApp(); + _overlay.OnDoubleClick += HandleOverlayDoubleClickAction; + _overlay.TaskbarSpaceConstraintChanged += HandleTaskbarSpaceConstraintChanged; + } + + private void ShowTrayContextMenu(System.Drawing.Point pt) + { + try { - if (string.Equals(action, "taskmanager", StringComparison.OrdinalIgnoreCase)) + if (ThrowInTrayContextMenuForTesting) + throw new InvalidOperationException("Simulated context menu failure"); + Log.Debug($"Forwarding right-click context menu display to TrayIconManager at ({pt.X}, {pt.Y})"); + _tray?.ShowOverlayContextMenu(pt); + } + catch (Exception ex) + { + Log.Error(ex, $"Failed to show context menu via tray manager at ({pt.X}, {pt.Y})"); + } + } + + private void WireTrayEvents() + { + if (_tray is null) return; + + _tray.OpenSettingsRequested += () => OpenSettings(); + _tray.QuitRequested += () => QuitApp(); + _tray.ToggleOverlayRequested += () => + { + _cfg.Overlay.Visible = !_cfg.Overlay.Visible; + Log.Info($"User toggled overlay visibility via system tray to {(_cfg.Overlay.Visible ? VisibilityVisible : VisibilityHidden)}"); + _cfg.Save(); + HandleSettingsApplied(); + }; + _tray.TaskManagerRequested += () => LaunchTaskManager(); + _tray.TaskbarCreated += () => + { + if (!_cfg.Overlay.Visible) return; + if (_overlayManager is not null) { - LaunchTaskManager(); + _overlayManager.RecoverTaskbars("TaskbarCreated notification from explorer"); } - else if (string.Equals(action, "settings", StringComparison.OrdinalIgnoreCase)) + else { - Log.Info("Opened Settings (double-click)"); - OpenSettings(); + _overlay?.RecoverTaskbar("TaskbarCreated notification from explorer"); } }; + } - _monitor.SnapshotReady += HandleSnapshotReady; + private void WireOverlayManagerEvents(Action showCtx) + { + if (_overlayManager is null || _tray is null) return; + + _overlayManager.ShowContextMenuAction = showCtx; + _overlayManager.IsContextMenuOpen = () => _tray.IsOverlayContextMenuOpen; + _overlayManager.IsPointInsideContextMenu = pt => _tray.IsPointInsideOverlayContextMenu(pt); + _overlayManager.GetContextMenuBounds = () => _tray.OverlayContextMenuBounds; + _overlayManager.CloseContextMenuAction = () => + { + _tray.CloseOverlayContextMenu(); + _overlayManager.StopMouseHook(); + }; + _overlayManager.OnOpenSettingsRequested = () => OpenSettings(); + _overlayManager.OnToggleOverlayRequested = () => + { + _cfg.Overlay.Visible = !_cfg.Overlay.Visible; + Log.Info($"User toggled overlay visibility via overlay menu to {(_cfg.Overlay.Visible ? VisibilityVisible : VisibilityHidden)}"); + _cfg.Save(); + HandleSettingsApplied(); + }; + _overlayManager.OnExitRequested = () => QuitApp(); + _overlayManager.OnDoubleClick += HandleOverlayDoubleClickAction; + _overlayManager.TaskbarSpaceConstraintChanged += HandleTaskbarSpaceConstraintChanged; + } + + private bool _spaceWarningFired; + internal bool SpaceWarningFired => _spaceWarningFired; + private long _lastSpaceWarningTicks; + + internal void HandleTaskbarSpaceConstraintChanged(bool constrained, int slotWidth) + { + if (!constrained) + { + if (slotWidth > 500) + { + _spaceWarningFired = false; + } + return; + } + + long now = Stopwatch.GetTimestamp(); + if (_spaceWarningFired && (now - _lastSpaceWarningTicks) < (Stopwatch.Frequency * 60)) + { + return; + } + _spaceWarningFired = true; + _lastSpaceWarningTicks = now; + + string title = slotWidth <= 0 ? "Taskbar Space Full" : "Taskbar Space Constrained"; + string body = slotWidth <= 0 + ? "There is no space on your taskbar for the telemetry overlay. Consider unpinning apps or hiding metrics in Settings." + : $"Taskbar slot is narrow ({slotWidth}px). LocalTelemetry has auto-scaled down to fit."; + + _tray?.ShowBalloonTip(title, body, ToolTipIcon.Warning); + + ForceLaunchNotifier(); + if (_notifierProcess is { HasExited: false } || NotifierLauncherAction is not null) + { + _notifClient?.SendToastAsync(title, body, "taskbar_space_warning") + .ContinueWith(t => { _ = t.Exception; }, TaskContinuationOptions.OnlyOnFaulted); + } + } + + private void HandleOverlayDoubleClickAction(string action) + { + if (string.Equals(action, "taskmanager", StringComparison.OrdinalIgnoreCase)) + { + LaunchTaskManager(); + } + else if (string.Equals(action, "settings", StringComparison.OrdinalIgnoreCase)) + { + OpenSettings(); + } } private void LaunchTaskManager() @@ -502,10 +1055,13 @@ private void HandleSnapshotReady(TelemetrySnapshot snap) _netLogger!.Record(snap); _alerts!.Evaluate(snap); - _overlay!.UpdateSnapshot(snap); + if (_overlayManager is not null) + _overlayManager.UpdateSnapshot(snap); + else + _overlay!.UpdateSnapshot(snap); if (_tray is not null) - _uiCtx?.Post(_ => _tray.Update(snap), null); + Dispatcher.InvokeAsync(() => _tray.Update(snap)); } // Tray action handlers @@ -513,28 +1069,202 @@ private void OpenSettings() { if (SuppressSettingsWindowForTesting) return; - if (_settingsShell is null || !_settingsShell.IsLoaded) + if (Dispatcher is not null && !Dispatcher.CheckAccess()) + { + Dispatcher.InvokeAsync(OpenSettings); + return; + } + + if (SettingsShellFactory is not null || !LaunchSettingsOutOfProcess) { - if (SettingsShellFactory is not null) + RunInProcessSettings(); + return; + } + + LaunchSettingsProcess(); + } + + private void LaunchSettingsProcess() + { + try + { + NativeMethods.AllowSetForegroundWindow(NativeMethods.ASFW_ANY); + } + catch (Exception ex) + { + Log.Debug(ex, "AllowSetForegroundWindow failed"); + } + + bool settingsRunning = false; + try + { + if (Mutex.TryOpenExisting(SettingsMutexName, out var mutex)) { - _settingsShell = SettingsShellFactory(_cfg, _netLogger!); + using (mutex) + { + settingsRunning = true; + } } - else + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to check existing Settings mutex"); + } + + if (settingsRunning) + { + try { - _settingsShell = new SettingsShell(_cfg, _netLogger!); + if (EventWaitHandle.TryOpenExisting(SettingsShowEventName, out var showEvent)) + { + using (showEvent) + { + showEvent.Set(); + Log.Info("Settings process already running; signaled show event"); + return; + } + } } - _settingsShell.TaskbarSlotStatusProvider = () => (_overlay?.IsTaskbarSpaceConstrained ?? false, _overlay?.AvailableSlotWidth ?? 0); - Log.Debug("SettingsShell created"); - _settingsShell.SettingsApplied += HandleSettingsApplied; - _settingsShell.Closed += (_, _) => + catch (Exception ex) { - Log.Debug("SettingsShell closed, clearing reference"); - _settingsShell = null; + Log.Debug(ex, "Failed to signal show event to existing Settings process"); + } + } + + try + { + if (_settingsProcess is { HasExited: true }) + { + _settingsProcess.Dispose(); + _settingsProcess = null; + } + + string exePath = Environment.ProcessPath ?? Path.Combine(AppContext.BaseDirectory, "LocalTelemetry.exe"); + var psi = new ProcessStartInfo + { + FileName = exePath, + Arguments = "--settings", + UseShellExecute = true, }; + + if (SettingsProcessLauncher is not null) + { + SettingsProcessLauncher(psi); + } + else if (ProcessStarter is not null) + { + _settingsProcess = ProcessStarter(psi); + } + else + { + _settingsProcess = Process.Start(psi); + } + + Log.Info("Launched Settings process"); + } + catch (Exception ex) + { + Log.Error(ex, "Failed to launch Settings process"); } + } - _settingsShell.Show(); - _settingsShell.Activate(); + private bool TryActivateExistingSettingsShell() + { + if (_settingsShell is null) return false; + + var handle = new WindowInteropHelper(_settingsShell).Handle; + if (handle != IntPtr.Zero && NativeMethods.IsWindow(handle)) + { + if (_settingsShell.WindowState == WindowState.Minimized) + { + _settingsShell.WindowState = WindowState.Normal; + } + _settingsShell.Show(); + _settingsShell.Activate(); + _settingsShell.Focus(); + NativeMethods.ShowWindow(handle, NativeMethods.SW_RESTORE); + NativeMethods.SetForegroundWindow(handle); + return true; + } + + _settingsShell = null; + return false; + } + + private void WireSettingsShellLifecycle(Action slotChangedHandler) + { + if (_overlayManager is not null) + { + _overlayManager.TaskbarSpaceConstraintChanged += slotChangedHandler; + } + else if (_overlay is not null) + { + _overlay.TaskbarSpaceConstraintChanged += slotChangedHandler; + } + + Log.Debug("SettingsShell created"); + _settingsShell!.SettingsApplied += HandleSettingsApplied; + _settingsShell.Closed += (_, _) => + { + if (_overlayManager is not null) + { + _overlayManager.TaskbarSpaceConstraintChanged -= slotChangedHandler; + } + else if (_overlay is not null) + { + _overlay.TaskbarSpaceConstraintChanged -= slotChangedHandler; + } + Log.Debug("SettingsShell closed, clearing reference and trimming working set"); + _settingsShell = null; + + try + { + NativeMethods.EmptyWorkingSet(Process.GetCurrentProcess().Handle); + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to trim working set after SettingsShell closed"); + } + }; + } + + private void RunInProcessSettings() + { + try + { + Log.Info("Opening Settings window in-process"); + + if (TryActivateExistingSettingsShell()) + { + return; + } + + _settingsShell = SettingsShellFactory is not null + ? SettingsShellFactory(_cfg, _netLogger!) + : new SettingsShell(_cfg, _netLogger!); + + _settingsShell.TaskbarSlotStatusProvider = () => (_overlayManager?.IsTaskbarSpaceConstrained ?? _overlay?.IsTaskbarSpaceConstrained ?? false, _overlayManager?.AvailableSlotWidth ?? _overlay?.AvailableSlotWidth ?? 0); + Action slotChangedHandler = (constrained, width) => + { + _settingsShell?.NotifyTaskbarSlotChanged(constrained, width); + }; + + WireSettingsShellLifecycle(slotChangedHandler); + + _settingsShell.Show(); + _settingsShell.Activate(); + _settingsShell.Focus(); + var hwnd = new WindowInteropHelper(_settingsShell).Handle; + if (hwnd != IntPtr.Zero) + { + NativeMethods.ShowWindow(hwnd, NativeMethods.SW_RESTORE); + NativeMethods.SetForegroundWindow(hwnd); + } + } + catch (Exception ex) + { + Log.Error(ex, "Failed to open in-process settings window"); + } } private int _lastPollIntervalMs; @@ -542,7 +1272,11 @@ private void OpenSettings() private void HandleSettingsApplied() { - if (_overlay is null) { Log.Error("Cannot apply settings to taskbar overlay (overlay instance is null)"); return; } + if (_overlayManager is null && _overlay is null) + { + Log.Error("Cannot apply settings to taskbar overlay (overlay instance is null)"); + return; + } Log.Debug($"Applied settings to overlay (visible: {_cfg.Overlay.Visible})"); @@ -554,28 +1288,14 @@ private void HandleSettingsApplied() _tray?.SetTrayVisible(_cfg.ShowSystemTrayIcon); _tray?.SetOverlayVisible(_cfg.Overlay.Visible); - if (_cfg.Overlay.Visible) - { - _overlay.Show(); - _overlay.RefreshOverlay(); - } - else - { - _overlay.Hide(); - } + SyncOverlayVisibility(); if (_settingsShell is not null && _settingsShell.IsLoaded) { _settingsShell.SendUpdatedSettings(); } - // Restart hardware monitor with new poll interval - int ms = Math.Max(100, _cfg.Monitoring.PollIntervalMs); - if (ms != _lastPollIntervalMs) - { - _lastPollIntervalMs = ms; - _monitor?.Restart(ms); - } + SyncMonitorInterval(); // Toggle metrics logging (system log is always on) bool shouldLog = _cfg.EnableFileLogging; @@ -588,10 +1308,63 @@ private void HandleSettingsApplied() EnsureNotifierStopped(); } + private void SyncOverlayVisibility() + { + if (_cfg.Overlay.Visible) + { + if (_overlayManager is not null) + { + _overlayManager.Show(); + _overlayManager.RefreshOverlays(); + } + else if (_overlay is not null) + { + _overlay.Show(); + _overlay.RefreshOverlay(); + } + } + else + { + if (_overlayManager is not null) + { + _overlayManager.Hide(); + } + else if (_overlay is not null) + { + _overlay.Hide(); + } + } + } + + private void SyncMonitorInterval() + { + int ms = Math.Max(1000, _cfg.Monitoring.PollIntervalMs); + if (ms != _lastPollIntervalMs) + { + _lastPollIntervalMs = ms; + _monitor?.Restart(ms); + } + } + /// Full quit - stops monitor, saves settings, exits process. private void QuitApp() { + Log.Info("Application quit requested by user"); QuitAppAction?.Invoke(); + try + { + if (EventWaitHandle.TryOpenExisting(SettingsCloseEventName, out var closeEvent)) + { + using (closeEvent) + { + closeEvent.Set(); + } + } + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to signal settings close event during QuitApp"); + } _settingsShell?.Close(); Shutdown(); } @@ -606,6 +1379,17 @@ internal void EnsureNotifierLaunched() { if (_notifierLaunched) return; if (_cfg != null && (!_cfg.Alerts.Enabled || !_cfg.Alerts.ShowToastNotif)) return; + LaunchNotifierProcess(); + } + + internal void ForceLaunchNotifier() + { + if (_notifierLaunched) return; + LaunchNotifierProcess(); + } + + private void LaunchNotifierProcess() + { try { string notifierPath = Path.Combine( @@ -647,7 +1431,12 @@ internal void EnsureNotifierLaunched() internal void EnsureNotifierStopped() { - if (!_notifierLaunched && _notifierProcess is null) return; + if (!_notifierLaunched && _notifierProcess is null) + { + KillOrphanedNotifierProcesses(); + return; + } + _notifierLaunched = false; try { @@ -690,11 +1479,198 @@ internal void EnsureNotifierStopped() } _notifierProcess = null; } + finally + { + KillOrphanedNotifierProcesses(); + } + } + + private static void KillOrphanedNotifierProcesses() + { + try + { + foreach (var proc in Process.GetProcessesByName("LocalTelemetry.Notifier")) + { + try + { + using (proc) + { + if (!proc.HasExited) + { + proc.Kill(entireProcessTree: true); + } + } + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to terminate orphaned notifier process"); + } + } + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to enumerate notifier processes for termination"); + } + } + + private void ExitSettingsProcess(WpfExitEventArgs e) + { + Log.Debug("Settings process exiting cleanly"); + _settingsShowWaitHandle?.Unregister(null); + _settingsShowWaitHandle = null; + _settingsShowEvent?.Dispose(); + _settingsShowEvent = null; + + _settingsCloseWaitHandle?.Unregister(null); + _settingsCloseWaitHandle = null; + _settingsCloseEvent?.Dispose(); + _settingsCloseEvent = null; + + _settingsTrafficUpdatedWaitHandle?.Unregister(null); + _settingsTrafficUpdatedWaitHandle = null; + _settingsTrafficUpdatedEvent?.Dispose(); + _settingsTrafficUpdatedEvent = null; + + if (_settingsMutex is not null) + { + try + { + _settingsMutex.ReleaseMutex(); + } + catch (Exception ex) + { + Log.Debug(ex, "Exception releasing settings mutex"); + } + _settingsMutex.Dispose(); + _settingsMutex = null; + } + + base.OnExit(e); + } + + private void SendGracefulShutdownToNotifier() + { + if (_notifClient is null) return; + try + { + _notifClient.SendShutdownAsync() + .Wait(TimeSpan.FromSeconds(2)); + } + catch (Exception ex) + { + Log.Error(ex, "Shutdown notification to notifier process failed"); + } + _notifClient.Dispose(); + } + + private void CloseExternalSettingsProcess() + { + try + { + if (EventWaitHandle.TryOpenExisting(SettingsCloseEventName, out var closeEvent)) + { + using (closeEvent) + { + closeEvent.Set(); + } + } + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to signal settings close event"); + } + + if (_settingsProcess is { HasExited: false }) + { + try + { + if (!_settingsProcess.WaitForExit(500)) + { + _settingsProcess.Kill(); + } + } + catch (Exception ex) + { + Log.Debug(ex, "Exception terminating settings process"); + } + finally + { + _settingsProcess.Dispose(); + _settingsProcess = null; + } + } + else + { + _settingsProcess?.Dispose(); + _settingsProcess = null; + } + } + + private void CleanUpIpcAndInstanceHandles() + { + _settingsReloadWaitHandle?.Unregister(null); + _settingsReloadWaitHandle = null; + _settingsReloadEvent?.Dispose(); + _settingsReloadEvent = null; + + _settingsShowWaitHandle?.Unregister(null); + _settingsShowWaitHandle = null; + _settingsShowEvent?.Dispose(); + _settingsShowEvent = null; + + _settingsCloseWaitHandle?.Unregister(null); + _settingsCloseWaitHandle = null; + _settingsCloseEvent?.Dispose(); + _settingsCloseEvent = null; + + _settingsTrafficUpdatedWaitHandle?.Unregister(null); + _settingsTrafficUpdatedWaitHandle = null; + _settingsTrafficUpdatedEvent?.Dispose(); + _settingsTrafficUpdatedEvent = null; + + if (_settingsMutex is not null) + { + try + { + _settingsMutex.ReleaseMutex(); + } + catch (Exception ex) + { + Log.Debug(ex, "Exception releasing settings mutex"); + } + _settingsMutex.Dispose(); + _settingsMutex = null; + } + + _singleInstanceWaitHandle?.Unregister(null); + _singleInstanceWaitHandle = null; + _singleInstanceEvent?.Dispose(); + _singleInstanceEvent = null; + + if (_singleInstanceMutex is not null) + { + try + { + _singleInstanceMutex.ReleaseMutex(); + } + catch (Exception ex) + { + Log.Debug(ex, "Exception releasing single-instance mutex"); + } + _singleInstanceMutex.Dispose(); + _singleInstanceMutex = null; + } } // Shutdown protected override void OnExit(WpfExitEventArgs e) { + if (_isSettingsProcess) + { + ExitSettingsProcess(e); + return; + } + // Stop the monitor first so no new snapshots arrive during teardown. _monitor?.Stop(); @@ -702,31 +1678,22 @@ protected override void OnExit(WpfExitEventArgs e) Log.SessionEnd("Application Quit", uptime); // Dispose UI elements immediately so the overlay + tray icon vanish. + _overlayManager?.Dispose(); _overlay?.Dispose(); _tray?.Dispose(); _netLogger?.Dispose(); _monitor?.Dispose(); - // Send graceful shutdown to the notifier via named pipe. - // The notifier also monitors our PID and self-terminates if we crash. - if (_notifClient is not null) - { - try - { - _notifClient.SendShutdownAsync() - .Wait(TimeSpan.FromSeconds(2)); - } - catch (Exception ex) - { - Log.Error(ex, "Shutdown notification to notifier process failed"); - } - _notifClient.Dispose(); - } + SendGracefulShutdownToNotifier(); _services?.Dispose(); _cfg.Save(); Log.Shutdown(); + + CloseExternalSettingsProcess(); + CleanUpIpcAndInstanceHandles(); + base.OnExit(e); } } diff --git a/src/LocalTelemetry.App/LocalTelemetry.App.csproj b/src/LocalTelemetry.App/LocalTelemetry.App.csproj index 7937bdf..ab482cd 100644 --- a/src/LocalTelemetry.App/LocalTelemetry.App.csproj +++ b/src/LocalTelemetry.App/LocalTelemetry.App.csproj @@ -1,13 +1,14 @@ WinExe - net10.0-windows10.0.19041.0 + net11.0-windows10.0.19041.0 true true enable enable x64 x64 + true app.manifest $(NoWarn);WFO0003 LocalTelemetry @@ -50,11 +51,11 @@ - - - - - + + + + + + + + + + + + + diff --git a/src/LocalTelemetry.App/Overlay/TaskbarOverlay.cs b/src/LocalTelemetry.App/Overlay/TaskbarOverlay.cs index 79369e0..14a69b7 100644 --- a/src/LocalTelemetry.App/Overlay/TaskbarOverlay.cs +++ b/src/LocalTelemetry.App/Overlay/TaskbarOverlay.cs @@ -10,7 +10,7 @@ namespace LocalTelemetry.App.Overlay; /// -/// A transparent overlay window embedded in or floating above the Windows taskbar. +/// A transparent overlay window embedded directly in the Windows taskbar. /// Renders hardware telemetry metrics using GDI+ and supports click-through, /// DPI awareness and a flash alert effect. /// @@ -36,11 +36,17 @@ public sealed class TaskbarOverlay : NativeWindow, IDisposable private Font? _cachedFont; private string _fontCacheKey = string.Empty; private readonly Dictionary _brushCache = []; + private readonly HashSet _activeAlertMetrics = []; private bool _disposed; private bool _refreshLogged; private int _overlayWidth = 200; private int _overlayHeight = 30; private float _autoScaleFactor = 1.0f; + private float _spacingScaleFactor = 1.0f; + private bool _lastReportedSpaceConstrained; + private int _lastReportedSlotWidth = -1; + private IntPtr _mouseHook = IntPtr.Zero; + private NativeMethods.LowLevelMouseHookCallback? _mouseHookDelegate; // Layout constants private const int ItemSpace = 3; // px gap between columns (DPI-scaled) @@ -58,6 +64,9 @@ public sealed class TaskbarOverlay : NativeWindow, IDisposable /// Gets the measured width in pixels of the taskbar slot available for the overlay. public int AvailableSlotWidth => _embedder.AvailableSlotWidth; + /// Gets whether the low-level mouse hook is currently active. + public bool IsMouseHookActive => _mouseHookDelegate is not null && _mouseHook != IntPtr.Zero; + internal static bool SkipShowWindowForTesting { get; set; } internal static bool SkipMouseHookForTesting { get; set; } internal static bool SkipTimersForTesting { get; set; } @@ -73,11 +82,48 @@ public sealed class TaskbarOverlay : NativeWindow, IDisposable /// Fired when the user requests exiting the application from the overlay context menu. public Action? OnExitRequested { get; set; } + /// Fired when the taskbar space constraint state or available slot width changes. + public event Action? TaskbarSpaceConstraintChanged; + + internal void CheckAndNotifySpaceConstraint() + { + bool constrained = _embedder.IsTaskbarSpaceConstrained; + int slotWidth = _embedder.AvailableSlotWidth; + bool initial = _lastReportedSlotWidth == -1; + bool stateChanged = constrained != _lastReportedSpaceConstrained; + bool widthShifted = constrained && Math.Abs(slotWidth - _lastReportedSlotWidth) > 30; + + if (initial || stateChanged || widthShifted) + { + _lastReportedSpaceConstrained = constrained; + _lastReportedSlotWidth = slotWidth; + if (stateChanged || (initial && constrained)) + { + if (constrained) + { + Log.Info($"Taskbar space limited; overlay automatically scaled to fit available space ({slotWidth}px slot)."); + } + else + { + Log.Info($"Taskbar space restored; overlay running at normal size ({slotWidth}px slot)."); + } + } + else if (widthShifted) + { + Log.Debug($"Taskbar slot width adjusted to {slotWidth}px while constrained."); + } + TaskbarSpaceConstraintChanged?.Invoke(constrained, slotWidth); + } + } + + /// Gets the target display info for this overlay instance. + public DisplayInfo? TargetDisplay => _embedder.TargetDisplay; + /// /// Initialises a new overlay instance. The window is not created until is called. /// /// Application settings used for layout, colors and behaviour. - /// Taskbar embedding strategy (child-window or layered float). + /// Taskbar embedding strategy (native child window). public TaskbarOverlay(AppSettings cfg, TaskbarEmbedder embedder) { _cfg = cfg; @@ -86,6 +132,16 @@ public TaskbarOverlay(AppSettings cfg, TaskbarEmbedder embedder) UpdateKeyColor(); } + /// + /// Initialises a new overlay instance targeting a specific display. + /// + /// Application settings used for layout, colors and behaviour. + /// Target display monitor. + public TaskbarOverlay(AppSettings cfg, DisplayInfo display) + : this(cfg, new TaskbarEmbedder(cfg, display)) + { + } + /// Creates (or re-shows) the overlay window and embeds it in the taskbar. public void Show() { @@ -118,8 +174,9 @@ public void Show() return; } + string displayInfo = TargetDisplay is not null ? $" on {TargetDisplay.FriendlyName}" : ""; ActivateOverlayWindow(); - Log.Info($"Taskbar overlay shown ({sz.Width}x{sz.Height}, {(_embedder.IsChildMode ? "child" : "floating")} mode)"); + Log.Info($"Taskbar overlay shown (child mode, {sz.Width}x{sz.Height}{displayInfo})"); } private void TryReshowExistingWindow() @@ -150,8 +207,6 @@ private void ActivateOverlayWindow() Visible = true; if (!SkipShowWindowForTesting) NativeMethods.ShowWindow(Handle, NativeMethods.SW_SHOWNOACTIVATE); - if (!SkipMouseHookForTesting) - StartMouseHook(); if (!SkipShowWindowForTesting) RefreshOverlay(); } @@ -163,8 +218,8 @@ private void InitializeThemePolling() DetectSystemTheme(); if (!SkipTimersForTesting && _themeTimer is null) { - _themeTimer = new System.Threading.Timer(_ => ThemeTick(), null, 2_000, 2_000); - Log.Debug("Windows theme polling timer started (2s interval)"); + _themeTimer = new System.Threading.Timer(_ => ThemeTick(), null, 20_000, 20_000); + Log.Debug("Windows theme polling timer started (20s interval)"); } } @@ -172,15 +227,33 @@ private void StartWatchAndPositionTimers() { if (SkipTimersForTesting || _watchTimer is not null) return; - _lastTrayHwnd = TaskbarEmbedder.FindExplorerTrayWnd(); + _lastTrayHwnd = _embedder.GetTargetTrayWnd(); _watchTimer = new System.Threading.Timer(_ => WatchTick(), null, 5_000, 5_000); - _posTimer = new System.Threading.Timer(_ => PosTick(), null, 200, 200); + _posTimer = new System.Threading.Timer(_ => PosTick(), null, 1_000, 1_000); + } + + /// Pauses background timers while workstation is locked or suspended. + public void PauseTimers() + { + _watchTimer?.Change(Timeout.Infinite, Timeout.Infinite); + _posTimer?.Change(Timeout.Infinite, Timeout.Infinite); + _themeTimer?.Change(Timeout.Infinite, Timeout.Infinite); + } + + /// Resumes background timers when workstation is active and unlocked. + public void ResumeTimers() + { + if (SkipTimersForTesting) return; + _watchTimer?.Change(5_000, 5_000); + _posTimer?.Change(1_000, 1_000); + _themeTimer?.Change(20_000, 20_000); } /// Hides the overlay window without destroying it. public void Hide() { - Log.Info("Hiding taskbar overlay window"); + string displayInfo = TargetDisplay is not null ? $" on {TargetDisplay.FriendlyName}" : ""; + Log.Info($"Taskbar overlay hidden{displayInfo}"); if (Handle == IntPtr.Zero || !NativeMethods.IsWindow(Handle)) { Visible = false; @@ -213,10 +286,7 @@ public void UpdateSnapshot(TelemetrySnapshot snap) ApplyOverlayDimensions(MeasureSize()); - if (_embedder.IsChildMode) - Invalidate(); - else - RenderFloat(); + Invalidate(); _lastRenderedSnap = snap; } @@ -232,6 +302,7 @@ private void ApplyOverlayDimensions(Size sz) _overlayHeight = sz.Height; _embedder.Reposition(Handle, sz); } + CheckAndNotifySpaceConstraint(); } private static bool ValuesChanged(TelemetrySnapshot a, TelemetrySnapshot b) @@ -284,11 +355,43 @@ public void Flash(TimeSpan duration) if (Handle == IntPtr.Zero || _disposed) return; _uiCtx.Post(_ => { - if (_embedder.IsChildMode) Invalidate(); - else RenderFloat(); + Invalidate(); }, null); } + /// + /// Sets or clears the active warning state for a metric on the overlay. + /// When active, the metric's value is drawn in a prominent alert color. + /// + /// The metric identifier. + /// True if the metric is currently breaching alert thresholds; otherwise false. + public void SetAlertActive(string metricId, bool active) + { + bool changed; + lock (_activeAlertMetrics) + { + changed = active ? _activeAlertMetrics.Add(metricId) : _activeAlertMetrics.Remove(metricId); + } + + if (changed && Handle != IntPtr.Zero && !_disposed) + { + _uiCtx.Post(_ => Invalidate(), null); + } + } + + /// + /// Checks whether an alert warning is currently active for the specified metric. + /// + /// The metric identifier. + /// True if the metric is currently marked active; otherwise false. + public bool IsAlertActive(string metricId) + { + lock (_activeAlertMetrics) + { + return _activeAlertMetrics.Contains(metricId); + } + } + /// /// Forces a full overlay redraw (color, font, layout) on the UI thread. /// Called after settings changes. @@ -312,11 +415,12 @@ public void RefreshOverlay() _overlayWidth = sz.Width; _overlayHeight = sz.Height; _embedder.Reposition(Handle, sz); - if (_embedder.IsChildMode) Invalidate(); - else RenderFloat(); + CheckAndNotifySpaceConstraint(); + Invalidate(); }, null); } + private volatile bool _isDisplayChangePending; private DateTime _lastClickTime = DateTime.MinValue; protected override void WndProc(ref Message m) @@ -346,6 +450,8 @@ protected override void WndProc(ref Message m) return; case NativeMethods.WM_DISPLAYCHANGE: HardwareLifecycleManager.Instance.NotifyDisplayChanged(); + TaskbarEmbedder.InvalidateCaches(); + ScheduleDisplayChangeReposition(); break; case NativeMethods.WM_DEVICECHANGE: HandleDeviceChange(m.WParam); @@ -357,6 +463,10 @@ protected override void WndProc(ref Message m) m.Result = (IntPtr)NativeMethods.HTCLIENT; return; case NativeMethods.WM_LBUTTONDOWN: + if (IsContextMenuOpen?.Invoke() == true) + { + CloseContextMenuAction?.Invoke(); + } HandleLButtonDown(); return; case NativeMethods.WM_LBUTTONDBLCLK: @@ -373,6 +483,26 @@ protected override void WndProc(ref Message m) base.WndProc(ref m); } + private void ScheduleDisplayChangeReposition() + { + _isDisplayChangePending = true; + Task.Delay(500).ContinueWith(_ => + { + _uiCtx.Post(_ => + { + try + { + if (_disposed || !Visible) return; + RecoverTaskbar("display configuration change"); + } + finally + { + _isDisplayChangePending = false; + } + }, null); + }, TaskScheduler.Default); + } + private static void HandleDeviceChange(IntPtr wParam) { int dbtEvent = wParam.ToInt32(); @@ -391,8 +521,11 @@ private void HandleLButtonDown() if ((now - _lastClickTime).TotalMilliseconds <= doubleClickMaxMs) { _lastClickTime = DateTime.MinValue; - if (!string.IsNullOrEmpty(_cfg.Overlay.DoubleClickAction)) + if (!string.IsNullOrEmpty(_cfg.Overlay.DoubleClickAction) && + !string.Equals(_cfg.Overlay.DoubleClickAction, "none", StringComparison.OrdinalIgnoreCase)) + { OnDoubleClick?.Invoke(_cfg.Overlay.DoubleClickAction); + } } else { @@ -406,6 +539,9 @@ private void HandleLButtonDown() /// Callback to query if the overlay context menu is currently open. public Func? IsContextMenuOpen { get; set; } + /// Callback to check if a physical screen point is inside the overlay context menu. + internal Func? IsPointInsideContextMenu { get; set; } + /// Callback to query the screen bounds of the overlay context menu. public Func? GetContextMenuBounds { get; set; } @@ -424,17 +560,20 @@ private void ShowOverlayContextMenu() try { + if (!SkipMouseHookForTesting) + StartMouseHook(); ShowContextMenuAction.Invoke(pos); } catch (Exception ex) { Log.Error(ex, $"Exception occurred while invoking ShowContextMenuAction at ({pos.X}, {pos.Y})"); + StopMouseHook(); } } private void WmPaint() { - var ps = new NativeMethods.PAINTSTRUCT(); + var ps = new NativeMethods.PaintStruct(); var hdc = NativeMethods.BeginPaint(Handle, ref ps); if (hdc == IntPtr.Zero) return; try @@ -456,8 +595,8 @@ private void HandleDpiChanged() _overlayWidth = sz.Width; _overlayHeight = sz.Height; _embedder.Reposition(Handle, sz); - if (_embedder.IsChildMode) Invalidate(); - else RenderFloat(); + CheckAndNotifySpaceConstraint(); + Invalidate(); } private void DetectSystemTheme() @@ -559,14 +698,14 @@ private void DrawItems(Graphics g) var drawFlags = TextFormatFlags.VerticalCenter | TextFormatFlags.SingleLine | TextFormatFlags.NoPrefix | TextFormatFlags.NoPadding; int rowH = TextRenderer.MeasureText(g, "Ay↓g", font, Size.Empty, drawFlags).Height + 6; - int colCount = (oc.Row1.Count + 1) / 2; - bool hasRow2 = oc.Row1.Count > 1; + int colCount = oc.Columns.Count; var cols = BuildColumns(g, font, drawFlags, oc, mc, colCount); if (cols.Count == 0) return; + bool hasRow2 = cols.Any(c => c.BotOn); int vPad = (int)(8 * _dpi + 0.5f); int wndH = hasRow2 ? rowH * 2 + RowGap + vPad * 2 : rowH + vPad * 2; - int gap = (int)(ItemSpace * _dpi * _autoScaleFactor + 0.5f); + int gap = Math.Max((int)(ItemSpace * _dpi * _autoScaleFactor * _spacingScaleFactor + 0.5f), 2); int yTop, yBot; if (hasRow2) @@ -589,6 +728,7 @@ private void DrawItems(Graphics g) foreach (var col in cols) { int colW = col.FullW; + if (x + colW > _overlayWidth && x > gap) break; int colonEndX = x + col.LabelPartPx + col.ColonW; if (col.TopOn) @@ -656,24 +796,39 @@ private List BuildColumns(Graphics g, Font font, TextFormatFlags fla private readonly record struct RenderMeasureContext(Graphics G, Font Font, TextFormatFlags Flags, MonitoringConfig Mc, int ColonW); + private bool CheckMetricAvailable(string id) + { + if (_snap != TelemetrySnapshot.Empty) + { + return IsMetricAvailable(id, _snap); + } + + return id is not (Metrics.BatteryPct or Metrics.BatteryRate) || SystemInfo.HasBattery(); + } + + private bool IsEligible(string id, MonitoringConfig mc) => + !string.IsNullOrEmpty(id) && IsMetricEnabled(id, mc) && CheckMetricAvailable(id); + private List<(int colIdx, bool isTop, string id, string rawPart)> CollectRawParts( OverlayConfig oc, MonitoringConfig mc, int colCount) { var rawParts = new List<(int colIdx, bool isTop, string id, string rawPart)>(); - int total = oc.Row1.Count; for (int i = 0; i < colCount; i++) { - int topIdx = i * 2; - int botIdx = i * 2 + 1; - string topId = topIdx < total ? oc.Row1[topIdx] : ""; - string botId = botIdx < total ? oc.Row1[botIdx] : ""; + var col = oc.Columns[i]; + string topId = col.Count > 0 ? col[0] : ""; + string botId = col.Count > 1 ? col[1] : ""; - if (!string.IsNullOrEmpty(topId) && IsMetricEnabled(topId, mc) && IsMetricAvailable(topId, _snap)) + if (IsEligible(topId, mc)) + { rawParts.Add((i, true, topId, ResolveMetricLabel(topId))); + } - if (!string.IsNullOrEmpty(botId) && IsMetricEnabled(botId, mc) && IsMetricAvailable(botId, _snap)) + if (IsEligible(botId, mc)) + { rawParts.Add((i, false, botId, ResolveMetricLabel(botId))); + } } return rawParts; @@ -735,7 +890,12 @@ private string GetDiskLabel(string id) string diskId = id[5..last]; string aspect = id[(last + 1)..]; - string suffix = aspect == "read" ? "R" : "W"; + string suffix = aspect switch + { + "read" => "R", + "temp" => "T", + _ => "W", + }; int idx = diskId.StartsWith("disk") && int.TryParse(diskId[4..], out int di) ? di : -1; if (idx >= 0 && idx < _snap.Disks.Count && !string.IsNullOrEmpty(_snap.Disks[idx].BusType)) @@ -822,7 +982,36 @@ private static Color AdjustForTheme(Color c, bool isLightTheme) private SolidBrush MakeValueBrush(string id, OverlayConfig oc) { - string hex = oc.MetricColors.TryGetValue(id, out var userColor) ? userColor : oc.ValueColor; + bool isAlert; + lock (_activeAlertMetrics) + { + isAlert = _activeAlertMetrics.Contains(id); + } + + if (isAlert) + { + var alertColor = AdjustForTheme(Color.FromArgb(255, 68, 68), _isLightTheme); + int alertArgb = alertColor.ToArgb(); + if (_brushCache.TryGetValue(alertArgb, out var cachedAlert)) + return cachedAlert; + var alertBrush = new SolidBrush(alertColor); + _brushCache[alertArgb] = alertBrush; + return alertBrush; + } + + string hex; + if (oc.MetricColors.TryGetValue(id, out var userColor) && !string.IsNullOrEmpty(userColor)) + { + hex = userColor; + } + else if (oc.DefaultMetricColors.TryGetValue(id, out var defColor) && !string.IsNullOrEmpty(defColor)) + { + hex = defColor; + } + else + { + hex = oc.ValueColor; + } var c = AdjustForTheme(WindowHelpers.ParseHex(hex, Color.White), _isLightTheme); int argb = c.ToArgb(); if (_brushCache.TryGetValue(argb, out var cached)) @@ -832,23 +1021,47 @@ private SolidBrush MakeValueBrush(string id, OverlayConfig oc) return brush; } - private void RenderFloat() - { - if (Handle == IntPtr.Zero || !Visible || !_cfg.Overlay.Visible || _overlayWidth <= 0 || _overlayHeight <= 0) return; - if (SkipShowWindowForTesting) return; - Invalidate(); - } - private Size MeasureSize() { _autoScaleFactor = 1.0f; + _spacingScaleFactor = 1.0f; var unconstrained = MeasureSizeInternal(); - if (_embedder.AvailableSlotWidth > 0 && unconstrained.Width > _embedder.AvailableSlotWidth) + _embedder.NaturalOverlayWidth = unconstrained.Width; + int available = _embedder.CalculateAvailableSlotWidth(); + if (available <= 0) { - float ratio = (float)_embedder.AvailableSlotWidth / unconstrained.Width; - _autoScaleFactor = Math.Clamp(ratio, 0.75f, 1.0f); + available = _embedder.AvailableSlotWidth; + } + + if (available <= 0 && _embedder.IsTaskbarSpaceConstrained) + { + _spacingScaleFactor = 0.5f; + _autoScaleFactor = 0.60f; return MeasureSizeInternal(); } + + if (available > 0 && unconstrained.Width > available) + { + // Stage 1: Compress inter-chip spacing first to preserve full font legibility + _spacingScaleFactor = 0.5f; + var compressed = MeasureSizeInternal(); + if (compressed.Width <= available) + { + return new Size(compressed.Width, compressed.Height); + } + + // Stage 2: Calculate the exact continuous scale percentage required to fit the slot + float ratio = (float)available / compressed.Width; + _autoScaleFactor = Math.Clamp(ratio, 0.60f, 1.0f); + var scaled = MeasureSizeInternal(); + if (scaled.Width > available && _autoScaleFactor > 0.60f) + { + float secondRatio = (float)available / scaled.Width; + _autoScaleFactor = Math.Clamp(_autoScaleFactor * secondRatio, 0.60f, 1.0f); + scaled = MeasureSizeInternal(); + } + return new Size(scaled.Width, scaled.Height); + } return unconstrained; } @@ -861,11 +1074,11 @@ private Size MeasureSizeInternal() using var g = Graphics.FromImage(bmp); var font = BuildFont(); - int colCount = (oc.Row1.Count + 1) / 2; - bool hasRow2 = oc.Row1.Count > 1; + int colCount = oc.Columns.Count; var flags = TextFormatFlags.VerticalCenter | TextFormatFlags.SingleLine | TextFormatFlags.NoPrefix | TextFormatFlags.NoPadding; var cols = BuildColumns(g, font, flags, oc, mc, colCount); - int gap = (int)(ItemSpace * _dpi * _autoScaleFactor + 0.5f); + bool hasRow2 = cols.Any(c => c.BotOn); + int gap = Math.Max((int)(ItemSpace * _dpi * _autoScaleFactor * _spacingScaleFactor + 0.5f), 2); int w = gap; foreach (var col in cols) w += col.FullW + gap; @@ -911,7 +1124,7 @@ private float GetDpi() private void PosTick() { if (SkipTimersForTesting) return; - if (_disposed || Handle == IntPtr.Zero || !Visible) return; + if (_disposed || Handle == IntPtr.Zero || !Visible || _isDisplayChangePending) return; if (!_embedder.IsEmbedded || _embedder.State == OverlayDeploymentState.Failed) return; _uiCtx.Post(_ => @@ -930,6 +1143,7 @@ private void PosTick() _overlayHeight = sz.Height; } _embedder.Reposition(Handle, sz); + CheckAndNotifySpaceConstraint(); }, null); } @@ -952,7 +1166,6 @@ private void EnsureWindowCreated() } } - Log.Info("Creating taskbar overlay native window"); var cp = new CreateParams { Caption = "LocalTelemetry_Overlay", @@ -980,7 +1193,7 @@ public void RecoverTaskbar(string reason) { if (_disposed || !_cfg.Overlay.Visible) return; - Log.Info($"Re-embedding taskbar overlay due to {reason}"); + Log.Debug($"Re-embedding taskbar overlay due to {reason}"); try { EnsureWindowCreated(); @@ -1008,7 +1221,7 @@ private void WatchTick() if (SkipTimersForTesting) return; if (!_cfg.Overlay.Visible || _disposed) return; - var current = TaskbarEmbedder.FindExplorerTrayWnd(); + var current = _embedder.GetTargetTrayWnd(); if (current == IntPtr.Zero) return; bool trayChanged = current != _lastTrayHwnd; @@ -1069,18 +1282,58 @@ public void Dispose() private void StartMouseHook() { - // Global mouse hook is intentionally replaced by embedded window message handling. + if (SkipMouseHookForTesting || _mouseHook != IntPtr.Zero || _mouseHookDelegate is not null) return; + try + { + _mouseHookDelegate = MouseHookCallback; + IntPtr moduleHandle = NativeMethods.GetModuleHandle(null); + _mouseHook = NativeMethods.SetWindowsHookEx( + NativeMethods.WH_MOUSE_LL, + _mouseHookDelegate, + moduleHandle, + 0); + if (_mouseHook == IntPtr.Zero) + { + int err = Marshal.GetLastWin32Error(); + Log.Warn($"Failed to install low-level mouse hook for taskbar overlay (error {err})"); + _mouseHookDelegate = null; + } + } + catch (Exception ex) + { + Log.Error(ex, "Exception while installing taskbar overlay mouse hook"); + _mouseHookDelegate = null; + } } - private void StopMouseHook() + internal void StopMouseHook() { - // Global mouse hook cleanup is intentionally a no-op when inactive. + if (_mouseHook != IntPtr.Zero) + { + try + { + NativeMethods.UnhookWindowsHookEx(_mouseHook); + } + catch (Exception ex) + { + Log.Debug(ex, "Exception while removing taskbar overlay mouse hook"); + } + finally + { + _mouseHook = IntPtr.Zero; + } + } + + if (_mouseHookDelegate is not null) + { + _mouseHookDelegate = null; + } } internal Rectangle GetScreenBounds() { if (Handle == IntPtr.Zero || _overlayWidth <= 0 || _overlayHeight <= 0) return Rectangle.Empty; - var pt = new NativeMethods.POINT { X = 0, Y = 0 }; + var pt = new NativeMethods.Point { X = 0, Y = 0 }; NativeMethods.ClientToScreen(Handle, ref pt); return new Rectangle(pt.X, pt.Y, _overlayWidth, _overlayHeight); } @@ -1090,14 +1343,23 @@ internal IntPtr MouseHookCallback(int nCode, IntPtr wParam, IntPtr lParam) if (nCode >= 0) { int msg = wParam.ToInt32(); - HandleOutsideContextMenuClick(msg, lParam); + if (msg == NativeMethods.WM_MOUSEMOVE) + { + return NativeMethods.CallNextHookEx(_mouseHook, nCode, wParam, lParam); + } + + if (IsContextMenuOpen?.Invoke() == true) + { + HandleOutsideContextMenuClick(msg, lParam); + return NativeMethods.CallNextHookEx(_mouseHook, nCode, wParam, lParam); + } if (TryHandleOverlayClick(msg, lParam, out var handledResult)) { return handledResult; } } - return NativeMethods.CallNextHookEx(IntPtr.Zero, nCode, wParam, lParam); + return NativeMethods.CallNextHookEx(_mouseHook, nCode, wParam, lParam); } private void HandleOutsideContextMenuClick(int msg, IntPtr lParam) @@ -1107,12 +1369,24 @@ private void HandleOutsideContextMenuClick(int msg, IntPtr lParam) if (isButtonDown && IsContextMenuOpen?.Invoke() == true) { - var hookStruct = Marshal.PtrToStructure(lParam); - var clickPt = new Point(hookStruct.pt.X, hookStruct.pt.Y); - var bounds = GetContextMenuBounds?.Invoke() ?? Rectangle.Empty; - if (!bounds.Contains(clickPt)) + var hookStruct = Marshal.PtrToStructure(lParam); + if (IsPointInsideContextMenu is not null) + { + if (!IsPointInsideContextMenu(hookStruct.pt)) + { + CloseContextMenuAction?.Invoke(); + StopMouseHook(); + } + } + else { - CloseContextMenuAction?.Invoke(); + var clickPt = new Point(hookStruct.pt.X, hookStruct.pt.Y); + var bounds = GetContextMenuBounds?.Invoke() ?? Rectangle.Empty; + if (!bounds.Contains(clickPt)) + { + CloseContextMenuAction?.Invoke(); + StopMouseHook(); + } } } } @@ -1120,14 +1394,47 @@ private void HandleOutsideContextMenuClick(int msg, IntPtr lParam) private bool TryHandleOverlayClick(int msg, IntPtr lParam, out IntPtr handledResult) { handledResult = IntPtr.Zero; - if (!Visible || !_cfg.Overlay.Visible || Handle == IntPtr.Zero) + if (msg is not (NativeMethods.WM_RBUTTONDOWN or NativeMethods.WM_RBUTTONUP or NativeMethods.WM_LBUTTONDBLCLK)) { return false; } - var hookStruct = Marshal.PtrToStructure(lParam); + if (!Visible || !_cfg.Overlay.Visible || Handle == IntPtr.Zero || !NativeMethods.IsWindow(Handle)) + { + return false; + } + + var hookStruct = Marshal.PtrToStructure(lParam); var pt = new Point(hookStruct.pt.X, hookStruct.pt.Y); - return GetScreenBounds().Contains(pt) && HandleOverlayMouseMessage(msg, out handledResult); + if (!GetScreenBounds().Contains(pt)) + { + return false; + } + + return HandleOverlayMouseMessage(msg, out handledResult); + } + + private static bool IsTargetOrDescendant(IntPtr hwnd, IntPtr target) => + target != IntPtr.Zero && (hwnd == target || NativeMethods.GetAncestor(hwnd, NativeMethods.GA_ROOT) == target); + + internal bool IsOverlayOrTaskbarAtPoint(NativeMethods.Point pt) + { + if (SkipEmbedForTesting || SkipShowWindowForTesting) + { + return true; + } + + if (Handle == IntPtr.Zero || !NativeMethods.IsWindow(Handle) || !NativeMethods.IsWindowVisible(Handle)) + return false; + + IntPtr hwndAtPt = NativeMethods.WindowFromPoint(pt); + if (hwndAtPt == IntPtr.Zero) return false; + if (hwndAtPt == Handle) return true; + + if (IsTargetOrDescendant(hwndAtPt, _embedder.ParentHwnd)) return true; + + IntPtr tray = _lastTrayHwnd != IntPtr.Zero ? _lastTrayHwnd : TaskbarEmbedder.FindExplorerTrayWnd(); + return IsTargetOrDescendant(hwndAtPt, tray); } internal bool HandleOverlayMouseMessage(int msg, out IntPtr result) diff --git a/src/LocalTelemetry.App/Overlay/TaskbarOverlayManager.cs b/src/LocalTelemetry.App/Overlay/TaskbarOverlayManager.cs new file mode 100644 index 0000000..39b3f5c --- /dev/null +++ b/src/LocalTelemetry.App/Overlay/TaskbarOverlayManager.cs @@ -0,0 +1,396 @@ +using System.Runtime.Versioning; +using Microsoft.Win32; +using LocalTelemetry.App.Win32; +using LocalTelemetry.Core.Config; +using LocalTelemetry.Core.Diagnostics; +using LocalTelemetry.Core.Models; + +namespace LocalTelemetry.App.Overlay; + +/// +/// Coordinates multiple instances across one or more display monitors. +/// +[SupportedOSPlatform("windows")] +public sealed class TaskbarOverlayManager : IDisposable +{ + private const string PrimaryDisplayId = "primary"; + private readonly AppSettings _cfg; + private readonly Dictionary _overlays = [with(StringComparer.OrdinalIgnoreCase)]; + private readonly Lock _syncLock = new(); + private bool _disposed; + private bool _isVisible; + + // Test seams + internal Func? OverlayFactory { get; set; } + internal static bool SkipDisplaySettingsChangedHookForTesting { get; set; } + + public TaskbarOverlay PrimaryOverlay + { + get + { + lock (_syncLock) + { + if (!_overlays.TryGetValue(PrimaryDisplayId, out var overlay)) + { + var primaryDisplay = DisplayInfo.EnumerateDisplays().FirstOrDefault(d => d.IsPrimary) + ?? new DisplayInfo { Id = PrimaryDisplayId, IsPrimary = true }; + overlay = OverlayFactory is not null ? OverlayFactory(_cfg, primaryDisplay) : new TaskbarOverlay(_cfg, primaryDisplay); + WireOverlay(overlay, true); + _overlays[PrimaryDisplayId] = overlay; + } + return overlay; + } + } + } + + /// Gets all currently active overlay instances across all displays. + public IReadOnlyList GetActiveOverlays() + { + lock (_syncLock) + { + return [.. _overlays.Values]; + } + } + + public bool IsTaskbarSpaceConstrained => PrimaryOverlay?.IsTaskbarSpaceConstrained ?? false; + + public int AvailableSlotWidth => PrimaryOverlay?.AvailableSlotWidth ?? 0; + + public event Action? TaskbarSpaceConstraintChanged; + + public Action? ShowContextMenuAction { get; set; } + public Func? IsContextMenuOpen { get; set; } + internal Func? IsPointInsideContextMenu { get; set; } + public Func? GetContextMenuBounds { get; set; } + public Action? CloseContextMenuAction { get; set; } + public Action? OnOpenSettingsRequested { get; set; } + public Action? OnToggleOverlayRequested { get; set; } + public Action? OnExitRequested { get; set; } + public event Action? OnDoubleClick; + + public TaskbarOverlayManager(AppSettings cfg) + { + _cfg = cfg; + if (!SkipDisplaySettingsChangedHookForTesting) + { + try + { + SystemEvents.DisplaySettingsChanged += OnDisplaySettingsChanged; + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to register SystemEvents.DisplaySettingsChanged handler"); + } + } + } + + private void OnDisplaySettingsChanged(object? sender, EventArgs e) + { + if (_disposed) return; + Log.Info("Display settings change detected; synchronizing overlay monitors"); + try + { + SyncOverlays("DisplaySettingsChanged notification"); + } + catch (Exception ex) + { + Log.Error(ex, "Error synchronizing overlays following display change"); + } + } + + /// + public void Show() + { + ObjectDisposedException.ThrowIf(_disposed, this); + bool wasVisible = _isVisible; + _isVisible = true; + SyncOverlays(wasVisible ? "Display settings updated" : "Show request"); + } + + /// + public void Hide() + { + _isVisible = false; + lock (_syncLock) + { + foreach (var overlay in _overlays.Values) + { + try + { + overlay.Hide(); + } + catch (Exception ex) + { + Log.Debug(ex, "Error hiding overlay during manager Hide"); + } + } + } + } + + /// + public void RefreshOverlays() + { + if (_disposed) return; + SyncOverlays("Refresh request"); + lock (_syncLock) + { + foreach (var overlay in _overlays.Values) + { + try + { + overlay.RefreshOverlay(); + } + catch (Exception ex) + { + Log.Debug(ex, "Error refreshing overlay during manager RefreshOverlays"); + } + } + } + } + + /// + public void UpdateSnapshot(TelemetrySnapshot snap) + { + if (_disposed || !_isVisible || !_cfg.Overlay.Visible) return; + lock (_syncLock) + { + foreach (var overlay in _overlays.Values) + { + try + { + overlay.UpdateSnapshot(snap); + } + catch (Exception ex) + { + Log.Debug(ex, "Error updating snapshot on overlay"); + } + } + } + } + + /// + public void RecoverTaskbars(string reason) + { + if (_disposed || !_cfg.Overlay.Visible) return; + SyncOverlays($"Recovery: {reason}"); + lock (_syncLock) + { + foreach (var overlay in _overlays.Values) + { + try + { + overlay.RecoverTaskbar(reason); + } + catch (Exception ex) + { + Log.Debug(ex, "Error recovering overlay during manager RecoverTaskbars"); + } + } + } + } + + /// + public void StopMouseHook() + { + lock (_syncLock) + { + foreach (var overlay in _overlays.Values) + { + try + { + overlay.StopMouseHook(); + } + catch (Exception ex) + { + Log.Debug(ex, "Error stopping mouse hook on overlay"); + } + } + } + } + + /// + /// Synchronizes active overlay instances with currently connected displays and settings. + /// + /// Trigger reason for the synchronization. + public void SyncOverlays(string reason) + { + if (_disposed) return; + + var displays = DisplayInfo.EnumerateDisplays(); + var desiredDisplayIds = DetermineDesiredDisplayIds(displays); + + lock (_syncLock) + { + RemoveObsoleteOverlays(desiredDisplayIds, reason); + + if (_isVisible && _cfg.Overlay.Visible) + { + EnsureDesiredOverlays(displays, desiredDisplayIds); + } + } + } + + private void RemoveObsoleteOverlays(HashSet desiredDisplayIds, string reason) + { + var idsToRemove = _overlays.Keys.Where(k => !desiredDisplayIds.Contains(k)).ToList(); + foreach (var id in idsToRemove) + { + if (_overlays.Remove(id, out var removedOverlay)) + { + string displayLabel = removedOverlay.TargetDisplay?.FriendlyName ?? id; + Log.Info($"Removing overlay for display '{id}' ({displayLabel}) - reason: {reason}"); + UnwireOverlay(removedOverlay); + removedOverlay.Hide(); + removedOverlay.Dispose(); + } + } + } + + private void EnsureDesiredOverlays(List displays, HashSet desiredDisplayIds) + { + foreach (var display in displays.Where(d => desiredDisplayIds.Contains(d.Id))) + { + if (_overlays.TryGetValue(display.Id, out var existingOverlay)) + { + UpdateExistingOverlay(existingOverlay, display); + } + else if (display.HasTaskbar) + { + AttachNewOverlay(display); + } + else + { + Log.Debug($"Display '{display.Id}' ({display.FriendlyName}) has no taskbar window; skipping overlay creation"); + } + } + } + + private void AttachNewOverlay(DisplayInfo display) + { + Log.Info($"Creating overlay for display '{display.Id}' ({display.FriendlyName})"); + var overlay = OverlayFactory is not null + ? OverlayFactory(_cfg, display) + : new TaskbarOverlay(_cfg, display); + + WireOverlay(overlay, display.IsPrimary); + _overlays[display.Id] = overlay; + overlay.Show(); + } + + private static void UpdateExistingOverlay(TaskbarOverlay overlay, DisplayInfo display) + { + if (overlay.TargetDisplay is not null) + { + overlay.TargetDisplay.TaskbarHwnd = display.TaskbarHwnd; + } + + if (!overlay.Visible) + { + overlay.Show(); + } + } + + private HashSet DetermineDesiredDisplayIds(List displays) + { + string mode = _cfg.Overlay.DisplayMode?.ToLowerInvariant() ?? PrimaryDisplayId; + return mode switch + { + "all" => new HashSet(displays.Select(d => d.Id), StringComparer.OrdinalIgnoreCase), + "secondary" => ResolveSecondaryDisplayIds(displays), + "custom" => new HashSet(_cfg.Overlay.EnabledDisplays ?? [PrimaryDisplayId], StringComparer.OrdinalIgnoreCase), + _ => [with(StringComparer.OrdinalIgnoreCase), PrimaryDisplayId] + }; + } + + private static HashSet ResolveSecondaryDisplayIds(List displays) + { + var secondaries = displays.Where(d => !d.IsPrimary).Select(d => d.Id).ToList(); + if (secondaries.Count > 0) + { + return new HashSet(secondaries, StringComparer.OrdinalIgnoreCase); + } + + Log.Info("No secondary displays detected; falling back to primary display overlay"); + return [with(StringComparer.OrdinalIgnoreCase), PrimaryDisplayId]; + } + + private void WireOverlay(TaskbarOverlay overlay, bool isPrimary) + { + overlay.ShowContextMenuAction = pt => ShowContextMenuAction?.Invoke(pt); + overlay.IsContextMenuOpen = () => IsContextMenuOpen?.Invoke() ?? false; + overlay.IsPointInsideContextMenu = pt => IsPointInsideContextMenu?.Invoke(pt) ?? false; + overlay.GetContextMenuBounds = () => GetContextMenuBounds?.Invoke() ?? Rectangle.Empty; + overlay.CloseContextMenuAction = () => CloseContextMenuAction?.Invoke(); + overlay.OnOpenSettingsRequested = () => OnOpenSettingsRequested?.Invoke(); + overlay.OnToggleOverlayRequested = () => OnToggleOverlayRequested?.Invoke(); + overlay.OnExitRequested = () => OnExitRequested?.Invoke(); + overlay.OnDoubleClick += action => OnDoubleClick?.Invoke(action); + + if (isPrimary) + { + overlay.TaskbarSpaceConstraintChanged += OnPrimaryConstraintChanged; + } + } + + private void UnwireOverlay(TaskbarOverlay overlay) + { + overlay.TaskbarSpaceConstraintChanged -= OnPrimaryConstraintChanged; + } + + private void OnPrimaryConstraintChanged(bool constrained, int slotWidth) + { + TaskbarSpaceConstraintChanged?.Invoke(constrained, slotWidth); + } + + /// Pauses background timers on all managed overlay windows. + public void PauseAllTimers() + { + lock (_syncLock) + { + foreach (var overlay in _overlays.Values) + { + overlay.PauseTimers(); + } + } + } + + /// Resumes background timers on all managed overlay windows. + public void ResumeAllTimers() + { + lock (_syncLock) + { + foreach (var overlay in _overlays.Values) + { + overlay.ResumeTimers(); + } + } + } + + public void Dispose() + { + if (_disposed) return; + _disposed = true; + + if (!SkipDisplaySettingsChangedHookForTesting) + { + try + { + SystemEvents.DisplaySettingsChanged -= OnDisplaySettingsChanged; + } + catch (Exception ex) + { + Log.Debug(ex, "Error unhooking DisplaySettingsChanged"); + } + } + + lock (_syncLock) + { + foreach (var overlay in _overlays.Values) + { + UnwireOverlay(overlay); + overlay.Dispose(); + } + _overlays.Clear(); + } + } +} diff --git a/src/LocalTelemetry.App/Services/AlertService.cs b/src/LocalTelemetry.App/Services/AlertService.cs index b6a3771..8f77ffd 100644 --- a/src/LocalTelemetry.App/Services/AlertService.cs +++ b/src/LocalTelemetry.App/Services/AlertService.cs @@ -17,17 +17,20 @@ public sealed class AlertService( AppSettings cfg, TaskbarOverlay overlay, NotificationClient notifClient, - NetUsageLogger? netLogger = null) + NetUsageLogger? netLogger = null, + TimeProvider? timeProvider = null) { private readonly AppSettings _cfg = cfg; private readonly TaskbarOverlay _overlay = overlay; private readonly NotificationClient _notifClient = notifClient; private readonly NetUsageLogger? _netLogger = netLogger; + private readonly TimeProvider _timeProvider = timeProvider ?? TimeProvider.System; private readonly Dictionary _cooldowns = []; private readonly HashSet _firedOnce = []; private readonly HashSet _activeAlerts = []; private readonly Dictionary _lastAlertedValue = []; - private readonly DateTime _startupTime = DateTime.UtcNow; + private readonly Dictionary _breachStartTimes = []; + private readonly DateTime _startupTime = (timeProvider ?? TimeProvider.System).GetUtcNow().UtcDateTime; // Evaluation @@ -38,18 +41,69 @@ public sealed class AlertService( /// The latest telemetry snapshot to evaluate. public void Evaluate(TelemetrySnapshot snap) { - if (!_cfg.Alerts.Enabled) return; + if (!_cfg.Alerts.Enabled) + { + if (_activeAlerts.Count > 0) + { + foreach (var id in _activeAlerts) + { + _overlay.SetAlertActive(id, false); + } + _activeAlerts.Clear(); + _lastAlertedValue.Clear(); + _breachStartTimes.Clear(); + } + return; + } + + DateTime now = _timeProvider.GetUtcNow().UtcDateTime; // Skip alerts for first 10 seconds to let the notification process start - if ((DateTime.UtcNow - _startupTime).TotalSeconds < 10) return; + if ((now - _startupTime).TotalSeconds < 10) return; bool f = _cfg.Monitoring.UseFahrenheit; EvaluateCpuAlerts(snap, f); EvaluateGpuAlerts(snap, f); EvaluateRamAndMiscAlerts(snap); + EvaluateDiskAlerts(snap, f); EvaluateNetAlerts(); + + CleanupInactiveAlerts(); } + private void CleanupInactiveAlerts() + { + if (_activeAlerts.Count == 0) return; + + var toRemove = _activeAlerts.Where(metricId => !IsMetricAlertEnabled(metricId)).ToList(); + foreach (var metricId in toRemove) + { + _activeAlerts.Remove(metricId); + _lastAlertedValue.Remove(metricId); + _breachStartTimes.Remove(metricId); + _overlay.SetAlertActive(metricId, false); + } + } + + private bool IsMetricAlertEnabled(string metricId) => metricId switch + { + Metrics.CpuTemp => _cfg.Alerts.AlertCpuTemp, + Metrics.CpuPct => _cfg.Alerts.AlertCpuUsage, + Metrics.CpuFreq => _cfg.Alerts.AlertCpuFreq, + Metrics.CpuPower => _cfg.Alerts.AlertCpuPower, + Metrics.GpuTemp => _cfg.Alerts.AlertGpuTemp, + Metrics.GpuPct => _cfg.Alerts.AlertGpuUsage, + Metrics.GpuVram => _cfg.Alerts.AlertGpuVram, + Metrics.GpuFreq => _cfg.Alerts.AlertGpuFreq, + Metrics.GpuPower => _cfg.Alerts.AlertGpuPower, + Metrics.RamPct => _cfg.Alerts.AlertRamUsage, + Metrics.BatteryPct => _cfg.Alerts.AlertBatteryLow, + "net_daily" => _cfg.Alerts.AlertNetDaily, + "net_monthly" => _cfg.Alerts.AlertNetMonthly, + _ when metricId.StartsWith("disk_", StringComparison.OrdinalIgnoreCase) && metricId.EndsWith("_temp", StringComparison.OrdinalIgnoreCase) => _cfg.Alerts.AlertDiskTemp, + _ => false + }; + private void EvaluateCpuAlerts(TelemetrySnapshot snap, bool useFahrenheit) { if (_cfg.Alerts.AlertCpuTemp) @@ -58,7 +112,7 @@ private void EvaluateCpuAlerts(TelemetrySnapshot snap, bool useFahrenheit) displayValue: Metrics.TempString(snap.CpuTempPackageC, useFahrenheit), displayThreshold: Metrics.TempString(_cfg.Alerts.CpuTempMaxC, useFahrenheit)) { - Hysteresis = 6f, + Hysteresis = 10f, EscalationDelta = 5f }); @@ -101,7 +155,7 @@ private void EvaluateGpuAlerts(TelemetrySnapshot snap, bool useFahrenheit) displayValue: Metrics.TempString(snap.GpuTempC, useFahrenheit), displayThreshold: Metrics.TempString(_cfg.Alerts.GpuTempMaxC, useFahrenheit)) { - Hysteresis = 6f, + Hysteresis = 10f, EscalationDelta = 5f }); @@ -171,6 +225,30 @@ private void EvaluateRamAndMiscAlerts(TelemetrySnapshot snap) } } + private void EvaluateDiskAlerts(TelemetrySnapshot snap, bool useFahrenheit) + { + if (!_cfg.Alerts.AlertDiskTemp) return; + + for (int i = 0; i < snap.Disks.Count; i++) + { + var disk = snap.Disks[i]; + if (!disk.TemperatureC.HasValue) continue; + + string metricId = $"disk_{disk.Id}_temp"; + string label = $"{disk.Label} Temperature"; + float tempC = disk.TemperatureC.Value; + + EvaluateThreshold(new(metricId, label, tempC, _cfg.Alerts.DiskTempMaxC, + unit: useFahrenheit ? "°F" : "°C", + displayValue: Metrics.TempString(tempC, useFahrenheit), + displayThreshold: Metrics.TempString(_cfg.Alerts.DiskTempMaxC, useFahrenheit)) + { + Hysteresis = 5f, + EscalationDelta = 5f + }); + } + } + private void EvaluateNetAlerts() { if (_netLogger is null) return; @@ -243,11 +321,31 @@ private void EvaluateThreshold(in ThresholdEvaluationContext ctx) if (isBreached) { + if (!wasActive && _cfg.Alerts.SustainedSecs > 0) + { + DateTime now = _timeProvider.GetUtcNow().UtcDateTime; + if (!_breachStartTimes.TryGetValue(ctx.MetricId, out var startTime)) + { + _breachStartTimes[ctx.MetricId] = now; + return; + } + + if ((now - startTime).TotalSeconds < _cfg.Alerts.SustainedSecs) + { + return; + } + } + HandleBreach(ctx, wasActive); } - else if (wasActive) + else { - HandleRecovery(ctx); + _breachStartTimes.Remove(ctx.MetricId); + + if (wasActive) + { + HandleRecovery(ctx); + } } } @@ -255,16 +353,21 @@ private void HandleBreach(in ThresholdEvaluationContext ctx, bool wasActive) { if (!wasActive) { - if (!CanFireAlert(ctx.MetricId)) return; - _activeAlerts.Add(ctx.MetricId); _lastAlertedValue[ctx.MetricId] = ctx.Value; + _overlay.SetAlertActive(ctx.MetricId, true); + + if (!CanFireAlert(ctx.MetricId)) return; string title = GetAlertTitle(ctx.MetricId, ctx.MetricName, ctx.LowAlert); string direction = ctx.LowAlert ? "low" : "high"; string body = $"{ctx.MetricName} {direction} at {ctx.DisplayValue} (limit: {ctx.DisplayThreshold})"; - DispatchAlert(ctx.MetricId, title, body, $"{ctx.MetricName} reached {ctx.DisplayValue} (limit: {ctx.DisplayThreshold})"); + string logSummary = ctx.LowAlert + ? $"{ctx.MetricName} dropped to {ctx.DisplayValue} (threshold: {ctx.DisplayThreshold})" + : $"{ctx.MetricName} reached {ctx.DisplayValue} (threshold: {ctx.DisplayThreshold})"; + + DispatchAlert(title, body, logSummary); return; } @@ -285,7 +388,7 @@ private void HandleEscalation(in ThresholdEvaluationContext ctx) _lastAlertedValue[ctx.MetricId] = ctx.Value; string title = $"{ctx.MetricName} Critical"; string body = $"Surged to {ctx.DisplayValue} (was {lastVal:F0} {ctx.Unit}, limit: {ctx.DisplayThreshold})"; - DispatchAlert(ctx.MetricId, title, body, $"{ctx.MetricName} critical surge at {ctx.DisplayValue} (limit: {ctx.DisplayThreshold})"); + DispatchAlert(title, body, $"{ctx.MetricName} surged to {ctx.DisplayValue} (threshold: {ctx.DisplayThreshold})"); } } @@ -299,7 +402,9 @@ private void HandleRecovery(in ThresholdEvaluationContext ctx) { _activeAlerts.Remove(ctx.MetricId); _lastAlertedValue.Remove(ctx.MetricId); - Log.Info($"Alert normalized for {ctx.MetricName}, dropped to {ctx.DisplayValue} (recovered below {ctx.DisplayThreshold})"); + _breachStartTimes.Remove(ctx.MetricId); + _overlay.SetAlertActive(ctx.MetricId, false); + Log.Info($"{ctx.MetricName} normalized to {ctx.DisplayValue} (threshold: {ctx.DisplayThreshold})"); } } @@ -320,14 +425,14 @@ private static string GetAlertTitle(string metricId, string metricName, bool low : $"{metricName} High"; } - private void DispatchAlert(string metricId, string title, string body, string logSummary) + private void DispatchAlert(string title, string body, string logSummary) { var actions = new List(); if (_cfg.Alerts.ShowToastNotif) actions.Add("Toast"); if (_cfg.Alerts.FlashOverlay) actions.Add("Overlay Flash"); string actionStr = actions.Count > 0 ? string.Join(", ", actions) : "None (Muted)"; - Log.Warn($"Alert [{metricId}] triggered for {logSummary} [Actions: {actionStr}]"); + Log.Warn($"{logSummary} [Actions: {actionStr}]"); if (_cfg.Alerts.FlashOverlay) _overlay.Flash(TimeSpan.FromMilliseconds(800)); @@ -338,7 +443,7 @@ private void DispatchAlert(string metricId, string title, string body, string lo private bool CanFireAlert(string metricId) { - DateTime now = DateTime.UtcNow; + DateTime now = _timeProvider.GetUtcNow().UtcDateTime; if (_cfg.Alerts.FireOncePerSession) return _firedOnce.Add(metricId); diff --git a/src/LocalTelemetry.App/Services/NotificationClient.cs b/src/LocalTelemetry.App/Services/NotificationClient.cs index fc02b2d..4f47537 100644 --- a/src/LocalTelemetry.App/Services/NotificationClient.cs +++ b/src/LocalTelemetry.App/Services/NotificationClient.cs @@ -70,8 +70,9 @@ private async Task SendAsync(NotificationMessage msg, int? timeoutMs = null, int { await _lock.WaitAsync(cancellationToken); } - catch (OperationCanceledException) + catch (OperationCanceledException ex) { + Log.Debug(ex, "SendAsync operation was cancelled while awaiting lock"); return; } @@ -117,8 +118,9 @@ private async Task ExecuteAttemptAsync(NotificationMessage msg, i Log.Error("Failed to connect to notification service (service may not be running)"); return AttemptResult.Stop; } - catch (OperationCanceledException) + catch (OperationCanceledException ex) { + Log.Debug(ex, "ExecuteAttemptAsync operation was cancelled"); return AttemptResult.Stop; } catch (Exception ex) diff --git a/src/LocalTelemetry.App/Services/UpdateCheckService.cs b/src/LocalTelemetry.App/Services/UpdateCheckService.cs index 3a88130..b6345b2 100644 --- a/src/LocalTelemetry.App/Services/UpdateCheckService.cs +++ b/src/LocalTelemetry.App/Services/UpdateCheckService.cs @@ -17,11 +17,9 @@ public sealed class UpdateCheckService(AppSettings cfg, HttpClient? httpClient = { private readonly AppSettings _cfg = cfg; private readonly HttpClient _httpClient = httpClient ?? CreateDefaultHttpClient(); -#pragma warning disable S1075 // Official repository releases API and web URLs are invariant - private const string GitHubReleasesUrl = "https://api.github.com/repos/Nicconike/LocalTelemetry/releases?per_page=3"; - private const string GitHubReleasesWebUrl = "https://github.com/Nicconike/LocalTelemetry/releases"; - -#pragma warning restore S1075 + private const string RepositoryPath = "Nicconike/LocalTelemetry"; + private static readonly string GitHubReleasesUrl = $"https://api.github.com/repos/{RepositoryPath}/releases?per_page=3"; + private static readonly string GitHubReleasesWebUrl = $"https://github.com/{RepositoryPath}/releases"; private static HttpClient CreateDefaultHttpClient() { @@ -180,6 +178,17 @@ public static string GetCurrentVersionString() return ver.TrimStart('v', 'V'); } + /// + /// Checks whether the specified version or current application version is a pre-release or beta build. + /// + /// Optional version string to evaluate. If null, evaluates the current running assembly. + /// True if the version represents a pre-release or beta build; otherwise, false. + public static bool IsPrereleaseVersion(string? version = null) + { + string ver = version ?? GetCurrentVersionString(); + return TryParseSemVer(ver, out var parsed) ? parsed.Prerelease is not null : ver.Contains('-'); + } + /// /// Robust version comparison logic supporting Semantic Versioning 2.0 & standard System.Version. /// diff --git a/src/LocalTelemetry.App/Settings/SettingsDto.cs b/src/LocalTelemetry.App/Settings/SettingsDto.cs index 2e27936..3246982 100644 --- a/src/LocalTelemetry.App/Settings/SettingsDto.cs +++ b/src/LocalTelemetry.App/Settings/SettingsDto.cs @@ -108,7 +108,7 @@ public sealed class OverlayDto /// Action to perform on double-click ("settings" or "taskmanager"). public string DoubleClickAction { get; set; } = "settings"; - /// Overlay position relative to the taskbar ("left", "right", or "beside_apps"). + /// Overlay position relative to the taskbar ("left" or "right"). public string Position { get; set; } = "left"; /// Detected Windows 11 taskbar alignment ("left" or "center"). @@ -126,6 +126,15 @@ public sealed class OverlayDto /// Overlay opacity percentage (0-100). public int Opacity { get; set; } = 100; + /// Display targeting mode: "primary", "all", or "custom". + public string DisplayMode { get; set; } = "primary"; + + /// List of enabled display keys when DisplayMode is "custom". + public List EnabledDisplays { get; set; } = ["primary"]; + + /// List of all currently connected physical displays and their taskbar status. + public List DetectedDisplays { get; set; } = []; + /// DPI scale factor percentage (100 = normal). public int Scale { get; set; } = 100; @@ -160,8 +169,11 @@ public sealed class OverlayDto /// Whether to follow the Windows accent/theme color automatically. public bool FollowWindowsTheme { get; set; } = true; - /// Metric IDs displayed in the first overlay row (top row). - public List Row1 { get; set; } = []; + /// Active layout preset name ("default", "gaming", "compact", "micro", "thermals", "workstation", "network", "full", or "custom"). + public string LayoutPreset { get; set; } = "default"; + + /// Columns of metric IDs where each column has 1 or 2 metrics. + public List> Columns { get; set; } = []; /// Set of metric IDs whose colors have been customised by the user. public HashSet UserCustomizedMetricColors { get; set; } = []; @@ -217,6 +229,9 @@ public sealed class AlertsDto /// Alert when current month's network usage exceeds . public bool AlertNetMonthly { get; set; } + /// Alert when any disk temperature exceeds . + public bool AlertDiskTemp { get; set; } + // Thresholds /// CPU usage threshold (percent) above which an alert fires. public float CpuUsageMaxPct { get; set; } = 90; @@ -236,6 +251,9 @@ public sealed class AlertsDto /// GPU temperature threshold (°C) above which an alert fires. public float GpuTempMaxC { get; set; } = 90; + /// Maximum disk temperature (°C) before alert fires. + public float DiskTempMaxC { get; set; } = 70; + /// Battery level threshold (percent) below which an alert fires. public float BatteryLowPct { get; set; } = 20; @@ -264,6 +282,9 @@ public sealed class AlertsDto /// Whether to flash the overlay briefly on alert. public bool FlashOverlay { get; set; } = true; + /// Consecutive seconds a metric must continuously breach threshold before triggering alerts. + public int SustainedSecs { get; set; } = 3; + /// Minimum seconds between repeated alerts for the same metric. public int CooldownSecs { get; set; } = 30; @@ -287,7 +308,24 @@ public sealed class UpdateConfigDto public string CheckFrequency { get; set; } = "manual"; /// Whether to include pre-release and Release Candidate (RC) builds. - public bool IncludePrereleases { get; set; } = true; + public bool IncludePrereleases { get; set; } = UpdateConfig.DefaultIncludePrereleases; +} + +// DetectedDisplayDto +/// Information about a detected display monitor for settings display selection. +public sealed class DetectedDisplayDto +{ + /// Display identifier ("primary", "display_2", etc.). + public string Id { get; set; } = "primary"; + + /// Display friendly label (e.g. "Display 1 (Primary - 2048 x 1280)"). + public string Name { get; set; } = string.Empty; + + /// Whether this is the primary Windows display. + public bool IsPrimary { get; set; } + + /// Whether a valid Windows taskbar exists on this display. + public bool HasTaskbar { get; set; } } // SettingsDtoMapping @@ -345,13 +383,23 @@ public static SettingsDto ToDto(AppSettings src, bool isSpaceConstrained = false LabelColor = src.Overlay.LabelColor, BgColor = src.Overlay.BgColor, TextColor = src.Overlay.ValueColor, - MetricColors = new Dictionary(src.Overlay.MetricColors), - GroupColors = new Dictionary(src.Overlay.GroupColors), - DefaultMetricColors = new Dictionary(src.Overlay.DefaultMetricColors), + MetricColors = new(src.Overlay.MetricColors), + GroupColors = new(src.Overlay.GroupColors), + DefaultMetricColors = new(src.Overlay.DefaultMetricColors), FollowWindowsTheme = src.Overlay.FollowWindowsTheme, UserCustomizedMetricColors = [.. src.Overlay.UserCustomizedMetricColors], UserCustomizedGroupColors = [.. src.Overlay.UserCustomizedGroupColors], - Row1 = [.. src.Overlay.Row1], + LayoutPreset = src.Overlay.LayoutPreset, + Columns = [.. src.Overlay.Columns.Select(c => new List(c))], + DisplayMode = src.Overlay.DisplayMode ?? PrimaryDisplayId, + EnabledDisplays = src.Overlay.EnabledDisplays is { Count: > 0 } ? [.. src.Overlay.EnabledDisplays] : [PrimaryDisplayId], + DetectedDisplays = Win32.DisplayInfo.EnumerateDisplays().Select(d => new DetectedDisplayDto + { + Id = d.Id, + Name = d.FriendlyName, + IsPrimary = d.IsPrimary, + HasTaskbar = d.HasTaskbar + }).ToList(), TaskbarSpaceConstrained = isSpaceConstrained, AvailableSlotWidth = availableSlotWidth, }, @@ -371,12 +419,14 @@ public static SettingsDto ToDto(AppSettings src, bool isSpaceConstrained = false AlertGpuPower = src.Alerts.AlertGpuPower, AlertNetDaily = src.Alerts.AlertNetDaily, AlertNetMonthly = src.Alerts.AlertNetMonthly, + AlertDiskTemp = src.Alerts.AlertDiskTemp, CpuUsageMaxPct = src.Alerts.CpuUsageMaxPct, RamUsageMaxPct = src.Alerts.RamUsageMaxPct, GpuUsageMaxPct = src.Alerts.GpuUsageMaxPct, GpuVramMaxMb = src.Alerts.GpuVramMaxMb, CpuTempMaxC = src.Alerts.CpuTempMaxC, GpuTempMaxC = src.Alerts.GpuTempMaxC, + DiskTempMaxC = src.Alerts.DiskTempMaxC, BatteryLowPct = src.Alerts.BatteryLowPct, CpuFreqMinMhz = src.Alerts.CpuFreqMinMhz, CpuPowerMaxW = src.Alerts.CpuPowerMaxW, @@ -386,6 +436,7 @@ public static SettingsDto ToDto(AppSettings src, bool isSpaceConstrained = false NetMonthlyMaxGb = src.Alerts.NetMonthlyMaxGb, ShowToastNotif = src.Alerts.ShowToastNotif, FlashOverlay = src.Alerts.FlashOverlay, + SustainedSecs = src.Alerts.SustainedSecs, CooldownSecs = src.Alerts.CooldownSecs, FireOncePerSession = src.Alerts.FireOncePerSession, }, @@ -402,6 +453,8 @@ public static SettingsDto ToDto(AppSettings src, bool isSpaceConstrained = false }; } + private const string PrimaryDisplayId = "primary"; + /// Applies values from a onto an domain object. /// The target application settings to update. /// The source DTO received from the frontend. @@ -412,115 +465,147 @@ public static void ApplyTo(AppSettings settings, SettingsDto dto) settings.EnableFileLogging = dto.EnableFileLogging; settings.SystemLogLevel = string.IsNullOrEmpty(dto.SystemLogLevel) ? "Info" : dto.SystemLogLevel; - settings.Monitoring.PollIntervalMs = Math.Max(100, dto.Monitoring.IntervalMs); - settings.Monitoring.UseFahrenheit = dto.Monitoring.UseFahrenheit; - settings.Monitoring.UseNetBits = dto.Monitoring.UseNetBits; - settings.Monitoring.PreferredNic = !string.IsNullOrEmpty(dto.Monitoring.PreferredNic) - ? dto.Monitoring.PreferredNic : "auto"; - settings.Monitoring.EnableCpu = dto.Monitoring.TrackCpu; - settings.Monitoring.EnableGpu = dto.Monitoring.TrackGpu; - settings.Monitoring.EnableRam = dto.Monitoring.TrackRam; - settings.Monitoring.EnableNet = dto.Monitoring.TrackNet; - settings.Monitoring.EnableDisk = dto.Monitoring.TrackDisk; - settings.Monitoring.EnableBattery = dto.Monitoring.TrackBattery; - settings.Monitoring.CpuFreqMode = dto.Monitoring.CpuFreqMode; - settings.Monitoring.CpuUsageMode = dto.Monitoring.CpuUsageMode; - settings.Monitoring.GpuUsageSource = dto.Monitoring.GpuUsageSource; - settings.Monitoring.LogCpuMode = dto.Monitoring.LogCpuMode; - settings.Monitoring.LogGpuMode = dto.Monitoring.LogGpuMode; - settings.Monitoring.LogRamMode = dto.Monitoring.LogRamMode; - settings.Monitoring.LogNetMode = dto.Monitoring.LogNetMode; - settings.Monitoring.LogDiskMode = dto.Monitoring.LogDiskMode; - settings.Monitoring.LogBatteryMode = dto.Monitoring.LogBatteryMode; - settings.Overlay.Visible = dto.Overlay.Visible; + ApplyMonitoringSettings(settings.Monitoring, dto.Monitoring); + ApplyOverlaySettings(settings, dto.Overlay); + ApplyAlertSettings(settings.Alerts, dto.Alerts); + + settings.NetUsage.Enabled = dto.NetUsage.Enabled; + ApplyUpdateSettings(settings.Updates, dto.Updates); + settings.WindowTheme = dto.WindowTheme; + } + + private static void ApplyMonitoringSettings(MonitoringConfig cfg, MonitoringDto dto) + { + cfg.PollIntervalMs = Math.Max(1000, dto.IntervalMs); + cfg.UseFahrenheit = dto.UseFahrenheit; + cfg.UseNetBits = dto.UseNetBits; + cfg.PreferredNic = !string.IsNullOrEmpty(dto.PreferredNic) ? dto.PreferredNic : "auto"; + cfg.EnableCpu = dto.TrackCpu; + cfg.EnableGpu = dto.TrackGpu; + cfg.EnableRam = dto.TrackRam; + cfg.EnableNet = dto.TrackNet; + cfg.EnableDisk = dto.TrackDisk; + cfg.EnableBattery = dto.TrackBattery; + cfg.CpuFreqMode = dto.CpuFreqMode; + cfg.CpuUsageMode = dto.CpuUsageMode; + cfg.GpuUsageSource = dto.GpuUsageSource; + cfg.LogCpuMode = dto.LogCpuMode; + cfg.LogGpuMode = dto.LogGpuMode; + cfg.LogRamMode = dto.LogRamMode; + cfg.LogNetMode = dto.LogNetMode; + cfg.LogDiskMode = dto.LogDiskMode; + cfg.LogBatteryMode = dto.LogBatteryMode; + } + + private static void ApplyOverlaySettings(AppSettings settings, OverlayDto dto) + { + settings.Overlay.Visible = dto.Visible; if (!settings.ShowSystemTrayIcon && !settings.Overlay.Visible) { settings.ShowSystemTrayIcon = true; Log.Warn("Cannot disable both System Tray Icon and Overlay. Retaining System Tray Icon to prevent lockout."); } - settings.Overlay.DoubleClickAction = string.IsNullOrEmpty(dto.Overlay.DoubleClickAction) - ? "settings" : dto.Overlay.DoubleClickAction; - settings.Overlay.Placement = MapPositionToPlacement(dto.Overlay.Position); - settings.Overlay.PlacementOffset = dto.Overlay.OffsetX; - settings.Overlay.Opacity = dto.Overlay.Opacity; - settings.Overlay.ScalePct = dto.Overlay.Scale; - settings.Overlay.FontSizePx = dto.Overlay.FontSizePx; - settings.Overlay.FontBold = dto.Overlay.FontBold; - settings.Overlay.LabelColor = dto.Overlay.LabelColor; - settings.Overlay.BgColor = dto.Overlay.BgColor; - settings.Overlay.ValueColor = dto.Overlay.TextColor; - if (dto.Overlay.MetricColors is { Count: > 0 }) - settings.Overlay.MetricColors = new Dictionary(dto.Overlay.MetricColors); - if (dto.Overlay.GroupColors is { Count: > 0 }) - settings.Overlay.GroupColors = new Dictionary(dto.Overlay.GroupColors); - settings.Overlay.FollowWindowsTheme = dto.Overlay.FollowWindowsTheme; - settings.Overlay.UserCustomizedMetricColors = dto.Overlay.UserCustomizedMetricColors is { Count: > 0 } - ? [.. dto.Overlay.UserCustomizedMetricColors] : []; - settings.Overlay.UserCustomizedGroupColors = dto.Overlay.UserCustomizedGroupColors is { Count: > 0 } - ? [.. dto.Overlay.UserCustomizedGroupColors] : []; - settings.Overlay.DefaultMetricColors = dto.Overlay.DefaultMetricColors is { Count: > 0 } - ? new Dictionary(dto.Overlay.DefaultMetricColors) + settings.Overlay.DoubleClickAction = string.IsNullOrEmpty(dto.DoubleClickAction) + ? "settings" : dto.DoubleClickAction; + settings.Overlay.Placement = MapPositionToPlacement(dto.Position); + settings.Overlay.PlacementOffset = dto.OffsetX; + settings.Overlay.Opacity = dto.Opacity; + settings.Overlay.ScalePct = dto.Scale; + settings.Overlay.FontSizePx = dto.FontSizePx; + settings.Overlay.FontBold = dto.FontBold; + settings.Overlay.LabelColor = dto.LabelColor; + settings.Overlay.BgColor = dto.BgColor; + settings.Overlay.ValueColor = dto.TextColor; + if (dto.MetricColors is { Count: > 0 }) + settings.Overlay.MetricColors = new(dto.MetricColors); + if (dto.GroupColors is { Count: > 0 }) + settings.Overlay.GroupColors = new(dto.GroupColors); + settings.Overlay.FollowWindowsTheme = dto.FollowWindowsTheme; + settings.Overlay.UserCustomizedMetricColors = dto.UserCustomizedMetricColors is { Count: > 0 } + ? [.. dto.UserCustomizedMetricColors] : []; + settings.Overlay.UserCustomizedGroupColors = dto.UserCustomizedGroupColors is { Count: > 0 } + ? [.. dto.UserCustomizedGroupColors] : []; + settings.Overlay.DefaultMetricColors = dto.DefaultMetricColors is { Count: > 0 } + ? new(dto.DefaultMetricColors) : []; - settings.Overlay.Row1 = [.. dto.Overlay.Row1 ?? []]; - - settings.Alerts.Enabled = dto.Alerts.Enabled; - settings.Alerts.AlertCpuTemp = dto.Alerts.AlertCpuTemp; - settings.Alerts.AlertGpuTemp = dto.Alerts.AlertGpuTemp; - settings.Alerts.AlertCpuUsage = dto.Alerts.AlertCpuUsage; - settings.Alerts.AlertRamUsage = dto.Alerts.AlertRamUsage; - settings.Alerts.AlertGpuUsage = dto.Alerts.AlertGpuUsage; - settings.Alerts.AlertGpuVram = dto.Alerts.AlertGpuVram; - settings.Alerts.AlertBatteryLow = dto.Alerts.AlertBatteryLow; - settings.Alerts.AlertCpuFreq = dto.Alerts.AlertCpuFreq; - settings.Alerts.AlertCpuPower = dto.Alerts.AlertCpuPower; - settings.Alerts.AlertGpuFreq = dto.Alerts.AlertGpuFreq; - settings.Alerts.AlertGpuPower = dto.Alerts.AlertGpuPower; - settings.Alerts.AlertNetDaily = dto.Alerts.AlertNetDaily; - settings.Alerts.AlertNetMonthly = dto.Alerts.AlertNetMonthly; - settings.Alerts.CpuUsageMaxPct = dto.Alerts.CpuUsageMaxPct; - settings.Alerts.RamUsageMaxPct = dto.Alerts.RamUsageMaxPct; - settings.Alerts.GpuUsageMaxPct = dto.Alerts.GpuUsageMaxPct; - settings.Alerts.GpuVramMaxMb = dto.Alerts.GpuVramMaxMb; - settings.Alerts.CpuTempMaxC = dto.Alerts.CpuTempMaxC; - settings.Alerts.GpuTempMaxC = dto.Alerts.GpuTempMaxC; - settings.Alerts.BatteryLowPct = dto.Alerts.BatteryLowPct; - settings.Alerts.CpuFreqMinMhz = dto.Alerts.CpuFreqMinMhz; - settings.Alerts.CpuPowerMaxW = dto.Alerts.CpuPowerMaxW; - settings.Alerts.GpuFreqMinMhz = dto.Alerts.GpuFreqMinMhz; - settings.Alerts.GpuPowerMaxW = dto.Alerts.GpuPowerMaxW; - settings.Alerts.NetDailyMaxGb = dto.Alerts.NetDailyMaxGb; - settings.Alerts.NetMonthlyMaxGb = dto.Alerts.NetMonthlyMaxGb; - settings.Alerts.ShowToastNotif = dto.Alerts.ShowToastNotif; - settings.Alerts.FlashOverlay = dto.Alerts.FlashOverlay; - settings.Alerts.CooldownSecs = dto.Alerts.CooldownSecs; - settings.Alerts.FireOncePerSession = dto.Alerts.FireOncePerSession; + if (!string.IsNullOrWhiteSpace(dto.LayoutPreset)) + settings.Overlay.LayoutPreset = dto.LayoutPreset; + settings.Overlay.Columns = [.. dto.Columns?.Select(c => new List(c)) ?? []]; + settings.Overlay.DisplayMode = string.IsNullOrEmpty(dto.DisplayMode) ? PrimaryDisplayId : dto.DisplayMode; + settings.Overlay.EnabledDisplays = dto.EnabledDisplays is { Count: > 0 } + ? [.. dto.EnabledDisplays] + : [PrimaryDisplayId]; + } - settings.NetUsage.Enabled = dto.NetUsage.Enabled; - if (dto.Updates is not null) + private static void ApplyAlertSettings(AlertConfig cfg, AlertsDto dto) + { + cfg.Enabled = dto.Enabled; + cfg.AlertCpuTemp = dto.AlertCpuTemp; + cfg.AlertGpuTemp = dto.AlertGpuTemp; + cfg.AlertCpuUsage = dto.AlertCpuUsage; + cfg.AlertRamUsage = dto.AlertRamUsage; + cfg.AlertGpuUsage = dto.AlertGpuUsage; + cfg.AlertGpuVram = dto.AlertGpuVram; + cfg.AlertBatteryLow = dto.AlertBatteryLow; + cfg.AlertCpuFreq = dto.AlertCpuFreq; + cfg.AlertCpuPower = dto.AlertCpuPower; + cfg.AlertGpuFreq = dto.AlertGpuFreq; + cfg.AlertGpuPower = dto.AlertGpuPower; + cfg.AlertNetDaily = dto.AlertNetDaily; + cfg.AlertNetMonthly = dto.NetMonthlyMaxGb > 0 && dto.AlertNetMonthly; + cfg.AlertDiskTemp = dto.AlertDiskTemp; + cfg.CpuUsageMaxPct = dto.CpuUsageMaxPct; + cfg.RamUsageMaxPct = dto.RamUsageMaxPct; + cfg.GpuUsageMaxPct = dto.GpuUsageMaxPct; + cfg.GpuVramMaxMb = dto.GpuVramMaxMb; + cfg.CpuTempMaxC = dto.CpuTempMaxC; + cfg.GpuTempMaxC = dto.GpuTempMaxC; + cfg.DiskTempMaxC = dto.DiskTempMaxC; + cfg.BatteryLowPct = dto.BatteryLowPct; + cfg.CpuFreqMinMhz = dto.CpuFreqMinMhz; + cfg.CpuPowerMaxW = dto.CpuPowerMaxW; + cfg.GpuFreqMinMhz = dto.GpuFreqMinMhz; + cfg.GpuPowerMaxW = dto.GpuPowerMaxW; + cfg.NetDailyMaxGb = dto.NetDailyMaxGb; + cfg.NetMonthlyMaxGb = dto.NetMonthlyMaxGb; + cfg.ShowToastNotif = dto.ShowToastNotif; + cfg.FlashOverlay = dto.FlashOverlay; + cfg.SustainedSecs = dto.SustainedSecs > 0 ? dto.SustainedSecs : 3; + cfg.CooldownSecs = dto.CooldownSecs; + cfg.FireOncePerSession = dto.FireOncePerSession; + } + + private static void ApplyUpdateSettings(UpdateConfig cfg, UpdateConfigDto? dto) + { + if (dto is null) { - settings.Updates.CheckFrequency = dto.Updates.CheckFrequency ?? "weekly"; - settings.Updates.IncludePrereleases = dto.Updates.IncludePrereleases; + return; } - settings.WindowTheme = dto.WindowTheme; + + cfg.CheckFrequency = dto.CheckFrequency ?? "weekly"; + if (cfg.IncludePrereleases != dto.IncludePrereleases) + { + cfg.UserExplicitlySetIncludePrereleases = true; + } + cfg.IncludePrereleases = dto.IncludePrereleases; } private const string PositionLeft = "left"; private const string PositionRight = "right"; - private const string PositionBesideApps = "beside_apps"; private static string MapPlacementToPosition(string placement) => placement switch { - PositionBesideApps => PositionBesideApps, PositionLeft => PositionLeft, "center" => PositionLeft, + "beside_apps" => PositionLeft, PositionRight => PositionRight, _ => PositionRight, }; private static string MapPositionToPlacement(string position) => position switch { - PositionBesideApps => PositionBesideApps, PositionLeft => PositionLeft, + "beside_apps" => PositionLeft, _ => PositionRight, }; } diff --git a/src/LocalTelemetry.App/Settings/SettingsShell.xaml.cs b/src/LocalTelemetry.App/Settings/SettingsShell.xaml.cs index 6cddc8a..992aa90 100644 --- a/src/LocalTelemetry.App/Settings/SettingsShell.xaml.cs +++ b/src/LocalTelemetry.App/Settings/SettingsShell.xaml.cs @@ -3,6 +3,7 @@ using System.IO; using System.Net.NetworkInformation; using System.Runtime.Versioning; +using System.Text; using System.Text.Json; using System.Windows; using System.Windows.Input; @@ -29,8 +30,7 @@ public sealed partial class SettingsShell : Window internal static Action? UrlProcessLauncher { get; set; } internal static Action? FolderLauncherAction { get; set; } internal static Action? FolderProcessLauncher { get; set; } - internal static Action? ScriptExecutorOverride { get; set; } - internal static Func? ScriptExecutorAsyncOverride { get; set; } + internal static Func? SaveFileDialogOverride { get; set; } internal static bool SkipWebView2InitForTesting { get; set; } internal static bool SkipInitializeComponentForTesting { get; set; } internal static bool SkipShowForTesting { get; set; } @@ -62,6 +62,10 @@ public sealed partial class SettingsShell : Window private const string NvidiaVendor = "NVIDIA"; private const string EnabledStr = "enabled"; private const string DisabledStr = "disabled"; + private const string OverlayLayoutPresetPath = "overlay.layoutpreset"; + private const string OverlayColumnsPath = "overlay.columns"; + private const string OverlayRow1Path = "overlay.row1"; + private const string OverlayMetricsPath = "overlay.metrics"; private readonly AppSettings _cfg; private readonly string _wwwRoot; @@ -110,9 +114,34 @@ public SettingsShell(AppSettings cfg, NetUsageLogger? _ = null) SetWindowIcon(); Loaded += OnLoaded; - // Close WebView2 select dropdowns when the window is moved - // (WebView2 native popups render at stale screen coordinates after move) - LocationChanged += (_, _) => HandleWindowLocationChanged(); + StateChanged += (_, _) => + { + if (WindowState != WindowState.Minimized && IsVisible) + { + SendTrafficToday(); + OnAppUsageTick(null, EventArgs.Empty); + } + }; + IsVisibleChanged += (_, _) => + { + if (IsVisible && WindowState != WindowState.Minimized) + { + SendTrafficToday(); + OnAppUsageTick(null, EventArgs.Empty); + } + }; + } + + protected override void OnSourceInitialized(EventArgs e) + { + base.OnSourceInitialized(e); + var handle = new WindowInteropHelper(this).Handle; + if (handle != IntPtr.Zero) + { + int style = NativeMethods.GetWindowLong(handle, NativeMethods.GWL_STYLE); + style |= NativeMethods.WS_CAPTION | NativeMethods.WS_SYSMENU | NativeMethods.WS_MINIMIZEBOX | NativeMethods.WS_MAXIMIZEBOX; + NativeMethods.SetWindowLong(handle, NativeMethods.GWL_STYLE, style); + } } private void SetWindowIcon() @@ -138,29 +167,6 @@ private void SetWindowIcon() catch (Exception ex) { Log.Error(ex, "Window icon extraction failed"); } } - private void HandleWindowLocationChanged() - { - if (_webViewReady && (ScriptExecutorOverride is not null || ScriptExecutorAsyncOverride is not null || WebView?.CoreWebView2 is not null)) - { - try - { - if (ScriptExecutorOverride is not null) - { - ScriptExecutorOverride("try{document.activeElement?.blur();}catch(e){console.warn('WebView2 blur failed',e);}"); - } - else if (ScriptExecutorAsyncOverride is not null) - { - ScriptExecutorAsyncOverride("try{document.activeElement?.blur();}catch(e){console.warn('WebView2 blur failed',e);}"); - } - else - { - WebView!.CoreWebView2.ExecuteScriptAsync("try{document.activeElement?.blur();}catch(e){console.warn('WebView2 blur failed',e);}"); - } - } - catch (Exception ex) { Log.Error(ex, "WebView2 blur script failed after window move"); } - } - } - // Use Loaded event so the WPF visual tree is ready. // Guard with _webViewReady so re-showing the window doesn't re-init. private async void OnLoaded(object sender, RoutedEventArgs e) @@ -173,30 +179,7 @@ private async void OnLoaded(object sender, RoutedEventArgs e) _appUsageTimer = new System.Windows.Threading.DispatcherTimer(); _appUsageTimer.Interval = TimeSpan.FromSeconds(2); - _appUsageTimer.Tick += (s, ev) => - { - if (_currentProcess == null) return; - try - { - _currentProcess.Refresh(); - var cpuTime = _currentProcess.TotalProcessorTime; - var now = DateTime.UtcNow; - var timeDelta = now - _lastUsageCheckTime; - var cpuDelta = cpuTime - _lastProcessorTime; - - _lastProcessorTime = cpuTime; - _lastUsageCheckTime = now; - - double cpuPct = 0; - if (timeDelta.TotalMilliseconds > 0) - { - cpuPct = cpuDelta.TotalMilliseconds / timeDelta.TotalMilliseconds * 100.0 / Environment.ProcessorCount; - } - - WindowTitleText.Text = $"LocalTelemetry ({cpuPct:0.0}% CPU)"; - } - catch (Exception ex) { Log.Warn(ex, "App usage title update failed"); } - }; + _appUsageTimer.Tick += OnAppUsageTick; _appUsageTimer.Start(); } @@ -218,7 +201,7 @@ private void SetupTimersAndSubscriptions() // Start periodic push of today's traffic totals (every 5 seconds). _trafficTodayTimer = new System.Threading.Timer( - _ => Dispatcher.Invoke(SendTrafficToday), + _ => Dispatcher.Invoke(OnTrafficTodayTimerTick), null, TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5)); TrafficHistoryStore.HistoryUpdated += OnHistoryUpdated; @@ -226,7 +209,6 @@ private void SetupTimersAndSubscriptions() _webViewReady = true; SendTrafficToday(); SendTrafficMonths(); - SendAllTrafficHistory(); } // WebView2 init @@ -245,7 +227,7 @@ private async Task InitWebViewAsync() var envOptions = new CoreWebView2EnvironmentOptions { Language = "en-GB", - AdditionalBrowserArguments = "--disable-features=EyeDropper --force-dark-mode", + AdditionalBrowserArguments = "--disable-features=CalculateNativeWinOcclusion,EyeDropper,Translate,OptimizationHints,MediaRouter --renderer-process-limit=1 --js-flags=\"--max-old-space-size=32 --optimize-for-size\" --disable-gpu-shader-disk-cache --disable-background-networking --aggressive-cache-discard --force-dark-mode", }; CoreWebView2Environment env = await CoreWebView2Environment.CreateAsync( @@ -254,6 +236,20 @@ await CoreWebView2Environment.CreateAsync( options: envOptions); await WebView.EnsureCoreWebView2Async(env); + WebView.NavigationCompleted += async (_, _) => + { + _webViewReady = true; + RefreshTrafficHistory(); + await Task.Delay(1000); + try + { + NativeMethods.EmptyWorkingSet(Process.GetCurrentProcess().Handle); + } + catch (Exception ex) + { + Log.Debug(ex, "Failed initial working set trimming after WebView2 navigation"); + } + }; WebView.CoreWebView2.Profile.PreferredColorScheme = CoreWebView2PreferredColorScheme.Dark; CoreWebView2Settings wv = WebView.CoreWebView2.Settings; @@ -267,6 +263,11 @@ await CoreWebView2Environment.CreateAsync( wv.IsStatusBarEnabled = false; WebView.CoreWebView2.WebMessageReceived += OnWebMessageReceived; + WebView.CoreWebView2.DownloadStarting += (_, args) => + { + args.Handled = true; + args.Cancel = true; + }; WebView.CoreWebView2.SetVirtualHostNameToFolderMapping( hostName: SettingsHost, @@ -316,6 +317,58 @@ await CoreWebView2Environment.CreateAsync( } } + private void OnTrafficTodayTimerTick() + { + if (!SkipShowForTesting && (!IsVisible || WindowState == WindowState.Minimized)) return; + SendTrafficToday(); + } + + internal void OnAppUsageTick(object? s, EventArgs ev) + { + if (_currentProcess == null) return; + if (!SkipShowForTesting && (!IsVisible || WindowState == WindowState.Minimized)) + { + try + { + NativeMethods.EmptyWorkingSet(_currentProcess.Handle); + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to empty working set while hidden or minimized"); + } + return; + } + try + { + _currentProcess.Refresh(); + var cpuTime = _currentProcess.TotalProcessorTime; + var now = DateTime.UtcNow; + var timeDelta = now - _lastUsageCheckTime; + var cpuDelta = cpuTime - _lastProcessorTime; + + _lastProcessorTime = cpuTime; + _lastUsageCheckTime = now; + + double cpuPct = 0; + if (timeDelta.TotalMilliseconds > 0) + { + cpuPct = cpuDelta.TotalMilliseconds / timeDelta.TotalMilliseconds * 100.0 / Environment.ProcessorCount; + } + + long privateWs = NativeMethods.GetPrivateWorkingSetBytes(_currentProcess.Handle); + double ramMb = privateWs > 0 + ? privateWs / (1024.0 * 1024.0) + : _currentProcess.WorkingSet64 / (1024.0 * 1024.0); + string title = $"LocalTelemetry ({cpuPct:0.0}% CPU, {ramMb:0.0} MB RAM)"; + WindowTitleText.Text = title; + Title = "LocalTelemetry Settings"; + } + catch (Exception ex) + { + Log.Warn(ex, "App usage title update failed"); + } + } + internal static bool IsValidMessageSource(string? source) { return !string.IsNullOrWhiteSpace(source) && @@ -371,7 +424,21 @@ internal void HandleWebMessageJson(string json) case "getSystemInfo": SendSystemInfo(); break; case "openUrl": HandleOpenUrl(root); break; case "openFolder": HandleOpenFolder(root); break; - case "getTrafficHistoryAll": SendAllTrafficHistory(); break; + case "exportDatabase": HandleExportDatabase(root); break; + case "getTrafficHistoryAll": + SendAllTrafficHistory(); + _ = Task.Run(async () => + { + try + { + await WindowsNetworkUsageProvider.RefreshTodayUsageAsync(TrafficHistoryStore.HistoryFile); + } + catch (Exception ex) + { + Log.Debug(ex, "Background today traffic refresh failed"); + } + }); + break; case "importDat": HandleImportJson(json); break; case "importWindowsUsage": LastImportTask = HandleImportWindowsUsage(root); break; case "checkForUpdates": HandleCheckForUpdatesMsg(root); break; @@ -435,13 +502,43 @@ private void HandleOpenUrl(JsonElement root) private static void HandleOpenFolder(JsonElement root) { - if (!root.TryGetProperty(PayloadProp, out JsonElement folderPayload) - || !folderPayload.TryGetProperty("target", out JsonElement targetEl)) + if (!root.TryGetProperty(PayloadProp, out JsonElement folderPayload)) + return; + + string? specificPath = folderPayload.TryGetProperty("path", out JsonElement pEl) ? pEl.GetString() : null; + if (!string.IsNullOrWhiteSpace(specificPath) && (File.Exists(specificPath) || Directory.Exists(specificPath))) { + OpenSpecificFolder(specificPath); return; } - string target = targetEl.GetString() ?? string.Empty; + if (folderPayload.TryGetProperty("target", out JsonElement targetEl)) + { + OpenTargetFolder(targetEl.GetString() ?? string.Empty); + } + } + + private static void OpenSpecificFolder(string specificPath) + { + Log.Info($"Opened folder in Windows Explorer for '{specificPath}'"); + if (FolderLauncherAction is not null) + { + FolderLauncherAction(specificPath); + return; + } + + string explorerPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "explorer.exe"); + var psi = new ProcessStartInfo + { + FileName = explorerPath, + Arguments = File.Exists(specificPath) ? $"/select,\"{specificPath}\"" : $"\"{specificPath}\"", + UseShellExecute = true + }; + LaunchFolderProcess(psi); + } + + private static void OpenTargetFolder(string target) + { string dirToOpen; string folderLabel; @@ -461,26 +558,100 @@ private static void HandleOpenFolder(JsonElement root) folderLabel = "data"; } - if (!string.IsNullOrEmpty(dirToOpen) && Directory.Exists(dirToOpen)) + if (string.IsNullOrEmpty(dirToOpen) || !Directory.Exists(dirToOpen)) return; + + Log.Info($"Opened {folderLabel} folder in Windows Explorer ({dirToOpen})"); + if (FolderLauncherAction is not null) + { + FolderLauncherAction(dirToOpen); + return; + } + + string explorerPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "explorer.exe"); + var psi = new ProcessStartInfo { - Log.Info($"Opened {folderLabel} folder in Windows Explorer ({dirToOpen})"); - if (FolderLauncherAction is not null) + FileName = explorerPath, + Arguments = $"\"{dirToOpen}\"", + UseShellExecute = true + }; + LaunchFolderProcess(psi); + } + + private static void LaunchFolderProcess(ProcessStartInfo psi) + { + if (FolderProcessLauncher is not null) + FolderProcessLauncher(psi); + else if (!SkipShowForTesting && !SkipWebView2InitForTesting) + Process.Start(psi); + } + + internal void HandleExportDatabase(JsonElement root) + { + if (!root.TryGetProperty(PayloadProp, out JsonElement payload)) return; + string content = payload.TryGetProperty("content", out JsonElement c) ? c.GetString() ?? string.Empty : string.Empty; + string defaultFileName = payload.TryGetProperty("defaultFileName", out JsonElement f) ? f.GetString() ?? "internet_usage.jsonl" : "internet_usage.jsonl"; + + try + { + bool? dialogResult; + string? selectedPath; + + if (SaveFileDialogOverride is not null) { - FolderLauncherAction(dirToOpen); - return; + (dialogResult, selectedPath) = SaveFileDialogOverride(defaultFileName); + } + else + { + var sfd = new Microsoft.Win32.SaveFileDialog + { + Title = "Export Traffic Database", + Filter = "JSON Lines (*.jsonl)|*.jsonl|All files (*.*)|*.*", + FileName = defaultFileName, + DefaultExt = ".jsonl" + }; + dialogResult = sfd.ShowDialog(this); + selectedPath = sfd.FileName; } - string explorerPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "explorer.exe"); - var psi = new ProcessStartInfo + if (dialogResult == true && !string.IsNullOrWhiteSpace(selectedPath)) { - FileName = explorerPath, - Arguments = $"\"{dirToOpen}\"", - UseShellExecute = true - }; - if (FolderProcessLauncher is not null) - FolderProcessLauncher(psi); - else if (!SkipShowForTesting && !SkipWebView2InitForTesting) - Process.Start(psi); + File.WriteAllText(selectedPath, content, Encoding.UTF8); + Log.Info($"Exported traffic database to '{selectedPath}'"); + PostJson(JsonSerializer.Serialize(new + { + type = "exportDatabaseResult", + payload = new + { + success = true, + filePath = selectedPath, + fileName = Path.GetFileName(selectedPath) + } + }, JsonOut)); + } + else + { + PostJson(JsonSerializer.Serialize(new + { + type = "exportDatabaseResult", + payload = new + { + cancelled = true + } + }, JsonOut)); + } + } + catch (Exception ex) + { + Log.Error(ex, "Failed to export traffic database"); + PostJson(JsonSerializer.Serialize(new + { + type = "exportDatabaseResult", + payload = new + { + success = false, + error = ex.Message + } + }, JsonOut)); } } @@ -489,10 +660,6 @@ private void HandleCheckForUpdatesMsg(JsonElement root) bool force = root.TryGetProperty(PayloadProp, out JsonElement forcePayload) && forcePayload.TryGetProperty("force", out JsonElement forceEl) && forceEl.GetBoolean(); - if (force) - { - Log.Info("User requested manual software update check"); - } _ = HandleCheckForUpdatesAsync(force); } @@ -514,6 +681,34 @@ public void SendUpdatedSettings() SendSettings(); } + /// Pushes fresh traffic history records and today's usage totals to the frontend. + public void RefreshTrafficHistory() + { + if (!_webViewReady) return; + SendTrafficToday(); + SendTrafficMonths(); + } + + /// + /// Notifies the settings UI that the taskbar space constraint state or available slot width has changed. + /// + /// Whether the taskbar slot is narrower than the overlay width. + /// The measured width in pixels available for the overlay. + public void NotifyTaskbarSlotChanged(bool constrained, int availableWidth) + { + var envelope = new + { + type = "taskbarSlotChanged", + payload = new + { + taskbarSpaceConstrained = constrained, + availableSlotWidth = availableWidth + } + }; + PostJson(JsonSerializer.Serialize(envelope, JsonOut)); + Log.Debug($"Dispatched taskbar slot constraint update to settings UI (constrained: {constrained}, availableWidth: {availableWidth})"); + } + private void SendSettings() { var (constrained, availableWidth) = TaskbarSlotStatusProvider?.Invoke() ?? (false, 0); @@ -576,6 +771,7 @@ private static List GetActiveNics() /// Debounced handler for . private void OnNetworkAddressChanged(object? sender, EventArgs e) { + if (!SkipShowForTesting && (!IsVisible || WindowState == WindowState.Minimized)) return; _nicDebounceTimer?.Change(1000, Timeout.Infinite); } @@ -623,6 +819,7 @@ private void SendAllTrafficHistory() private void SendTrafficToday() { if (!_webViewReady) return; + var (td, tu) = TrafficHistoryStore.GetToday(); var payload = new { downBytes = td, upBytes = tu }; var envelope = new { type = "trafficToday", payload }; @@ -637,7 +834,6 @@ private void OnHistoryUpdated() { SendTrafficToday(); SendTrafficMonths(); - SendAllTrafficHistory(); } }); } @@ -677,14 +873,14 @@ internal void HandleImportJson(string json) } int days; - string trimmed = content.TrimStart(); - if (trimmed.StartsWith('{')) + string trimmed = content.TrimStart('\uFEFF', ' ', '\t', '\r', '\n'); + if (trimmed.StartsWith('{') || trimmed.StartsWith('[')) { - days = JsonlTrafficImporter.Import(content); + days = JsonlTrafficImporter.Import(trimmed); } else { - days = DatImporter.Import(content); + days = DatImporter.Import(trimmed); } TrafficHistoryStore.Save(); @@ -746,6 +942,7 @@ private async Task HandleImportWindowsUsage(JsonElement root) } catch (Exception ex) { + Log.Error(ex, "Traffic history file access failed during import"); PostWindowsImportResult(false, 0, 0, 0, $"Traffic history not initialized: {ex.Message}"); return; } @@ -866,7 +1063,12 @@ private void SendSystemInfo() formattedSize = d.FormattedSize, sizeGb = d.SizeBytes.HasValue ? $"{d.SizeBytes.Value / (1024.0 * 1024.0 * 1024.0):F1}" : null, diskIndex = d.DiskIndex, - boot = d.IsBootDrive + boot = d.IsBootDrive, + health = d.HealthStatus, + temperatureC = d.TemperatureC, + remainingLifePercent = d.RemainingLifePercent, + totalWrittenTb = d.TotalWrittenTb.HasValue ? $"{d.TotalWrittenTb.Value:F1}" : null, + totalReadTb = d.TotalReadTb.HasValue ? $"{d.TotalReadTb.Value:F1}" : null, }).ToList(), ["motherboardMfr"] = SystemInfo.GetMotherboardManufacturer(), ["motherboardModel"] = SystemInfo.GetMotherboardProductName(), @@ -1063,15 +1265,28 @@ private static List ComputeSettingsDiff(string beforeJson, string afterJ var alertChanges = rawChanges.Where(c => c.Path.StartsWith("alerts.", StringComparison.OrdinalIgnoreCase)).ToList(); var colorChanges = rawChanges.Where(c => c.Path.StartsWith(groupColorsPrefix, StringComparison.OrdinalIgnoreCase) || c.Path.StartsWith(metricColorsPrefix, StringComparison.OrdinalIgnoreCase)).ToList(); + var layoutChanges = rawChanges.Where(c => c.Path.Equals(OverlayLayoutPresetPath, StringComparison.OrdinalIgnoreCase) + || c.Path.Equals(OverlayColumnsPath, StringComparison.OrdinalIgnoreCase) + || c.Path.Equals(OverlayRow1Path, StringComparison.OrdinalIgnoreCase) + || c.Path.Equals(OverlayMetricsPath, StringComparison.OrdinalIgnoreCase)).ToList(); var result = rawChanges .Where(c => !c.Path.StartsWith("alerts.", StringComparison.OrdinalIgnoreCase) && !c.Path.StartsWith(groupColorsPrefix, StringComparison.OrdinalIgnoreCase) - && !c.Path.StartsWith(metricColorsPrefix, StringComparison.OrdinalIgnoreCase)) + && !c.Path.StartsWith(metricColorsPrefix, StringComparison.OrdinalIgnoreCase) + && !c.Path.Equals(OverlayLayoutPresetPath, StringComparison.OrdinalIgnoreCase) + && !c.Path.Equals(OverlayColumnsPath, StringComparison.OrdinalIgnoreCase) + && !c.Path.Equals(OverlayRow1Path, StringComparison.OrdinalIgnoreCase) + && !c.Path.Equals(OverlayMetricsPath, StringComparison.OrdinalIgnoreCase)) .Select(c => FormatHumanReadableChange(c.Path, c.OldVal, c.NewVal)) .Where(s => !string.IsNullOrWhiteSpace(s)) .ToList(); + if (layoutChanges.Count > 0) + { + result.AddRange(ConsolidateLayoutDiff(layoutChanges)); + } + if (alertChanges.Count > 0) { result.Add(ConsolidateAlertsDiff(alertChanges)); @@ -1122,7 +1337,7 @@ private static string FormatMasterAlertToggle( if (map.TryGetValue(threshKey, out var thresh)) enabledSummaries.Add($"{label} ({prefix}{thresh.NewVal}{unit})"); else - enabledSummaries.Add($"{label} enabled"); + enabledSummaries.Add(label); } return enabledSummaries.Count > 0 @@ -1412,10 +1627,25 @@ private static string FormatHumanReadableChange(string path, string oldVal, stri "overlay.flashoverlay" => $"Flashing alerts {ToggleStr(newVal)}", "overlay.showlabels" => newVal.Equals("true", StringComparison.OrdinalIgnoreCase) ? "Labels shown" : "Labels hidden", - "overlay.doubleclickaction" => newVal.Equals("taskmanager", StringComparison.OrdinalIgnoreCase) - ? "Double-click action set to Task Manager" : "Double-click action set to Open Settings", + "overlay.doubleclickaction" => newVal.ToLowerInvariant() switch + { + "taskmanager" => "Double-click action set to Task Manager", + "none" => "Double-click action set to None", + _ => "Double-click action set to Open Settings", + }, "overlay.followwindowstheme" => $"Follow Windows theme {ToggleStr(newVal)}", - "overlay.row1" or "overlay.metrics" => FormatOverlayLayoutChange(oldVal, newVal), + "overlay.displaymode" => newVal.ToLowerInvariant() switch + { + "primary" => "Overlay display mode set to Primary Display", + "secondary" => "Overlay display mode set to Secondary Displays", + "all" => "Overlay display mode set to All Displays", + "custom" => "Overlay display mode set to Custom Displays", + _ => $"Overlay display mode set to {newVal}", + }, + "overlay.enableddisplays" => $"Enabled displays set to {newVal}", + "overlay.taskbarspaceconstrained" or "overlay.availableslotwidth" => "", + OverlayLayoutPresetPath => $"Layout preset updated to '{GetPresetDisplayName(newVal)}'", + OverlayColumnsPath or OverlayRow1Path or OverlayMetricsPath => FormatOverlayLayoutChange(oldVal, newVal), _ when normPath.StartsWith("overlay.metriccolors.", StringComparison.Ordinal) => $"Metric '{GetMetricName(path[21..])}' color changed from {oldVal} to {newVal}", _ when normPath.StartsWith("overlay.groupcolors.", StringComparison.Ordinal) => @@ -1456,39 +1686,179 @@ _ when normPath.StartsWith("overlay.usercustomized", StringComparison.Ordinal) = "alerts.gpupowermaxw" => $"GPU power threshold set to {newVal} W", "alerts.netdailymaxgb" => $"Daily network limit set to {newVal} GB", "alerts.netmonthlymaxgb" => $"Monthly network limit set to {newVal} GB", + "alerts.sustainedsecs" => $"Alert sustained duration set to {newVal}s", "alerts.cooldownsecs" => $"Alert cooldown set to {newVal}s", "alerts.showtoastnotif" => $"Alert toast notifications {ToggleStr(newVal)}", "alerts.flashoverlay" => $"Alert overlay flashing {ToggleStr(newVal)}", "netusage.enabled" => $"Network usage tracking {ToggleStr(newVal)}", "updates.includeprereleases" => $"Include pre-release builds {ToggleStr(newVal)}", "updates.checkfrequency" => newVal.Length > 0 ? $"Update check frequency set to {char.ToUpperInvariant(newVal[0]) + newVal[1..]}" : "Update check frequency changed", + "updates.userexplicitlysetincludeprereleases" => "", _ => null }; private static string ToggleStr(string newVal) => newVal.Equals("true", StringComparison.OrdinalIgnoreCase) ? EnabledStr : DisabledStr; - private static string GetMetricName(string metricId) => metricId.ToLowerInvariant() switch - { - "cpu_pct" => "CPU Usage", - "cpu_temp" => "CPU Temperature", - "cpu_freq" => "CPU Frequency", - "cpu_power" => "CPU Power", - "ram_pct" => "RAM Usage %", - "ram_used" => "RAM Used", - "gpu_pct" => "GPU Usage", - "gpu_temp" => "GPU Temperature", - "gpu_vram" => "GPU VRAM", - "gpu_freq" => "GPU Frequency", - "gpu_power" => "GPU Power", - "net_down" => "Download Speed", - "net_up" => "Upload Speed", - "net_total" => "Total Network Usage", - "battery_pct" => "Battery %", - "battery_rate" => "Battery Rate", - _ when metricId.StartsWith("disk_", StringComparison.Ordinal) => $"Disk {metricId[5..].ToUpperInvariant()}", - _ => metricId + private static string GetPresetDisplayName(string presetId) => presetId.Trim('"').Trim().ToLowerInvariant() switch + { + "default" => "Default", + "gaming" => "Gaming", + "compact" => "Compact", + "full" => "Full Telemetry", + "custom" => "Custom", + _ when presetId.Trim('"').Trim().Length > 0 => char.ToUpperInvariant(presetId.Trim('"').Trim()[0]) + presetId.Trim('"').Trim()[1..], + _ => "Custom" }; + private static List ConsolidateLayoutDiff(List<(string Path, string OldVal, string NewVal)> layoutChanges) + { + var result = new List(); + var presetChange = layoutChanges.FirstOrDefault(c => c.Path.Equals(OverlayLayoutPresetPath, StringComparison.OrdinalIgnoreCase)); + var rowChange = layoutChanges.FirstOrDefault(c => c.Path.Equals(OverlayColumnsPath, StringComparison.OrdinalIgnoreCase) + || c.Path.Equals(OverlayRow1Path, StringComparison.OrdinalIgnoreCase) + || c.Path.Equals(OverlayMetricsPath, StringComparison.OrdinalIgnoreCase)); + + bool hasPreset = !string.IsNullOrEmpty(presetChange.Path); + bool hasRow = !string.IsNullOrEmpty(rowChange.Path); + + if (hasPreset) + { + string cleanNewPreset = presetChange.NewVal.Trim('"').Trim(); + + if (!cleanNewPreset.Equals("custom", StringComparison.OrdinalIgnoreCase)) + { + result.Add($"Layout preset updated to '{GetPresetDisplayName(cleanNewPreset)}'"); + return result; + } + + if (hasRow) + { + string rowDetails = FormatCustomLayoutDetails(rowChange.OldVal, rowChange.NewVal); + if (!string.IsNullOrWhiteSpace(rowDetails)) + { + result.Add($"Layout preset updated to 'Custom' ({rowDetails})"); + return result; + } + } + + result.Add("Layout preset updated to 'Custom'"); + return result; + } + + if (hasRow) + { + string rowMsg = FormatOverlayLayoutChange(rowChange.OldVal, rowChange.NewVal); + if (!string.IsNullOrWhiteSpace(rowMsg)) + { + result.Add(rowMsg); + } + } + + return result; + } + + private static string FormatCustomLayoutDetails(string oldVal, string newVal) + { + var newIds = ParseMetricIds(newVal); + var oldIds = ParseMetricIds(oldVal); + + if (newIds.Count == 0) return "cleared"; + + var added = newIds.Except(oldIds).Select(GetMetricName).ToList(); + var removed = oldIds.Except(newIds).Select(GetMetricName).ToList(); + + if (added.Count > 0) + { + if (removed.Count == 0) + return $"Added {string.Join(", ", added)}"; + return $"Added {string.Join(", ", added)}, Removed {string.Join(", ", removed)}"; + } + if (removed.Count > 0) + { + return $"Removed {string.Join(", ", removed)}"; + } + if (!oldIds.SequenceEqual(newIds)) + { + return "Metrics layout reordered"; + } + return string.Empty; + } + + private static string GetMetricName(string metricId) + { + return metricId.ToLowerInvariant() switch + { + "cpu_pct" => "CPU Usage", + "cpu_temp" => "CPU Temperature", + "cpu_freq" => "CPU Frequency", + "cpu_power" => "CPU Power", + "ram_pct" => "RAM Usage %", + "ram_used" => "RAM Used", + "gpu_pct" => "GPU Usage", + "gpu_temp" => "GPU Temperature", + "gpu_vram" => "GPU VRAM", + "gpu_freq" => "GPU Frequency", + "gpu_power" => "GPU Power", + "net_down" => "Download Speed", + "net_up" => "Upload Speed", + "net_total" => "Total Network Usage", + "battery_pct" => "Battery %", + "battery_rate" => "Battery Rate", + _ when metricId.StartsWith("disk_", StringComparison.OrdinalIgnoreCase) => GetDiskMetricName(metricId), + _ when Metrics.AllMetricsById.TryGetValue(metricId, out var desc) && !string.IsNullOrWhiteSpace(desc.FullLabel) => desc.FullLabel, + _ => metricId + }; + } + + private static string GetDiskMetricName(string metricId) + { + int last = metricId.LastIndexOf('_'); + if (last <= 5) return metricId; + string diskPart = metricId[5..last]; + string aspectRaw = metricId[(last + 1)..]; + string aspect = char.ToUpperInvariant(aspectRaw[0]) + aspectRaw[1..].ToLowerInvariant(); + + if (diskPart.StartsWith("disk", StringComparison.OrdinalIgnoreCase) && int.TryParse(diskPart[4..], out int idx)) + { + var disks = SystemInfo.GetAllDisks(); + if (disks is not null && disks.Count > 0) + { + var archPairs = disks.Select(d => ((string?)d.DisplayType, (string?)d.BusType)).ToList(); + var labels = HardwareMonitor.ComputeDiskArchitectureLabels(archPairs); + if (idx >= 0 && idx < labels.Count) + { + return $"{labels[idx]} {aspect}"; + } + } + + if (Metrics.AllMetricsById.TryGetValue(metricId, out var desc) && !string.IsNullOrWhiteSpace(desc.FullLabel) + && !desc.FullLabel.StartsWith("DISK", StringComparison.OrdinalIgnoreCase)) + { + return desc.FullLabel; + } + + return $"Disk {idx + 1} {aspect}"; + } + + return FormatFallbackDiskMetricName(metricId); + } + + private static string FormatFallbackDiskMetricName(string metricId) + { + var parts = metricId.Split('_', StringSplitOptions.RemoveEmptyEntries); + if (parts.Length >= 3) + { + string diskPart = parts[1]; + string aspect = char.ToUpperInvariant(parts[2][0]) + parts[2][1..].ToLowerInvariant(); + if (diskPart.StartsWith("disk", StringComparison.OrdinalIgnoreCase) && int.TryParse(diskPart[4..], out int idx)) + { + return $"Disk {idx + 1} {aspect}"; + } + return $"{diskPart.ToUpperInvariant()} {aspect}"; + } + return $"Disk {metricId[5..]}"; + } + private static List ParseMetricIds(string val) { var metricIds = new List(); @@ -1497,32 +1867,62 @@ private static List ParseMetricIds(string val) if (trimmed.StartsWith('[') && trimmed.EndsWith(']')) { - try - { - using var doc = JsonDocument.Parse(trimmed); - if (doc.RootElement.ValueKind == JsonValueKind.Array) - { - foreach (var elem in doc.RootElement.EnumerateArray()) - { - string? id = elem.GetString(); - if (!string.IsNullOrWhiteSpace(id)) - metricIds.Add(id.Trim()); - } - } + if (TryParseJsonMetricIds(trimmed, metricIds)) return metricIds; + + trimmed = trimmed.Trim('[', ']'); + } + + AddDelimitedMetricIds(trimmed, metricIds); + return metricIds; + } + + private static bool TryParseJsonMetricIds(string json, List metricIds) + { + try + { + using var doc = JsonDocument.Parse(json); + if (doc.RootElement.ValueKind != JsonValueKind.Array) return false; + + foreach (var elem in doc.RootElement.EnumerateArray()) + { + ExtractMetricIdsFromElement(elem, metricIds); } - catch (JsonException ex) + return true; + } + catch (JsonException ex) + { + Log.Debug(ex, "Failed to parse metrics layout as JSON; falling back to delimiter split"); + return false; + } + } + + private static void ExtractMetricIdsFromElement(JsonElement elem, List metricIds) + { + if (elem.ValueKind == JsonValueKind.Array) + { + foreach (var inner in elem.EnumerateArray()) { - Log.Debug(ex, "Failed to parse metrics layout as JSON; falling back to delimiter split"); - var parts = trimmed.Trim('[', ']').Split([',', ';'], StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); - metricIds.AddRange(parts.Select(p => p.Trim('"', '\'')).Where(p => !string.IsNullOrWhiteSpace(p))); - return metricIds; + AddMetricIdIfValid(inner.GetString(), metricIds); } + return; } - var fallbackParts = trimmed.Split([',', ';'], StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); - metricIds.AddRange(fallbackParts.Select(p => p.Trim('"', '\'')).Where(p => !string.IsNullOrWhiteSpace(p))); - return metricIds; + AddMetricIdIfValid(elem.GetString(), metricIds); + } + + private static void AddMetricIdIfValid(string? id, List metricIds) + { + if (!string.IsNullOrWhiteSpace(id)) + { + metricIds.Add(id.Trim()); + } + } + + private static void AddDelimitedMetricIds(string text, List metricIds) + { + var parts = text.Split([',', ';'], StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); + metricIds.AddRange(parts.Select(p => p.Trim('"', '\'')).Where(p => !string.IsNullOrWhiteSpace(p))); } private static string FormatOverlayLayoutChange(string oldVal, string newVal) @@ -1579,7 +1979,17 @@ private void TitleBar_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) return; } if (SkipDragMoveForTesting) return; - DragMove(); + if (e.ButtonState == MouseButtonState.Pressed) + { + try + { + DragMove(); + } + catch (InvalidOperationException ex) + { + Log.Debug(ex, "DragMove ignored due to window or mouse capture state"); + } + } } /// Closes the settings configuration window. @@ -1591,14 +2001,48 @@ private void CloseButton_Click(object sender, RoutedEventArgs e) // Disposal protected override void OnClosed(EventArgs e) { - NetworkChange.NetworkAddressChanged -= OnNetworkAddressChanged; - _nicDebounceTimer?.Dispose(); - _trafficTodayTimer?.Dispose(); + try + { + NetworkChange.NetworkAddressChanged -= OnNetworkAddressChanged; + TrafficHistoryStore.HistoryUpdated -= OnHistoryUpdated; + _nicDebounceTimer?.Dispose(); + _trafficTodayTimer?.Dispose(); + if (_appUsageTimer != null) + { + _appUsageTimer.Stop(); + _appUsageTimer.Tick -= OnAppUsageTick; + } - // Properly dispose WebView2 to prevent phantom COM objects - if (_webViewReady) - WebView?.Dispose(); - base.OnClosed(e); + // Properly dispose WebView2 to prevent phantom COM objects + if (_webViewReady) + { + try + { + WebView?.Dispose(); + } + catch (Exception ex) + { + Log.Debug(ex, "WebView2 disposal error during OnClosed"); + } + } + + try + { + NativeMethods.EmptyWorkingSet(Process.GetCurrentProcess().Handle); + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to trim working set after Settings closed"); + } + } + catch (Exception ex) + { + Log.Debug(ex, "SettingsShell cleanup error during OnClosed"); + } + finally + { + base.OnClosed(e); + } } } diff --git a/src/LocalTelemetry.App/Settings/wwwroot/bun.lock b/src/LocalTelemetry.App/Settings/wwwroot/bun.lock index 9ee65f5..9a16462 100644 --- a/src/LocalTelemetry.App/Settings/wwwroot/bun.lock +++ b/src/LocalTelemetry.App/Settings/wwwroot/bun.lock @@ -5,21 +5,21 @@ "": { "name": "localtelemetry", "dependencies": { - "@lucide/svelte": "^1.59.0", + "@lucide/svelte": "^1.84.0", "lucide-svelte": "^1.0.1", }, "devDependencies": { "@codecov/vite-plugin": "^2.0.1", - "@commitlint/cli": "^21.2.3", - "@commitlint/config-conventional": "^21.2.3", - "@sveltejs/vite-plugin-svelte": "^7.3.1", - "@vitest/coverage-v8": "^5.0.5", - "commitlint-plugin-function-rules": "4.0.1", + "@commitlint/cli": "^21.3.0", + "@commitlint/config-conventional": "^21.3.0", + "@sveltejs/vite-plugin-svelte": "^7.3.2", + "@vitest/coverage-v8": "^5.1.2", + "commitlint-plugin-function-rules": "5.0.1", "happy-dom": "^21.0.4", - "svelte": "^5.57.2", + "svelte": "^5.59.2", "typescript": "^7.0.2", - "vite": "^8.3.4", - "vitest": "^5.0.5", + "vite": "^8.4.0", + "vitest": "^5.1.2", }, }, }, @@ -54,13 +54,13 @@ "@babel/code-frame": ["@babel/code-frame@7.29.7", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.29.7", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw=="], - "@babel/helper-string-parser": ["@babel/helper-string-parser@7.29.7", "", {}, "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw=="], + "@babel/helper-string-parser": ["@babel/helper-string-parser@7.29.15", "", {}, "sha512-C2FuapQ2Kh1OnVHAoLi5rD3GBJ8COb9Q609T6HEpLqaBAo560PDP5OxBE5dCI/h951MBO/+bCUYU5SZ+8ZlV+w=="], "@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.29.7", "", {}, "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg=="], - "@babel/parser": ["@babel/parser@7.29.8", "", { "dependencies": { "@babel/types": "^7.29.8" }, "bin": "./bin/babel-parser.js" }, "sha512-E8lTAYNB1KW+FH+VGJuZM1ioAx2E6oVlvQFRrf5P8ZZmsiJXYAD9vTFV7yyEURNzgh1dFqMZuO6tUwcARbqFCA=="], + "@babel/parser": ["@babel/parser@7.29.15", "", { "dependencies": { "@babel/types": "^7.29.15" }, "bin": "./bin/babel-parser.js" }, "sha512-RpKWyisHoP81twtSCgmE02iU0RnPcq1DN5bBEbpUePrjA9Q3wXhufnCJrrayPpoZieqFh3zyZQqwtSK0gGccRA=="], - "@babel/types": ["@babel/types@7.29.8", "", { "dependencies": { "@babel/helper-string-parser": "^7.29.7", "@babel/helper-validator-identifier": "^7.29.7" } }, "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg=="], + "@babel/types": ["@babel/types@7.29.15", "", { "dependencies": { "@babel/helper-string-parser": "^7.29.15", "@babel/helper-validator-identifier": "^7.29.7" } }, "sha512-/XKpKDakL//LZ66bq1XsZOswuqeI5MZqPLDu18o3XdkU1fNJ7bdPtzgnc4ZNS+bBGHV0FJG8jjb8SwcC3nNVQQ=="], "@bcoe/v8-coverage": ["@bcoe/v8-coverage@1.0.2", "", {}, "sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA=="], @@ -68,63 +68,63 @@ "@codecov/vite-plugin": ["@codecov/vite-plugin@2.0.1", "", { "dependencies": { "@codecov/bundler-plugin-core": "^2.0.1", "unplugin": "^1.10.1" }, "peerDependencies": { "vite": "4.x || 5.x || 6.x" } }, "sha512-w7nGA9SSc0WECzn05yRrw3uN8293I620Kd9x97I0kyyxUjtWxCMmlgmAbS364gJZYvljd0A6iQyAigVV2dOX9A=="], - "@commitlint/cli": ["@commitlint/cli@21.2.3", "", { "dependencies": { "@commitlint/config-conventional": "^21.2.3", "@commitlint/format": "^21.2.3", "@commitlint/lint": "^21.2.3", "@commitlint/load": "^21.2.3", "@commitlint/read": "^21.2.3", "@commitlint/types": "^21.2.3", "tinyexec": "^1.0.0", "yargs": "^18.0.0" }, "bin": { "commitlint": "cli.js" } }, "sha512-5yOX6IRjcrIReCxpyAd04hgI/yhUMpVBJ/ouwFV0wk9yx5+fYRDWZWJ5h55Tbedgfol+5m2mU5nqzbB8g3v0vQ=="], + "@commitlint/cli": ["@commitlint/cli@21.3.0", "", { "dependencies": { "@commitlint/config-conventional": "^21.3.0", "@commitlint/format": "^21.3.0", "@commitlint/lint": "^21.3.0", "@commitlint/load": "^21.3.0", "@commitlint/read": "^21.3.0", "@commitlint/types": "^21.3.0", "tinyexec": "^1.0.0", "yargs": "^18.0.0" }, "bin": { "commitlint": "cli.js" } }, "sha512-64hJOwbVJJHG22QtHtJyyvksh9cvNN8fS6LhazEayjaR0vY20uug9RL5wMqyA7FV5sqfXC5PunyPMsxHqATRPA=="], - "@commitlint/config-conventional": ["@commitlint/config-conventional@21.2.3", "", { "dependencies": { "@commitlint/types": "^21.2.3", "conventional-changelog-conventionalcommits": "^10.0.0" } }, "sha512-EP2n5DN2GwRWNVrLX0Jx3mpQlW5PfFi9HnD9OJ8hN/H0xFqpCFyHeGDhg+0P8/21iMMcdkcQgbNqmVklebqYsQ=="], + "@commitlint/config-conventional": ["@commitlint/config-conventional@21.3.0", "", { "dependencies": { "@commitlint/types": "^21.3.0", "conventional-changelog-conventionalcommits": "^10.0.0" } }, "sha512-jWTouDSbhDqlJyJCN3RW0v7nxhU28MsUb5Gsrp8An6W4Xqa3GkrvjMdRbnoVX7S8oVgHy12p8Pmq2r8PCPOQ7w=="], - "@commitlint/config-validator": ["@commitlint/config-validator@21.2.3", "", { "dependencies": { "@commitlint/types": "^21.2.3", "ajv": "^8.11.0" } }, "sha512-JQ13v0GafSM4fBYX8UowSy++07Was20auq0NcTdnzSEq6/05Cq5GBUMIfKkqjzyBwC9sJFmPpKWgLLhH7cygkw=="], + "@commitlint/config-validator": ["@commitlint/config-validator@21.3.0", "", { "dependencies": { "@commitlint/types": "^21.3.0", "ajv": "^8.11.0" } }, "sha512-7xpkUIhTOrkZAZ89Qdflb3FuZNFe1wFLF17qqxCUJUtw6X6jLZk1ziIj+fzAeW64KaMW/T5MHHa/KaQCoCghqw=="], - "@commitlint/ensure": ["@commitlint/ensure@21.2.3", "", { "dependencies": { "@commitlint/types": "^21.2.3", "es-toolkit": "^1.46.0" } }, "sha512-gEjNKgRocbODI5/sMx2Qc9XOf2/zFTNV2aEK1QZ4gKDKxDC/VR7us3QtIX1C5d5xxHxx0I/tEbYbdSP1Am2LwA=="], + "@commitlint/ensure": ["@commitlint/ensure@21.3.0", "", { "dependencies": { "@commitlint/types": "^21.3.0", "es-toolkit": "^1.46.0" } }, "sha512-quMTkkqv/ESih+faPbSBW9guBEmSDXfJMtTYTQvV3iz5leLO6Wqes8q5N6TtLkF113pO9zu1soW09BdbTskcnQ=="], "@commitlint/execute-rule": ["@commitlint/execute-rule@21.0.1", "", {}, "sha512-RifH+FmImozKBE6mozhF4K3r2RRKP7SMi/Q/zLCmExtp5e05lhHOUYqGBlFBAGNHaZxU/WYw1XuugYK9jQzqnA=="], - "@commitlint/format": ["@commitlint/format@21.2.3", "", { "dependencies": { "@commitlint/types": "^21.2.3", "picocolors": "^1.1.1" } }, "sha512-KKwCjXYqA8r295uhLnulDXL9yekdXmj2yp2Q0XsBPhxQ2iPuvRE8F43j7g7yexo69wTdmUQmFz15jpderluzUQ=="], + "@commitlint/format": ["@commitlint/format@21.3.0", "", { "dependencies": { "@commitlint/types": "^21.3.0", "picocolors": "^1.1.1" } }, "sha512-iY/pqG9e+cgJoxN02oai+2iDzmCODrSOVn/C/ggDiEtUBRu+8jU+tvRz3ola+w7RNIPp9JPJNInQAkX77r9MiQ=="], - "@commitlint/is-ignored": ["@commitlint/is-ignored@21.2.3", "", { "dependencies": { "@commitlint/types": "^21.2.3", "semver": "^7.6.0" } }, "sha512-Ng4nRj/LBAOvc+GQu7bsFW4/fL89LvZ14OOC/ERLbUpnG6QBwWRzY/1oXGwPs3C8YHWjJObin4kLYo2YeEn70w=="], + "@commitlint/is-ignored": ["@commitlint/is-ignored@21.3.0", "", { "dependencies": { "@commitlint/types": "^21.3.0", "semver": "^7.6.0" } }, "sha512-YF13lm57pxSN++LklBZmrAMOPAJSm/jNm3ictyRoFw2Zro7d9cMRttQ4pLKPE+UVHzbUCq+hVrZKtH9hGKG9gw=="], - "@commitlint/lint": ["@commitlint/lint@21.2.3", "", { "dependencies": { "@commitlint/is-ignored": "^21.2.3", "@commitlint/parse": "^21.2.3", "@commitlint/rules": "^21.2.3", "@commitlint/types": "^21.2.3" } }, "sha512-lUZcSuVLLEDkhge9ERk8Rp+FXQtrUhCK+h328BFnzKXrTuXGdqiYMEpTlNWdZaOrjyMhMJaz354ZaWEGJxcLeg=="], + "@commitlint/lint": ["@commitlint/lint@21.3.0", "", { "dependencies": { "@commitlint/is-ignored": "^21.3.0", "@commitlint/parse": "^21.3.0", "@commitlint/rules": "^21.3.0", "@commitlint/types": "^21.3.0" } }, "sha512-SyuGd4clg7My/Z6+OKDIh9vYlwTjTGlePKkDp92pU28EE80WVnzShZCmjD00mMGMWkFB+LdzNFm+eX31+CPHaw=="], - "@commitlint/load": ["@commitlint/load@21.2.3", "", { "dependencies": { "@commitlint/config-validator": "^21.2.3", "@commitlint/execute-rule": "^21.0.1", "@commitlint/resolve-extends": "^21.2.3", "@commitlint/types": "^21.2.3", "cosmiconfig": "^9.0.1", "cosmiconfig-typescript-loader": "^6.1.0", "es-toolkit": "^1.46.0", "is-plain-obj": "^4.1.0", "picocolors": "^1.1.1" } }, "sha512-cDrL8lOo23Lk7knGzQdjbFcq7z2JgvjwV6PhbESVvEc+Fe21MeLjPKBJi8nKjg7j+jh79CVbVSUbZc104thXRw=="], + "@commitlint/load": ["@commitlint/load@21.3.0", "", { "dependencies": { "@commitlint/config-validator": "^21.3.0", "@commitlint/execute-rule": "^21.0.1", "@commitlint/resolve-extends": "^21.3.0", "@commitlint/types": "^21.3.0", "cosmiconfig": "^9.0.1", "es-toolkit": "^1.46.0", "is-plain-obj": "^4.1.0", "jiti": "^2.6.1", "picocolors": "^1.1.1" } }, "sha512-1TBooVkFOEvvyf9cxpNTC9iBxtc6lPjzRjVVyaGywLjaRIdlUgeEZwxaSFCKGl2Vu35uAnO4eoeaCkfF8QXjpg=="], "@commitlint/message": ["@commitlint/message@21.2.0", "", {}, "sha512-YxGoiXD/HXNXLJPrQwE5poXa+XH0CBEm+mdvbHQP0g6MV/dmJyUFCzPNzZbxL93GvZ70TmtTK0Z0/IBpAqHv8g=="], - "@commitlint/parse": ["@commitlint/parse@21.2.3", "", { "dependencies": { "@commitlint/types": "^21.2.3", "conventional-changelog-angular": "^9.0.0", "conventional-commits-parser": "^7.0.0" } }, "sha512-Jt61QpF1xA88damCELe8I0FlDZPSpXNc8IhN7z5kZ0EcDYPjdZ+ZHPvsSXl69r2MIlLnNKeHhOn2cmVpziFE9w=="], + "@commitlint/parse": ["@commitlint/parse@21.3.0", "", { "dependencies": { "@commitlint/types": "^21.3.0", "conventional-changelog-angular": "^9.0.0", "conventional-commits-parser": "^7.0.0" } }, "sha512-y1gy51vLPxfpagSDZfHqOfkpbHZBFKYk6PIe2uN7Qc+rxOpTAp1NstQSjbJ8DxiMkfeMtlCMuGC1QOf+HGVdEQ=="], - "@commitlint/read": ["@commitlint/read@21.2.3", "", { "dependencies": { "@commitlint/top-level": "^21.2.0", "@commitlint/types": "^21.2.3", "@conventional-changelog/git-client": "^3.0.0", "tinyexec": "^1.0.0" } }, "sha512-szAepuLA1vTTr7fuudEg7jYyVHudf+FH+vptU91bhxE1WnE8TKrfTAi44HVllz8XpI8Pvp4GjR/iP5Nshgh+og=="], + "@commitlint/read": ["@commitlint/read@21.3.0", "", { "dependencies": { "@commitlint/top-level": "^21.2.0", "@commitlint/types": "^21.3.0", "@conventional-changelog/git-client": "^3.0.0", "tinyexec": "^1.0.0" } }, "sha512-lEmt2O8RQ9ywSmAI+HW/VbOXBmz+0KuVFhr38eqcr/bWRySTUu7kE6w/K370KPDlTHlv4XMYSaRp/n5WXt9soQ=="], - "@commitlint/resolve-extends": ["@commitlint/resolve-extends@21.2.3", "", { "dependencies": { "@commitlint/config-validator": "^21.2.3", "@commitlint/types": "^21.2.3", "es-toolkit": "^1.46.0", "global-directory": "^5.0.0", "resolve-from": "^5.0.0" } }, "sha512-bqJdmAtXgAQel+l02uIsF7rHgKgx1AGZdGBjam7uK4XW54ZAQtB6XAIUXezYprQiCcRMpBh4fHs5JodXK4mVZA=="], + "@commitlint/resolve-extends": ["@commitlint/resolve-extends@21.3.0", "", { "dependencies": { "@commitlint/config-validator": "^21.3.0", "@commitlint/types": "^21.3.0", "es-toolkit": "^1.46.0", "global-directory": "^5.0.0", "resolve-from": "^5.0.0" } }, "sha512-YTRgtoB/0fLGK5lL1zN8RKe9PsKoh79qCnXUjocKhlbkLR16vwYLtkdWUFhj+UA4vQPEmJI4U1nJJHwlijUxIg=="], - "@commitlint/rules": ["@commitlint/rules@21.2.3", "", { "dependencies": { "@commitlint/ensure": "^21.2.3", "@commitlint/message": "^21.2.0", "@commitlint/to-lines": "^21.0.1", "@commitlint/types": "^21.2.3" } }, "sha512-5+YnI/LuTx3JDl9GjqfP2z9x96M8KKDrd+4jOel/T0L1BB3oAmBlSN8xppf63QsudiVEgR8C0gRoAMrPVrms6g=="], + "@commitlint/rules": ["@commitlint/rules@21.3.0", "", { "dependencies": { "@commitlint/ensure": "^21.3.0", "@commitlint/message": "^21.2.0", "@commitlint/to-lines": "^21.0.1", "@commitlint/types": "^21.3.0" } }, "sha512-xq6eQIazhsJRvfXygKbrhDL0zlHQa0tfHtPW1t7+8LEAVMQ6ALpXdqUjvWWzwNUr0ydt0aCqSO1o+Dqa7f7pKA=="], "@commitlint/to-lines": ["@commitlint/to-lines@21.0.1", "", {}, "sha512-bd1BFII7p1EQZre9Kaj+kKaMFP3cFCdt21K7DItVux9XP5WjLgJ0/Uy1pJJh9aPwVJ6SKg62PxqlZaHI8hQAXw=="], "@commitlint/top-level": ["@commitlint/top-level@21.2.0", "", { "dependencies": { "escalade": "^3.2.0" } }, "sha512-Y5gmQ+KxzqCrBFJfLvFEPvvwD3LDiNZoTT2yeFBm96M8qhmqSzQc5DvX3rheAaAMjyIvMXOCLS/mWfdpONsjyQ=="], - "@commitlint/types": ["@commitlint/types@21.2.3", "", { "dependencies": { "conventional-commits-parser": "^7.0.0", "picocolors": "^1.1.1" } }, "sha512-sGEA473TlCvhCGNoTBY9OXZVWdscIXdGt0dm8EpB+2MRfmt8LNh/X56P/T3nCtEB+eH5qGEa3odphSAoUxSfSQ=="], + "@commitlint/types": ["@commitlint/types@21.3.0", "", { "dependencies": { "conventional-commits-parser": "^7.0.0", "picocolors": "^1.1.1" } }, "sha512-3tg5Ea8vNvA1a1oBoyTcRXNJwVWZec9LBxud8XYmljNeYtya2ZToaGUyFlAfctiHIHDmf1Ijq5F8zXmnEY9r2w=="], - "@conventional-changelog/git-client": ["@conventional-changelog/git-client@3.1.0", "", { "dependencies": { "@simple-libs/child-process-utils": "^2.0.0", "@simple-libs/stream-utils": "^2.0.0", "semver": "^7.5.2" }, "peerDependencies": { "conventional-commits-filter": "^6.0.1", "conventional-commits-parser": "^7.0.1" }, "optionalPeers": ["conventional-commits-filter", "conventional-commits-parser"] }, "sha512-Tqa/gHco2WJWa740NRjOrfKVvzIqxkZpecb8bemaQ8sKM5PXb1UK4uTyTb/1wIqNuOVaDOFxyBdhTIQZn6gdjQ=="], + "@conventional-changelog/git-client": ["@conventional-changelog/git-client@3.2.0", "", { "dependencies": { "@simple-libs/child-process-utils": "^2.0.0", "@simple-libs/stream-utils": "^2.0.0", "verkit": "^0.5.0" }, "peerDependencies": { "conventional-commits-filter": "^6.0.1", "conventional-commits-parser": "^7.1.3" }, "optionalPeers": ["conventional-commits-filter", "conventional-commits-parser"] }, "sha512-sD/E0vzpkoDz/dqM1Hhv0ihC4KBw6RXjefeO8SG1XrX+wGkMxe1pKeedkKDPCtr2JjuhbuS9aJNgOvnT8hbeBw=="], - "@conventional-changelog/template": ["@conventional-changelog/template@1.2.1", "", {}, "sha512-TzlTVpKPjaqW6qOYjQcYUDuGsLCNsvFHVBXkYGTAnf5V37jCWrE5haKNXzz0WZUtVHjrpV76L1buANjwXMfT8w=="], + "@conventional-changelog/template": ["@conventional-changelog/template@1.4.1", "", {}, "sha512-mHyyEL0eIEqJ6+aF24+AdZRo4bu4W5GdUiCiCx5X7kfDY51ye8GQJ264uOINObrRSKxtSRCOWPpl9hbOy4UzxQ=="], "@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.13", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="], "@jridgewell/remapping": ["@jridgewell/remapping@2.3.5", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ=="], - "@jridgewell/resolve-uri": ["@jridgewell/resolve-uri@3.1.2", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="], + "@jridgewell/resolve-uri": ["@jridgewell/resolve-uri@3.1.3", "", {}, "sha512-lhTtjtoEArWBjismtfS761S9Hlyn+nIZqOZVYoZ1Xn82PMNMVnk+jj/NhC4fAXGTs7ydONcJiR5vyQBTMDu27g=="], "@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.6.0", "", {}, "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw=="], "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="], - "@lucide/svelte": ["@lucide/svelte@1.59.0", "", { "peerDependencies": { "svelte": "^5" } }, "sha512-ga9IrEsFJBkt/34VnRFcQ2HLs8eOpOovXZ62XzwfC7f0zBfo4y116FBIDroZkD0gInYYY2hSSAcsQEm/Vm+AoA=="], + "@lucide/svelte": ["@lucide/svelte@1.84.0", "", { "peerDependencies": { "svelte": "^5" } }, "sha512-MdC8yG6N0Qc0vYlPa44KnFQ7Uaduy+YVsaNQy31C1gMvXTjyUTGvw/WlGfJLdnC11FM0jN4XSqPiwb1dZj9piw=="], "@octokit/auth-token": ["@octokit/auth-token@6.0.0", "", {}, "sha512-P4YJBPdPSpWTQ1NU4XYdvHvXJJDxM6YwpS0FZHRgP7YFkdVxsWcpWGy/NVqlAA7PcPCnMacXlRm1y2PFZRWL/w=="], "@octokit/core": ["@octokit/core@7.0.8", "", { "dependencies": { "@octokit/auth-token": "^6.0.0", "@octokit/graphql": "^9.0.5", "@octokit/request": "^10.0.16", "@octokit/request-error": "^7.1.2", "@octokit/types": "^18.0.0", "before-after-hook": "^4.0.0", "universal-user-agent": "^7.0.0" } }, "sha512-L7y8eYc+AwxGr2PWI4WFt1VG4TiJ66c26BD16mXpYIlXxG0SMigM1+m4aTSlYyBr5BlQsGAlz8uDCoZN4SEMcg=="], - "@octokit/endpoint": ["@octokit/endpoint@11.0.5", "", { "dependencies": { "@octokit/types": "^18.0.0", "universal-user-agent": "^7.0.2" } }, "sha512-iXa654H3yFafF/ieHkukfbgWo2rmXD2ceD0ZOtrPhw1bc3FDch1d9N/TNs0FQ1/cIbwb7kspUX8jzIs8nzb9DQ=="], + "@octokit/endpoint": ["@octokit/endpoint@11.0.6", "", { "dependencies": { "@octokit/types": "^18.0.0", "universal-user-agent": "^7.0.2" } }, "sha512-H52ocs+dXsxmLtMPqabXz0p+mNWfe5RacpUHq8sB6mJLiMPU6PF/7O0Bl/U8a8WrV1NzWNYpXwZW0zo0BeoT2A=="], - "@octokit/graphql": ["@octokit/graphql@9.0.5", "", { "dependencies": { "@octokit/request": "^10.0.16", "@octokit/types": "^18.0.0", "universal-user-agent": "^7.0.0" } }, "sha512-bt/hm03LeU6Vy7FwTrkkC9p3XGT/lBwClglMqxBSe5/q0E5CdJTXeAqEI0vlw89/LF/G6tryTIH8HirZ3prMVg=="], + "@octokit/graphql": ["@octokit/graphql@9.0.6", "", { "dependencies": { "@octokit/request": "^10.0.16", "@octokit/types": "^18.0.0", "universal-user-agent": "^7.0.0" } }, "sha512-NZuqjuSGn8DEMq4fq/QWhg6DoqGdNOkKPi5R1kZ8Y3k+MqeRopYRSa3hccdHhGP4ISfV8BHv9+YURO4TEkbRWQ=="], "@octokit/openapi-types": ["@octokit/openapi-types@29.0.1", "", {}, "sha512-9qWOMFNxxLokERcms42rU0PTLqQmVs7g5E41TI4mCOxmpFayD1rfC7XxOL55cG9MBZLFlC31BrR37myMKardwg=="], @@ -132,45 +132,47 @@ "@octokit/plugin-rest-endpoint-methods": ["@octokit/plugin-rest-endpoint-methods@17.0.0", "", { "dependencies": { "@octokit/types": "^16.0.0" }, "peerDependencies": { "@octokit/core": ">=6" } }, "sha512-B5yCyIlOJFPqUUeiD0cnBJwWJO8lkJs5d8+ze9QDP6SvfiXSz1BF+91+0MeI1d2yxgOhU/O+CvtiZ9jSkHhFAw=="], - "@octokit/request": ["@octokit/request@10.0.16", "", { "dependencies": { "@octokit/endpoint": "^11.0.5", "@octokit/request-error": "^7.1.2", "@octokit/types": "^18.0.0", "content-type": "^3.0.0", "json-with-bigint": "^3.5.12", "universal-user-agent": "^7.0.2" } }, "sha512-A0zWGjHzISIb+9ccG8s0dq7LKO5zVpJLRICjgUb+sJxEWqn8RUHB1rD3AE51+PECvXHIxqZ1VVvs4fHTSD9nUQ=="], + "@octokit/request": ["@octokit/request@10.0.19", "", { "dependencies": { "@octokit/endpoint": "^11.0.5", "@octokit/request-error": "^7.1.2", "@octokit/types": "^18.0.0", "content-type": "^3.0.0", "json-with-bigint": "^3.5.12", "universal-user-agent": "^7.0.2" } }, "sha512-FgcDrtnG33ZF4STrBzO6DLfoy5RhqZAiWdfpZRojiEd8O8UU+FqCWQ/7ucUDEXYnKsBk/70R3D8hFkqR2x6lRg=="], "@octokit/request-error": ["@octokit/request-error@7.1.2", "", { "dependencies": { "@octokit/types": "^18.0.0" } }, "sha512-XZRuT3xZ84D3gYErI1DZvhJ33dCWVV6uzBtWkaBB4TvA/L6eOeTZodxLFVB44bBEEo3vEx7y00UfX1tBLrtLRg=="], "@octokit/types": ["@octokit/types@18.0.0", "", { "dependencies": { "@octokit/openapi-types": "^29.0.1" } }, "sha512-l6bAF43PNxkJp6g+W4PjoUSSkxHomXw2nOum5CTftJz1NlV3vu93NImgOYtLf6CbBUb5j+fiuzW0PPQ5JTSvZA=="], - "@oxc-project/types": ["@oxc-project/types@0.153.0", "", {}, "sha512-jSNrRIyvPVLL5E1z/tS5zLAprosGz/FuI1PWwEOz59j3E4TTTzSpqKb/RDGqJhhW0QHYISGXxq582wGx6T11Tw=="], + "@oxc-project/types": ["@oxc-project/types@0.160.0", "", {}, "sha512-gw4k9syEmnckbOgw2A2FU1TBDdX9hfwV9jEn/uio65pguPzwWiXQS3OIJDMEhv9m06tj9XiEe6RoD0YA+LgreA=="], - "@rolldown/binding-android-arm-eabi": ["@rolldown/binding-android-arm-eabi@1.2.13", "", { "os": "android", "cpu": "arm" }, "sha512-Vu/NICrgdRvUOeaJZIyB2FP63s6fO/4ud5l8dXmxDx9yDyn+mN0y+gsvsVviSli+T361Aqo0h46EuMoobrwawA=="], + "@rolldown/binding-android-arm-eabi": ["@rolldown/binding-android-arm-eabi@1.3.4", "", { "os": "android", "cpu": "arm" }, "sha512-xCW8CkL/ualx/SbYqeG9iK87lJCZGDQ0soE+kaORJ0Bd+pHALyE4qK7BStmEAyYWLEzZ3/biSIpA6/7GDFvzIg=="], - "@rolldown/binding-android-arm64": ["@rolldown/binding-android-arm64@1.2.13", "", { "os": "android", "cpu": "arm64" }, "sha512-6LEoIrGy5vvCd2boNnv2soPSUZj/PRvhp8R/t9KlX+mIZxThIE/ZqxrGXxmuNX0FuvQFvLdZr7S4HrYpYBVhEQ=="], + "@rolldown/binding-android-arm64": ["@rolldown/binding-android-arm64@1.3.4", "", { "os": "android", "cpu": "arm64" }, "sha512-5lifIO+b/prcM9sx/bkPN4w6UEToEfQ3gjhx0+0neuL+dkYskI792CfAq03T51jc8JFcaYXs2hi3l8RjiH/VWQ=="], - "@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.2.13", "", { "os": "darwin", "cpu": "arm64" }, "sha512-CaJSRzlQ6Q+zkDMVA9OkVxBjVoPRCDEE3v0FSJ9kIQBgRjFApA3Si4ijhbNVUji7ZJt+PfO0e46qy4nPInHUPA=="], + "@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.3.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-RCgxTI4AJQxhVF//BI3ImQOsXTHrF4Eg+f99jBy8WoETA2kSEGFxpnrVmW0leQq/2aBR4R5AC6csmy3rc66e3Q=="], - "@rolldown/binding-darwin-x64": ["@rolldown/binding-darwin-x64@1.2.13", "", { "os": "darwin", "cpu": "x64" }, "sha512-e4r340I5hxSzJkD3YJBxgzq/rJ3wwxwdLLb2FPt1Zpyem20nrQPT11DDEEkazwxaHumH8wpglsp/Ozgj/wT6mw=="], + "@rolldown/binding-darwin-x64": ["@rolldown/binding-darwin-x64@1.3.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-zNPJVVPUaDEj+L0lImoK3rFv2b+Z5gNijI6DWu/fcD3/1TfmRXKb9ZyxbSN+2AhlctqjbNzUvCsMa+EBhnEM4Q=="], - "@rolldown/binding-freebsd-x64": ["@rolldown/binding-freebsd-x64@1.2.13", "", { "os": "freebsd", "cpu": "x64" }, "sha512-hoBWDZ4/K/mJKVMbsgUd1jfpA2DiOrJ54mpegObU9TBHBBrtX4FLIXJJQRDPZ/2Dn91GvPob+Z2hwKJzf4E5SQ=="], + "@rolldown/binding-freebsd-x64": ["@rolldown/binding-freebsd-x64@1.3.4", "", { "os": "freebsd", "cpu": "x64" }, "sha512-upP6g7ZIRy5by1RDQ/EphHIdJ5xK0eUD7sUgfZFWJ49s4XdbYsIvIlAPtrFpayR70Hhf9J22lb4Pm8/9FhrZmg=="], - "@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/binding-linux-arm-gnueabihf@1.2.13", "", { "os": "linux", "cpu": "arm" }, "sha512-oF9fZu3vTWnTiVAkDFxU9PJLt1nh20K9RRpuHsR7ZnE2L7XookBbDBVLojCVSLGbvtSlxeUNnjAj6DbNsKyzbg=="], + "@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/binding-linux-arm-gnueabihf@1.3.4", "", { "os": "linux", "cpu": "arm" }, "sha512-SAX5C5+poMLCxu8dkPF6h5yst40rkzs+9Y3cbPn2OFSydmHjAEprrGi64zGgnYyPIVZfdGUFqJ2fJbfbnHI+mA=="], - "@rolldown/binding-linux-arm64-gnu": ["@rolldown/binding-linux-arm64-gnu@1.2.13", "", { "os": "linux", "cpu": "arm64" }, "sha512-DTpb/+jMiqWMPgphn4ksW1zW+XLJ6dJJ9FMvnIk9I291LhCctMPhMYJrP5t9p6C9qa3KXadDdUEZHBaPh3kNxQ=="], + "@rolldown/binding-linux-arm64-gnu": ["@rolldown/binding-linux-arm64-gnu@1.3.4", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-nwHqdlRZS6GWBef3dG5/pMY6RNTBBUjj7s0Da+m6xsFpe7jx6IC46SLZcCu8f46JOfCovZmwnrz51EzGE+7Fyw=="], - "@rolldown/binding-linux-arm64-musl": ["@rolldown/binding-linux-arm64-musl@1.2.13", "", { "os": "linux", "cpu": "arm64" }, "sha512-xU+Kvv9N2A3SY35zFh1FWWNjxbadE/BKeqnkXe7vScU4GZsw757BlVmDLITZEq8DPpk6m7uoDYkK7P+x/uU5Ow=="], + "@rolldown/binding-linux-arm64-musl": ["@rolldown/binding-linux-arm64-musl@1.3.4", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-Gr78X2ur/AgLCkmZgHffk/FerIX8S5zb/eII4bCcvJo0ANzeXhTShahdNbpnY6bpiszIAgIfiuKS9ziziWsamw=="], - "@rolldown/binding-linux-ppc64-gnu": ["@rolldown/binding-linux-ppc64-gnu@1.2.13", "", { "os": "linux", "cpu": "ppc64" }, "sha512-XMk/hnhh25oQ756Lclb1Q11h4ll0xC0Esa5w4Vzp+mAE2S3AGJgeM0SonrIgY8fHhjarb6hcoTuwoFG0VVP2ig=="], + "@rolldown/binding-linux-ppc64-gnu": ["@rolldown/binding-linux-ppc64-gnu@1.3.4", "", { "os": "linux", "cpu": "ppc64", "libc": "glibc" }, "sha512-o9Wcn8nWrsQasaBRYM4d//FwhlBsTJYWkPVlhlt6FwzpwEoovY4IopRZjk5Fq3+ntRuSDORJjF/nA8sFeF2q6w=="], - "@rolldown/binding-linux-s390x-gnu": ["@rolldown/binding-linux-s390x-gnu@1.2.13", "", { "os": "linux", "cpu": "s390x" }, "sha512-U1BoTHYmlywE2n3HUWjzZ+8EQsKr+OwpxYuDWaubx42tUL8QSL7nOqRz/NVHanibbFP3M1Rxuprz/wNcbMKjqw=="], + "@rolldown/binding-linux-s390x-gnu": ["@rolldown/binding-linux-s390x-gnu@1.3.4", "", { "os": "linux", "cpu": "s390x", "libc": "glibc" }, "sha512-UDWu4jkVcx2kiBKm3Ec//4lVCbeTWj8gmJ9SyLWCdLWtTlyq7fQVeVV/14nXvRtSLErvJ2+yA/Ux5taS31Y17Q=="], - "@rolldown/binding-linux-x64-gnu": ["@rolldown/binding-linux-x64-gnu@1.2.13", "", { "os": "linux", "cpu": "x64" }, "sha512-J4cm80Pc6wEwV5AZ42o62sIQgDk+Y7R2s646jIwuvO+4V46QB58N4vVuMPWCBaNgursXLpmUWJV//WQAkPvHBQ=="], + "@rolldown/binding-linux-x64-gnu": ["@rolldown/binding-linux-x64-gnu@1.3.4", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-W9mGtTa0w4fWh8RLMNPyaEhhcuqUfO07Q4I1bBc4PDMNg7gQSw0yPQNQ3D0qwbkXwxbyL4YrIzc8n6k1vuFExQ=="], - "@rolldown/binding-linux-x64-musl": ["@rolldown/binding-linux-x64-musl@1.2.13", "", { "os": "linux", "cpu": "x64" }, "sha512-W0euZS40U4V6JkmEnVCIX9mcsL6cbXQ4X8c2w+MMOIjFg68TXUW+u3RT+2e1t1pv9mg/EP3pDtK3POXdQ7Rxyw=="], + "@rolldown/binding-linux-x64-musl": ["@rolldown/binding-linux-x64-musl@1.3.4", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-8B+ofyQZ7/aCmkqnyMonPr5zKLqMVNczhRGFNtdIuItiwNn8iQWJawMq2E58r7bxD1XEbtRRsULY/eCWwZQ01Q=="], - "@rolldown/binding-openharmony-arm64": ["@rolldown/binding-openharmony-arm64@1.2.13", "", { "os": "none", "cpu": "arm64" }, "sha512-do/AF/4n9MRshia3a5aXoy8xM2c6mgfT6D7H/dY6my5z+hfCIR4ab7mk4IRj++nsEQpKy39kd0DQnDq+r692tw=="], + "@rolldown/binding-openharmony-arm64": ["@rolldown/binding-openharmony-arm64@1.3.4", "", { "os": "none", "cpu": "arm64" }, "sha512-TlD0FSZaC7o2B4NCe9V5N11ugTnhzTM9ksj4sgRLvrKosDzjEkvlsTX3ehkw4ZlPv8AADimZZTvJGEa16pfXug=="], - "@rolldown/binding-win32-arm64-msvc": ["@rolldown/binding-win32-arm64-msvc@1.2.13", "", { "os": "win32", "cpu": "arm64" }, "sha512-6FtUf2cJZobutJdxnGYX8z0vtbgqU0b2v8vfBhkXb9wp2MppMFtkunE+IaOntyi01rkIQoPW2GHABtfzsC0BRQ=="], + "@rolldown/binding-wasm32-wasi": ["@rolldown/binding-wasm32-wasi@1.3.4", "", { "dependencies": { "@oxc-project/types": "0.160.0" }, "cpu": "none" }, "sha512-jwO8P3o53ygo7b5061B7BeaJ1BGv3BKZ6jroFdw/01qWry7Z+qNBlDvulzbTle5s/A0Fc1FRgsTxrke9DvsSbA=="], - "@rolldown/binding-win32-x64-msvc": ["@rolldown/binding-win32-x64-msvc@1.2.13", "", { "os": "win32", "cpu": "x64" }, "sha512-UKhFaZTeTcbKrb3iU82m17jVcPEAoqDkCN5MBqgPyZSwp/cQmib21crTS0DdH7T1B7wZRWEI89YQAOJMet5yhg=="], + "@rolldown/binding-win32-arm64-msvc": ["@rolldown/binding-win32-arm64-msvc@1.3.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-8adGMrNtrdzi2WD1ozhYapER59gD8Q/DV6SCKJlyG2HqULPdeQUBvMa33lTsiEYwIqTZUaIU2MmvPp5f1wbtXA=="], - "@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.1", "", {}, "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw=="], + "@rolldown/binding-win32-x64-msvc": ["@rolldown/binding-win32-x64-msvc@1.3.4", "", { "os": "win32", "cpu": "x64" }, "sha512-rIMjtESdXJCIoOiUTroQ1Y1rjVDZkuUVRUxs3APX2vNv175D7TDWvzdELiIhzGq9cUNUFat+co+PTmPHPqSREg=="], + + "@rolldown/pluginutils": ["@rolldown/pluginutils@1.1.1", "", {}, "sha512-glFIJDvLNDtJhT9qrMFWLPbvS+skxgt4L0K8Ei2YtnhPysAJnsI7nyxSJxKj4ADeKX0OLjC4ntRkwpLOoS3rwA=="], "@simple-libs/child-process-utils": ["@simple-libs/child-process-utils@2.0.0", "", { "dependencies": { "@simple-libs/stream-utils": "^2.0.0" } }, "sha512-dvNoRKLijXnD0XoJAz94pbNuB5GQgDr55UhpSPhffDkTT0Cmcqh9jSCOtwfT2d4H6MI9E7c4SgtMuJXZ6F3c6A=="], @@ -178,19 +180,19 @@ "@sveltejs/acorn-typescript": ["@sveltejs/acorn-typescript@1.0.13", "", { "peerDependencies": { "acorn": "^8.9.0" } }, "sha512-wgKggnhZVL9Bfx1OaKKTrYY9BFRk6C8UAkQNUcIv1+llzYrIqy+RZm5HPKzn0NpEBvTVhTqB4kQyllZywsRBRQ=="], - "@sveltejs/vite-plugin-svelte": ["@sveltejs/vite-plugin-svelte@7.3.1", "", { "dependencies": { "deepmerge": "^4.3.1", "magic-string": "^1.0.0", "obug": "^2.1.0", "vitefu": "^1.1.2" }, "peerDependencies": { "svelte": "^5.46.4", "vite": "^8.0.0-beta.7 || ^8.0.0" } }, "sha512-ZPsLN8B1e/En+Ak5s4V7srFDT532oS0qieLsQwu63NGKsS+iAjoO2Js1BochlHlglcU+Pt7WAO3C5Ee+4f6gVA=="], + "@sveltejs/vite-plugin-svelte": ["@sveltejs/vite-plugin-svelte@7.3.2", "", { "dependencies": { "deepmerge": "^4.3.1", "obug": "^3.0.0", "vitefu": "^1.1.2" }, "peerDependencies": { "svelte": "^5.46.4", "vite": "^8.0.0-beta.7 || ^8.0.0" } }, "sha512-86J4nBLeTqYYIx/paBIRqYJMFYlpTS2sepUdQ6tUyU1jxqRV72ejOrIV2wsqlOsKlkM+h0G1SgwoHI30N+n9CA=="], "@types/chai": ["@types/chai@5.2.3", "", { "dependencies": { "@types/deep-eql": "*", "assertion-error": "^2.0.1" } }, "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA=="], "@types/deep-eql": ["@types/deep-eql@4.0.2", "", {}, "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw=="], - "@types/estree": ["@types/estree@1.0.9", "", {}, "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg=="], + "@types/estree": ["@types/estree@1.0.11", "", {}, "sha512-YBdNe5JcjYR0sPhJW1QIeRCmI11YhYvaRuGCs9+WCeTTb+Yhb2BE2XMe5/wAqF10FK5g3+q1PDhQABfT7aX0gg=="], - "@types/node": ["@types/node@26.1.2", "", { "dependencies": { "undici-types": "~8.3.0" } }, "sha512-Vu4a5UFA9rIIFJ7rB/Vaafh9lrCQszopTCx6KjFboXTGQbPNasehVR5TEiithSDGyd1DEiUByggTZsg8jukeIg=="], + "@types/node": ["@types/node@26.6.11", "", { "dependencies": { "undici-types": "~8.9.0" } }, "sha512-uUyQ2XLEz+EXh34lmS3GhKrkqn/8FU7KUiKRpk347At2bmnMVWss45yz8b4FG/tUtmV1tV/+TVkITItPROyeeQ=="], "@types/whatwg-mimetype": ["@types/whatwg-mimetype@3.0.2", "", {}, "sha512-c2AKvDT8ToxLIOUlN51gTiHXflsfIFisS4pO7pDPoKouJCESkhZnEy623gwP9laCy5lnLDAw1vAzu2vM2YLOrA=="], - "@types/ws": ["@types/ws@8.18.1", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="], + "@types/ws": ["@types/ws@8.18.2", "", { "dependencies": { "@types/node": "*" } }, "sha512-67MQl+fpWKVTT1NYdnmo3U4sc/xPo/zQBncVnI74qmQa0z/b+1g6iYqNmGCPbxO+zz2aklb08a0oHfegiVd0/w=="], "@typescript/typescript-aix-ppc64": ["@typescript/typescript-aix-ppc64@7.0.2", "", { "os": "aix", "cpu": "ppc64" }, "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ=="], @@ -232,33 +234,33 @@ "@typescript/typescript-win32-x64": ["@typescript/typescript-win32-x64@7.0.2", "", { "os": "win32", "cpu": "x64" }, "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g=="], - "@vitest/coverage-v8": ["@vitest/coverage-v8@5.0.5", "", { "dependencies": { "@bcoe/v8-coverage": "^1.0.2", "@vitest/istanbul-lib-coverage": "^1.0.2", "@vitest/istanbul-lib-report": "^1.0.2", "ast-v8-to-istanbul": "^1.0.7", "magicast": "^0.5.5", "obug": "^3.0.0", "std-env": "^4.3.0", "tinyrainbow": "^3.2.0" }, "peerDependencies": { "@vitest/browser": "5.0.5", "vitest": "5.0.5" }, "optionalPeers": ["@vitest/browser"] }, "sha512-4KpkGdIrSqBihx/JyP/e+S+IKB98etg1XDQiLAxksLfcShnwi1VReGeOT9NI43hLHbknosKp/1CCLn9Zgcs8mg=="], + "@vitest/coverage-v8": ["@vitest/coverage-v8@5.1.2", "", { "dependencies": { "@bcoe/v8-coverage": "^1.0.2", "@vitest/istanbul-lib-coverage": "^2.1.1", "@vitest/istanbul-lib-report": "^2.1.1", "ast-v8-to-istanbul": "^1.0.8", "magicast": "^0.5.5", "obug": "^3.0.0", "std-env": "^4.3.0", "tinyrainbow": "^3.2.0" }, "peerDependencies": { "@vitest/browser": "5.1.2", "vitest": "5.1.2" }, "optionalPeers": ["@vitest/browser"] }, "sha512-VG0JLv0T4kr1fR6QAfe8PTou+Frc4t0u4j+oKgDH3djJpFawzBfGyX14/z56NXoCTNem3OEphzCJhc4DkE62xQ=="], - "@vitest/istanbul-lib-coverage": ["@vitest/istanbul-lib-coverage@1.0.2", "", {}, "sha512-9J/JMwOf9AoJhAywhrn7ScKTL38hsWQP/qPG60OtaAFcQ5OXPwKsxZFlbnuCKmZ61m8/lGgHYnFpdyQZUvG/iA=="], + "@vitest/istanbul-lib-coverage": ["@vitest/istanbul-lib-coverage@2.1.1", "", {}, "sha512-pF9nMHHuyQzyEXdkWX3d4wElEKjymfL5TEoofegJn/jK2WjmTLOcJKfJ7/YwYGYdbZf8Ebrt4VDUoBPiTuO9zg=="], - "@vitest/istanbul-lib-report": ["@vitest/istanbul-lib-report@1.0.2", "", { "dependencies": { "@vitest/istanbul-lib-coverage": "1.0.2" } }, "sha512-gUsfXZJbzPamoIY5TvHFiMMoXESBrUMo+xqaj+rYrWI69+EnvRlYBlP96ZnHPY4vX8kyUpgAnFUCg5wZG/HkDQ=="], + "@vitest/istanbul-lib-report": ["@vitest/istanbul-lib-report@2.1.1", "", { "dependencies": { "@vitest/istanbul-lib-coverage": "2.1.1" } }, "sha512-Qba+8OpQQAbWrmq3u1olh6jqE/vyW4OYJe6TLrrTBpXhjJhbY7Os69wyVvMQmNA64KJhGd5nQ/c7l4io8tPCHQ=="], - "@vitest/mocker": ["@vitest/mocker@5.0.5", "", { "dependencies": { "@jridgewell/trace-mapping": "0.3.31", "@vitest/spy": "5.0.5", "estree-walker": "^3.0.3", "magic-string": "^1.4.3" }, "peerDependencies": { "msw": "^2.4.9 || ^3.0.0", "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["msw", "vite"] }, "sha512-xLL3lkDegJZw+MGoGaCCsFayDZthGgpAtr3Vziyfc4p7xH89K7KRPcRBBh/kEYm0Aqkt5DtTmkYpBtRV/FrHZg=="], + "@vitest/mocker": ["@vitest/mocker@5.1.2", "", { "dependencies": { "@jridgewell/trace-mapping": "0.3.31", "@vitest/spy": "5.1.2", "estree-walker": "^3.0.3", "magic-string": "^1.4.5" }, "peerDependencies": { "msw": "^2.4.9 || ^3.0.0", "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["msw", "vite"] }, "sha512-UGc97wUIy0Ji2+9GxzHEJiOhiwkaukgE7VYcUNnjpX3sWnwQ8XogmNXX4WyOukxYgKb8Nh2XFa7KId0ZjpmVhQ=="], - "@vitest/spy": ["@vitest/spy@5.0.5", "", {}, "sha512-lwJRExuH417257Q5wv9QYugN9IMJkoxcrKrYxGPQkBzl7wlNpTUxD/5yNX4ESKVUIShKPgkGchYPFMWOOk0wzw=="], + "@vitest/spy": ["@vitest/spy@5.1.2", "", {}, "sha512-PQl0/3+p9GaY71+MHywN6oyHfLhVDD5kcbm7oNRldA2F0ExMU3S8RQdnpteJ9gFAdK5P6KCgE6LqCpUgy57KzA=="], "acorn": ["acorn@8.19.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw=="], "ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="], - "ansi-regex": ["ansi-regex@6.2.2", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="], + "ansi-regex": ["ansi-regex@6.6.0", "", {}, "sha512-XZ5apbzreCbXSKwPjJstu8R0zOi247w3XYwWxtwBXgpZrCyc1Ka7p9/xY0A9/diMewmHbEKz+FIraWaEWjlN5g=="], "ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], "argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], - "argue-cli": ["argue-cli@3.1.0", "", {}, "sha512-DhBpBfXL4SS2uC0N922MMajKR3CdrTG0u2or1PNYgXMsrSzViJrbtvT0nCLlLGUI0plam/ZZCs7aAauHtW9thw=="], + "argue-cli": ["argue-cli@3.2.1", "", {}, "sha512-h8QG03KSAympQnbZe0k5h/mnQCCkoKO9rVQ0L+F99+NNTV4vm18Lq70WwIKE0aLN3mM1EUf42l960bl6Dd0jOw=="], "aria-query": ["aria-query@5.3.1", "", {}, "sha512-Z/ZeOgVl7bcSYZ/u/rh0fOpvEpq//LZmdbkXyc7syVzjPAhfOa9ebsdTSjEBDU4vs5nC98Kfduj1uFo0qyET3g=="], "assertion-error": ["assertion-error@2.0.1", "", {}, "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA=="], - "ast-v8-to-istanbul": ["ast-v8-to-istanbul@1.0.7", "", { "dependencies": { "@jridgewell/trace-mapping": "^0.3.31", "estree-walker": "^3.0.3", "js-tokens": "^10.0.0" } }, "sha512-kFL68AG6ajd8fg248zwM9GQrUWEp79gsmjum34OEXjs4yHuUMZfYKwOLW9GMmB4oNvVrj+EAGxsP7ye2UR9UlA=="], + "ast-v8-to-istanbul": ["ast-v8-to-istanbul@1.0.8", "", { "dependencies": { "@jridgewell/trace-mapping": "^0.3.31", "estree-walker": "^3.0.3", "js-tokens": "^10.0.0" } }, "sha512-lPdpagk13ANXV+HClJEpCZM7kUsl5XcvgqKzZhaj6Ve1ZFICcY2sGhAN1n1vT0tML6EclT7bfVgTxqL57Gkpow=="], "axobject-query": ["axobject-query@4.1.0", "", {}, "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ=="], @@ -280,20 +282,18 @@ "color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], - "commitlint-plugin-function-rules": ["commitlint-plugin-function-rules@4.0.1", "", { "peerDependencies": { "@commitlint/lint": ">=19 <20" } }, "sha512-q3zniafaRo41x0eatCCe1ai9Tge4ArK4Mc5rVXTCtj6D9s0unxYpCnFiyLVOpKyz8za78qlZacCHTErvHnU+dw=="], + "commitlint-plugin-function-rules": ["commitlint-plugin-function-rules@5.0.1", "", { "peerDependencies": { "@commitlint/lint": ">=19 <22" } }, "sha512-AC8fH83A+soNq9VKTlLptkbg8Zpfx88ng9hKzdiJ0N+GoYgWTWNt6yFA3zEZ0qy3ekQ4Paf1slkaH1UKWRLUvg=="], "content-type": ["content-type@3.1.1", "", {}, "sha512-GW4qUsfFo59d0HbUibDlWv5wPz+vAAcaTWbKIuKCf0JkC7wWkSyf8f13IpXn5JkeMlB2P8iTSSIjwXljorg2vA=="], - "conventional-changelog-angular": ["conventional-changelog-angular@9.2.1", "", { "dependencies": { "@conventional-changelog/template": "^1.2.1" } }, "sha512-oWSL6ZhnXbYraOFTK3PgRAQJ8fADDAEv5K6AdeyQPLvjFmhG8+ejL0jZZp/R7vTmGJaBvZEE+sE7dB4bCv7sAw=="], + "conventional-changelog-angular": ["conventional-changelog-angular@9.4.0", "", { "dependencies": { "@conventional-changelog/template": "^1.4.0" } }, "sha512-HdxRxuS8bBXVIuo4V82gvSwAXT0vYQUizrjs/izmPg5JdDstr8v8I5hduGL3iQbG+o310dUDxC4+LetuS5hu9w=="], - "conventional-changelog-conventionalcommits": ["conventional-changelog-conventionalcommits@10.2.1", "", { "dependencies": { "@conventional-changelog/template": "^1.2.1" } }, "sha512-n4Kr1HFMTf3iMbES0TMxKIcYtUUv4rKqyQQp2JwfOEfFCOfGT3Tq4mCyJ8S9/YPyWhydjfKrrvnyl+gCjA+mJQ=="], + "conventional-changelog-conventionalcommits": ["conventional-changelog-conventionalcommits@10.4.1", "", { "dependencies": { "@conventional-changelog/template": "^1.4.0" } }, "sha512-jS1LRFSbRoAr6JbhhRy1JYfNNUj5LM3+v49hRE03CgccsiYqgdVj/RTmrw4J1rylrqijHwdOlJWiJa61JHOgHg=="], - "conventional-commits-parser": ["conventional-commits-parser@7.1.1", "", { "dependencies": { "@simple-libs/stream-utils": "^2.0.0", "argue-cli": "^3.1.0" }, "bin": { "conventional-commits-parser": "./dist/cli/index.js" } }, "sha512-B0f42jI++V5Vb7qK+DDw68r0dNxz5hk+RdKUkx2NOi39emc9hsHa3u2M3doF7QQhRFzCrAj7uM90teG+RBTaYQ=="], + "conventional-commits-parser": ["conventional-commits-parser@7.1.4", "", { "dependencies": { "@simple-libs/stream-utils": "^2.0.0", "argue-cli": "^3.1.0" }, "bin": { "conventional-commits-parser": "./dist/cli/index.js" } }, "sha512-TW3PZHi6hwF4cyu7KKc4kNqD1cgg8AkkK5ge9+zsEfpjaSXOeeIQyNWBr7kx5hR2wFuKVmr0be37RzcpmACQIA=="], "cosmiconfig": ["cosmiconfig@9.0.2", "", { "dependencies": { "env-paths": "^2.2.1", "import-fresh": "^3.3.0", "js-yaml": "^4.1.0", "parse-json": "^5.2.0" }, "peerDependencies": { "typescript": ">=4.9.5" }, "optionalPeers": ["typescript"] }, "sha512-gtTZxTDau1wL7Y7zifc2dd8jHSK/k6BTx/2Xp/BpdlAdnlYWFVt7qhJqgwi7637yRwRQ3qL4ZidbB4I8tA5VOg=="], - "cosmiconfig-typescript-loader": ["cosmiconfig-typescript-loader@6.3.0", "", { "dependencies": { "jiti": "2.6.1" }, "peerDependencies": { "@types/node": "*", "cosmiconfig": ">=9", "typescript": ">=5" } }, "sha512-Akr82WH1Wfqatyiqpj8HDkO2o2KmJRu1FhKfSNJP3K4IdXwHfEyL7MOb62i1AGQVLtIQM+iCE9CGOtrfhR+mmA=="], - "deepmerge": ["deepmerge@4.3.1", "", {}, "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A=="], "detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="], @@ -310,13 +310,13 @@ "es-module-lexer": ["es-module-lexer@2.3.2", "", {}, "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw=="], - "es-toolkit": ["es-toolkit@1.50.0", "", {}, "sha512-OyZKhUVvEep9ITEiwHn8GKnMRQIVqoSIX7WnRbkWgJkllCujilqP2rD0u979tkl8wqyc8ICwlc1UBVv/Sl1G6w=="], + "es-toolkit": ["es-toolkit@1.53.2", "", {}, "sha512-iUqZ+NlwH4jUgRmXZUxFBsV/9762TQEa1O4IXLFBmDEjVHScBytKuseX23I0+v9ShZ5MYxEx6WKNzm6IPnex8g=="], "escalade": ["escalade@3.2.0", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="], "esm-env": ["esm-env@1.2.2", "", {}, "sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA=="], - "esrap": ["esrap@2.4.0", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.4.15" }, "peerDependencies": { "@typescript-eslint/types": "^8.2.0" }, "optionalPeers": ["@typescript-eslint/types"] }, "sha512-CQPcneEHw/czj32uwQC52nYnax8H4SXt25FCM+LIwGZ49cMIxpOj3bP8wmzcI+Z0HIy5KkClaPhRLfCySzwHPA=="], + "esrap": ["esrap@2.4.2", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.4.15" }, "peerDependencies": { "@typescript-eslint/types": "^8.2.0" }, "optionalPeers": ["@typescript-eslint/types"] }, "sha512-WpVZsWnSheHBy+fGrO/0duwnbe6ODZH1QyBbjupreSCJGojaBWRncrq+HVeIJ8eHQjEwSJg9hC4yPJyNVOrpqg=="], "estree-walker": ["estree-walker@3.0.3", "", { "dependencies": { "@types/estree": "^1.0.0" } }, "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g=="], @@ -332,7 +332,7 @@ "get-caller-file": ["get-caller-file@2.0.5", "", {}, "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="], - "get-east-asian-width": ["get-east-asian-width@1.6.0", "", {}, "sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA=="], + "get-east-asian-width": ["get-east-asian-width@1.7.0", "", {}, "sha512-XjH1AECxf0giL2V1aU8vKyRR2ppRUb5c0EvT7zuJTokQ74bNo52zOtghqdWIqrhUD79fo3x0WfKZdOqxF6LG1Q=="], "global-directory": ["global-directory@5.0.0", "", { "dependencies": { "ini": "6.0.0" } }, "sha512-1pgFdhK3J2LeM+dVf2Pd424yHx2ou338lC0ErNP2hPx4j8eW1Sp0XqSjNxtk6Tc4Kr5wlWtSvz8cn2yb7/SG/w=="], @@ -352,7 +352,7 @@ "jiti": ["jiti@2.6.1", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ=="], - "js-tokens": ["js-tokens@10.0.0", "", {}, "sha512-lM/UBzQmfJRo9ABXbPWemivdCW8V2G8FHaHdypQaIy523snUjog0W71ayWXTjiR+ixeMyVHN2XcpnTd/liPg/Q=="], + "js-tokens": ["js-tokens@10.0.2", "", {}, "sha512-DXL98F5NsFBwDz7kcb4UUlrg9ePDgBCPjK4inUYi5gahxsTrKNW8Oh6F3WAuh7hntbP41EL/DkUYccRsDfLQLQ=="], "js-yaml": ["js-yaml@4.3.2", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA=="], @@ -392,13 +392,15 @@ "lucide-svelte": ["lucide-svelte@1.0.1", "", { "peerDependencies": { "svelte": "^3 || ^4 || ^5.0.0-next.42" } }, "sha512-WvzZgk0pqzgda+AErLvgWxHkfg/+GgUwqKMRHvzt0IqyMdmyEDzDCk3Z+Wo/3y753oIgx8u9Q4eUbWkghFa8Jg=="], - "magic-string": ["magic-string@1.1.0", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-kS3VHe0nEPST2saQV4Rbkchcd3UBRkVTQHo1D3h/ZTwFDhai/mfKkmtPAtD129EOI7K3HlHIsFOt0WrI2/oU9g=="], + "magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="], "magicast": ["magicast@0.5.5", "", { "dependencies": { "@babel/parser": "^7.29.7", "@babel/types": "^7.29.7", "source-map-js": "^1.2.1" } }, "sha512-UicdXN8zQ3JHlxVq+28afMXPr1z7WNY6+7EJnzTdQWkTAlMLF5fNCCKxJHBQwGaNGR11581EiQmQzx73+MvszA=="], - "nanoid": ["nanoid@3.3.18", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w=="], + "nanoid": ["nanoid@3.3.20", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ=="], - "obug": ["obug@2.1.3", "", {}, "sha512-9miFgM2OFba7hB+pRgvtV84pYTBaoTHohvmIgiRt6dRIzbwEOIaNaP+dIlGs2fNFoB0SeISs0Jz5WFVRid6Xyg=="], + "napi-windows-process-start-time": ["napi-windows-process-start-time@0.1.0", "", { "os": "win32", "cpu": [ "x64", "arm64", ] }, "sha512-zHxhzKsIFu3elch3eFw69WEUGc79DFhbc3nD/WEOzWL/pFFLZRW13EHnuO0c+0YjncE5uCaS9ICHxOBXkb6vPw=="], + + "obug": ["obug@3.0.0", "", {}, "sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw=="], "parent-module": ["parent-module@1.0.1", "", { "dependencies": { "callsites": "^3.0.0" } }, "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g=="], @@ -408,31 +410,31 @@ "picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="], - "postcss": ["postcss@8.5.26", "", { "dependencies": { "nanoid": "^3.3.17", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-u82N74LFzG8ca+dD8puPnplTXoGH4fTPpVGuIbt36G3qvNlkvfD0lEAZSxaly3KX8TS/L1A1gsCEmvKmBcVbkQ=="], + "postcss": ["postcss@8.5.34", "", { "dependencies": { "nanoid": "^3.3.20", "picocolors": "^1.1.1", "source-map-js": "^1.2.4" } }, "sha512-P1Qzj0XXZjMda74C7qiVnBG90UKNbyNUAOeQRBW8X63RsIMV57gevRqjnkELdwtZ/S2/uQFksJhmwuN8xShLPw=="], "require-from-string": ["require-from-string@2.0.2", "", {}, "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw=="], "resolve-from": ["resolve-from@5.0.0", "", {}, "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw=="], - "rolldown": ["rolldown@1.2.13", "", { "dependencies": { "@oxc-project/types": "=0.153.0", "@rolldown/pluginutils": "^1.0.0" }, "optionalDependencies": { "@rolldown/binding-android-arm-eabi": "1.2.13", "@rolldown/binding-android-arm64": "1.2.13", "@rolldown/binding-darwin-arm64": "1.2.13", "@rolldown/binding-darwin-x64": "1.2.13", "@rolldown/binding-freebsd-x64": "1.2.13", "@rolldown/binding-linux-arm-gnueabihf": "1.2.13", "@rolldown/binding-linux-arm64-gnu": "1.2.13", "@rolldown/binding-linux-arm64-musl": "1.2.13", "@rolldown/binding-linux-ppc64-gnu": "1.2.13", "@rolldown/binding-linux-s390x-gnu": "1.2.13", "@rolldown/binding-linux-x64-gnu": "1.2.13", "@rolldown/binding-linux-x64-musl": "1.2.13", "@rolldown/binding-openharmony-arm64": "1.2.13", "@rolldown/binding-win32-arm64-msvc": "1.2.13", "@rolldown/binding-win32-x64-msvc": "1.2.13" }, "bin": { "rolldown": "./bin/cli.mjs" } }, "sha512-/5apOkwWxtACcQtZ5WlrAsKS4JwXVThQPJZ3RqIruRY9UG9M8e0VlXN068xum/JRKA4aIUoJ13ghe/kGCvidiQ=="], + "rolldown": ["rolldown@1.3.4", "", { "dependencies": { "@oxc-project/types": "=0.160.0", "@rolldown/pluginutils": "^1.0.0" }, "optionalDependencies": { "@rolldown/binding-android-arm-eabi": "1.3.4", "@rolldown/binding-android-arm64": "1.3.4", "@rolldown/binding-darwin-arm64": "1.3.4", "@rolldown/binding-darwin-x64": "1.3.4", "@rolldown/binding-freebsd-x64": "1.3.4", "@rolldown/binding-linux-arm-gnueabihf": "1.3.4", "@rolldown/binding-linux-arm64-gnu": "1.3.4", "@rolldown/binding-linux-arm64-musl": "1.3.4", "@rolldown/binding-linux-ppc64-gnu": "1.3.4", "@rolldown/binding-linux-s390x-gnu": "1.3.4", "@rolldown/binding-linux-x64-gnu": "1.3.4", "@rolldown/binding-linux-x64-musl": "1.3.4", "@rolldown/binding-openharmony-arm64": "1.3.4", "@rolldown/binding-wasm32-wasi": "1.3.4", "@rolldown/binding-win32-arm64-msvc": "1.3.4", "@rolldown/binding-win32-x64-msvc": "1.3.4" }, "bin": { "rolldown": "./bin/cli.mjs" } }, "sha512-p2rq4bfBmF0M6yaR8+A89fbkBQynZI2fxUW4G07eq9kpctAkpo7q5BZ4X4Mo4XZ7HHROu33cX9PeopUFN6u+2Q=="], - "semver": ["semver@7.8.5", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA=="], + "semver": ["semver@7.8.6", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw=="], - "source-map-js": ["source-map-js@1.2.2", "", {}, "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw=="], + "source-map-js": ["source-map-js@1.2.4", "", {}, "sha512-J7ZjMvHd9O1fcT/5V09QWaaSl2BbWx3F6O08spde82Namf9UB0GxRVIPiNbVsdKkoizHiSpTodo3vp2bAy91MA=="], "std-env": ["std-env@4.3.0", "", {}, "sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag=="], - "string-width": ["string-width@8.2.2", "", { "dependencies": { "get-east-asian-width": "^1.5.0", "strip-ansi": "^7.1.2" } }, "sha512-GaPUh5gfdrYzqeVNZvUfT23vYYxXzKYidUcnMtJg/3rxRV63EFZy3k6xfKlmfeJD0176lnUV/Usr3XcwSvFzpg=="], + "string-width": ["string-width@8.3.0", "", { "dependencies": { "get-east-asian-width": "^1.5.0", "strip-ansi": "^7.1.2" } }, "sha512-ZbmZM0JCihQN91dWnxoipT2KOEyHqEyfRXUyjuRhW8b/xnqPDoq4gWEVApTVa9db2wN8mmoikgFBbjh71+cGeQ=="], "strip-ansi": ["strip-ansi@7.2.0", "", { "dependencies": { "ansi-regex": "^6.2.2" } }, "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w=="], "supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], - "svelte": ["svelte@5.57.2", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "@jridgewell/sourcemap-codec": "^1.6.0", "@sveltejs/acorn-typescript": "^1.0.13", "@types/estree": "^1.0.9", "acorn": "^8.18.0", "aria-query": "5.3.1", "axobject-query": "^4.1.0", "clsx": "^2.1.1", "devalue": "^5.9.2", "esm-env": "^1.2.1", "esrap": "^2.3.6", "is-reference": "^3.0.3", "locate-character": "^3.0.0", "magic-string": "^0.30.11", "zimmerframe": "^1.1.2" } }, "sha512-1YiPCAXT0Ct6g1vOMmSLa0Nsc3QRMvtDF32ihgglGVrugIuIK38RyDiFNXVDhtQ81TJjSO57NdMw6DyYLqSGDQ=="], + "svelte": ["svelte@5.59.2", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "@jridgewell/sourcemap-codec": "^1.6.0", "@sveltejs/acorn-typescript": "^1.0.13", "@types/estree": "^1.0.9", "acorn": "^8.18.0", "aria-query": "5.3.1", "axobject-query": "^4.1.0", "clsx": "^2.1.1", "devalue": "^6.0.4", "esm-env": "^1.2.1", "esrap": "^2.4.2", "is-reference": "^3.0.3", "locate-character": "^3.0.0", "magic-string": "^0.30.11", "zimmerframe": "^1.1.2" } }, "sha512-XsSgJYzoRJ1GfD5IOJorwRy77eIEv8I1p+3wDQGkDIEbVd8BFXCy4PTQ8diPtuazRRHq6IWidBg2m3rDrqNtcA=="], - "tinybench": ["tinybench@6.2.2", "", {}, "sha512-nIZ2N2dFpjBsg2hgitKu7mA+FvsIJuGJOwysRngmVRRmWgR/UyPjwJj8c/fT/dhm8EkHnF5EOogRf+0Z2qrimA=="], + "tinybench": ["tinybench@6.2.5", "", {}, "sha512-b/8GRMdnY4cqkfCLyaFpTGIv1qwfi3oT0mWaepwT++6Z/ZrYehNfZZ2JDKVLKGhNoEkS3IIB1ELtCT0XS5DtOA=="], - "tinyexec": ["tinyexec@1.2.4", "", {}, "sha512-SHf/r48b7vOrjve9PxJo3MN5v5yuyjHvdUcrQffT3WXMUfnGmHDVbC4k3sHJaJTgZCwpUplIaAo5ANtMyp3YHg=="], + "tinyexec": ["tinyexec@1.4.0", "", {}, "sha512-PV6lIcJQh57aFeJDwx16JNHmgFRh5xguzallrDW1qe8nAghYgr5MKz2K5k7wEyV/ygZhdnIAP8+HZSarHPBCsg=="], "tinyglobby": ["tinyglobby@0.2.17", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" } }, "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g=="], @@ -444,17 +446,19 @@ "undici": ["undici@6.29.1", "", {}, "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA=="], - "undici-types": ["undici-types@8.3.0", "", {}, "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ=="], + "undici-types": ["undici-types@8.9.0", "", {}, "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg=="], "universal-user-agent": ["universal-user-agent@7.0.3", "", {}, "sha512-TmnEAEAsBJVZM/AADELsK76llnwcf9vMKuPz8JflO1frO8Lchitr0fNaN9d+Ap0BjKtqWqd/J17qeDnXh8CL2A=="], "unplugin": ["unplugin@1.16.1", "", { "dependencies": { "acorn": "^8.14.0", "webpack-virtual-modules": "^0.6.2" } }, "sha512-4/u/j4FrCKdi17jaxuJA0jClGxB1AvU2hw/IuayPc4ay1XGaJs/rbb4v5WKwAjNifjmXK9PIFyuPiaK8azyR9w=="], - "vite": ["vite@8.3.4", "", { "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.7", "postcss": "^8.5.29", "rolldown": "~1.2.12", "tinyglobby": "^0.2.17" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.7.1", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-IftLE8phJhdNRIGNEV4JCCvfNScoZQVfcXaN8TQropWGJtOHcu+iAB9pHcuGvmEb/kddw0LBe/jS8ztdC6xdiQ=="], + "verkit": ["verkit@0.5.0", "", {}, "sha512-u4J1hr6Y+C/hit34GwL3eIcUf3wngT8TlYUjK7tk0jxydKLAq3sYvifjdTDA6U3KCKRcQCQDGf/srjxfZF3l7g=="], + + "vite": ["vite@8.4.0", "", { "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.7", "postcss": "^8.5.33", "rolldown": "~1.3.2", "tinyglobby": "^0.2.17" }, "optionalDependencies": { "fsevents": "~2.3.3", "napi-windows-process-start-time": "^0.1.0" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.7.1 || ^0.8.0", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-X2nUJg+9cutlz3hzqyO6p+WTwk9H257DjwAEf9EQYUFrQbDItmetadi9gYmb+l7VDy4r3VXLUnmLTwuPmzejDw=="], - "vitefu": ["vitefu@1.1.3", "", { "peerDependencies": { "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["vite"] }, "sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg=="], + "vitefu": ["vitefu@1.1.4", "", { "peerDependencies": { "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["vite"] }, "sha512-qbEIDswfXH3x3IYRMScl/bf1AVW0dn7Z8qkr7g7nohkusfuC7tcFa7t5EoTOz60AunosLM9sDrDjHxsX+Up+CQ=="], - "vitest": ["vitest@5.0.5", "", { "dependencies": { "@types/chai": "^5.2.2", "@vitest/mocker": "5.0.5", "chai": "^6.3.0", "es-module-lexer": "^2.3.2", "expect-type": "^1.4.0", "magic-string": "^1.4.3", "obug": "^3.0.0", "picomatch": "^4.0.7", "std-env": "^4.3.0", "tinybench": "^6.2.2", "tinyexec": "^1.3.1", "tinyglobby": "^0.2.17", "why-is-node-running": "3.2.1" }, "peerDependencies": { "@edge-runtime/vm": "*", "@opentelemetry/api": "^1.9.0", "@types/node": "^22.0.0 || >=24.0.0", "@vitest/browser-playwright": "5.0.5", "@vitest/browser-preview": "5.0.5", "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0", "@vitest/coverage-istanbul": "5.0.5", "@vitest/coverage-v8": "5.0.5", "@vitest/ui": "5.0.5", "happy-dom": "*", "jsdom": "*", "vite": "^6.4.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["@edge-runtime/vm", "@opentelemetry/api", "@types/node", "@vitest/browser-playwright", "@vitest/browser-preview", "@vitest/browser-webdriverio", "@vitest/coverage-istanbul", "@vitest/coverage-v8", "@vitest/ui", "happy-dom", "jsdom"], "bin": { "vitest": "./vitest.mjs" } }, "sha512-cPODOMF8YnkiiYtDdHo6n4wWmBrOBBbOIYH2d33M4l3CdNn72h+qMmO6uXffUN6A5AZFXNND/d+krS9mgkXRfg=="], + "vitest": ["vitest@5.1.2", "", { "dependencies": { "@types/chai": "^5.2.2", "@vitest/mocker": "5.1.2", "chai": "^6.3.0", "es-module-lexer": "^2.3.2", "expect-type": "^1.4.0", "magic-string": "^1.4.5", "obug": "^3.0.0", "picomatch": "^4.0.7", "std-env": "^4.3.0", "tinybench": "^6.2.3", "tinyexec": "^1.3.1", "tinyglobby": "^0.2.17", "why-is-node-running": "3.2.1" }, "peerDependencies": { "@edge-runtime/vm": "*", "@opentelemetry/api": "^1.9.0", "@types/node": "^22.0.0 || >=24.0.0", "@vitest/browser-playwright": "5.1.2", "@vitest/browser-preview": "5.1.2", "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0", "@vitest/coverage-istanbul": "5.1.2", "@vitest/coverage-v8": "5.1.2", "@vitest/ui": "5.1.2", "happy-dom": "*", "jsdom": "*", "vite": "^6.4.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["@edge-runtime/vm", "@opentelemetry/api", "@types/node", "@vitest/browser-playwright", "@vitest/browser-preview", "@vitest/browser-webdriverio", "@vitest/coverage-istanbul", "@vitest/coverage-v8", "@vitest/ui", "happy-dom", "jsdom"], "bin": { "vitest": "./vitest.mjs" } }, "sha512-VIa2wXV208WraXUbzH+dQUrGcFpPuaiRA8HlhXS8R6/sy9cynw6OMqGj8fmAlH1hot7huTCtWUE14+FdXU3eLw=="], "webpack-virtual-modules": ["webpack-virtual-modules@0.6.2", "", {}, "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ=="], @@ -464,15 +468,15 @@ "wrap-ansi": ["wrap-ansi@9.0.2", "", { "dependencies": { "ansi-styles": "^6.2.1", "string-width": "^7.0.0", "strip-ansi": "^7.1.0" } }, "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww=="], - "ws": ["ws@8.21.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-+0NTnW77fFN/DjQi6k/Sq/Yvk4Sgajw7urW8V+asjXnRgDs9gyGkdb7EzgfhA4goXsRIZKE28fzIXBHEzhuiWw=="], + "ws": ["ws@8.23.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-1rzWDSN0NOi3tpwgHsQExjWRoKUGtjCkJ2gZRaaRtzhYLboMytOI9pj9PU7yCgY37auqdd4OyLofZDbkeuZmPA=="], "y18n": ["y18n@5.0.8", "", {}, "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA=="], - "yargs": ["yargs@18.1.0", "", { "dependencies": { "cliui": "^9.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "string-width": "^8.2.1", "y18n": "^5.0.5", "yargs-parser": "^22.0.0" } }, "sha512-2rAgRKu54VsHkqI0/tYkmluGXHD4KW7yZoycuqDQ15QOTnc2VVfy0nN/1eMhnQLO00A+dwtK20xuCnc1YGeUyg=="], + "yargs": ["yargs@18.2.0", "", { "dependencies": { "cliui": "^9.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "string-width": "^8.2.1", "y18n": "^5.0.5", "yargs-parser": "^22.0.0" } }, "sha512-9OpKOLeaoNFecEp7P6iYbzze/5CqWoH7N3SMs/6y1XF4nMvFMspEGZzJ6uFi9MmQwXhyzqYoSEKO3tvA3Z/o2w=="], "yargs-parser": ["yargs-parser@22.0.0", "", {}, "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw=="], - "zimmerframe": ["zimmerframe@1.1.4", "", {}, "sha512-B58NGBEoc8Y9MWWCQGl/gq9xBCe4IiKM0a2x7GZdQKOW5Exr8S1W24J6OgM1njK8xCRGvAJIL/MxXHf6SkmQKQ=="], + "zimmerframe": ["zimmerframe@1.1.5", "", {}, "sha512-msJxIvYDYcoNL+PJsu+7qmpDWsYmAxTY+2TNYXXF0hzBzBk0BMecOqDOG/EckUoKCuKwObfbugIl8QpqHDXeFA=="], "zod": ["zod@4.6.7", "", {}, "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg=="], @@ -480,33 +484,17 @@ "@babel/code-frame/js-tokens": ["js-tokens@4.0.0", "", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="], - "@jridgewell/gen-mapping/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.5", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="], - - "@jridgewell/trace-mapping/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.5", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="], - "@octokit/plugin-paginate-rest/@octokit/types": ["@octokit/types@16.0.0", "", { "dependencies": { "@octokit/openapi-types": "^27.0.0" } }, "sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg=="], "@octokit/plugin-rest-endpoint-methods/@octokit/types": ["@octokit/types@16.0.0", "", { "dependencies": { "@octokit/openapi-types": "^27.0.0" } }, "sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg=="], - "@vitest/coverage-v8/obug": ["obug@3.0.0", "", {}, "sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw=="], - - "@vitest/mocker/magic-string": ["magic-string@1.4.3", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.6.0" } }, "sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ=="], + "@vitest/mocker/magic-string": ["magic-string@1.4.5", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.6.0" } }, "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w=="], "cliui/string-width": ["string-width@7.2.0", "", { "dependencies": { "emoji-regex": "^10.3.0", "get-east-asian-width": "^1.0.0", "strip-ansi": "^7.1.0" } }, "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ=="], "import-fresh/resolve-from": ["resolve-from@4.0.0", "", {}, "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g=="], - "magic-string/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.5", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="], - - "svelte/magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="], - - "tinyglobby/picomatch": ["picomatch@4.0.5", "", {}, "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A=="], - - "vitest/magic-string": ["magic-string@1.4.3", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.6.0" } }, "sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ=="], - - "vitest/obug": ["obug@3.0.0", "", {}, "sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw=="], - - "vitest/tinyexec": ["tinyexec@1.3.1", "", {}, "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA=="], + "vitest/magic-string": ["magic-string@1.4.5", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.6.0" } }, "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w=="], "wrap-ansi/ansi-styles": ["ansi-styles@6.2.3", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="], @@ -515,7 +503,5 @@ "@octokit/plugin-paginate-rest/@octokit/types/@octokit/openapi-types": ["@octokit/openapi-types@27.0.0", "", {}, "sha512-whrdktVs1h6gtR+09+QsNk2+FO+49j6ga1c55YZudfEG+oKJVvJLQi3zkOm5JjiUXAagWK2tI2kTGKJ2Ys7MGA=="], "@octokit/plugin-rest-endpoint-methods/@octokit/types/@octokit/openapi-types": ["@octokit/openapi-types@27.0.0", "", {}, "sha512-whrdktVs1h6gtR+09+QsNk2+FO+49j6ga1c55YZudfEG+oKJVvJLQi3zkOm5JjiUXAagWK2tI2kTGKJ2Ys7MGA=="], - - "svelte/magic-string/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.5", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="], } } diff --git a/src/LocalTelemetry.App/Settings/wwwroot/package.json b/src/LocalTelemetry.App/Settings/wwwroot/package.json index 8c94fbd..0e2c760 100644 --- a/src/LocalTelemetry.App/Settings/wwwroot/package.json +++ b/src/LocalTelemetry.App/Settings/wwwroot/package.json @@ -1,53 +1,51 @@ -{ - "name": "localtelemetry", - "version": "1.2.0", - "description": "Settings UI for LocalTelemetry", - "license": "GPL-3.0-or-later", - "private": true, - "type": "module", - "scripts": { - "dev": "vite", - "build": "vite build", - "preview": "vite preview", - "test": "vitest run", - "test:coverage": "vitest run --coverage", - "commitlint": "commitlint" - }, - "devDependencies": { - "@codecov/vite-plugin": "^2.0.1", - "@commitlint/cli": "^21.2.3", - "@commitlint/config-conventional": "^21.2.3", - "@sveltejs/vite-plugin-svelte": "^7.3.1", - "@vitest/coverage-v8": "^5.0.5", - "commitlint-plugin-function-rules": "4.0.1", - "happy-dom": "^21.0.4", - "svelte": "^5.57.2", - "typescript": "^7.0.2", - "vite": "^8.3.4", - "vitest": "^5.0.5" - }, - "overrides": { - "fast-uri": "^3.1.9", - "nanoid": "^3.3.18", - "postcss": "^8.5.23", - "js-yaml": "^4.3.2", - "dompurify": "^3.4.17", - "esbuild": "^0.25.0", - "cross-spawn": "^7.0.6", - "body-parser": "^1.20.3", - "fast-xml-parser": "^4.5.1", - "cookie": "^0.7.0", - "send": "^0.19.0", - "express": "^4.20.0", - "devalue": "^5.9.3", - "source-map-js": "^1.2.2", - "@vitest/mocker": "^5.0.5", - "zod": "^4.6.7" - }, - "dependencies": { - "@lucide/svelte": "^1.59.0", - "lucide-svelte": "^1.0.1" - } -} - - +{ + "name": "localtelemetry", + "version": "1.3.0-beta.9", + "description": "Settings UI for LocalTelemetry", + "license": "GPL-3.0-or-later", + "private": true, + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview", + "test": "vitest run", + "test:coverage": "vitest run --coverage", + "commitlint": "commitlint" + }, + "devDependencies": { + "@codecov/vite-plugin": "^2.0.1", + "@commitlint/cli": "^21.3.0", + "@commitlint/config-conventional": "^21.3.0", + "@sveltejs/vite-plugin-svelte": "^7.3.2", + "@vitest/coverage-v8": "^5.1.2", + "commitlint-plugin-function-rules": "5.0.1", + "happy-dom": "^21.0.4", + "svelte": "^5.59.2", + "typescript": "^7.0.2", + "vite": "^8.4.0", + "vitest": "^5.1.2" + }, + "overrides": { + "fast-uri": "^3.1.9", + "nanoid": "^3.3.18", + "postcss": "^8.5.23", + "js-yaml": "^4.3.2", + "dompurify": "^3.4.17", + "esbuild": "^0.25.0", + "cross-spawn": "^7.0.6", + "body-parser": "^1.20.3", + "fast-xml-parser": "^4.5.1", + "cookie": "^0.7.0", + "send": "^0.19.0", + "express": "^4.20.0", + "devalue": "^5.9.3", + "source-map-js": "^1.2.2", + "@vitest/mocker": "^5.0.5", + "zod": "^4.6.7" + }, + "dependencies": { + "@lucide/svelte": "^1.84.0", + "lucide-svelte": "^1.0.1" + } +} diff --git a/src/LocalTelemetry.App/Settings/wwwroot/src/app.css b/src/LocalTelemetry.App/Settings/wwwroot/src/app.css index 96b9e22..0a91aaa 100644 --- a/src/LocalTelemetry.App/Settings/wwwroot/src/app.css +++ b/src/LocalTelemetry.App/Settings/wwwroot/src/app.css @@ -20,7 +20,7 @@ --color-success: #4ade80; --color-warning: #f59e0b; --color-error: #f43f5e; - --color-orange: #fb923c; + --color-secondary: #38bdf8; --radius-sm: 0.25rem; --radius-md: 0.375rem; @@ -78,6 +78,15 @@ textarea { color: inherit; } +select { + color-scheme: dark; +} + +option { + background-color: var(--color-surface-2); + color: var(--color-text); +} + button { cursor: pointer; background: none; @@ -93,6 +102,13 @@ button { /* Scrollbar */ ::-webkit-scrollbar { width: 6px; + height: 6px; +} + +::-webkit-scrollbar-button { + display: none; + width: 0; + height: 0; } ::-webkit-scrollbar-track { diff --git a/src/LocalTelemetry.App/Settings/wwwroot/src/components/App.svelte b/src/LocalTelemetry.App/Settings/wwwroot/src/components/App.svelte index bdd79a0..a307396 100644 --- a/src/LocalTelemetry.App/Settings/wwwroot/src/components/App.svelte +++ b/src/LocalTelemetry.App/Settings/wwwroot/src/components/App.svelte @@ -24,7 +24,7 @@ requestTrafficHistoryAll, logError, } from "../lib/bridge.ts"; - import { deepClone } from "../lib/utils.ts"; + import { deepClone, sanitizeSettingsForDirtyCheck } from "../lib/utils.ts"; import { applyThemeVars } from "../lib/themes.ts"; import Sidebar from "./Sidebar.svelte"; import GeneralPage from "./pages/GeneralPage.svelte"; @@ -45,13 +45,32 @@ let isDirty = $derived.by(() => { if (!$settings || !$pristineSettings) return false; - return JSON.stringify($settings) !== $pristineSettings; + try { + const currentClean = sanitizeSettingsForDirtyCheck($settings); + const pristineClean = sanitizeSettingsForDirtyCheck( + JSON.parse($pristineSettings), + ); + return ( + JSON.stringify(currentClean) !== JSON.stringify(pristineClean) + ); + } catch (err) { + console.debug( + "Failed comparing clean settings, falling back to raw JSON", + err, + ); + return JSON.stringify($settings) !== $pristineSettings; + } }); $effect(() => { $activePage; scrollToTop(); }); + $effect(() => { + if ($settings?.windowTheme) { + applyThemeVars($settings.windowTheme); + } + }); function scrollToTop() { const el = document.getElementById("main-content"); if (el) el.scrollTop = 0; @@ -89,7 +108,9 @@ }); const unsub5 = onMessage("trafficHistoryAll", (payload) => { - const records = payload.records ?? []; + const records = Array.isArray(payload) + ? payload + : (payload?.records ?? []); allTrafficHistory.set(records); const now = new Date(); const currentMonth = records.filter((r) => { @@ -102,8 +123,8 @@ }); trafficHistory.set(currentMonth); trafficToday.set({ - downBytes: payload.todayDown ?? 0, - upBytes: payload.todayUp ?? 0, + downBytes: payload?.todayDown ?? 0, + upBytes: payload?.todayUp ?? 0, }); }); @@ -162,11 +183,51 @@ requestTrafficMonths(); }); + const unsubSlot = onMessage("taskbarSlotChanged", (payload) => { + if (!payload || typeof payload !== "object") return; + const slot = payload; + settings.update((s) => { + if (!s || !s.overlay) return s; + return { + ...s, + overlay: { + ...s.overlay, + taskbarSpaceConstrained: + slot.taskbarSpaceConstrained ?? + s.overlay.taskbarSpaceConstrained, + availableSlotWidth: + slot.availableSlotWidth ?? + s.overlay.availableSlotWidth, + }, + }; + }); + pristineSettings.update((p) => { + if (!p) return p; + try { + const parsed = JSON.parse(p); + if (parsed?.overlay) { + parsed.overlay.taskbarSpaceConstrained = + slot.taskbarSpaceConstrained ?? + parsed.overlay.taskbarSpaceConstrained; + parsed.overlay.availableSlotWidth = + slot.availableSlotWidth ?? + parsed.overlay.availableSlotWidth; + return JSON.stringify(parsed); + } + } catch (err) { + console.debug( + "Failed updating slot metrics in pristine settings", + err, + ); + } + return p; + }); + }); + requestSettings(); requestNics(); requestSystemInfo(); requestTrafficMonths(); - requestTrafficHistoryAll(); return () => { unsub1(); unsub2(); @@ -177,6 +238,7 @@ unsub7(); unsub8(); unsub9(); + unsubSlot(); }; } }); @@ -185,6 +247,7 @@ if (!$settings || saving) return; saving = true; saveStatus.set("saving"); + pristineSettings.set(JSON.stringify(deepClone($settings))); saveSettings($settings); } @@ -356,14 +419,14 @@ .content { flex: 1; overflow-y: auto; - padding: 10px var(--space-6); + padding: 12px var(--space-4); } .save-bar { display: flex; align-items: center; justify-content: space-between; - padding: var(--space-3) var(--space-6); + padding: var(--space-2) var(--space-4); background: var(--color-surface); border-top: 1px solid var(--color-divider); transform: translateY(100%); @@ -382,7 +445,7 @@ } .save-bar.auto-save { height: auto; - padding: var(--space-1) var(--space-6); + padding: var(--space-1) var(--space-4); border: none; justify-content: center; } @@ -438,7 +501,7 @@ padding: var(--space-2) var(--space-4); border: none; border-radius: var(--radius-md); - background: var(--color-accent, #3b82f6); + background: var(--color-primary, #3b82f6); color: #ffffff; font-size: var(--text-sm); font-weight: 500; @@ -492,7 +555,7 @@ font-weight: 500; } .nav-modal .btn-save { - background: var(--color-accent, #3b82f6); + background: var(--color-primary, #3b82f6); color: #ffffff; border: none; } diff --git a/src/LocalTelemetry.App/Settings/wwwroot/src/components/Sidebar.svelte b/src/LocalTelemetry.App/Settings/wwwroot/src/components/Sidebar.svelte index 20cb0e7..6f9b33e 100644 --- a/src/LocalTelemetry.App/Settings/wwwroot/src/components/Sidebar.svelte +++ b/src/LocalTelemetry.App/Settings/wwwroot/src/components/Sidebar.svelte @@ -1,6 +1,8 @@ - @@ -38,6 +124,7 @@ diff --git a/src/LocalTelemetry.App/Settings/wwwroot/src/components/pages/AboutPage.svelte b/src/LocalTelemetry.App/Settings/wwwroot/src/components/pages/AboutPage.svelte index b6066f5..9feac19 100644 --- a/src/LocalTelemetry.App/Settings/wwwroot/src/components/pages/AboutPage.svelte +++ b/src/LocalTelemetry.App/Settings/wwwroot/src/components/pages/AboutPage.svelte @@ -129,7 +129,7 @@ { name: "Svelte 5", type: "MIT" }, { name: "Vite", type: "MIT" }, { name: "Microsoft WebView2", type: "Proprietary" }, - { name: "PawnIo Driver", type: "GPL-2.0" }, + { name: "PawnIO Driver", type: "GPL-2.0" }, { name: "MinVer", type: "Apache-2.0" }, ]; @@ -261,6 +261,9 @@ ? "" : "v"}{updateResult?.latestVersion} Available + {#if updateResult?.isPrerelease} + Beta + {/if} +
+ {/if} @@ -128,7 +218,67 @@ .page { display: flex; flex-direction: column; - gap: var(--space-5); + gap: var(--space-3); + } + .display-list { + display: flex; + flex-direction: column; + gap: var(--space-2); + padding: var(--space-2) 0; + } + .display-list-title { + color: var(--color-text-muted); + font-size: var(--text-xs); + font-weight: 500; + text-transform: uppercase; + } + .display-checkbox-item { + align-items: center; + cursor: pointer; + display: flex; + font-size: var(--text-sm); + gap: var(--space-2); + user-select: none; + } + .display-checkbox-item input[type="checkbox"] { + accent-color: var(--color-primary); + cursor: pointer; + height: 16px; + width: 16px; + } + .display-name { + color: var(--color-text); + } + .no-taskbar-badge { + color: var(--color-warning); + font-size: var(--text-xs); + font-style: italic; + } + .display-note { + align-items: flex-start; + display: flex; + flex-direction: column; + gap: var(--space-1); + margin-top: var(--space-2); + padding-top: var(--space-2); + border-top: 1px solid var(--color-border); + color: var(--color-text-muted); + font-size: var(--text-xs); + line-height: 1.4; + } + .link-btn { + background: transparent; + border: none; + color: var(--color-primary); + cursor: pointer; + font-size: var(--text-xs); + font-weight: 500; + padding: 0; + text-decoration: underline; + transition: opacity var(--transition); + } + .link-btn:hover { + opacity: 0.8; } h2 { font-size: var(--text-lg); @@ -169,6 +319,8 @@ font-size: var(--text-xs); } .banner-actions { + display: flex; + gap: var(--space-2); margin-top: var(--space-1); } .banner-btn { @@ -187,4 +339,13 @@ .banner-btn:hover { background: color-mix(in srgb, var(--color-warning) 35%, transparent); } + .banner-btn-dismiss { + background: transparent; + border-color: var(--color-border); + color: var(--color-text-muted); + } + .banner-btn-dismiss:hover { + background: var(--color-surface-hover); + color: var(--color-text); + } diff --git a/src/LocalTelemetry.App/Settings/wwwroot/src/components/pages/SystemPage.svelte b/src/LocalTelemetry.App/Settings/wwwroot/src/components/pages/SystemPage.svelte index 6879835..432b90c 100644 --- a/src/LocalTelemetry.App/Settings/wwwroot/src/components/pages/SystemPage.svelte +++ b/src/LocalTelemetry.App/Settings/wwwroot/src/components/pages/SystemPage.svelte @@ -172,12 +172,6 @@ {info.ramMfr} {/if} - {#if info.ramSpeed} -
- Speed - {info.ramSpeed} -
- {/if} {#if info.ramType}
Type @@ -245,22 +239,84 @@
Storage
{#if info.disks?.length} {#each info.disks as disk, i} -
+
Disk {i + 1} {#if disk.boot} Boot {/if} - - {disk.model} - {#if disk.formattedSize} - ({disk.formattedSize}){:else if disk.sizeGb} - ({disk.sizeGb} GB){/if} - {#if disk.displayType} - [{disk.displayType}]{:else if disk.busType} - [{busTypeToLabel(disk.busType)}]{/if} - +
+ + {disk.model} + {#if disk.formattedSize} + ({disk.formattedSize}){:else if disk.sizeGb} + ({disk.sizeGb} GB){/if} + {#if disk.displayType} + [{disk.displayType}]{:else if disk.busType} + [{busTypeToLabel(disk.busType)}]{/if} + + {#if disk.health || disk.remainingLifePercent != null || disk.totalWrittenTb != null || disk.totalReadTb != null} +
+ {#if disk.health || disk.remainingLifePercent != null} +
+ {#if disk.health} + + {disk.health} + + {/if} + {#if disk.remainingLifePercent != null} + {disk.remainingLifePercent}% life + {/if} +
+ {/if} + {#if disk.totalWrittenTb != null || disk.totalReadTb != null} +
+ {#if disk.totalWrittenTb != null} + Total Writes: + {disk.totalWrittenTb} TBW + {/if} + {#if disk.totalWrittenTb != null && disk.totalReadTb != null} + • + {/if} + {#if disk.totalReadTb != null} + Total Reads: + {disk.totalReadTb} TBR + {/if} +
+ {/if} +
+ {/if} +
{/each} {:else} @@ -429,4 +485,61 @@ margin-left: 4px; vertical-align: middle; } + .disk-row { + align-items: flex-start; + padding: var(--space-2) 0; + } + .disk-info-col { + display: flex; + flex-direction: column; + gap: 3px; + min-width: 0; + } + .disk-meta { + display: flex; + flex-direction: column; + gap: 2px; + margin-top: 2px; + } + .disk-meta-line { + display: flex; + align-items: center; + gap: var(--space-2); + font-size: var(--text-xs); + line-height: 1.4; + } + .health-badge { + font-size: 10px; + font-weight: 600; + padding: 1px 6px; + border-radius: 3px; + background: rgba(34, 197, 94, 0.15); + color: #22c55e; + letter-spacing: 0.02em; + } + .health-badge.warn { + background: rgba(234, 179, 8, 0.15); + color: #eab308; + } + .health-badge.bad { + background: rgba(239, 68, 68, 0.15); + color: #ef4444; + } + .disk-sub { + font-size: 11px; + color: var(--color-text-secondary, #cbd5e1); + font-weight: 500; + } + .disk-sub-label { + color: var(--color-text-muted, #94a3b8); + } + .disk-sub-val { + color: var(--color-text, #f1f5f9); + font-weight: 600; + } + .disk-dot { + font-size: 10px; + color: var(--color-text-muted, #94a3b8); + opacity: 0.8; + } diff --git a/src/LocalTelemetry.App/Settings/wwwroot/src/components/pages/TrafficHistoryPage.svelte b/src/LocalTelemetry.App/Settings/wwwroot/src/components/pages/TrafficHistoryPage.svelte index a9d4148..970fdb4 100644 --- a/src/LocalTelemetry.App/Settings/wwwroot/src/components/pages/TrafficHistoryPage.svelte +++ b/src/LocalTelemetry.App/Settings/wwwroot/src/components/pages/TrafficHistoryPage.svelte @@ -12,12 +12,32 @@ importDatContent, importWindowsUsage, requestTrafficHistoryAll, + exportDatabase, + openFolder, + onMessage, } from "../../lib/bridge.ts"; + let exportModalData = $state(null); + let exportError = $state(null); + onMount(() => { - if ($allTrafficHistory.length === 0) { - requestTrafficHistoryAll(); - } + requestTrafficHistoryAll(); + + const unsubExport = onMessage("exportDatabaseResult", (payload) => { + if (payload?.cancelled) return; + if (payload?.success && payload?.filePath) { + exportModalData = { + filePath: payload.filePath, + fileName: payload.fileName || "internet_usage.jsonl", + }; + } else if (payload?.error) { + exportError = payload.error; + } + }); + + return () => { + unsubExport(); + }; }); function formatDateInput(date) { @@ -31,22 +51,25 @@ let winStartDate = $state(formatDateInput(sevenDaysAgo)); let winEndDate = $state(formatDateInput(today)); let isWindowsImporting = $state(false); - let dismissTimer = null; function toDmy(isoStr) { if (!isoStr) return ""; const parts = isoStr.split("-"); - if (parts.length === 3 && parts[0].length === 4) { - return `${parts[2]}-${parts[1]}-${parts[0]}`; - } - return isoStr; + return parts.length === 3 && parts[0].length === 4 + ? `${parts[2]}-${parts[1]}-${parts[0]}` + : isoStr; } function validateDateString(str) { if (!str || !str.trim()) return "Date is required."; - if (!/^\d{4}-\d{2}-\d{2}$/.test(str)) + let y, m, d; + if (/^\d{4}-\d{2}-\d{2}$/.test(str)) { + [y, m, d] = str.split("-").map(Number); + } else if (/^\d{2}-\d{2}-\d{4}$/.test(str)) { + [d, m, y] = str.split("-").map(Number); + } else { return "Invalid date (use DD-MM-YYYY)."; - const [y, m, d] = str.split("-").map(Number); + } if (y < 2000 || y > 2100 || m < 1 || m > 12 || d < 1 || d > 31) return "Invalid date."; const dateObj = new Date(y, m - 1, d); @@ -104,13 +127,42 @@ $effect(() => { if ($windowsImportResult) { isWindowsImporting = false; - if (dismissTimer) clearTimeout(dismissTimer); - dismissTimer = setTimeout(() => { + const timer = setTimeout(() => { windowsImportResult.set(null); }, 6000); + return () => clearTimeout(timer); } }); + $effect(() => { + if ($importResult) { + const timer = setTimeout(() => { + importResult.set(null); + }, 6000); + return () => clearTimeout(timer); + } + }); + + function handleExportDatabase() { + if (!$allTrafficHistory || $allTrafficHistory.length === 0) return; + const lines = $allTrafficHistory + .map((r) => + JSON.stringify({ + date: r.date, + download_bytes: r.downBytes, + upload_bytes: r.upBytes, + total_bytes: r.downBytes + r.upBytes, + interface: r.interfaceName || "Ethernet", + source: r.source || "LocalTelemetry", + }), + ) + .join("\n"); + + const now = new Date(); + const dateTag = `${String(now.getDate()).padStart(2, "0")}-${String(now.getMonth() + 1).padStart(2, "0")}-${now.getFullYear()}`; + exportDatabase(lines + "\n", `internet_usage_${dateTag}.jsonl`); + } + const _initDate = new Date(); let currentYear = $state(_initDate.getFullYear()); let currentMonth = $state(_initDate.getMonth() + 1); @@ -489,29 +541,51 @@
Traffic Database & Backup Import backup files (.jsonl or legacy .dat format)Import or export backup files (.jsonl or legacy .dat + format)
{ - const file = e.target?.files?.[0]; + const target = e.target; + const file = target?.files?.[0]; if (!file) return; + importResult.set(null); const reader = new FileReader(); reader.onload = () => { - importDatContent(reader.result); + if (typeof reader.result === "string") { + importDatContent(reader.result); + } + }; + reader.onerror = () => { + importResult.set({ + daysImported: 0, + error: + "Failed to read file: " + + (reader.error?.message || "Unknown error"), + }); + }; + reader.onloadend = () => { + target.value = ""; }; reader.readAsText(file); - e.target.value = ""; }} /> + {#if $importResult}
+{#if exportModalData} + +{/if} + diff --git a/src/LocalTelemetry.App/Settings/wwwroot/src/components/ui/SectionCard.svelte b/src/LocalTelemetry.App/Settings/wwwroot/src/components/ui/SectionCard.svelte index 0176aeb..93f74c5 100644 --- a/src/LocalTelemetry.App/Settings/wwwroot/src/components/ui/SectionCard.svelte +++ b/src/LocalTelemetry.App/Settings/wwwroot/src/components/ui/SectionCard.svelte @@ -22,7 +22,7 @@ overflow: hidden; } .card-head { - padding: var(--space-4) var(--space-5); + padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-divider); } h3 { @@ -36,9 +36,9 @@ margin-top: var(--space-1); } .card-body { - padding: var(--space-4) var(--space-5); + padding: var(--space-3) var(--space-4); display: flex; flex-direction: column; - gap: var(--space-4); + gap: var(--space-3); } diff --git a/src/LocalTelemetry.App/Settings/wwwroot/src/components/ui/Slider.svelte b/src/LocalTelemetry.App/Settings/wwwroot/src/components/ui/Slider.svelte index 09405f9..a8813cb 100644 --- a/src/LocalTelemetry.App/Settings/wwwroot/src/components/ui/Slider.svelte +++ b/src/LocalTelemetry.App/Settings/wwwroot/src/components/ui/Slider.svelte @@ -19,7 +19,7 @@ {/if} { + const n = Number(e.currentTarget.value); + if (!isNaN(n)) { + value = n; + } + }} {onchange} />
diff --git a/src/LocalTelemetry.App/Settings/wwwroot/src/lib/bridge.ts b/src/LocalTelemetry.App/Settings/wwwroot/src/lib/bridge.ts index 4d4b3ac..c514f1b 100644 --- a/src/LocalTelemetry.App/Settings/wwwroot/src/lib/bridge.ts +++ b/src/LocalTelemetry.App/Settings/wwwroot/src/lib/bridge.ts @@ -78,6 +78,16 @@ export function requestHistoryMonths(): void { post('getHistoryMonths'); } export function importDatContent(content: string): void { post('importDat', { content }); } export function importWindowsUsage(startDate: string, endDate: string): void { post('importWindowsUsage', { startDate, endDate }); } -export function openFolder(target: 'app' | 'data'): void { post('openFolder', { target }); } +export function exportDatabase(content: string, defaultFileName: string): void { + post('exportDatabase', { content, defaultFileName }); +} + +export function openFolder(target: 'app' | 'data' | 'logs' | { path: string }): void { + if (typeof target === 'object' && target !== null && 'path' in target) { + post('openFolder', { path: target.path }); + } else { + post('openFolder', { target }); + } +} export function openUrl(url: string): void { post('openUrl', { url }); } export function checkForUpdates(force = true): void { post('checkForUpdates', { force }); } diff --git a/src/LocalTelemetry.App/Settings/wwwroot/src/lib/themes.ts b/src/LocalTelemetry.App/Settings/wwwroot/src/lib/themes.ts index 88c519e..f8ae9e2 100644 --- a/src/LocalTelemetry.App/Settings/wwwroot/src/lib/themes.ts +++ b/src/LocalTelemetry.App/Settings/wwwroot/src/lib/themes.ts @@ -23,7 +23,7 @@ export const themes: Theme[] = [ "--color-success": "#4ade80", "--color-warning": "#f59e0b", "--color-error": "#f43f5e", - "--color-orange": "#fb923c", + "--color-secondary": "#22d3ee", }, }, { @@ -40,15 +40,15 @@ export const themes: Theme[] = [ "--color-text": "#1a1a18", "--color-text-muted": "#6b6a68", "--color-text-faint": "#9a9997", - "--color-brand": "#0099b8", - "--color-primary": "#0099b8", - "--color-primary-hover": "#007a94", - "--color-primary-active": "#00687e", + "--color-brand": "#00738c", + "--color-primary": "#00738c", + "--color-primary-hover": "#005d72", + "--color-primary-active": "#004858", "--color-primary-hl": "#e0f8fc", "--color-success": "#16a34a", "--color-warning": "#d97706", "--color-error": "#dc2626", - "--color-orange": "#ea580c", + "--color-secondary": "#0e7490", }, }, { @@ -65,15 +65,15 @@ export const themes: Theme[] = [ "--color-text": "#e2e8f0", "--color-text-muted": "#8497b0", "--color-text-faint": "#536680", - "--color-brand": "#38bdf8", - "--color-primary": "#38bdf8", - "--color-primary-hover": "#0ea5e9", - "--color-primary-active": "#0284c7", - "--color-primary-hl": "#0c2840", + "--color-brand": "#2563eb", + "--color-primary": "#2563eb", + "--color-primary-hover": "#1d4ed8", + "--color-primary-active": "#1e40af", + "--color-primary-hl": "#172554", "--color-success": "#10b981", "--color-warning": "#eab308", "--color-error": "#f43f5e", - "--color-orange": "#f97316", + "--color-secondary": "#818cf8", }, }, { @@ -90,15 +90,15 @@ export const themes: Theme[] = [ "--color-text": "#0f172a", "--color-text-muted": "#475569", "--color-text-faint": "#7e8f9f", - "--color-brand": "#0284c7", - "--color-primary": "#0284c7", - "--color-primary-hover": "#0369a1", - "--color-primary-active": "#075985", - "--color-primary-hl": "#e0f2fe", + "--color-brand": "#1d4ed8", + "--color-primary": "#1d4ed8", + "--color-primary-hover": "#1e40af", + "--color-primary-active": "#1e3a8a", + "--color-primary-hl": "#dbeafe", "--color-success": "#059669", "--color-warning": "#ca8a04", "--color-error": "#e11d48", - "--color-orange": "#c2410c", + "--color-secondary": "#6366f1", }, }, { @@ -115,15 +115,15 @@ export const themes: Theme[] = [ "--color-text": "#e2ede5", "--color-text-muted": "#85a392", "--color-text-faint": "#547161", - "--color-brand": "#2ecc71", - "--color-primary": "#2ecc71", - "--color-primary-hover": "#27ae60", - "--color-primary-active": "#219653", - "--color-primary-hl": "#133824", + "--color-brand": "#16a34a", + "--color-primary": "#16a34a", + "--color-primary-hover": "#15803d", + "--color-primary-active": "#166534", + "--color-primary-hl": "#052e16", "--color-success": "#82e0aa", "--color-warning": "#f39c12", "--color-error": "#e74c3c", - "--color-orange": "#e67e22", + "--color-secondary": "#84cc16", }, }, { @@ -140,15 +140,15 @@ export const themes: Theme[] = [ "--color-text": "#142319", "--color-text-muted": "#4a6754", "--color-text-faint": "#789782", - "--color-brand": "#1e824c", - "--color-primary": "#1e824c", - "--color-primary-hover": "#196f3d", - "--color-primary-active": "#145a32", - "--color-primary-hl": "#d5f5e3", + "--color-brand": "#15803d", + "--color-primary": "#15803d", + "--color-primary-hover": "#166534", + "--color-primary-active": "#14532d", + "--color-primary-hl": "#dcfce7", "--color-success": "#27ae60", "--color-warning": "#d68910", "--color-error": "#c0392b", - "--color-orange": "#ba4a00", + "--color-secondary": "#65a30d", }, }, { @@ -165,15 +165,15 @@ export const themes: Theme[] = [ "--color-text": "#d5ecf2", "--color-text-muted": "#7fa3b0", "--color-text-faint": "#50727f", - "--color-brand": "#14b8a6", - "--color-primary": "#14b8a6", - "--color-primary-hover": "#0d9488", - "--color-primary-active": "#0f766e", - "--color-primary-hl": "#0c3237", + "--color-brand": "#0d9488", + "--color-primary": "#0d9488", + "--color-primary-hover": "#0f766e", + "--color-primary-active": "#115e59", + "--color-primary-hl": "#042f2e", "--color-success": "#34d399", "--color-warning": "#fbbf24", "--color-error": "#fb7185", - "--color-orange": "#f97316", + "--color-secondary": "#2dd4bf", }, }, { @@ -198,7 +198,7 @@ export const themes: Theme[] = [ "--color-success": "#059669", "--color-warning": "#d97706", "--color-error": "#e11d48", - "--color-orange": "#c2410c", + "--color-secondary": "#14b8a6", }, }, { @@ -215,15 +215,15 @@ export const themes: Theme[] = [ "--color-text": "#eddffd", "--color-text-muted": "#a391c4", "--color-text-faint": "#6e5d8f", - "--color-brand": "#a855f7", - "--color-primary": "#a855f7", - "--color-primary-hover": "#9333ea", - "--color-primary-active": "#7e22ce", - "--color-primary-hl": "#2c1b48", + "--color-brand": "#9333ea", + "--color-primary": "#9333ea", + "--color-primary-hover": "#7e22ce", + "--color-primary-active": "#6b21a8", + "--color-primary-hl": "#3b0764", "--color-success": "#4ade80", "--color-warning": "#facc15", "--color-error": "#ec4899", - "--color-orange": "#fb923c", + "--color-secondary": "#c084fc", }, }, { @@ -248,7 +248,7 @@ export const themes: Theme[] = [ "--color-success": "#16a34a", "--color-warning": "#ca8a04", "--color-error": "#db2777", - "--color-orange": "#c2410c", + "--color-secondary": "#a855f7", }, }, { @@ -265,15 +265,15 @@ export const themes: Theme[] = [ "--color-text": "#e2e4e8", "--color-text-muted": "#8e929b", "--color-text-faint": "#5c6068", - "--color-brand": "#eab308", - "--color-primary": "#eab308", - "--color-primary-hover": "#ca8a04", - "--color-primary-active": "#a16207", - "--color-primary-hl": "#332910", + "--color-brand": "#d97706", + "--color-primary": "#d97706", + "--color-primary-hover": "#b45309", + "--color-primary-active": "#92400e", + "--color-primary-hl": "#451a03", "--color-success": "#22c55e", "--color-warning": "#e28743", "--color-error": "#ef4444", - "--color-orange": "#ea580c", + "--color-secondary": "#ea580c", }, }, { @@ -290,15 +290,165 @@ export const themes: Theme[] = [ "--color-text": "#18191c", "--color-text-muted": "#54575f", "--color-text-faint": "#848892", - "--color-brand": "#a16207", - "--color-primary": "#a16207", - "--color-primary-hover": "#854d0e", - "--color-primary-active": "#713f12", - "--color-primary-hl": "#fef9c3", + "--color-brand": "#b45309", + "--color-primary": "#b45309", + "--color-primary-hover": "#92400e", + "--color-primary-active": "#78350f", + "--color-primary-hl": "#fef3c7", "--color-success": "#15803d", "--color-warning": "#b45309", "--color-error": "#b91c1c", - "--color-orange": "#9a3412", + "--color-secondary": "#c2410c", + }, + }, + { + value: "oled", + label: "OLED Black", + vars: { + "--color-bg": "#000000", + "--color-surface": "#0a0a0c", + "--color-surface-2": "#121215", + "--color-surface-offset": "#18181d", + "--color-surface-dynamic": "#222228", + "--color-divider": "#1e1e24", + "--color-border": "#2a2a32", + "--color-text": "#f3f4f6", + "--color-text-muted": "#9ca3af", + "--color-text-faint": "#4b5563", + "--color-brand": "#e11d48", + "--color-primary": "#e11d48", + "--color-primary-hover": "#be123c", + "--color-primary-active": "#9f1239", + "--color-primary-hl": "#4c0519", + "--color-success": "#10b981", + "--color-warning": "#f59e0b", + "--color-error": "#ef4444", + "--color-secondary": "#fb7185", + }, + }, + { + value: "oled-light", + label: "OLED Light", + vars: { + "--color-bg": "#ffffff", + "--color-surface": "#f8f9fa", + "--color-surface-2": "#f1f3f5", + "--color-surface-offset": "#e9ecef", + "--color-surface-dynamic": "#dee2e6", + "--color-divider": "#ced4da", + "--color-border": "#adb5bd", + "--color-text": "#000000", + "--color-text-muted": "#495057", + "--color-text-faint": "#6c757d", + "--color-brand": "#09090b", + "--color-primary": "#09090b", + "--color-primary-hover": "#27272a", + "--color-primary-active": "#3f3f46", + "--color-primary-hl": "#e4e4e7", + "--color-success": "#16a34a", + "--color-warning": "#d97706", + "--color-error": "#dc2626", + "--color-secondary": "#71717a", + }, + }, + { + value: "nord", + label: "Nord", + vars: { + "--color-bg": "#242933", + "--color-surface": "#2e3440", + "--color-surface-2": "#3b4252", + "--color-surface-offset": "#434c5e", + "--color-surface-dynamic": "#4c566a", + "--color-divider": "#3b4252", + "--color-border": "#4c566a", + "--color-text": "#eceff4", + "--color-text-muted": "#d8dee9", + "--color-text-faint": "#7b88a1", + "--color-brand": "#5e81ac", + "--color-primary": "#5e81ac", + "--color-primary-hover": "#4c6e96", + "--color-primary-active": "#3b5a80", + "--color-primary-hl": "#1e2a38", + "--color-success": "#a3be8c", + "--color-warning": "#ebcb8b", + "--color-error": "#bf616a", + "--color-secondary": "#88c0d0", + }, + }, + { + value: "nord-light", + label: "Nord Light", + vars: { + "--color-bg": "#e5e9f0", + "--color-surface": "#eceff4", + "--color-surface-2": "#e2e6ed", + "--color-surface-offset": "#d8dee9", + "--color-surface-dynamic": "#cbd3df", + "--color-divider": "#c4cddb", + "--color-border": "#b0bccd", + "--color-text": "#2e3440", + "--color-text-muted": "#4c566a", + "--color-text-faint": "#76849b", + "--color-brand": "#4c6e96", + "--color-primary": "#4c6e96", + "--color-primary-hover": "#3b5a80", + "--color-primary-active": "#2e4663", + "--color-primary-hl": "#d8e6f5", + "--color-success": "#43853d", + "--color-warning": "#b3821a", + "--color-error": "#a83d47", + "--color-secondary": "#81a1c1", + }, + }, + { + value: "cyberpunk", + label: "Cyberpunk", + vars: { + "--color-bg": "#09090b", + "--color-surface": "#111114", + "--color-surface-2": "#18181c", + "--color-surface-offset": "#1f1f26", + "--color-surface-dynamic": "#292933", + "--color-divider": "#262630", + "--color-border": "#363645", + "--color-text": "#f4f4f6", + "--color-text-muted": "#a1a1aa", + "--color-text-faint": "#71717a", + "--color-brand": "#ff0055", + "--color-primary": "#ff0055", + "--color-primary-hover": "#e6004c", + "--color-primary-active": "#cc0043", + "--color-primary-hl": "#3b0014", + "--color-success": "#00ff9f", + "--color-warning": "#ffaa00", + "--color-error": "#ff003c", + "--color-secondary": "#e0e722", + }, + }, + { + value: "cyberpunk-light", + label: "Cyberpunk Light", + vars: { + "--color-bg": "#fdf4f6", + "--color-surface": "#ffffff", + "--color-surface-2": "#fae8eb", + "--color-surface-offset": "#f5d5db", + "--color-surface-dynamic": "#f0c2cb", + "--color-divider": "#ecc0cb", + "--color-border": "#e2aab7", + "--color-text": "#18181b", + "--color-text-muted": "#64748b", + "--color-text-faint": "#94a3b8", + "--color-brand": "#c026d3", + "--color-primary": "#c026d3", + "--color-primary-hover": "#a21caf", + "--color-primary-active": "#86198f", + "--color-primary-hl": "#fae8ff", + "--color-success": "#059669", + "--color-warning": "#d97706", + "--color-error": "#dc2626", + "--color-secondary": "#ec4899", }, }, ]; diff --git a/src/LocalTelemetry.App/Settings/wwwroot/src/lib/types.ts b/src/LocalTelemetry.App/Settings/wwwroot/src/lib/types.ts index 926e468..78069ee 100644 --- a/src/LocalTelemetry.App/Settings/wwwroot/src/lib/types.ts +++ b/src/LocalTelemetry.App/Settings/wwwroot/src/lib/types.ts @@ -35,6 +35,13 @@ export interface MonitoringDto { logBatteryMode: number; } +export interface DetectedDisplayDto { + id: string; + name: string; + isPrimary: boolean; + hasTaskbar: boolean; +} + export interface OverlayDto { visible: boolean; doubleClickAction: string; @@ -52,11 +59,16 @@ export interface OverlayDto { groupColors: Record; defaultMetricColors: Record; followWindowsTheme: boolean; + layoutPreset?: string; + columns: string[][]; row1: string[]; userCustomizedMetricColors: string[]; userCustomizedGroupColors: string[]; taskbarSpaceConstrained?: boolean; availableSlotWidth?: number; + displayMode?: 'primary' | 'all' | 'custom'; + enabledDisplays?: string[]; + detectedDisplays?: DetectedDisplayDto[]; } export interface AlertsDto { @@ -72,6 +84,7 @@ export interface AlertsDto { alertCpuPower: boolean; alertGpuFreq: boolean; alertGpuPower: boolean; + alertDiskTemp: boolean; alertNetDaily: boolean; alertNetMonthly: boolean; cpuUsageMaxPct: number; @@ -80,6 +93,7 @@ export interface AlertsDto { gpuVramMaxMb: number; cpuTempMaxC: number; gpuTempMaxC: number; + diskTempMaxC: number; batteryLowPct: number; cpuFreqMinMhz: number; cpuPowerMaxW: number; @@ -89,6 +103,7 @@ export interface AlertsDto { netMonthlyMaxGb: number; showToastNotif: boolean; flashOverlay: boolean; + sustainedSecs?: number; cooldownSecs: number; fireOncePerSession: boolean; } @@ -127,9 +142,17 @@ export interface DiskInfo { model: string; vendor: string; busType: string; + mediaType?: string | null; + displayType?: string | null; + formattedSize?: string | null; sizeGb?: string | null; diskIndex?: number | null; boot: boolean; + health?: string | null; + temperatureC?: number | null; + remainingLifePercent?: number | null; + totalWrittenTb?: string | null; + totalReadTb?: string | null; } export interface SystemInfo { @@ -236,6 +259,7 @@ export type BridgeMessageType = | "checkForUpdates" | "openFolder" | "openUrl" + | "exportDatabase" | "log"; export type BridgeEventType = @@ -249,7 +273,9 @@ export type BridgeEventType = | "trafficToday" | "importDatResult" | "windowsUsageImportResult" - | "updateCheckResult"; + | "exportDatabaseResult" + | "updateCheckResult" + | "taskbarSlotChanged"; export interface BridgeMessage { type: BridgeMessageType; diff --git a/src/LocalTelemetry.App/Settings/wwwroot/src/lib/utils.ts b/src/LocalTelemetry.App/Settings/wwwroot/src/lib/utils.ts index 824ac9f..08cbaae 100644 --- a/src/LocalTelemetry.App/Settings/wwwroot/src/lib/utils.ts +++ b/src/LocalTelemetry.App/Settings/wwwroot/src/lib/utils.ts @@ -29,6 +29,23 @@ export function deepClone(obj: T): T { return structuredClone(obj); } +/** + * Strips runtime-only status properties (such as taskbar slot constraints and alignment) + * so that environmental measurements do not mark user configuration as dirty. + */ +export function sanitizeSettingsForDirtyCheck | null | undefined>(s: T): T { + if (!s) return s; + const clone = deepClone(s) as Record; + if (clone.overlay && typeof clone.overlay === 'object') { + const overlay = { ...(clone.overlay as Record) }; + delete overlay.taskbarSpaceConstrained; + delete overlay.availableSlotWidth; + delete overlay.taskbarAlignment; + clone.overlay = overlay; + } + return clone as T; +} + /** * Formats a date string ("DD-MM-YYYY", "YYYY-MM-DD", or ISO timestamp) into "DD-MM-YYYY" format. */ diff --git a/src/LocalTelemetry.App/Tray/TrayIconManager.cs b/src/LocalTelemetry.App/Tray/TrayIconManager.cs index d72e046..217fba6 100644 --- a/src/LocalTelemetry.App/Tray/TrayIconManager.cs +++ b/src/LocalTelemetry.App/Tray/TrayIconManager.cs @@ -20,12 +20,16 @@ public sealed class TrayIconManager : IDisposable private ToolStripMenuItem? _trayOverlayToggleItem; private ToolStripMenuItem? _overlayOverlayToggleItem; private ContextMenuStrip? _overlayContextMenu; + private IntPtr _mouseHook = IntPtr.Zero; + private readonly NativeMethods.LowLevelMouseHookCallback _mouseHookProc; + private ContextMenuStrip? _activeContextMenu; public event Action? OpenSettingsRequested; public event Action? QuitRequested; public event Action? ToggleOverlayRequested; public event Action? TaskManagerRequested; public event Action? TaskbarCreated; + public event Action? OverlayContextMenuClosed; internal void RaiseTaskbarCreated() => TaskbarCreated?.Invoke(); internal static bool SkipUiForTesting { get; set; } @@ -46,6 +50,7 @@ public TrayIconManager() // Dedicated top-level message window to own popup menus, handle outside-click dismissal, and catch TaskbarCreated broadcast _menuOwner = new HiddenMenuOwnerForm(); _menuOwner.TaskbarCreated += () => TaskbarCreated?.Invoke(); + _mouseHookProc = MouseHookCallback; if (!SkipUiForTesting) { _menuOwner.Show(); @@ -62,6 +67,7 @@ public TrayIconManager() BuildOverlayContextMenu(); _tray.DoubleClick += (_, _) => OpenSettingsRequested?.Invoke(); + _menuOwner.ShowSettingsRequested += () => OpenSettingsRequested?.Invoke(); } /// @@ -79,9 +85,13 @@ public void ShowOverlayContextMenu(Point screenPos) try { - Log.Debug($"Context menu opened at screen position ({screenPos.X}, {screenPos.Y})"); + Log.Debug($"Overlay context menu opened at ({screenPos.X}, {screenPos.Y})"); if (!SkipUiForTesting) { + if (_overlayContextMenu.Visible) + { + _overlayContextMenu.Close(); + } NativeMethods.SetForegroundWindow(_menuOwner.Handle); _overlayContextMenu.Show(screenPos); } @@ -95,8 +105,37 @@ public void ShowOverlayContextMenu(Point screenPos) /// Gets whether the overlay context menu is currently open and visible. public bool IsOverlayContextMenuOpen => _overlayContextMenu?.Visible == true; - /// Gets the current screen bounds of the overlay context menu, or empty if not open. - public Rectangle OverlayContextMenuBounds => _overlayContextMenu?.Visible == true ? _overlayContextMenu.Bounds : Rectangle.Empty; + /// Gets the current screen bounds of the overlay context menu in physical screen pixels, or empty if not open. + public Rectangle OverlayContextMenuBounds + { + get + { + if (_overlayContextMenu is null || !_overlayContextMenu.Visible) return Rectangle.Empty; + + if (_overlayContextMenu.Handle != IntPtr.Zero && + NativeMethods.GetWindowRect(_overlayContextMenu.Handle, out var rect)) + { + return new Rectangle(rect.Left, rect.Top, rect.Right - rect.Left, rect.Bottom - rect.Top); + } + + return _overlayContextMenu.Bounds; + } + } + + /// Checks whether a screen point in physical coordinates is inside the overlay context menu. + internal bool IsPointInsideOverlayContextMenu(NativeMethods.Point pt) + { + if (_overlayContextMenu is null || !_overlayContextMenu.Visible) return false; + + if (_overlayContextMenu.Handle != IntPtr.Zero && + NativeMethods.GetWindowRect(_overlayContextMenu.Handle, out var rect)) + { + return pt.X >= rect.Left && pt.X <= rect.Right && pt.Y >= rect.Top && pt.Y <= rect.Bottom; + } + + var clickPt = new Point(pt.X, pt.Y); + return _overlayContextMenu.Bounds.Contains(clickPt); + } /// Closes the overlay context menu if it is currently open. public void CloseOverlayContextMenu() @@ -150,6 +189,7 @@ private void BuildTrayContextMenu() _trayOverlayToggleItem = new ToolStripMenuItem("Hide Overlay", null, (_, _) => { + Log.Info("User toggled overlay visibility from tray menu"); ToggleOverlayRequested?.Invoke(); }) { @@ -160,6 +200,7 @@ private void BuildTrayContextMenu() var settingsItem = new ToolStripMenuItem("Open Settings", null, (_, _) => { + Log.Info("User clicked 'Open Settings' from tray menu"); OpenSettingsRequested?.Invoke(); }) { @@ -168,7 +209,7 @@ private void BuildTrayContextMenu() var quitItem = new ToolStripMenuItem("Quit", null, (_, _) => { - Log.Info("Application exit requested (system tray)"); + Log.Info("User clicked 'Quit' from tray menu"); QuitRequested?.Invoke(); }) { @@ -198,6 +239,7 @@ private void BuildOverlayContextMenu() _overlayOverlayToggleItem = new ToolStripMenuItem("Hide Overlay", null, (_, _) => { + Log.Info("User toggled overlay visibility from overlay context menu"); ToggleOverlayRequested?.Invoke(); }) { @@ -208,6 +250,7 @@ private void BuildOverlayContextMenu() var settingsItem = new ToolStripMenuItem("Open Settings", null, (_, _) => { + Log.Info("User clicked 'Open Settings' from overlay context menu"); OpenSettingsRequested?.Invoke(); }) { @@ -216,6 +259,7 @@ private void BuildOverlayContextMenu() var taskmgrItem = new ToolStripMenuItem("Task Manager", null, (_, _) => { + Log.Info("User clicked 'Task Manager' from overlay context menu"); TaskManagerRequested?.Invoke(); }) { @@ -224,7 +268,7 @@ private void BuildOverlayContextMenu() var quitItem = new ToolStripMenuItem("Quit", null, (_, _) => { - Log.Info("Application exit requested (context menu)"); + Log.Info("User clicked 'Quit' from overlay context menu"); QuitRequested?.Invoke(); }) { @@ -260,31 +304,143 @@ private ContextMenuStrip CreateBaseContextMenu() try { int cornerPref = 2; // DWMWCP_ROUND - DwmSetWindowAttribute(ctx.Handle, 33, ref cornerPref, sizeof(int)); + NativeMethods.DwmSetWindowAttribute(ctx.Handle, 33, ref cornerPref, sizeof(int)); int darkMode = 1; // DWMWA_USE_IMMERSIVE_DARK_MODE - DwmSetWindowAttribute(ctx.Handle, 20, ref darkMode, sizeof(int)); + NativeMethods.DwmSetWindowAttribute(ctx.Handle, 20, ref darkMode, sizeof(int)); } catch (Exception ex) { Log.Debug(ex, "DWM styling failed on context menu"); } + + _activeContextMenu = ctx; + if (ReferenceEquals(ctx, _overlayContextMenu)) + { + InstallOutsideClickHook(); + } }; ctx.Closed += (_, _) => { + if (ReferenceEquals(_activeContextMenu, ctx)) + { + _activeContextMenu = null; + } + UninstallOutsideClickHook(); try { NativeMethods.PostMessage(_menuOwner.Handle, 0, IntPtr.Zero, IntPtr.Zero); } catch (Exception ex) { - Log.Debug(ex, "Failed to post message to menu owner on context menu close"); + Log.Debug(ex, "Failed to post null message after context menu close"); + } + if (ReferenceEquals(ctx, _overlayContextMenu)) + { + OverlayContextMenuClosed?.Invoke(); } }; return ctx; } + private void InstallOutsideClickHook() + { + if (SkipUiForTesting || _mouseHook != IntPtr.Zero) return; + + try + { + IntPtr moduleHandle = NativeMethods.GetModuleHandle(null); + + _mouseHook = NativeMethods.SetWindowsHookEx( + NativeMethods.WH_MOUSE_LL, + _mouseHookProc, + moduleHandle, + 0); + + if (_mouseHook == IntPtr.Zero) + { + Log.Debug("Failed to install low-level mouse hook for context menu outside-click dismissal"); + } + } + catch (Exception ex) + { + Log.Debug(ex, "Exception while installing mouse hook for context menu"); + } + } + + private void UninstallOutsideClickHook() + { + if (_mouseHook != IntPtr.Zero) + { + try + { + NativeMethods.UnhookWindowsHookEx(_mouseHook); + } + catch (Exception ex) + { + Log.Debug(ex, "Exception while removing mouse hook for context menu"); + } + finally + { + _mouseHook = IntPtr.Zero; + } + } + } + + private static bool IsDismissMouseButtonMessage(int msg) => + msg is NativeMethods.WM_LBUTTONDOWN or NativeMethods.WM_RBUTTONDOWN or NativeMethods.WM_MBUTTONDOWN + or NativeMethods.WM_NCLBUTTONDOWN or NativeMethods.WM_NCRBUTTONDOWN or NativeMethods.WM_NCMBUTTONDOWN; + + private static void DismissIfClickedOutside(ContextMenuStrip menu, IntPtr lParam) + { + try + { + var hookStruct = Marshal.PtrToStructure(lParam); + if (menu.Handle != IntPtr.Zero && NativeMethods.GetWindowRect(menu.Handle, out var rect)) + { + if (hookStruct.pt.X < rect.Left || hookStruct.pt.X > rect.Right || + hookStruct.pt.Y < rect.Top || hookStruct.pt.Y > rect.Bottom) + { + CloseMenu(menu); + } + } + else + { + var clickPt = new Point(hookStruct.pt.X, hookStruct.pt.Y); + if (!menu.Bounds.Contains(clickPt)) + { + CloseMenu(menu); + } + } + } + catch (Exception ex) + { + Log.Debug(ex, "Error processing mouse hook click for context menu dismissal"); + } + } + + private static void CloseMenu(ContextMenuStrip menu) + { + if (menu.InvokeRequired) + { + menu.BeginInvoke(new Action(() => menu.Close())); + } + else + { + menu.Close(); + } + } + + private IntPtr MouseHookCallback(int nCode, IntPtr wParam, IntPtr lParam) + { + if (nCode >= 0 && _activeContextMenu is { Visible: true } menu && IsDismissMouseButtonMessage(wParam.ToInt32())) + { + DismissIfClickedOutside(menu, lParam); + } + return NativeMethods.CallNextHookEx(_mouseHook, nCode, wParam, lParam); + } + // Updates & Notifications /// Updates the notification area icon tooltip with current CPU, RAM, and GPU readings. public void Update(TelemetrySnapshot? s) @@ -306,13 +462,28 @@ private static string FormatTooltip(TelemetrySnapshot s) return text.Length > 63 ? text[..63] : text; } - [DllImport("dwmapi.dll")] - private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int attrValue, int attrSize); + /// Displays a notification balloon tip from the system tray icon. + /// Notification title. + /// Notification message text. + /// Icon style to display. + public void ShowBalloonTip(string title, string text, ToolTipIcon icon = ToolTipIcon.Warning) + { + if (SkipUiForTesting || !_tray.Visible) return; + try + { + _tray.ShowBalloonTip(4000, title, text, icon); + } + catch (Exception ex) + { + Log.Error(ex, "Failed to display tray balloon tip"); + } + } // Disposal /// Releases the tray icon and its associated resources. public void Dispose() { + UninstallOutsideClickHook(); _tray.Visible = false; _tray.Icon = null; _baseIcon.Dispose(); @@ -330,14 +501,14 @@ public DarkTrayRenderer() : base(new TrayMenuTheme()) { } protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e) { e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; - var rect = e.TextRectangle; - rect.Offset(4, 0); + var rect = new Rectangle(e.TextRectangle.X + 4, e.TextRectangle.Y, Math.Max(0, e.TextRectangle.Width - 4), e.TextRectangle.Height); + Color textColor = e.Item.Enabled ? e.Item.ForeColor : Color.FromArgb(142, 142, 147); TextRenderer.DrawText( e.Graphics, e.Text, e.TextFont, rect, - e.TextColor, + textColor, TextFormatFlags.Left | TextFormatFlags.VerticalCenter | TextFormatFlags.SingleLine | TextFormatFlags.NoPrefix); } @@ -386,15 +557,19 @@ internal sealed class TrayMenuTheme : ProfessionalColorTable internal sealed class HiddenMenuOwnerForm : Form { private static readonly uint WmTaskbarCreated = NativeMethods.RegisterWindowMessage("TaskbarCreated"); + private static readonly uint WmShowSettings = NativeMethods.RegisterWindowMessage(App.ShowSettingsMessageName); public event Action? TaskbarCreated; + public event Action? ShowSettingsRequested; internal void RaiseTaskbarCreated() => TaskbarCreated?.Invoke(); + internal void RaiseShowSettingsRequested() => ShowSettingsRequested?.Invoke(); public HiddenMenuOwnerForm() { FormBorderStyle = FormBorderStyle.None; ShowInTaskbar = false; WindowState = FormWindowState.Normal; + StartPosition = FormStartPosition.Manual; Size = new Size(1, 1); Location = new Point(-2000, -2000); Opacity = 0; @@ -403,6 +578,10 @@ public HiddenMenuOwnerForm() { NativeMethods.ChangeWindowMessageFilter(WmTaskbarCreated, NativeMethods.MSGFLT_ADD); } + if (WmShowSettings != 0) + { + NativeMethods.ChangeWindowMessageFilter(WmShowSettings, NativeMethods.MSGFLT_ADD); + } } protected override void OnHandleCreated(EventArgs e) @@ -412,6 +591,10 @@ protected override void OnHandleCreated(EventArgs e) { NativeMethods.ChangeWindowMessageFilterEx(Handle, WmTaskbarCreated, NativeMethods.MSGFLT_ALLOW, IntPtr.Zero); } + if (WmShowSettings != 0 && Handle != IntPtr.Zero) + { + NativeMethods.ChangeWindowMessageFilterEx(Handle, WmShowSettings, NativeMethods.MSGFLT_ALLOW, IntPtr.Zero); + } } protected override CreateParams CreateParams @@ -432,6 +615,11 @@ protected override void WndProc(ref Message m) Log.Info("Windows Explorer taskbar recreation detected (TaskbarCreated message received)"); TaskbarCreated?.Invoke(); } + else if (WmShowSettings != 0 && m.Msg == WmShowSettings) + { + Log.Info("ShowSettings broadcast received from secondary instance; activating Settings window"); + ShowSettingsRequested?.Invoke(); + } base.WndProc(ref m); } } diff --git a/src/LocalTelemetry.App/Win32/DisplayInfo.cs b/src/LocalTelemetry.App/Win32/DisplayInfo.cs new file mode 100644 index 0000000..406090a --- /dev/null +++ b/src/LocalTelemetry.App/Win32/DisplayInfo.cs @@ -0,0 +1,130 @@ +using System.Runtime.Versioning; +using LocalTelemetry.Core.Diagnostics; + +namespace LocalTelemetry.App.Win32; + +/// +/// Represents a physical display monitor and its associated Windows taskbar window. +/// +[SupportedOSPlatform("windows")] +public sealed record DisplayInfo +{ + /// Unique identifier used in settings (e.g. "primary", "display_2"). + public string Id { get; init; } = "primary"; + + /// 0-based display index (0 is always primary). + public int Index { get; init; } + + /// System device name (e.g. \\.\DISPLAY1). + public string DeviceName { get; init; } = string.Empty; + + /// User-friendly label (e.g. Primary Display (2048 x 1280)). + public string FriendlyName { get; init; } = string.Empty; + + /// Whether this is the primary Windows display. + public bool IsPrimary { get; init; } + + /// Display monitor virtual desktop rectangle. + public Rectangle Bounds { get; init; } + + /// Display monitor working area rectangle excluding the taskbar. + public Rectangle WorkingArea { get; init; } + + /// Handle to the taskbar window for this display (Shell_TrayWnd or Shell_SecondaryTrayWnd). + public IntPtr TaskbarHwnd { get; set; } = IntPtr.Zero; + + /// Whether a valid taskbar window was discovered for this display. + public bool HasTaskbar + { + get + { + if (TaskbarHwnd == IntPtr.Zero) return false; + if (SkipIsWindowCheckForTesting) return true; + return NativeMethods.IsWindow(TaskbarHwnd); + } + } + + internal static bool SkipIsWindowCheckForTesting { get; set; } + + // Test seam + internal static Func>? EnumerateDisplaysOverride { get; set; } + + /// + /// Enumerates all currently connected displays and resolves their taskbar windows. + /// + /// List of displays with Primary first, followed by secondary monitors. + public static List EnumerateDisplays() + { + if (EnumerateDisplaysOverride is not null) + return EnumerateDisplaysOverride(); + + var result = new List(); + try + { + var screens = Screen.AllScreens; + if (screens is null || screens.Length == 0) + { + return result; + } + + IntPtr primaryTray = TaskbarEmbedder.FindExplorerTrayWnd(); + var secondaryTrays = TaskbarEmbedder.FindExplorerSecondaryTrayWnds(); + + // Match secondary tray HWNDs to screen bounds + var secondaryTrayMap = new Dictionary(); + foreach (var secHwnd in secondaryTrays) + { + if (NativeMethods.GetWindowRect(secHwnd, out var rect)) + { + var r = new Rectangle(rect.Left, rect.Top, rect.Width, rect.Height); + var matchedScreen = screens.FirstOrDefault(s => !s.Primary && s.Bounds.IntersectsWith(r)); + if (matchedScreen is not null && !secondaryTrayMap.ContainsKey(matchedScreen)) + { + secondaryTrayMap[matchedScreen] = secHwnd; + } + } + } + + // Primary screen is index 0 + var primaryScreen = screens.FirstOrDefault(s => s.Primary) ?? screens[0]; + result.Add(new DisplayInfo + { + Id = "primary", + Index = 0, + DeviceName = primaryScreen.DeviceName, + FriendlyName = $"Display 1 (Primary - {primaryScreen.Bounds.Width} x {primaryScreen.Bounds.Height})", + IsPrimary = true, + Bounds = primaryScreen.Bounds, + WorkingArea = primaryScreen.WorkingArea, + TaskbarHwnd = primaryTray + }); + + // Secondary screens + int secIdx = 1; + foreach (var screen in screens.Where(s => s != primaryScreen)) + { + int displayNum = secIdx + 1; + secondaryTrayMap.TryGetValue(screen, out var trayHwnd); + + result.Add(new DisplayInfo + { + Id = $"display_{displayNum}", + Index = secIdx, + DeviceName = screen.DeviceName, + FriendlyName = $"Display {displayNum} ({screen.Bounds.Width} x {screen.Bounds.Height})", + IsPrimary = false, + Bounds = screen.Bounds, + WorkingArea = screen.WorkingArea, + TaskbarHwnd = trayHwnd + }); + secIdx++; + } + } + catch (Exception ex) + { + Log.Error(ex, "Failed to enumerate connected displays"); + } + + return result; + } +} diff --git a/src/LocalTelemetry.App/Win32/NativeMethods.cs b/src/LocalTelemetry.App/Win32/NativeMethods.cs index bdd9bb8..a000957 100644 --- a/src/LocalTelemetry.App/Win32/NativeMethods.cs +++ b/src/LocalTelemetry.App/Win32/NativeMethods.cs @@ -6,7 +6,7 @@ namespace LocalTelemetry.App.Win32; /// Win32 P/Invoke declarations and constants used by the taskbar embedder, /// GDI+ overlay renderer and AppBar/shell queries. /// -internal static class NativeMethods +internal static partial class NativeMethods { // Window Style Flags public const int GWL_STYLE = -16; @@ -15,6 +15,11 @@ internal static class NativeMethods public const int CS_DBLCLKS = 0x0008; public const int WS_POPUP = unchecked((int)0x80000000); public const int WS_CHILD = 0x40000000; + public const int WS_CAPTION = 0x00C00000; + public const int WS_SYSMENU = 0x00080000; + public const int WS_THICKFRAME = 0x00040000; + public const int WS_MINIMIZEBOX = 0x00020000; + public const int WS_MAXIMIZEBOX = 0x00010000; public const int WS_EX_LAYERED = 0x00080000; public const int WS_EX_TOOLWINDOW = 0x00000080; public const int WS_EX_NOACTIVATE = 0x08000000; @@ -34,6 +39,7 @@ internal static class NativeMethods // ShowWindow Commands public const int SW_HIDE = 0; public const int SW_SHOWNOACTIVATE = 4; + public const int SW_RESTORE = 9; // Special HWND Handles public static readonly IntPtr HWND_TOPMOST = new(-1); @@ -46,6 +52,7 @@ internal static class NativeMethods public const int WM_ERASEBKGND = 0x0014; public const int WM_NCDESTROY = 0x0082; public const int WM_LBUTTONDOWN = 0x0201; + public const int WM_LBUTTONUP = 0x0202; public const int WM_LBUTTONDBLCLK = 0x0203; public const int WM_RBUTTONDOWN = 0x0204; public const int WM_RBUTTONUP = 0x0205; @@ -85,40 +92,45 @@ internal static class NativeMethods public const uint GA_ROOTOWNER = 3; // Structs -#pragma warning disable S101 // Win32 SDK P/Invoke struct naming convention matches Windows API definitions /// Contains information about a display monitor. [StructLayout(LayoutKind.Sequential)] - public struct MONITORINFO + public struct MonitorInfo { public uint cbSize; - public RECT rcMonitor; - public RECT rcWork; + public Rect rcMonitor; + public Rect rcWork; public uint dwFlags; } + /// Fixed 32-byte reserved buffer for . + [System.Runtime.CompilerServices.InlineArray(32)] + public struct PaintReservedBytes + { + public byte Element0; + } + /// Contains painting information for a window client area. [StructLayout(LayoutKind.Sequential)] - public struct PAINTSTRUCT + public struct PaintStruct { public IntPtr hdc; public int fErase; - public RECT rcPaint; + public Rect rcPaint; public int fRestore, fIncUpdate; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] rgbReserved; + public PaintReservedBytes rgbReserved; } /// Defines the x- and y-coordinates of a point. [StructLayout(LayoutKind.Sequential)] - public struct POINT { public int X, Y; } + public struct Point { public int X, Y; } /// Defines the width and height of a rectangle. [StructLayout(LayoutKind.Sequential)] - public struct SIZE { public int cx, cy; } + public struct Size { public int cx, cy; } /// Defines the coordinates of a rectangle. [StructLayout(LayoutKind.Sequential)] - public struct RECT + public struct Rect { public int Left, Top, Right, Bottom; public int Width => Right - Left; @@ -127,15 +139,14 @@ public struct RECT /// Contains taskbar AppBar message information. [StructLayout(LayoutKind.Sequential)] - public struct APPBARDATA + public struct AppBarData { public uint cbSize; public IntPtr hWnd; public uint uCallbackMessage, uEdge; - public RECT rc; + public Rect rc; public IntPtr lParam; } -#pragma warning restore S101 // P/Invoke Method Declarations @@ -148,22 +159,22 @@ public struct APPBARDATA public static extern IntPtr MonitorFromWindow(IntPtr hWnd, uint dwFlags); /// Retrieves information about a display monitor. - [DllImport("user32.dll")] + [LibraryImport("user32.dll", EntryPoint = "GetMonitorInfoW")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool GetMonitorInfo(IntPtr hMonitor, ref MONITORINFO lpmi); + public static partial bool GetMonitorInfo(IntPtr hMonitor, ref MonitorInfo lpmi); /// Retrieves a system metric value. [DllImport("user32.dll")] public static extern int GetSystemMetrics(int nIndex); /// Begins painting in the specified window. - [DllImport("user32.dll")] - public static extern IntPtr BeginPaint(IntPtr hWnd, ref PAINTSTRUCT lpPaint); + [LibraryImport("user32.dll")] + public static partial IntPtr BeginPaint(IntPtr hWnd, ref PaintStruct lpPaint); /// Ends painting in the specified window. - [DllImport("user32.dll")] + [LibraryImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool EndPaint(IntPtr hWnd, ref PAINTSTRUCT lpPaint); + public static partial bool EndPaint(IntPtr hWnd, ref PaintStruct lpPaint); /// Registers a new window message guaranteed to be unique throughout the system. [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)] @@ -177,13 +188,19 @@ public struct APPBARDATA [DllImport("user32.dll", SetLastError = true)] public static extern IntPtr SetParent(IntPtr child, IntPtr parent); + /// Retrieves a handle to the specified window's parent or owner. + [LibraryImport("user32.dll")] + public static partial IntPtr GetParent(IntPtr hWnd); + /// Retrieves the bounding rectangle of a window. - [DllImport("user32.dll")] - public static extern bool GetWindowRect(IntPtr hWnd, out RECT r); + [LibraryImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + public static partial bool GetWindowRect(IntPtr hWnd, out Rect r); /// Retrieves the client-area rectangle of a window. - [DllImport("user32.dll")] - public static extern bool GetClientRect(IntPtr hWnd, out RECT r); + [LibraryImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + public static partial bool GetClientRect(IntPtr hWnd, out Rect r); /// Retrieves a window style long value. [DllImport("user32.dll")] @@ -211,6 +228,10 @@ public static IntPtr SetWindowLongPtr(IntPtr hWnd, int nIndex, IntPtr dwNewLong) [DllImport("user32.dll")] public static extern bool IsWindow(IntPtr hWnd); + /// Retrieves a handle to the window that contains the specified point. + [LibraryImport("user32.dll")] + public static partial IntPtr WindowFromPoint(Point point); + /// Retrieves the handle to the ancestor of the specified window. [DllImport("user32.dll")] public static extern IntPtr GetAncestor(IntPtr hWnd, uint gaFlags); @@ -221,8 +242,12 @@ public static IntPtr SetWindowLongPtr(IntPtr hWnd, int nIndex, IntPtr dwNewLong) public static extern bool IsWindowVisible(IntPtr hWnd); /// Retrieves the class name of the specified window. - [DllImport("user32.dll", CharSet = CharSet.Unicode)] - public static extern int GetClassName(IntPtr hWnd, char[] lpClassName, int nMaxCount); + [LibraryImport("user32.dll", EntryPoint = "GetClassNameW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)] + public static partial int GetClassName(IntPtr hWnd, [Out] char[] lpClassName, int nMaxCount); + + /// Copies the text of the specified window's title bar into a buffer. + [LibraryImport("user32.dll", EntryPoint = "GetWindowTextW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)] + public static partial int GetWindowText(IntPtr hWnd, [Out] char[] lpString, int nMaxCount); /// Changes window position, size and Z-order. [DllImport("user32.dll", SetLastError = true)] @@ -233,18 +258,25 @@ public static IntPtr SetWindowLongPtr(IntPtr hWnd, int nIndex, IntPtr dwNewLong) [return: MarshalAs(UnmanagedType.Bool)] public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); + public const uint ASFW_ANY = unchecked((uint)-1); + + /// Enables the specified process to set the foreground window using SetForegroundWindow. + [LibraryImport("user32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static partial bool AllowSetForegroundWindow(uint dwProcessId); + /// Sends an AppBar message to Windows Explorer. - [DllImport("shell32.dll")] - public static extern IntPtr SHAppBarMessage(uint msg, ref APPBARDATA data); + [LibraryImport("shell32.dll")] + public static partial IntPtr SHAppBarMessage(uint msg, ref AppBarData data); /// Retrieves thread and process ID for a window. [DllImport("user32.dll")] public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId); /// Converts screen coordinates to client coordinates. - [DllImport("user32.dll")] + [LibraryImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool ScreenToClient(IntPtr hWnd, ref POINT lpPoint); + public static partial bool ScreenToClient(IntPtr hWnd, ref Point lpPoint); /// Retrieves the DPI value for a window. [DllImport("user32.dll")] @@ -269,6 +301,9 @@ public static IntPtr SetWindowLongPtr(IntPtr hWnd, int nIndex, IntPtr dwNewLong) [DllImport("user32.dll")] public static extern uint GetDoubleClickTime(); + /// Special HWND value to broadcast a message to all top-level windows. + public static readonly IntPtr HWND_BROADCAST = new(0xffff); + /// Posts a message to the window's message queue. [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] @@ -300,21 +335,29 @@ public delegate IntPtr SUBCLASSPROC( public static extern bool RemoveWindowSubclass(IntPtr hWnd, SUBCLASSPROC pfnSubclass, UIntPtr uIdSubclass); // Mouse Hook & Cursor Constants & Declarations + public const int WH_MOUSE_LL = 14; public const int WM_SETCURSOR = 0x0020; public const int WM_MOUSEMOVE = 0x0200; public const int IDC_ARROW = 32512; -#pragma warning disable S101 // Win32 SDK P/Invoke struct naming convention matches Windows API definitions + public delegate IntPtr LowLevelMouseHookCallback(int nCode, IntPtr wParam, IntPtr lParam); + + [LibraryImport("user32.dll", EntryPoint = "SetWindowsHookExW", SetLastError = true)] + public static partial IntPtr SetWindowsHookEx(int idHook, LowLevelMouseHookCallback lpfn, IntPtr hMod, uint dwThreadId); + + [LibraryImport("user32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static partial bool UnhookWindowsHookEx(IntPtr hhk); + [StructLayout(LayoutKind.Sequential)] - public struct MSLLHOOKSTRUCT + public struct MsllHookStruct { - public POINT pt; + public Point pt; public uint mouseData; public uint flags; public uint time; public IntPtr dwExtraInfo; } -#pragma warning restore S101 [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] public static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, IntPtr wParam, IntPtr lParam); @@ -325,9 +368,9 @@ public struct MSLLHOOKSTRUCT [DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern IntPtr LoadCursor(IntPtr hInstance, int lpCursorName); - [DllImport("user32.dll")] + [LibraryImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool ClientToScreen(IntPtr hWnd, ref POINT lpPoint); + public static partial bool ClientToScreen(IntPtr hWnd, ref Point lpPoint); [DllImport("kernel32.dll", CharSet = CharSet.Auto)] public static extern IntPtr GetModuleHandle(string? lpModuleName); @@ -389,6 +432,54 @@ public struct MSLLHOOKSTRUCT // Desktop Window Manager (DWM) Attributes public const int DWMWA_USE_IMMERSIVE_DARK_MODE = 20; + [LibraryImport("psapi.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static partial bool EmptyWorkingSet(IntPtr hProcess); + + [StructLayout(LayoutKind.Sequential)] + public struct ProcessMemoryCountersEx2 + { + public uint cb; + public uint PageFaultCount; + public UIntPtr PeakWorkingSetSize; + public UIntPtr WorkingSetSize; + public UIntPtr QuotaPeakPagedPoolUsage; + public UIntPtr QuotaPagedPoolUsage; + public UIntPtr QuotaPeakNonPagedPoolUsage; + public UIntPtr QuotaNonPagedPoolUsage; + public UIntPtr PagefileUsage; + public UIntPtr PeakPagefileUsage; + public UIntPtr PrivateUsage; + public UIntPtr PrivateWorkingSetSize; + public ulong SharedCommitUsage; + } + + [LibraryImport("psapi.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static partial bool GetProcessMemoryInfo( + IntPtr hProcess, + ref ProcessMemoryCountersEx2 counters, + uint size); + + public static long GetPrivateWorkingSetBytes(IntPtr hProcess) + { + if (hProcess == IntPtr.Zero) return 0; + try + { + var counters = new ProcessMemoryCountersEx2(); + counters.cb = (uint)Marshal.SizeOf(); + if (GetProcessMemoryInfo(hProcess, ref counters, counters.cb) && counters.PrivateWorkingSetSize != UIntPtr.Zero) + { + return (long)counters.PrivateWorkingSetSize.ToUInt64(); + } + } + catch (Exception ex) + { + Core.Diagnostics.Log.Debug(ex, "Failed to read ProcessMemoryCountersEx2"); + } + return 0; + } + [DllImport("dwmapi.dll", PreserveSig = true)] public static extern int DwmSetWindowAttribute(IntPtr hwnd, int dwAttribute, ref int pvAttribute, int cbAttribute); } diff --git a/src/LocalTelemetry.App/Win32/TaskbarEmbedder.cs b/src/LocalTelemetry.App/Win32/TaskbarEmbedder.cs index d411fa5..c47dde3 100644 --- a/src/LocalTelemetry.App/Win32/TaskbarEmbedder.cs +++ b/src/LocalTelemetry.App/Win32/TaskbarEmbedder.cs @@ -9,26 +9,57 @@ namespace LocalTelemetry.App.Win32; /// -/// Embeds the overlay window into the Windows taskbar, either as a child of the -/// taskband (Approach A) or as a floating layered window (Approach B fallback). +/// Embeds the overlay window directly into the Windows taskbar as a native child window. /// Handles Win10 / Win11 taskbar structure differences and repositioning on resize. /// [SupportedOSPlatform("windows")] -public sealed class TaskbarEmbedder(AppSettings cfg) +public sealed class TaskbarEmbedder(AppSettings cfg, DisplayInfo? targetDisplay = null) { private readonly AppSettings _cfg = cfg; + /// Gets or sets the target display for this embedder instance. + public DisplayInfo? TargetDisplay { get; set; } = targetDisplay; + + /// Returns the target taskbar HWND for this embedder. + public IntPtr GetTargetTrayWnd() + { + if (TargetDisplay is not null && TargetDisplay.TaskbarHwnd != IntPtr.Zero) + return TargetDisplay.TaskbarHwnd; + + return FindExplorerTrayWnd(); + } + + /// Gets whether this embedder targets a secondary display taskbar. + public bool IsSecondaryTaskbar => TargetDisplay is not null + ? !TargetDisplay.IsPrimary + : IsSecondaryTrayWindow(GetTargetTrayWnd()); private IntPtr _parentHwnd = IntPtr.Zero; private IntPtr _taskBandHwnd = IntPtr.Zero; - private NativeMethods.RECT _taskBandOri; + private IntPtr _currentOverlayHwnd = IntPtr.Zero; + private int _lastPositionedX = int.MinValue; + private int _lastPositionedWidth = int.MinValue; + private NativeMethods.Rect _taskBandOri; private bool _taskBandSaved; private bool _isWin11; + internal static readonly System.Collections.Concurrent.ConcurrentDictionary ActiveOverlayHwnds = new(); + + private static bool IsAppOverlayWindow(IntPtr hwnd) + { + if (hwnd == IntPtr.Zero) return false; + if (ActiveOverlayHwnds.ContainsKey(hwnd)) return true; + + var titleBuf = new char[64]; + int len = NativeMethods.GetWindowText(hwnd, titleBuf, titleBuf.Length); + if (len <= 0) return false; + return new string(titleBuf, 0, len).Equals("LocalTelemetry_Overlay", StringComparison.Ordinal); + } + private Rectangle _taskbarRect; private uint _taskbarEdge; private int _lastShrinkWidth = -1; - private Rectangle _lastFloatRect = Rectangle.Empty; + private int _lastShrinkOffset = -1; /// /// Gets or sets the transparency color key for the layered overlay window (child mode only). @@ -40,48 +71,30 @@ public sealed class TaskbarEmbedder(AppSettings cfg) /// Gets the current deployment lifecycle state of the overlay. public OverlayDeploymentState State { get; private set; } = OverlayDeploymentState.Uninitialized; - /// Gets whether the overlay is currently embedded in the taskbar (either approach). + /// Gets whether the overlay is currently embedded in the taskbar. public bool IsEmbedded { get; private set; } - /// - /// Gets whether the overlay is using the floating layered-window approach (Approach B) - /// rather than the child-window approach (Approach A). - /// - public bool IsFallback { get; private set; } - - /// Gets the last calculated X coordinate for the floating overlay window. - public int LastComputedFloatX { get; private set; } - - /// Gets the last calculated Y coordinate for the floating overlay window. - public int LastComputedFloatY { get; private set; } - /// Gets whether the available taskbar space is narrower than the overlay width. public bool IsTaskbarSpaceConstrained { get; private set; } /// Gets the measured width in pixels of the taskbar slot available for the overlay. public int AvailableSlotWidth { get; private set; } + internal int NaturalOverlayWidth { get; set; } + private int _trayLeftEdge = -1; private int _leftWidgetRightEdge = -1; private int _rightWidgetLeftEdge = -1; - // Reposition() runs on a 200ms timer; PositionInBand() computes the same position every - // tick, so only emit a log line when the position message actually changes. - private string? _lastPositionInBandLog; - private string? _lastPositionFloatLog; - /// - /// Attempts to embed the overlay window into the taskbar. Tries the child-window - /// approach first; falls back to a layered floating window on failure. + /// Attempts to embed the overlay window into the taskbar as a native child window. /// /// Handle to the overlay window. /// Desired size of the overlay. - /// true if Approach A succeeded; false if fallback was used. + /// true if embedded as a child window successfully; otherwise, false. public bool Embed(IntPtr overlayHwnd, Size overlaySize) { IsEmbedded = false; - IsFallback = false; - _lastFloatRect = Rectangle.Empty; if (overlayHwnd == IntPtr.Zero || !NativeMethods.IsWindow(overlayHwnd)) { @@ -90,8 +103,10 @@ public bool Embed(IntPtr overlayHwnd, Size overlaySize) return false; } + ActiveOverlayHwnds.TryAdd(overlayHwnd, 0); + RefreshTaskbarInfo(); - _trayLeftEdge = GetTrayLeftEdge(); + _trayLeftEdge = ResolveTrayLeftEdge(GetTargetTrayWnd(), IsSecondaryTaskbar); UpdateWidgetsEdges(); LogTrayStructure(); @@ -101,29 +116,16 @@ public bool Embed(IntPtr overlayHwnd, Size overlaySize) if (PositionInBand(overlayHwnd, overlaySize)) { IsEmbedded = true; - IsFallback = false; State = OverlayDeploymentState.Active; - Log.Info($"Overlay embedded into taskbar (child mode, {overlaySize.Width}x{overlaySize.Height})"); return true; } - Log.Warn("PositionInBand failed after SetParent; detaching and falling back to floating mode"); + Log.Warn("PositionInBand failed after SetParent; detaching from parent"); NativeMethods.SetParent(overlayHwnd, IntPtr.Zero); } - RestoreLayeredStyles(overlayHwnd); - if (PositionFloat(overlayHwnd, overlaySize)) - { - IsEmbedded = true; - IsFallback = true; - State = OverlayDeploymentState.Active; - Log.Info($"Taskbar overlay active (floating mode, {overlaySize.Width}x{overlaySize.Height})"); - return false; - } - - Log.Error("Taskbar overlay failed to deploy into active state (both child and floating positioning failed)."); + Log.Warn("Taskbar overlay failed to embed into taskbar band; will retry on next layout tick"); IsEmbedded = false; - IsFallback = false; State = OverlayDeploymentState.Failed; return false; } @@ -134,18 +136,15 @@ public bool Embed(IntPtr overlayHwnd, Size overlaySize) public void Reposition(IntPtr overlayHwnd, Size overlaySize) { RefreshTaskbarInfo(); - _trayLeftEdge = GetTrayLeftEdge(); + _trayLeftEdge = ResolveTrayLeftEdge(GetTargetTrayWnd(), IsSecondaryTaskbar); UpdateWidgetsEdges(); - if (IsFallback) - { - PositionFloat(overlayHwnd, overlaySize); - return; - } - if (_taskBandHwnd != IntPtr.Zero && NativeMethods.IsWindow(_taskBandHwnd) && overlaySize.Width != _lastShrinkWidth) + if (_taskBandHwnd != IntPtr.Zero && NativeMethods.IsWindow(_taskBandHwnd) + && (overlaySize.Width != _lastShrinkWidth || _cfg.Overlay.PlacementOffset != _lastShrinkOffset)) { ShrinkTaskBand(overlaySize); _lastShrinkWidth = overlaySize.Width; + _lastShrinkOffset = _cfg.Overlay.PlacementOffset; } PositionInBand(overlayHwnd, overlaySize); @@ -155,12 +154,13 @@ public void Reposition(IntPtr overlayHwnd, Size overlaySize) /// Handle to the overlay window. public void Detach(IntPtr overlayHwnd) { + ActiveOverlayHwnds.TryRemove(overlayHwnd, out _); RestoreTaskBand(); - if (!IsFallback) - NativeMethods.SetParent(overlayHwnd, IntPtr.Zero); - else if (overlayHwnd != IntPtr.Zero && NativeMethods.IsWindow(overlayHwnd)) + if (overlayHwnd != IntPtr.Zero && NativeMethods.IsWindow(overlayHwnd)) + { NativeMethods.SetWindowLongPtr(overlayHwnd, NativeMethods.GWLP_HWNDPARENT, IntPtr.Zero); - _lastFloatRect = Rectangle.Empty; + NativeMethods.SetParent(overlayHwnd, IntPtr.Zero); + } _leftWidgetRightEdge = -1; _rightWidgetLeftEdge = -1; IsTaskbarSpaceConstrained = false; @@ -183,8 +183,7 @@ public void OnTaskbarRecreated(IntPtr overlayHwnd, Size overlaySize) _taskBandHwnd = IntPtr.Zero; _parentHwnd = IntPtr.Zero; _lastShrinkWidth = -1; - _lastPositionInBandLog = null; - _lastPositionFloatLog = null; + _lastShrinkOffset = -1; ResetStaticEdgeCaches(); _cachedAppListRightEdge = -1; _lastAppListQueryTicks = 0; @@ -192,11 +191,10 @@ public void OnTaskbarRecreated(IntPtr overlayHwnd, Size overlaySize) _lastAppListLeftQueryTicks = 0; IsTaskbarSpaceConstrained = false; AvailableSlotWidth = 0; - _lastFloatRect = Rectangle.Empty; Embed(overlayHwnd, overlaySize); } - public bool IsChildMode => IsEmbedded && !IsFallback; + public bool IsChildMode => IsEmbedded; public IntPtr ParentHwnd => _parentHwnd; /// @@ -220,19 +218,21 @@ public void UpdateLayeredSettings(IntPtr overlayHwnd) internal static Func? IsWidgetsFeatureEnabledOverride { get; set; } internal static Func? AppListLeftEdgeAutomationOverride { get; set; } internal static Func? AppListRightEdgeAutomationOverride { get; set; } + internal static Func? TrayLeftEdgeAutomationOverride { get; set; } internal static bool ThrowInAttachChildForTesting { get; set; } internal static bool ThrowInDumpTaskbarHierarchyForTesting { get; set; } internal static bool ThrowInTrayLeftEdgeForTesting { get; set; } + internal static bool ThrowInTrayLeftEdgeAutomationForTesting { get; set; } internal static bool ThrowInAppListLeftEdgeForTesting { get; set; } internal static bool ThrowInAppListRightEdgeForTesting { get; set; } internal static bool ThrowInIsWidgetsFeatureEnabledForTesting { get; set; } internal static bool ThrowInExplorerLookupForTesting { get; set; } internal static bool FailGetClientRectForTesting { get; set; } - internal static bool FailPositionFloatForTesting { get; set; } internal static bool ThrowInQueryWidgetsButtonEdgeForTesting { get; set; } internal static bool ThrowInQueryAppListLeftEdgeFromAutomationForTesting { get; set; } internal static bool ThrowInQueryAppListRightEdgeFromAutomationForTesting { get; set; } internal static bool ThrowInIsTaskbarCenteredForTesting { get; set; } + internal static bool ThrowInScanTaskbarForTesting { get; set; } internal static IntPtr SafeFindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string? lpszClass, string? lpszWindow) { @@ -241,6 +241,9 @@ internal static IntPtr SafeFindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter return NativeMethods.FindWindowEx(hwndParent, hwndChildAfter, lpszClass, lpszWindow); } + [ThreadStatic] + internal static IntPtr? CurrentTargetTrayWnd; + /// Locates Shell_TrayWnd owned by explorer.exe (avoids grabbing a /// third-party toolbar window that reused the same class name). public static IntPtr FindExplorerTrayWnd() @@ -248,6 +251,9 @@ public static IntPtr FindExplorerTrayWnd() if (ExplorerTrayWndOverride is not null) return ExplorerTrayWndOverride(); + if (CurrentTargetTrayWnd.HasValue && CurrentTargetTrayWnd.Value != IntPtr.Zero) + return CurrentTargetTrayWnd.Value; + IntPtr hwnd = IntPtr.Zero; while ((hwnd = SafeFindWindowEx(IntPtr.Zero, hwnd, "Shell_TrayWnd", null)) != IntPtr.Zero) { @@ -270,11 +276,57 @@ public static IntPtr FindExplorerTrayWnd() return IntPtr.Zero; } + /// Locates all Shell_SecondaryTrayWnd windows owned by explorer.exe. + public static List FindExplorerSecondaryTrayWnds() + { + if (ExplorerSecondaryTrayWndsOverride is not null) + return ExplorerSecondaryTrayWndsOverride(); + + var list = new List(); + IntPtr hwnd = IntPtr.Zero; + while ((hwnd = SafeFindWindowEx(IntPtr.Zero, hwnd, "Shell_SecondaryTrayWnd", null)) != IntPtr.Zero) + { + NativeMethods.GetWindowThreadProcessId(hwnd, out uint pid); + if (pid == 0) continue; + try + { + if (ThrowInExplorerLookupForTesting) + throw new InvalidOperationException("Simulated explorer lookup error"); + + using var proc = Process.GetProcessById((int)pid); + if (proc.ProcessName.Equals("explorer", StringComparison.OrdinalIgnoreCase)) + list.Add(hwnd); + } + catch (Exception ex) + { + Log.Debug(ex, "Explorer process lookup race during secondary tray scan"); + } + } + return list; + } + + internal static Func>? ExplorerSecondaryTrayWndsOverride { get; set; } + private void RefreshTaskbarInfo() { - var data = new NativeMethods.APPBARDATA + if (TargetDisplay is not null && !TargetDisplay.IsPrimary && TargetDisplay.TaskbarHwnd != IntPtr.Zero) + { + if (NativeMethods.GetWindowRect(TargetDisplay.TaskbarHwnd, out var r) && r.Width > 0 && r.Height > 0) + { + _taskbarRect = new Rectangle(r.Left, r.Top, r.Width, r.Height); + _taskbarEdge = NativeMethods.ABE_BOTTOM; + return; + } + + var fallbackSecondary = CalculateFromWorkingArea(TargetDisplay.Bounds, TargetDisplay.WorkingArea); + _taskbarRect = fallbackSecondary.Rect; + _taskbarEdge = fallbackSecondary.Edge; + return; + } + + var data = new NativeMethods.AppBarData { - cbSize = (uint)Marshal.SizeOf(), + cbSize = (uint)Marshal.SizeOf(), }; NativeMethods.SHAppBarMessage(NativeMethods.ABM_GETTASKBARPOS, ref data); _taskbarRect = new Rectangle(data.rc.Left, data.rc.Top, data.rc.Width, data.rc.Height); @@ -366,53 +418,242 @@ public static bool IsTaskbarCentered() } } - private static int GetTrayLeftEdge() + private static int FindNativeTrayLeft(IntPtr tray, NativeMethods.Rect trayRect) { - try + int minLeft = int.MaxValue; + IntPtr trayNotify = SafeFindWindowEx(tray, IntPtr.Zero, "TrayNotifyWnd", null); + if (trayNotify != IntPtr.Zero && NativeMethods.GetWindowRect(trayNotify, out var notifyRect) && notifyRect.Width > 0) { - if (ThrowInTrayLeftEdgeForTesting) - throw new InvalidOperationException("Simulated tray left edge error"); + minLeft = Math.Min(minLeft, notifyRect.Left); + } - IntPtr tray = FindExplorerTrayWnd(); - if (tray == IntPtr.Zero) return -1; + IntPtr clock = SafeFindWindowEx(tray, IntPtr.Zero, "TrayClockWClass", null); + if (clock == IntPtr.Zero) + clock = SafeFindWindowEx(tray, IntPtr.Zero, "ClockCompWidget", null); + if (clock != IntPtr.Zero && NativeMethods.GetWindowRect(clock, out var clockRect) && clockRect.Width > 0) + { + minLeft = Math.Min(minLeft, clockRect.Left); + } - int minLeft = int.MaxValue; + IntPtr rebar = SafeFindWindowEx(tray, IntPtr.Zero, "ReBarWindow32", null); + int clusterLeft = minLeft != int.MaxValue ? minLeft : trayRect.Right; + minLeft = Math.Min(minLeft, FindAdjacentClusterLeft(tray, trayRect, clusterLeft, rebar, trayNotify, clock)); - // 1. TrayNotifyWnd exists on Win10 and most Win11 builds (order: icons | clock) - IntPtr trayNotify = SafeFindWindowEx(tray, IntPtr.Zero, "TrayNotifyWnd", null); - if (trayNotify != IntPtr.Zero && NativeMethods.GetWindowRect(trayNotify, out var notifyRect) && notifyRect.Width > 0) + return Math.Min(minLeft, FindRightmostChildTrayLeft(tray, trayRect)); + } + + private static bool IsAdjacentTrayChild(IntPtr child, NativeMethods.Rect trayRect, int clusterLeft, IntPtr rebar, IntPtr trayNotify, IntPtr clock, out int childLeft) + { + childLeft = 0; + if (child == rebar || child == trayNotify || child == clock || !NativeMethods.IsWindowVisible(child)) + return false; + + if (IsAppOverlayWindow(child)) + return false; + + if (!NativeMethods.GetWindowRect(child, out var cr) || cr.Width <= 0 || cr.Height <= 0) + return false; + + bool isHorizontallyAdjacent = cr.Right >= clusterLeft - 20 && cr.Left < clusterLeft; + bool isReasonableBounds = cr.Left >= trayRect.Left + (trayRect.Width / 3) && cr.Width < trayRect.Width * 0.45; + + if (isHorizontallyAdjacent && isReasonableBounds) + { + childLeft = cr.Left; + return true; + } + + return false; + } + + private static int FindAdjacentClusterLeft(IntPtr tray, NativeMethods.Rect trayRect, int initialClusterLeft, IntPtr rebar, IntPtr trayNotify, IntPtr clock) + { + int clusterLeft = initialClusterLeft; + bool foundAdjacent; + do + { + foundAdjacent = false; + IntPtr child = IntPtr.Zero; + while ((child = SafeFindWindowEx(tray, child, null, null)) != IntPtr.Zero) { - minLeft = Math.Min(minLeft, notifyRect.Left); + if (IsAdjacentTrayChild(child, trayRect, clusterLeft, rebar, trayNotify, clock, out int childLeft)) + { + clusterLeft = childLeft; + foundAdjacent = true; + } } + } while (foundAdjacent); - // 2. Win11: clock widget - IntPtr clock = SafeFindWindowEx(tray, IntPtr.Zero, "TrayClockWClass", null); - if (clock == IntPtr.Zero) - clock = SafeFindWindowEx(tray, IntPtr.Zero, "ClockCompWidget", null); - if (clock != IntPtr.Zero && NativeMethods.GetWindowRect(clock, out var clockRect) && clockRect.Width > 0) + return clusterLeft; + } + + private static int FindSecondaryClockLeft(IntPtr tray) + { + IntPtr clock = SafeFindWindowEx(tray, IntPtr.Zero, "TrayClockWClass", null); + if (clock == IntPtr.Zero) + clock = SafeFindWindowEx(tray, IntPtr.Zero, "ClockCompWidget", null); + if (clock != IntPtr.Zero && !IsAppOverlayWindow(clock) && NativeMethods.GetWindowRect(clock, out var clockRect) && clockRect.Width > 0) + { + return clockRect.Left; + } + return -1; + } + + internal static Func? IsSecondaryTrayWindowOverride { get; set; } + + private static bool IsSecondaryTrayWindow(IntPtr tray) + { + if (IsSecondaryTrayWindowOverride is not null) + return IsSecondaryTrayWindowOverride(tray); + if (tray == IntPtr.Zero) return false; + var className = new char[256]; + int len = NativeMethods.GetClassName(tray, className, className.Length); + if (len <= 0) return false; + string cls = new string(className, 0, len); + return cls.Equals("Shell_SecondaryTrayWnd", StringComparison.OrdinalIgnoreCase); + } + + private const string ClockAutomationId = "Clock"; + + private static int FindSecondaryClockById(AutomationElement trayElem, int midX) + { + string[] clockIds = ["ClockButton", "TimeButton", "TimeWidget", ClockAutomationId, "NotificationCenterButton"]; + foreach (string id in clockIds) + { + var clockCond = new PropertyCondition(AutomationElement.AutomationIdProperty, id); + var elem = trayElem.FindFirst(TreeScope.Descendants, clockCond); + if (elem is not null) { - minLeft = Math.Min(minLeft, clockRect.Left); + var rect = elem.Current.BoundingRectangle; + if (!rect.IsEmpty && rect.Width > 0 && rect.Height > 0 && (int)rect.Left >= midX) + { + return (int)rect.Left; + } } + } + return -1; + } - // 3. Win11: inspect any visible child windows on the right half of the taskbar - if (NativeMethods.GetWindowRect(tray, out var trayRect) && trayRect.Width > 0) + private static int FindSecondaryClockByPosition(AutomationElement trayElem, int midX) + { + var buttons = trayElem.FindAll(TreeScope.Descendants, + new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button)); + int rightmostLeft = -1; + double maxRight = double.MinValue; + foreach (AutomationElement btn in buttons) + { + var r = btn.Current.BoundingRectangle; + if (IsClockButtonCandidate(r, midX, maxRight)) { - minLeft = Math.Min(minLeft, FindRightmostChildTrayLeft(tray, trayRect)); + maxRight = r.Right; + rightmostLeft = (int)r.Left; + } + } + return rightmostLeft; + } - if (minLeft != int.MaxValue) + private static bool IsClockButtonCandidate(System.Windows.Rect r, int midX, double maxRight) => + !r.IsEmpty && r.Width is > 20 and < 250 && r.Right > maxRight && (int)r.Left >= midX; + + private static int QuerySecondaryClockFromAutomation(IntPtr tray, NativeMethods.Rect trayRect) + { + long now = Stopwatch.GetTimestamp(); + if (_trayAutomationCache.TryGetValue(tray, out var cached) && (now - cached.Ticks) < (Stopwatch.Frequency * 30)) + { + return cached.Edge; + } + + try + { + var task = Task.Run(() => + { + try + { + var trayElem = AutomationElement.FromHandle(tray); + if (trayElem is null) return -1; + + int midX = trayRect.Left + (trayRect.Width / 2); + int idClock = FindSecondaryClockById(trayElem, midX); + if (idClock != -1) return idClock; + + return FindSecondaryClockByPosition(trayElem, midX); + } + catch (Exception ex) { - LogTrayEdgeChange(minLeft, $"resolved tray left={minLeft}"); - return minLeft; + Log.Debug(ex, "UIAutomation query for secondary clock worker failed"); + return -1; } + }); + task.ContinueWith(t => { _ = t.Exception; }, TaskContinuationOptions.OnlyOnFaulted); - int estimatedTrayWidth = EstimateTrayWidth(); - int fallbackEdge = trayRect.Right - estimatedTrayWidth; - LogTrayEdgeChange(fallbackEdge, $"fallback estimate from right={trayRect.Right}, width={estimatedTrayWidth}"); - return fallbackEdge; + if (task.Wait(TimeSpan.FromMilliseconds(250))) + { + int calculatedLeft = task.Result; + if (calculatedLeft != -1) + { + _trayAutomationCache[tray] = (calculatedLeft, now); + return calculatedLeft; + } } + } + catch (Exception ex) + { + Log.Debug(ex, "UIAutomation query for secondary clock failed"); + } - LogTrayEdgeChange(-1, "no tray marker found, returning -1"); - return -1; + if (_trayAutomationCache.TryGetValue(tray, out var lastKnown) && lastKnown.Edge != -1) + { + return lastKnown.Edge; + } + + return -1; + } + + private static int ResolveSecondaryTrayLeftEdge(IntPtr tray, NativeMethods.Rect trayRect) + { + int secClock = FindSecondaryClockLeft(tray); + if (secClock != -1) + { + LogTrayEdgeChange(secClock, $"resolved secondary tray clock left={secClock}"); + return secClock; + } + + var scan = ScanTaskbar(tray, trayRect.Width, trayRect.Left); + if (scan.TrayLeft != -1) + { + LogTrayEdgeChange(scan.TrayLeft, $"batched UIAutomation secondary tray left={scan.TrayLeft}"); + return scan.TrayLeft; + } + + int secAutoClock = QuerySecondaryClockFromAutomation(tray, trayRect); + if (secAutoClock != -1) + { + LogTrayEdgeChange(secAutoClock, $"UIAutomation secondary clock left={secAutoClock}"); + return secAutoClock; + } + + // Dynamic taskbar edge detection: when a secondary taskbar does not contain a clock or tray, + // its right boundary is the true right edge of the taskbar window. + LogTrayEdgeChange(trayRect.Right, $"secondary taskbar has no right-docked elements; boundary is right={trayRect.Right}"); + return trayRect.Right; + } + + internal static int ResolveTrayLeftEdge(IntPtr tray, bool isSecondary) + { + try + { + if (ThrowInTrayLeftEdgeForTesting) + throw new InvalidOperationException("Simulated tray left edge error"); + + if (tray == IntPtr.Zero || !NativeMethods.GetWindowRect(tray, out var trayRect) || trayRect.Width <= 0) + { + LogTrayEdgeChange(-1, "no tray marker found, returning -1"); + return -1; + } + + return isSecondary + ? ResolveSecondaryTrayLeftEdge(tray, trayRect) + : ResolvePrimaryTrayLeftEdge(tray, trayRect, isSecondary); } catch (Exception ex) { @@ -421,7 +662,214 @@ private static int GetTrayLeftEdge() } } - private static int FindRightmostChildTrayLeft(IntPtr tray, NativeMethods.RECT trayRect) + private static int ResolvePrimaryTrayLeftEdge(IntPtr tray, NativeMethods.Rect trayRect, bool isSecondary) + { + int nativeSecClock = FindSecondaryClockLeft(tray); + if (nativeSecClock != -1 && FindNativeTrayLeft(tray, trayRect) == int.MaxValue) + { + LogTrayEdgeChange(nativeSecClock, $"resolved secondary tray clock left={nativeSecClock}"); + return nativeSecClock; + } + + if (TrayLeftEdgeAutomationOverride is not null) + { + int automatedLeft = TrayLeftEdgeAutomationOverride(trayRect.Width); + if (automatedLeft != -1) + { + LogTrayEdgeChange(automatedLeft, $"UIAutomation tray left={automatedLeft}"); + return automatedLeft; + } + } + + int minLeft = FindNativeTrayLeft(tray, trayRect); + if (minLeft != int.MaxValue) + { + LogTrayEdgeChange(minLeft, $"resolved tray left={minLeft}"); + return minLeft; + } + + var scan = ScanTaskbar(tray, trayRect.Width, trayRect.Left); + if (scan.TrayLeft != -1) + { + LogTrayEdgeChange(scan.TrayLeft, $"batched UIAutomation tray left={scan.TrayLeft}"); + return scan.TrayLeft; + } + + int fallbackLeft = QueryTrayLeftEdgeFromAutomation(tray, trayRect.Width); + if (fallbackLeft != -1) + { + LogTrayEdgeChange(fallbackLeft, $"UIAutomation tray left={fallbackLeft}"); + return fallbackLeft; + } + + if (_trayAutomationCache.TryGetValue(tray, out var cached) && cached.Edge != -1) + { + return cached.Edge; + } + + int estimatedTrayWidth = ResolveTrayWidth(tray, isSecondary); + int fallbackEdge = trayRect.Right - estimatedTrayWidth; + LogTrayEdgeChange(fallbackEdge, $"fallback estimate from right={trayRect.Right}, width={estimatedTrayWidth}"); + return fallbackEdge; + } + + internal static int GetTrayLeftEdge() + { + IntPtr tray = CurrentTargetTrayWnd.HasValue && CurrentTargetTrayWnd.Value != IntPtr.Zero + ? CurrentTargetTrayWnd.Value + : FindExplorerTrayWnd(); + return ResolveTrayLeftEdge(tray, IsSecondaryTrayWindow(tray)); + } + + private static int FindChevronLeft(AutomationElement trayElem, int midX) + { + var chevronCond = new PropertyCondition(AutomationElement.AutomationIdProperty, "NotificationChevron"); + var chevron = trayElem.FindFirst(TreeScope.Descendants, chevronCond); + if (chevron is not null) + { + var cr = chevron.Current.BoundingRectangle; + if (!cr.IsEmpty && cr.Width > 0 && cr.Height > 0 && (int)cr.Left >= midX) + { + return (int)cr.Left; + } + } + return -1; + } + + private static List CollectCandidateAutomationRects(AutomationElement trayElem, int midX) + { + var candidateRects = new List(); + string[] targetIds = + [ + "NotificationChevron", + "SystemPromotedNotificationArea", + "NotificationArea", + "SystemTrayFrameGrid", + "SystemTrayIcons", + "ControlCenterButton", + "ClockButton", + "NotificationCenterButton", + "TimeButton", + "TimeWidget", + ClockAutomationId + ]; + + foreach (string id in targetIds) + { + var cond = new PropertyCondition(AutomationElement.AutomationIdProperty, id); + var elem = trayElem.FindFirst(TreeScope.Descendants, cond); + if (elem is null) continue; + + var rect = elem.Current.BoundingRectangle; + if (!rect.IsEmpty && rect.Width > 0 && rect.Height > 0 && (int)rect.Left >= midX) + { + candidateRects.Add(rect); + } + } + return candidateRects; + } + + private static int QueryTrayLeftEdgeWorker(IntPtr tray, int taskbarWidth) + { + try + { + var trayElem = AutomationElement.FromHandle(tray); + if (trayElem is null) return -1; + + int taskbarLeft = 0; + if (tray != IntPtr.Zero && NativeMethods.GetWindowRect(tray, out var r)) + { + taskbarLeft = r.Left; + } + + int midX = taskbarLeft + (taskbarWidth > 0 ? (taskbarWidth / 2) : 0); + int chevronLeft = FindChevronLeft(trayElem, midX); + if (chevronLeft != -1) return chevronLeft; + + var candidateRects = CollectCandidateAutomationRects(trayElem, midX); + return CalculateTrayLeft(candidateRects, taskbarWidth, taskbarLeft); + } + catch (Exception ex) + { + Log.Debug(ex, "UIAutomation query for tray left edge worker failed"); + return -1; + } + } + + private static int QueryTrayLeftEdgeFromAutomation(IntPtr tray, int taskbarWidth) + { + if (ThrowInTrayLeftEdgeAutomationForTesting) + throw new InvalidOperationException("Simulated tray left edge automation error"); + + long now = Stopwatch.GetTimestamp(); + if (_trayAutomationCache.TryGetValue(tray, out var cached) && (now - cached.Ticks) < (Stopwatch.Frequency * 30)) + { + return cached.Edge; + } + + try + { + var queryTask = Task.Run(() => QueryTrayLeftEdgeWorker(tray, taskbarWidth)); + queryTask.ContinueWith(t => { _ = t.Exception; }, TaskContinuationOptions.OnlyOnFaulted); + + if (queryTask.Wait(TimeSpan.FromMilliseconds(150))) + { + int calculatedLeft = queryTask.Result; + if (calculatedLeft != -1) + { + _trayAutomationCache[tray] = (calculatedLeft, now); + return calculatedLeft; + } + } + else + { + Log.Debug("UIAutomation query for tray left edge timed out; avoiding explorer deadlock"); + } + } + catch (Exception ex) + { + Log.Debug(ex, "UIAutomation query for tray left edge failed"); + } + + if (_trayAutomationCache.TryGetValue(tray, out var lastKnown) && lastKnown.Edge != -1) + { + return lastKnown.Edge; + } + + return -1; + } + + internal static int CalculateTrayLeft(IEnumerable rects, int taskbarWidth, int taskbarLeft = int.MinValue) + { + var list = rects as IList ?? rects.ToList(); + if (list.Count == 0) return -1; + + int midX; + if (taskbarLeft != int.MinValue) + { + midX = taskbarLeft + (taskbarWidth > 0 ? taskbarWidth / 2 : 0); + } + else + { + double minCoord = list.Min(r => r.Left); + int halfWidth = taskbarWidth > 0 ? taskbarWidth / 2 : 0; + midX = minCoord < 0 && taskbarWidth > 0 + ? (int)minCoord + halfWidth + : halfWidth; + } + + int minLeft = int.MaxValue; + foreach (var cr in list) + { + if (!cr.IsEmpty && cr.Width > 0 && cr.Height > 0 && (int)cr.Left >= midX) + { + minLeft = Math.Min(minLeft, (int)cr.Left); + } + } + return minLeft == int.MaxValue ? -1 : minLeft; + } + + private static int FindRightmostChildTrayLeft(IntPtr tray, NativeMethods.Rect trayRect) { int minLeft = int.MaxValue; int midX = trayRect.Left + trayRect.Width / 2; @@ -429,10 +877,11 @@ private static int FindRightmostChildTrayLeft(IntPtr tray, NativeMethods.RECT tr while ((child = SafeFindWindowEx(tray, child, null, null)) != IntPtr.Zero) { if (!NativeMethods.IsWindowVisible(child)) continue; + if (IsAppOverlayWindow(child)) continue; if (!NativeMethods.GetWindowRect(child, out var cr) || cr.Width <= 0) continue; // If docked on the right side and doesn't span the majority of the taskbar - if (cr.Right >= trayRect.Right - 50 && cr.Left > midX && cr.Width < trayRect.Width * 0.45) + if (cr.Right >= trayRect.Right - 50 && cr.Left >= midX && cr.Width < trayRect.Width * 0.45) { minLeft = Math.Min(minLeft, cr.Left); } @@ -440,6 +889,175 @@ private static int FindRightmostChildTrayLeft(IntPtr tray, NativeMethods.RECT tr return minLeft; } + internal static TaskbarScanResult ScanTaskbar(IntPtr tray, int taskbarWidth, int taskbarLeft) + { + long now = Stopwatch.GetTimestamp(); + if (_taskbarScanCache.TryGetValue(tray, out var cached) && (now - cached.Ticks) < (Stopwatch.Frequency * 30)) + { + return cached; + } + + if (ThrowInScanTaskbarForTesting) + throw new InvalidOperationException("Simulated taskbar scan error"); + + if (tray == IntPtr.Zero || !NativeMethods.GetWindowRect(tray, out var tr) || tr.Width <= 0) + { + return new TaskbarScanResult(-1, -1, -1, now); + } + + try + { + var task = Task.Run(() => PerformTaskbarScanWorker(tray, tr, taskbarWidth, taskbarLeft)); + task.ContinueWith(t => { _ = t.Exception; }, TaskContinuationOptions.OnlyOnFaulted); + if (task.Wait(TimeSpan.FromMilliseconds(500))) + { + var result = task.Result; + _taskbarScanCache[tray] = result; + return result; + } + } + catch (Exception ex) + { + Log.Debug(ex, "Batched UIAutomation scan of taskbar failed"); + } + + if (_taskbarScanCache.TryGetValue(tray, out var lastKnown)) + { + return lastKnown; + } + + return new TaskbarScanResult(-1, -1, -1, now); + } + + private static TaskbarScanResult PerformTaskbarScanWorker(IntPtr tray, NativeMethods.Rect tr, int taskbarWidth, int taskbarLeft) + { + long now = Stopwatch.GetTimestamp(); + try + { + var cacheReq = new CacheRequest + { + AutomationElementMode = AutomationElementMode.None, + TreeScope = TreeScope.Descendants + }; + cacheReq.Add(AutomationElement.ClassNameProperty); + cacheReq.Add(AutomationElement.AutomationIdProperty); + cacheReq.Add(AutomationElement.BoundingRectangleProperty); + cacheReq.Add(AutomationElement.IsOffscreenProperty); + cacheReq.Add(AutomationElement.ControlTypeProperty); + + NativeMethods.GetWindowThreadProcessId(tray, out uint explorerPid); + var filter = explorerPid != 0 + ? (Condition)new PropertyCondition(AutomationElement.ProcessIdProperty, (int)explorerPid) + : Condition.TrueCondition; + + AutomationElement? root; + AutomationElementCollection? allElements = null; + using (cacheReq.Activate()) + { + root = AutomationElement.FromHandle(tray); + if (root is not null) + { + allElements = root.FindAll(TreeScope.Descendants, filter); + } + } + + int tbw = tr.Width; + int midX = taskbarLeft + (taskbarWidth > 0 ? (taskbarWidth / 2) : 0); + int appsR = int.MinValue; + int appsL = int.MaxValue; + int trayL = int.MaxValue; + bool isSecondary = IsSecondaryTrayWindow(tray); + + int nativeTray = FindNativeTrayLeft(tray, tr); + if (nativeTray != int.MaxValue) + { + trayL = nativeTray; + } + + if (allElements is not null) + { + foreach (AutomationElement elem in allElements) + { + ProcessCachedTaskbarElement(elem, tbw, midX, ref appsR, ref appsL, ref trayL); + } + } + + int finalAppsR = appsR != int.MinValue ? appsR : -1; + int finalAppsL = appsL != int.MaxValue ? appsL : -1; + int finalTrayL; + if (trayL != int.MaxValue) + { + finalTrayL = trayL; + } + else + { + finalTrayL = isSecondary ? tr.Right : -1; + } + + return new TaskbarScanResult(finalAppsR, finalAppsL, finalTrayL, now); + } + catch (Exception ex) + { + Log.Debug(ex, "UIAutomation perform taskbar scan worker failed"); + return new TaskbarScanResult(-1, -1, -1, now); + } + } + + private static void ProcessCachedTaskbarElement(AutomationElement elem, int tbw, int midX, + ref int appsR, ref int appsL, ref int trayL) + { + try + { + if (elem.Cached.IsOffscreen) return; + var r = elem.Cached.BoundingRectangle; + if (r.IsEmpty || r.Width <= 0 || r.Height <= 0 || r.Width >= tbw * 0.8) return; + + string cls = elem.Cached.ClassName ?? string.Empty; + string id = elem.Cached.AutomationId ?? string.Empty; + var ctrlType = elem.Cached.ControlType; + + bool isRightDocked = (int)r.Left >= midX && (IsRightDockedId(id) || cls.Contains("Tray", StringComparison.OrdinalIgnoreCase) || cls.Contains(ClockAutomationId, StringComparison.OrdinalIgnoreCase)); + if (isRightDocked) + { + trayL = Math.Min(trayL, (int)r.Left); + } + else + { + bool isApp = cls.StartsWith("Taskbar", StringComparison.OrdinalIgnoreCase) + || cls.StartsWith("Start", StringComparison.OrdinalIgnoreCase) + || cls.StartsWith("Search", StringComparison.OrdinalIgnoreCase) + || id.StartsWith("Task", StringComparison.OrdinalIgnoreCase) + || id.StartsWith("App", StringComparison.OrdinalIgnoreCase) + || (ctrlType == ControlType.Button && r.Width < (tbw * 0.4)); + + if (isApp && (trayL == int.MaxValue || (int)r.Right <= trayL)) + { + appsR = Math.Max(appsR, (int)r.Right); + appsL = Math.Min(appsL, (int)r.Left); + } + } + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to process cached taskbar automation element"); + } + } + + internal static bool IsRightDockedId(string id) + { + return id is "NotificationChevron" + or "SystemPromotedNotificationArea" + or "NotificationArea" + or "SystemTrayFrameGrid" + or "SystemTrayIcons" + or "ControlCenterButton" + or "ClockButton" + or "NotificationCenterButton" + or "TimeButton" + or "TimeWidget" + or ClockAutomationId; + } + // Reposition() runs on a 200ms timer; GetTrayLeftEdge() resolves the same value every // tick, so only emit a log line when the resolved edge actually changes significantly. private static int _lastLoggedTrayEdge = int.MinValue; @@ -455,12 +1073,21 @@ private static void LogTrayEdgeChange(int edge, string message) private static int _cachedLeftWidgetRightEdge = -1; private static int _cachedRightWidgetLeftEdge = -1; private static long _lastWidgetQueryTicks = 0; + private static long _lastWidgetNegativeQueryTicks = 0; + private static readonly System.Collections.Concurrent.ConcurrentDictionary _trayAutomationCache = new(); + internal sealed record TaskbarScanResult(int AppsRight, int AppsLeft, int TrayLeft, long Ticks); + private static readonly System.Collections.Concurrent.ConcurrentDictionary _taskbarScanCache = new(); private int _cachedAppListRightEdge = -1; private long _lastAppListQueryTicks = 0; private int _cachedAppListLeftEdge = -1; private long _lastAppListLeftQueryTicks = 0; + internal static void InvalidateCaches() + { + ResetStaticEdgeCaches(); + } + private static void ResetStaticEdgeCaches() { _lastLoggedTrayEdge = int.MinValue; @@ -468,6 +1095,10 @@ private static void ResetStaticEdgeCaches() _cachedLeftWidgetRightEdge = -1; _cachedRightWidgetLeftEdge = -1; _lastWidgetQueryTicks = 0; + _lastWidgetNegativeQueryTicks = 0; + _trayAutomationCache.Clear(); + _taskbarScanCache.Clear(); + ActiveOverlayHwnds.Clear(); } private static void LogWidgetEdgeChange(int edge, string message) @@ -477,13 +1108,70 @@ private static void LogWidgetEdgeChange(int edge, string message) Log.Debug($"Detected widget edge via {message}"); } + private int QueryLegacyTaskBandRightEdge() + { + if (_taskBandHwnd == IntPtr.Zero || !NativeMethods.IsWindow(_taskBandHwnd)) + return -1; + + int buttonRight = QueryLegacyTaskBandButtonsRightEdge(); + if (buttonRight > 0) + { + return buttonRight; + } + + if (NativeMethods.GetWindowRect(_taskBandHwnd, out var bandRect) && bandRect.Width > 0) + { + return bandRect.Right; + } + + return -1; + } + + private int QueryLegacyTaskBandButtonsRightEdge() + { + try + { + var bandElem = AutomationElement.FromHandle(_taskBandHwnd); + if (bandElem is not null) + { + int maxBtn = FindMaxButtonRight(bandElem); + if (maxBtn != -1 && maxBtn != int.MinValue) + { + return maxBtn; + } + } + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to query taskband button edge via UIAutomation"); + } + + return -1; + } + + private int ResolveDynamicAppListRightEdge() + { + if (AppListRightEdgeAutomationOverride is not null) + { + return AppListRightEdgeAutomationOverride(_taskbarRect.Width); + } + + var scan = ScanTaskbar(GetTargetTrayWnd(), _taskbarRect.Width, _taskbarRect.Left); + if (scan.AppsRight != -1) + { + return scan.AppsRight; + } + + return QueryAppListRightEdgeFromAutomationForTray(GetTargetTrayWnd(), _taskbarRect.Width); + } + private int GetAppListRightEdge() { if (AppListRightEdgeOverride is not null) return AppListRightEdgeOverride(); long now = Stopwatch.GetTimestamp(); - if (_cachedAppListRightEdge >= 0 && (now - _lastAppListQueryTicks) < (Stopwatch.Frequency * 2)) + if (_cachedAppListRightEdge != -1 && (now - _lastAppListQueryTicks) < (Stopwatch.Frequency * 30)) { return _cachedAppListRightEdge; } @@ -493,19 +1181,16 @@ private int GetAppListRightEdge() if (ThrowInAppListRightEdgeForTesting) throw new InvalidOperationException("Simulated app list right edge error"); - // If legacy taskband is present, use its actual bounding rectangle - if (_taskBandHwnd != IntPtr.Zero && NativeMethods.IsWindow(_taskBandHwnd) - && NativeMethods.GetWindowRect(_taskBandHwnd, out var bandRect) && bandRect.Width > 0) + int legacyRight = QueryLegacyTaskBandRightEdge(); + if (legacyRight > 0) { - _cachedAppListRightEdge = bandRect.Right; + _cachedAppListRightEdge = legacyRight; _lastAppListQueryTicks = now; - return bandRect.Right; + return legacyRight; } - int automatedRight = AppListRightEdgeAutomationOverride is not null - ? AppListRightEdgeAutomationOverride(_taskbarRect.Width) - : QueryAppListRightEdgeFromAutomation(_taskbarRect.Width); - if (automatedRight > 0) + int automatedRight = ResolveDynamicAppListRightEdge(); + if (automatedRight != -1 && automatedRight != int.MinValue) { _cachedAppListRightEdge = automatedRight; _lastAppListQueryTicks = now; @@ -517,40 +1202,90 @@ private int GetAppListRightEdge() Log.Debug(ex, "Failed to determine app list right edge via UIAutomation"); } - int fallback = _taskbarRect.Left + WindowHelpers.Scale(360, 1f); + if (_cachedAppListRightEdge > 0) + { + return _cachedAppListRightEdge; + } + + int fallback = !IsTaskbarCentered() + ? _taskbarRect.Left + (_taskbarRect.Width / 3) + : _taskbarRect.Left + (_taskbarRect.Width / 2); _cachedAppListRightEdge = fallback; - _lastAppListQueryTicks = now; + _lastAppListQueryTicks = now - (Stopwatch.Frequency * 28); return fallback; } - private static int QueryAppListRightEdgeFromAutomation(int taskbarWidth) + private static int TryResolveAppListRightEdge(AutomationElement listElem, int taskbarWidth) { - IntPtr tray = FindExplorerTrayWnd(); - if (tray == IntPtr.Zero) return -1; + int maxChildRight = FindMaxButtonRight(listElem); + if (maxChildRight != -1 && maxChildRight != int.MinValue) return maxChildRight; - if (ThrowInQueryAppListRightEdgeFromAutomationForTesting) - throw new InvalidOperationException("Simulated app list right edge automation error"); + var rect = listElem.Current.BoundingRectangle; + int maxAllowed = taskbarWidth > 0 ? (int)(taskbarWidth * 0.75) : 1400; + if (!rect.IsEmpty && rect.Width > 0 && rect.Width < maxAllowed) + { + return (int)rect.Right; + } - var trayElem = AutomationElement.FromHandle(tray); - if (trayElem is null) return -1; + return -1; + } - string[] targetIds = ["TaskbarItemsContainer", "TaskList"]; + private static int SearchAppListRightEdge(AutomationElement trayElem, int taskbarWidth) + { + string[] targetIds = ["TaskList", "TaskbarItemsContainer"]; foreach (string id in targetIds) { var cond = new PropertyCondition(AutomationElement.AutomationIdProperty, id); var listElem = trayElem.FindFirst(TreeScope.Descendants, cond); if (listElem is null) continue; - int maxChildRight = FindMaxButtonRight(listElem); - if (maxChildRight > 0) return maxChildRight; + int edge = TryResolveAppListRightEdge(listElem, taskbarWidth); + if (edge != -1 && edge != int.MinValue) return edge; + } + return -1; + } - var rect = listElem.Current.BoundingRectangle; - int maxAllowed = taskbarWidth > 0 ? (int)(taskbarWidth * 0.75) : 1400; - if (!rect.IsEmpty && rect.Width > 0 && rect.Width < maxAllowed) + internal static int QueryAppListRightEdgeFromAutomation(int taskbarWidth) + { + IntPtr tray = CurrentTargetTrayWnd.HasValue && CurrentTargetTrayWnd.Value != IntPtr.Zero + ? CurrentTargetTrayWnd.Value + : FindExplorerTrayWnd(); + return QueryAppListRightEdgeFromAutomationForTray(tray, taskbarWidth); + } + + private static int QueryAppListRightEdgeFromAutomationForTray(IntPtr tray, int taskbarWidth) + { + if (tray == IntPtr.Zero) return -1; + + try + { + if (ThrowInQueryAppListRightEdgeFromAutomationForTesting) + throw new InvalidOperationException("Simulated app list right edge automation error"); + + var task = Task.Run(() => + { + try + { + var trayElem = AutomationElement.FromHandle(tray); + return trayElem is not null ? SearchAppListRightEdge(trayElem, taskbarWidth) : -1; + } + catch (Exception ex) + { + Log.Debug(ex, "UIAutomation query for AppListRightEdge worker failed"); + return -1; + } + }); + task.ContinueWith(t => { _ = t.Exception; }, TaskContinuationOptions.OnlyOnFaulted); + + if (task.Wait(TimeSpan.FromMilliseconds(1500))) { - return (int)rect.Right; + return task.Result; } } + catch (Exception ex) + { + Log.Debug(ex, "UIAutomation query for AppListRightEdge failed"); + } return -1; } @@ -558,6 +1293,10 @@ private static int QueryAppListRightEdgeFromAutomation(int taskbarWidth) private static int FindMaxButtonRight(AutomationElement listElem) { var children = listElem.FindAll(TreeScope.Children, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button)); + if (children is null || children.Count == 0) + { + children = listElem.FindAll(TreeScope.Descendants, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button)); + } if (children is null || children.Count == 0) return -1; var rects = new List(children.Count); foreach (AutomationElement child in children) @@ -567,7 +1306,7 @@ private static int FindMaxButtonRight(AutomationElement listElem) internal static int CalculateMaxButtonRight(IEnumerable rects) { - int maxChildRight = -1; + int maxChildRight = int.MinValue; foreach (var cr in rects) { if (!cr.IsEmpty && cr.Width > 0) @@ -575,7 +1314,33 @@ internal static int CalculateMaxButtonRight(IEnumerable rec maxChildRight = Math.Max(maxChildRight, (int)cr.Right); } } - return maxChildRight; + return maxChildRight == int.MinValue ? -1 : maxChildRight; + } + + private int QueryLegacyTaskBandLeftEdge() + { + if (_taskBandHwnd != IntPtr.Zero && NativeMethods.IsWindow(_taskBandHwnd) + && NativeMethods.GetWindowRect(_taskBandHwnd, out var bandRect) && bandRect.Width > 0) + { + return bandRect.Left; + } + return -1; + } + + private int ResolveDynamicAppListLeftEdge() + { + if (AppListLeftEdgeAutomationOverride is not null) + { + return AppListLeftEdgeAutomationOverride(_taskbarRect.Width); + } + + var scan = ScanTaskbar(GetTargetTrayWnd(), _taskbarRect.Width, _taskbarRect.Left); + if (scan.AppsLeft != -1) + { + return scan.AppsLeft; + } + + return QueryAppListLeftEdgeFromAutomationForTray(GetTargetTrayWnd()); } private int GetAppListLeftEdge() @@ -584,7 +1349,7 @@ private int GetAppListLeftEdge() return AppListLeftEdgeOverride(); long now = Stopwatch.GetTimestamp(); - if (_cachedAppListLeftEdge >= 0 && (now - _lastAppListLeftQueryTicks) < (Stopwatch.Frequency * 2)) + if (_cachedAppListLeftEdge != -1 && (now - _lastAppListLeftQueryTicks) < (Stopwatch.Frequency * 30)) { return _cachedAppListLeftEdge; } @@ -594,18 +1359,16 @@ private int GetAppListLeftEdge() if (ThrowInAppListLeftEdgeForTesting) throw new InvalidOperationException("Simulated app list left edge error"); - if (_taskBandHwnd != IntPtr.Zero && NativeMethods.IsWindow(_taskBandHwnd) - && NativeMethods.GetWindowRect(_taskBandHwnd, out var bandRect) && bandRect.Width > 0) + int legacyLeft = QueryLegacyTaskBandLeftEdge(); + if (legacyLeft >= 0) { - _cachedAppListLeftEdge = bandRect.Left; + _cachedAppListLeftEdge = legacyLeft; _lastAppListLeftQueryTicks = now; - return bandRect.Left; + return legacyLeft; } - int automatedLeft = AppListLeftEdgeAutomationOverride is not null - ? AppListLeftEdgeAutomationOverride(_taskbarRect.Width) - : QueryAppListLeftEdgeFromAutomation(); - if (automatedLeft > 0) + int automatedLeft = ResolveDynamicAppListLeftEdge(); + if (automatedLeft != -1 && automatedLeft != int.MaxValue) { _cachedAppListLeftEdge = automatedLeft; _lastAppListLeftQueryTicks = now; @@ -617,26 +1380,37 @@ private int GetAppListLeftEdge() Log.Debug(ex, "Failed to determine app list left edge via UIAutomation"); } - int fallback = _taskbarRect.Width > 0 - ? _taskbarRect.Left + (int)(_taskbarRect.Width * 0.35) - : 600; + if (_cachedAppListLeftEdge > 0) + { + return _cachedAppListLeftEdge; + } + + int fallback = !IsTaskbarCentered() + ? _taskbarRect.Left + : _taskbarRect.Left + (_taskbarRect.Width / 4); _cachedAppListLeftEdge = fallback; - _lastAppListLeftQueryTicks = now; + _lastAppListLeftQueryTicks = now - (Stopwatch.Frequency * 28); return fallback; } - private static int QueryAppListLeftEdgeFromAutomation() + private static int FindStartButtonLeft(AutomationElement trayElem) { - IntPtr tray = FindExplorerTrayWnd(); - if (tray == IntPtr.Zero) return -1; - - if (ThrowInQueryAppListLeftEdgeFromAutomationForTesting) - throw new InvalidOperationException("Simulated app list left edge automation error"); - - var trayElem = AutomationElement.FromHandle(tray); - if (trayElem is null) return -1; + var startCond = new PropertyCondition(AutomationElement.AutomationIdProperty, "StartButton"); + var startBtn = trayElem.FindFirst(TreeScope.Descendants, startCond); + if (startBtn is not null) + { + var sr = startBtn.Current.BoundingRectangle; + if (!sr.IsEmpty && sr.Width > 0) + { + return (int)sr.Left; + } + } + return -1; + } - string[] targetIds = ["TaskbarItemsContainer", "TaskList"]; + private static int FindContainerLeftEdge(AutomationElement trayElem) + { + string[] targetIds = ["TaskList", "TaskbarItemsContainer"]; foreach (string id in targetIds) { var cond = new PropertyCondition(AutomationElement.AutomationIdProperty, id); @@ -644,7 +1418,7 @@ private static int QueryAppListLeftEdgeFromAutomation() if (listElem is null) continue; int minChildLeft = FindMinButtonLeft(listElem); - if (minChildLeft > 0) return minChildLeft; + if (minChildLeft != -1 && minChildLeft != int.MaxValue) return minChildLeft; var rect = listElem.Current.BoundingRectangle; if (!rect.IsEmpty && rect.Width > 0) @@ -652,6 +1426,57 @@ private static int QueryAppListLeftEdgeFromAutomation() return (int)rect.Left; } } + return -1; + } + + private static int QueryAppListLeftEdgeWorker(IntPtr tray) + { + try + { + var trayElem = AutomationElement.FromHandle(tray); + if (trayElem is null) return -1; + + int startLeft = FindStartButtonLeft(trayElem); + if (startLeft != -1) return startLeft; + + return FindContainerLeftEdge(trayElem); + } + catch (Exception ex) + { + Log.Debug(ex, "UIAutomation query for AppListLeftEdge worker failed"); + return -1; + } + } + + internal static int QueryAppListLeftEdgeFromAutomation() + { + IntPtr tray = CurrentTargetTrayWnd.HasValue && CurrentTargetTrayWnd.Value != IntPtr.Zero + ? CurrentTargetTrayWnd.Value + : FindExplorerTrayWnd(); + return QueryAppListLeftEdgeFromAutomationForTray(tray); + } + + private static int QueryAppListLeftEdgeFromAutomationForTray(IntPtr tray) + { + if (tray == IntPtr.Zero) return -1; + + if (ThrowInQueryAppListLeftEdgeFromAutomationForTesting) + throw new InvalidOperationException("Simulated app list left edge automation error"); + + try + { + var task = Task.Run(() => QueryAppListLeftEdgeWorker(tray)); + task.ContinueWith(t => { _ = t.Exception; }, TaskContinuationOptions.OnlyOnFaulted); + + if (task.Wait(TimeSpan.FromMilliseconds(1500))) + { + return task.Result; + } + } + catch (Exception ex) + { + Log.Debug(ex, "UIAutomation query for AppListLeftEdge failed"); + } return -1; } @@ -659,6 +1484,10 @@ private static int QueryAppListLeftEdgeFromAutomation() private static int FindMinButtonLeft(AutomationElement listElem) { var children = listElem.FindAll(TreeScope.Children, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button)); + if (children is null || children.Count == 0) + { + children = listElem.FindAll(TreeScope.Descendants, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button)); + } if (children is null || children.Count == 0) return -1; var rects = new List(children.Count); foreach (AutomationElement child in children) @@ -681,6 +1510,13 @@ internal static int CalculateMinButtonLeft(IEnumerable rect private void UpdateWidgetsEdges() { + if (IsSecondaryTaskbar) + { + _leftWidgetRightEdge = -1; + _rightWidgetLeftEdge = -1; + return; + } + if (LeftWidgetRightEdgeOverride is not null) { _leftWidgetRightEdge = LeftWidgetRightEdgeOverride(); @@ -736,22 +1572,27 @@ private static int QueryWidgetsButtonRightEdge(IntPtr tray) private int GetRightSideBoundary() { + if (IsSecondaryTaskbar) + { + return _trayLeftEdge; + } + if (RightWidgetLeftEdgeOverride is not null) { int r = RightWidgetLeftEdgeOverride(); - if (r > 0 && _trayLeftEdge > 0) return Math.Min(_trayLeftEdge, r); - if (r > 0) return r; + if (r != -1 && _trayLeftEdge != -1) return Math.Min(_trayLeftEdge, r); + if (r != -1) return r; } - if (_rightWidgetLeftEdge > 0 && _trayLeftEdge > 0) + if (_rightWidgetLeftEdge != -1 && _trayLeftEdge != -1) { return Math.Min(_trayLeftEdge, _rightWidgetLeftEdge); } - if (_rightWidgetLeftEdge > 0) + if (_rightWidgetLeftEdge != -1) return _rightWidgetLeftEdge; - if (_trayLeftEdge > 0) + if (_trayLeftEdge != -1) return _trayLeftEdge; return -1; @@ -781,32 +1622,52 @@ private static bool IsWidgetsFeatureEnabled() } } + private static (int leftRightEdge, int rightLeftEdge) FindWidgetEdgesWorker(IntPtr tray, int taskbarWidth, long now) + { + try + { + var trayElem = AutomationElement.FromHandle(tray); + if (trayElem is null) return (-1, -1); + + var cond = new PropertyCondition(AutomationElement.AutomationIdProperty, "WidgetsButton"); + var widgetBtn = trayElem.FindFirst(TreeScope.Descendants, cond); + if (widgetBtn is null) return (-1, -1); + + return ParseWidgetBoundingBox(widgetBtn, taskbarWidth, now); + } + catch (Exception ex) + { + Log.Debug(ex, "UIAutomation query for WidgetsButton worker failed"); + return (-1, -1); + } + } + private static (int leftRightEdge, int rightLeftEdge) QueryWidgetsButtonEdge(IntPtr tray, int taskbarWidth) { long now = Stopwatch.GetTimestamp(); - if ((_cachedLeftWidgetRightEdge >= 0 || _cachedRightWidgetLeftEdge >= 0) && (now - _lastWidgetQueryTicks) < (Stopwatch.Frequency * 2)) + if ((_cachedLeftWidgetRightEdge >= 0 || _cachedRightWidgetLeftEdge >= 0) && (now - _lastWidgetQueryTicks) < (Stopwatch.Frequency * 30)) { return (_cachedLeftWidgetRightEdge, _cachedRightWidgetLeftEdge); } + if (_lastWidgetNegativeQueryTicks > 0 && (now - _lastWidgetNegativeQueryTicks) < (Stopwatch.Frequency * 30)) + { + return (-1, -1); + } + try { if (ThrowInQueryWidgetsButtonEdgeForTesting) throw new InvalidOperationException("Simulated query widgets button error"); - var trayElem = AutomationElement.FromHandle(tray); - if (trayElem is not null) + var task = Task.Run(() => FindWidgetEdgesWorker(tray, taskbarWidth, now)); + task.ContinueWith(t => { _ = t.Exception; }, TaskContinuationOptions.OnlyOnFaulted); + + if (task.Wait(TimeSpan.FromMilliseconds(250))) { - var cond = new PropertyCondition(AutomationElement.AutomationIdProperty, "WidgetsButton"); - var widgetBtn = trayElem.FindFirst(TreeScope.Descendants, cond); - if (widgetBtn is not null) - { - var result = ParseWidgetBoundingBox(widgetBtn, taskbarWidth, now); - if (result != (-1, -1)) - { - return result; - } - } + var res = task.Result; + if (res != (-1, -1)) + return res; } } catch (Exception ex) @@ -817,6 +1678,7 @@ private static (int leftRightEdge, int rightLeftEdge) QueryWidgetsButtonEdge(Int _cachedLeftWidgetRightEdge = -1; _cachedRightWidgetLeftEdge = -1; _lastWidgetQueryTicks = now; + _lastWidgetNegativeQueryTicks = now; return (-1, -1); } @@ -832,6 +1694,7 @@ internal static (int leftRightEdge, int rightLeftEdge) CalculateWidgetEdges(Syst return (-1, -1); } + _lastWidgetNegativeQueryTicks = 0; int midX = taskbarWidth > 0 ? (taskbarWidth / 2) : 960; if (rect.Left < midX) { @@ -903,11 +1766,19 @@ private static bool IsWindows11Taskbar() return true; // Only if DesktopWindowContentBridge is absent AND ReBarWindow32 is present - // is a legacy Win10 taskbar replacement (e.g. ExplorerPatcher) active. - if (SafeFindWindowEx(tray, IntPtr.Zero, "ReBarWindow32", null) != IntPtr.Zero) + // AND an actual taskband window exists inside it is a legacy taskbar active + IntPtr rebar = SafeFindWindowEx(tray, IntPtr.Zero, "ReBarWindow32", null); + if (rebar != IntPtr.Zero) { - Log.Info("ReBarWindow32 detected without DesktopWindowContentBridge (ExplorerPatcher / legacy taskbar replacement active)"); - return false; + IntPtr taskBand = SafeFindWindowEx(rebar, IntPtr.Zero, "MSTaskSwWClass", null); + if (taskBand == IntPtr.Zero) + taskBand = SafeFindWindowEx(rebar, IntPtr.Zero, "MSTaskListWClass", null); + + if (taskBand != IntPtr.Zero && NativeMethods.IsWindow(taskBand)) + { + Log.Debug("ReBarWindow32 and taskband detected without DesktopWindowContentBridge (ExplorerPatcher / legacy taskbar replacement active)"); + return false; + } } } @@ -921,7 +1792,7 @@ private bool TrySetParent(IntPtr overlayHwnd, Size overlaySize) if (ThrowInAttachChildForTesting) throw new InvalidOperationException("Simulated attach child error"); - var tray = FindExplorerTrayWnd(); + var tray = GetTargetTrayWnd(); if (tray == IntPtr.Zero) return false; _isWin11 = IsWindows11Taskbar(); @@ -930,7 +1801,17 @@ private bool TrySetParent(IntPtr overlayHwnd, Size overlaySize) SaveOriginalTaskBandRect(); ConfigureOverlayWindowStyles(overlayHwnd); - NativeMethods.SetParent(overlayHwnd, _parentHwnd); + IntPtr prevParent = NativeMethods.SetParent(overlayHwnd, _parentHwnd); + if (prevParent == IntPtr.Zero) + { + int err = Marshal.GetLastWin32Error(); + Log.Debug($"SetParent to taskbar (0x{_parentHwnd:X}) failed with Win32 error {err}; falling back to owned window on taskbar"); + int s = NativeMethods.GetWindowLong(overlayHwnd, NativeMethods.GWL_STYLE); + s &= ~NativeMethods.WS_CHILD; + s |= NativeMethods.WS_POPUP; + NativeMethods.SetWindowLong(overlayHwnd, NativeMethods.GWL_STYLE, s); + NativeMethods.SetWindowLongPtr(overlayHwnd, NativeMethods.GWLP_HWNDPARENT, _parentHwnd); + } RestoreOverlayLayeredStyle(overlayHwnd); ApplyLayeredAttributes(overlayHwnd); @@ -943,7 +1824,7 @@ private bool TrySetParent(IntPtr overlayHwnd, Size overlaySize) } catch (Exception ex) { - Log.Error(ex, "Failed to attach overlay window to taskbar; switching to floating window fallback"); + Log.Error(ex, "Failed to attach overlay window to taskbar"); return false; } } @@ -1035,19 +1916,28 @@ private void ShrinkTaskBand(Size overlaySize) NativeMethods.GetWindowRect(_taskBandHwnd, out var cur); int gap = WindowHelpers.Scale(4, 1f); - int overlayW = overlaySize.Width + gap; - int newBandW = Math.Max(cur.Width - overlayW, 50); + int overlayW = overlaySize.Width + gap + Math.Max(0, _cfg.Overlay.PlacementOffset); + + int clientOriLeft = 0; + if (_parentHwnd != IntPtr.Zero && NativeMethods.GetWindowRect(_parentHwnd, out var parentRect)) + { + clientOriLeft = Math.Max(0, _taskBandOri.Left - parentRect.Left); + } + + int appsRight = ResolveClientAppsRight(clientOriLeft + 50); + int minButtonsWidth = Math.Max(50, appsRight - clientOriLeft); + int newBandW = Math.Max(cur.Width - overlayW, minButtonsWidth); if (_cfg.Overlay.Placement == "left") { NativeMethods.MoveWindow(_taskBandHwnd, - _taskBandOri.Left + overlayW, 0, + clientOriLeft + overlayW, 0, newBandW, cur.Height, true); } else { NativeMethods.MoveWindow(_taskBandHwnd, - _taskBandOri.Left, 0, + clientOriLeft, 0, newBandW, cur.Height, true); } } @@ -1102,6 +1992,7 @@ private bool ValidateBandWindows(IntPtr overlayHwnd) private bool PositionInBand(IntPtr overlayHwnd, Size sz) { + _currentOverlayHwnd = overlayHwnd; if (!ValidateBandWindows(overlayHwnd)) { return false; @@ -1114,378 +2005,339 @@ private bool PositionInBand(IntPtr overlayHwnd, Size sz) return false; } + var (targetX, targetY, zOrder) = ResolveBandPlacement(overlayHwnd, parentRect, sz); + bool success = NativeMethods.SetWindowPos( + overlayHwnd, zOrder, + targetX, targetY, sz.Width, sz.Height, + NativeMethods.SWP_NOACTIVATE | NativeMethods.SWP_SHOWWINDOW); + if (!success) + { + HandleSetWindowPosFailure(targetX, targetY); + return false; + } + + ApplyLayeredAttributes(overlayHwnd); + return true; + } + + private (int TargetX, int TargetY, IntPtr ZOrder) ResolveBandPlacement(IntPtr overlayHwnd, NativeMethods.Rect parentRect, Size sz) + { int x = ComputeBandX(parentRect, sz); x = Math.Max(x, 0); if (x + sz.Width > parentRect.Width) + { x = Math.Max(parentRect.Width - sz.Width, 0); + } int y = Math.Max(0, (parentRect.Height - sz.Height) / 2); - string positionLog = $"Positioned overlay in taskbar band ({sz.Width}x{sz.Height} at {x},{y}, offset {_cfg.Overlay.PlacementOffset}, placement '{_cfg.Overlay.Placement}')"; - if (positionLog != _lastPositionInBandLog) - { - _lastPositionInBandLog = positionLog; - Log.Debug(positionLog); - } - - bool success = NativeMethods.SetWindowPos( - overlayHwnd, NativeMethods.HWND_TOP, - x, y, sz.Width, sz.Height, - NativeMethods.SWP_NOACTIVATE | NativeMethods.SWP_SHOWWINDOW); - if (!success) + if (_lastPositionedX == int.MinValue || Math.Abs(x - _lastPositionedX) > 2 || sz.Width != _lastPositionedWidth) { - int err = Marshal.GetLastWin32Error(); - if (err is 87 or 1400) - { - Log.Debug($"SetWindowPos returned transient error {err} during band positioning at ({x}, {y}) (taskbar transition in progress)."); - State = OverlayDeploymentState.Recovering; - } - else - { - Log.Error($"SetWindowPos failed with Win32 error {err} during band positioning at ({x}, {y})."); - State = OverlayDeploymentState.Failed; - } - return false; + _lastPositionedX = x; + _lastPositionedWidth = sz.Width; + Log.Debug($"Taskbar overlay positioned at x={x}, y={y}, width={sz.Width} (slot={AvailableSlotWidth}px, constrained={IsTaskbarSpaceConstrained})"); } - byte alpha = (byte)(_cfg.Overlay.Opacity * 255 / 100); - uint flags = NativeMethods.LWA_ALPHA; - int crKey = 0; - if (!KeyColor.IsEmpty) + int targetX = x; + int targetY = y; + IntPtr actualParent = NativeMethods.GetParent(overlayHwnd); + bool isActualChild = actualParent == _parentHwnd && _parentHwnd != IntPtr.Zero; + if (!isActualChild && _parentHwnd != IntPtr.Zero) { - flags |= NativeMethods.LWA_COLORKEY; - crKey = KeyColor.R | (KeyColor.G << 8) | (KeyColor.B << 16); + var pt = new NativeMethods.Point { X = x, Y = y }; + NativeMethods.ClientToScreen(_parentHwnd, ref pt); + targetX = pt.X; + targetY = pt.Y; } - NativeMethods.SetLayeredWindowAttributes( - overlayHwnd, crKey, alpha, flags); - return true; + IntPtr zOrder = isActualChild ? NativeMethods.HWND_TOP : NativeMethods.HWND_TOPMOST; + return (targetX, targetY, zOrder); } - private int ComputeBandX(NativeMethods.RECT parentRect, Size sz) + private void HandleSetWindowPosFailure(int targetX, int targetY) { - if (!_isWin11 && _taskBandHwnd != IntPtr.Zero && NativeMethods.IsWindow(_taskBandHwnd)) + int err = Marshal.GetLastWin32Error(); + if (err is 87 or 1400) { - NativeMethods.GetWindowRect(_taskBandHwnd, out var bandRect); - var bandPt = new NativeMethods.POINT { X = bandRect.Left, Y = bandRect.Top }; - NativeMethods.ScreenToClient(_parentHwnd, ref bandPt); - - if (_cfg.Overlay.Placement == "left") - { - return Math.Max(bandPt.X - sz.Width, 0); - } - - int bandEnd = bandPt.X + bandRect.Width; - int rightBound = _trayLeftEdge > 0 ? _trayLeftEdge : parentRect.Width; - return Math.Max(Math.Min(bandEnd, rightBound - sz.Width), 0); + Log.Debug($"SetWindowPos returned transient error {err} during band positioning at ({targetX}, {targetY}) (taskbar transition in progress)."); + State = OverlayDeploymentState.Recovering; + } + else + { + Log.Error($"SetWindowPos failed with Win32 error {err} during band positioning at ({targetX}, {targetY})."); + State = OverlayDeploymentState.Failed; } + } + private int CalculateRightSlotWidth(NativeMethods.Rect parentRect, int offset) + { int rightBoundary = GetRightSideBoundary(); int clientRightBoundary; - if (rightBoundary > 0) + if (rightBoundary != int.MinValue && rightBoundary != -1) { - var pt = new NativeMethods.POINT { X = rightBoundary, Y = 0 }; + var pt = new NativeMethods.Point { X = rightBoundary, Y = 0 }; NativeMethods.ScreenToClient(_parentHwnd, ref pt); clientRightBoundary = pt.X; } else { - clientRightBoundary = parentRect.Width - EstimateTrayWidth(); + clientRightBoundary = parentRect.Width - ResolveTrayWidth(GetTargetTrayWnd(), IsSecondaryTaskbar); } - - return !IsTaskbarCentered() - ? ComputeBandLeftAlignedX(sz, clientRightBoundary) - : ComputeBandCenteredX(sz, clientRightBoundary); - } - - private int ComputeBandLeftAlignedX(Size sz, int clientRightBoundary) - { int appRight = GetAppListRightEdge(); - var appPt = new NativeMethods.POINT { X = appRight, Y = 0 }; + var appPt = new NativeMethods.Point { X = appRight, Y = 0 }; NativeMethods.ScreenToClient(_parentHwnd, ref appPt); int clientAppRight = Math.Max(0, appPt.X); + return Math.Max(0, clientRightBoundary - clientAppRight - (2 * offset)); + } - int offset = _cfg.Overlay.PlacementOffset; - int availableWidth = Math.Max(0, clientRightBoundary - clientAppRight - (2 * offset)); - AvailableSlotWidth = availableWidth; - IsTaskbarSpaceConstrained = availableWidth > 0 && sz.Width > availableWidth; + private int CalculateLeftSlotWidth(int offset) + { + int leftEdge = _leftWidgetRightEdge != -1 ? _leftWidgetRightEdge : GetLeftWidgetRightEdge(); + int clientLeftEdge = 0; + if (leftEdge != -1) + { + var pt = new NativeMethods.Point { X = leftEdge, Y = 0 }; + NativeMethods.ScreenToClient(_parentHwnd, ref pt); + clientLeftEdge = Math.Max(0, pt.X); + } - int maxRight = Math.Max(clientAppRight, clientRightBoundary - sz.Width); - int x = _cfg.Overlay.Placement is "beside_apps" or "left" - ? clientAppRight + offset - : clientRightBoundary - sz.Width - offset; + int appLeft = GetAppListLeftEdge(); + var appPt = new NativeMethods.Point { X = appLeft, Y = 0 }; + NativeMethods.ScreenToClient(_parentHwnd, ref appPt); + int clientAppLeft = Math.Max(clientLeftEdge, appPt.X); - return Math.Clamp(x, clientAppRight, maxRight); + return Math.Max(0, clientAppLeft - clientLeftEdge - (2 * offset)); } - private int ComputeBandCenteredX(Size sz, int clientRightBoundary) + /// Computes the available width in pixels in the taskbar band for the current placement and taskbar geometry. + public int CalculateAvailableSlotWidth() { - int offset = _cfg.Overlay.PlacementOffset; - if (_cfg.Overlay.Placement == "left") + if (_parentHwnd == IntPtr.Zero || !NativeMethods.IsWindow(_parentHwnd) || !NativeMethods.GetClientRect(_parentHwnd, out var parentRect)) { - int leftEdge = _leftWidgetRightEdge > 0 ? _leftWidgetRightEdge : GetLeftWidgetRightEdge(); - int clientLeftEdge = 0; - if (leftEdge > 0) - { - var pt = new NativeMethods.POINT { X = leftEdge, Y = 0 }; - NativeMethods.ScreenToClient(_parentHwnd, ref pt); - clientLeftEdge = Math.Max(0, pt.X); - } - - int appLeft = GetAppListLeftEdge(); - var appPt = new NativeMethods.POINT { X = appLeft, Y = 0 }; - NativeMethods.ScreenToClient(_parentHwnd, ref appPt); - int clientAppLeft = Math.Max(clientLeftEdge, appPt.X); - - int availableWidth = Math.Max(0, clientAppLeft - clientLeftEdge - (2 * offset)); - AvailableSlotWidth = availableWidth; - IsTaskbarSpaceConstrained = availableWidth > 0 && sz.Width > availableWidth; + return AvailableSlotWidth > 0 ? AvailableSlotWidth : 0; + } - int preferredX = clientLeftEdge + offset; - if (preferredX < clientAppLeft) + int offset = _cfg.Overlay.PlacementOffset; + if (!_isWin11 && _taskBandHwnd != IntPtr.Zero && NativeMethods.IsWindow(_taskBandHwnd)) + { + NativeMethods.GetWindowRect(_taskBandHwnd, out var bandRect); + var bandPt = new NativeMethods.Point { X = bandRect.Left, Y = bandRect.Top }; + NativeMethods.ScreenToClient(_parentHwnd, ref bandPt); + if (_cfg.Overlay.Placement == "left") { - int maxX = Math.Max(clientLeftEdge, clientAppLeft - sz.Width - offset); - return Math.Clamp(preferredX, clientLeftEdge, maxX); + return Math.Max(0, bandPt.X - (2 * offset)); } - return preferredX; + int rightBound = FindRebarDeskBandRightBound(bandPt.X, parentRect.Width); + int appsRight = ResolveClientAppsRight(bandPt.X + bandRect.Width); + return Math.Max(0, rightBound - appsRight - (2 * offset)); } - int appRight = GetAppListRightEdge(); - var rightAppPt = new NativeMethods.POINT { X = appRight, Y = 0 }; - NativeMethods.ScreenToClient(_parentHwnd, ref rightAppPt); - int clientAppRight = Math.Max(0, rightAppPt.X); - - int availableRightWidth = Math.Max(0, clientRightBoundary - clientAppRight - (2 * offset)); - AvailableSlotWidth = availableRightWidth; - IsTaskbarSpaceConstrained = availableRightWidth > 0 && sz.Width > availableRightWidth; + if (IsTaskbarCentered() && _cfg.Overlay.Placement == "left") + { + return CalculateLeftSlotWidth(offset); + } - int preferredRightX = clientRightBoundary - sz.Width - offset; - int minRightX = clientAppRight + offset; - int maxRightX = Math.Max(minRightX, clientRightBoundary - sz.Width); - return Math.Clamp(preferredRightX, minRightX, maxRightX); + return CalculateRightSlotWidth(parentRect, offset); } - private bool PositionFloat(IntPtr overlayHwnd, Size sz) + private int FindRebarDeskBandRightBound(int bandPtX, int parentWidth) { - if (FailPositionFloatForTesting) - return false; - - if (_cfg.Overlay.FloatX >= 0 && _cfg.Overlay.FloatY >= 0) + int rightBound = parentWidth; + if (_trayLeftEdge != -1) { - return PositionCustomFloat(overlayHwnd, sz); + var trayPt = new NativeMethods.Point { X = _trayLeftEdge, Y = 0 }; + NativeMethods.ScreenToClient(_parentHwnd, ref trayPt); + rightBound = Math.Min(rightBound, Math.Max(trayPt.X, 0)); } - if (_taskbarRect.Width <= 0 || _taskbarRect.Height <= 0) + IntPtr rebarChild = IntPtr.Zero; + while ((rebarChild = SafeFindWindowEx(_parentHwnd, rebarChild, null, null)) != IntPtr.Zero) { - Log.Error($"Taskbar bounds are invalid ({_taskbarRect.Width}x{_taskbarRect.Height}); skipping overlay repositioning until taskbar geometry is resolved"); - State = OverlayDeploymentState.Failed; - return false; + if (rebarChild == _currentOverlayHwnd || rebarChild == _taskBandHwnd || !NativeMethods.IsWindowVisible(rebarChild)) continue; + if (IsAppOverlayWindow(rebarChild)) continue; + if (!NativeMethods.GetWindowRect(rebarChild, out var cr) || cr.Width <= 0 || cr.Height <= 0) continue; + + var pt = new NativeMethods.Point { X = cr.Left, Y = 0 }; + NativeMethods.ScreenToClient(_parentHwnd, ref pt); + if (pt.X > bandPtX && pt.X < parentWidth) + { + rightBound = Math.Min(rightBound, pt.X); + } } - return PositionTaskbarFloat(overlayHwnd, sz); + return rightBound; } - private bool PositionCustomFloat(IntPtr overlayHwnd, Size sz) + private int ResolveClientAppsRight(int fallbackX) { - LastComputedFloatX = _cfg.Overlay.FloatX; - LastComputedFloatY = _cfg.Overlay.FloatY; - if (overlayHwnd == IntPtr.Zero || !NativeMethods.IsWindow(overlayHwnd)) + int appRightScreen = GetAppListRightEdge(); + if (appRightScreen > 0 && _parentHwnd != IntPtr.Zero) { - return false; + var appPt = new NativeMethods.Point { X = appRightScreen, Y = 0 }; + NativeMethods.ScreenToClient(_parentHwnd, ref appPt); + return Math.Max(0, appPt.X); } - - var targetRect = new Rectangle(_cfg.Overlay.FloatX, _cfg.Overlay.FloatY, sz.Width, sz.Height); - return ApplyFloatWindowPos(overlayHwnd, targetRect, $"custom float positioning ({_cfg.Overlay.FloatX}, {_cfg.Overlay.FloatY})"); + return fallbackX; } - private bool PositionTaskbarFloat(IntPtr overlayHwnd, Size sz) + private int ComputeBandWin10X(NativeMethods.Rect parentRect, Size sz) { - bool horizontal = _taskbarEdge is NativeMethods.ABE_BOTTOM or NativeMethods.ABE_TOP; - int x = horizontal ? ComputeHorizontalTaskbarFloatX(sz.Width) : _taskbarRect.Left + 4; - int y = _taskbarRect.Top + (_taskbarRect.Height - sz.Height) / 2; + NativeMethods.GetWindowRect(_taskBandHwnd, out var bandRect); + var bandPt = new NativeMethods.Point { X = bandRect.Left, Y = bandRect.Top }; + NativeMethods.ScreenToClient(_parentHwnd, ref bandPt); - LastComputedFloatX = x; - LastComputedFloatY = y; + int offset = _cfg.Overlay.PlacementOffset; + int checkWidth = NaturalOverlayWidth > 0 ? NaturalOverlayWidth : sz.Width; - string floatLog = $"Positioned floating overlay ({sz.Width}x{sz.Height} at {x},{y}, offset {_cfg.Overlay.PlacementOffset}, placement '{_cfg.Overlay.Placement}')"; - if (floatLog != _lastPositionFloatLog) + if (_cfg.Overlay.Placement == "left") { - _lastPositionFloatLog = floatLog; - Log.Debug(floatLog); - } - - var newFloatRect = new Rectangle(x, y, sz.Width, sz.Height); - return ApplyFloatWindowPos(overlayHwnd, newFloatRect, $"floating positioning at ({x}, {y})"); - } + int availableLeft = Math.Max(0, bandPt.X - (2 * offset)); + AvailableSlotWidth = availableLeft; + IsTaskbarSpaceConstrained = bandPt.X > 0 && (availableLeft == 0 || checkWidth > availableLeft); - private int ComputeHorizontalTaskbarFloatX(int width) - { - int offset = _cfg.Overlay.PlacementOffset; - int x = (_isWin11 && !IsTaskbarCentered()) - ? ComputeLeftAlignedFloatX(width, offset) - : ComputeCenteredFloatX(width, offset); + int minLeftX = offset; + int maxLeftX = Math.Max(minLeftX, bandPt.X - sz.Width - offset); + return Math.Clamp(bandPt.X - sz.Width - offset, minLeftX, maxLeftX); + } - int minX = (_isWin11 && !IsTaskbarCentered()) ? GetAppListRightEdge() : _taskbarRect.Left; - int boundary = GetRightSideBoundary(); - int maxX = Math.Max(minX, (boundary > 0 ? boundary : _taskbarRect.Right) - width); + int rightBound = FindRebarDeskBandRightBound(bandPt.X, parentRect.Width); + int appsRight = ResolveClientAppsRight(bandPt.X + bandRect.Width); + int availableWidth = Math.Max(0, rightBound - appsRight - (2 * offset)); + AvailableSlotWidth = availableWidth; + IsTaskbarSpaceConstrained = rightBound > 0 && (availableWidth == 0 || checkWidth > availableWidth); - if (x < minX || x > maxX) + if (_cfg.Overlay.Placement == "beside_apps") { - Log.Warn($"Calculated floating X coordinate ({x}) for width {width} is out of taskbar horizontal range [{minX}, {maxX}]. Clamping to taskbar."); - x = Math.Clamp(x, minX, maxX); + int minX = appsRight + offset; + int maxX = Math.Max(minX, rightBound - sz.Width); + return Math.Clamp(minX, minX, maxX); } - return x; + // "right" (default on Windows 10) + int minRightX = appsRight + offset; + int maxRightX = Math.Max(minRightX, rightBound - sz.Width); + int preferredRightX = rightBound - sz.Width - offset; + return Math.Clamp(preferredRightX, minRightX, maxRightX); } - private int ComputeLeftAlignedFloatX(int width, int offset) + private int ResolveClientRightBoundary(NativeMethods.Rect parentRect) { - int appRight = GetAppListRightEdge(); int rightBoundary = GetRightSideBoundary(); - int limitRight = rightBoundary > 0 ? rightBoundary : _taskbarRect.Right; - int availableWidth = Math.Max(0, limitRight - appRight - (2 * offset)); - AvailableSlotWidth = availableWidth; - IsTaskbarSpaceConstrained = availableWidth > 0 && width > availableWidth; - - return _cfg.Overlay.Placement is "beside_apps" or "left" - ? ComputeLeftFloatX() - : ComputeRightFloatX(width); - } - - private int ComputeCenteredFloatX(int width, int offset) - { - if (_cfg.Overlay.Placement == "left") + if (rightBoundary != int.MinValue && rightBoundary != -1) { - return ComputeCenteredLeftFloatX(width, offset); - } - - if (_cfg.Overlay.Placement == "center") - { - return _taskbarRect.Left + (_taskbarRect.Width - width) / 2 + offset; + var pt = new NativeMethods.Point { X = rightBoundary, Y = 0 }; + NativeMethods.ScreenToClient(_parentHwnd, ref pt); + return pt.X; } - return ComputeCenteredRightFloatX(width, offset); + return parentRect.Width - ResolveTrayWidth(GetTargetTrayWnd(), IsSecondaryTaskbar); } - private int ComputeCenteredLeftFloatX(int width, int offset) + internal int ComputeBandX(NativeMethods.Rect parentRect, Size sz) { - int leftEdge = _leftWidgetRightEdge > 0 ? _leftWidgetRightEdge : GetLeftWidgetRightEdge(); - int defaultLeftBase = leftEdge > _taskbarRect.Left ? leftEdge : _taskbarRect.Left; - int appLeft = GetAppListLeftEdge(); - int availableWidth = Math.Max(0, appLeft - defaultLeftBase - (2 * offset)); - AvailableSlotWidth = availableWidth; - IsTaskbarSpaceConstrained = availableWidth > 0 && width > availableWidth; - - int x = ComputeLeftFloatX(); - if (x < appLeft) + if (!_isWin11 && _taskBandHwnd != IntPtr.Zero && NativeMethods.IsWindow(_taskBandHwnd)) { - int maxLeftFloatX = Math.Max(defaultLeftBase, appLeft - width - offset); - x = Math.Clamp(x, defaultLeftBase, maxLeftFloatX); + return ComputeBandWin10X(parentRect, sz); } - return x; + int clientRightBoundary = ResolveClientRightBoundary(parentRect); + return !IsTaskbarCentered() + ? ComputeBandLeftAlignedX(sz, clientRightBoundary) + : ComputeBandCenteredX(sz, clientRightBoundary); } - private int ComputeCenteredRightFloatX(int width, int offset) + private int ComputeBandLeftAlignedX(Size sz, int clientRightBoundary) { int appRight = GetAppListRightEdge(); - int rightBoundary = GetRightSideBoundary(); - int limitRight = rightBoundary > 0 ? rightBoundary : _taskbarRect.Right; - int availableWidth = Math.Max(0, limitRight - appRight - (2 * offset)); + var appPt = new NativeMethods.Point { X = appRight, Y = 0 }; + NativeMethods.ScreenToClient(_parentHwnd, ref appPt); + int clientAppRight = Math.Max(0, appPt.X); + + int offset = _cfg.Overlay.PlacementOffset; + int availableWidth = Math.Max(0, clientRightBoundary - clientAppRight - (2 * offset)); AvailableSlotWidth = availableWidth; - IsTaskbarSpaceConstrained = availableWidth > 0 && width > availableWidth; + int checkWidth = NaturalOverlayWidth > 0 ? NaturalOverlayWidth : sz.Width; + IsTaskbarSpaceConstrained = clientRightBoundary > 0 && (availableWidth == 0 || checkWidth > availableWidth); + + int minX = clientAppRight + offset; + int maxX = Math.Max(minX, clientRightBoundary - sz.Width); + int preferredX = _cfg.Overlay.Placement is "beside_apps" or "left" + ? minX + : clientRightBoundary - sz.Width - offset; - return ComputeRightFloatX(width); + return Math.Clamp(preferredX, minX, maxX); } - private bool ApplyFloatWindowPos(IntPtr overlayHwnd, Rectangle targetRect, string errorContext) + private int ComputeBandCenteredX(Size sz, int clientRightBoundary) { - if (_lastFloatRect == targetRect) + int offset = _cfg.Overlay.PlacementOffset; + int checkWidth = NaturalOverlayWidth > 0 ? NaturalOverlayWidth : sz.Width; + if (_cfg.Overlay.Placement == "left") { - return true; - } + int leftEdge = _leftWidgetRightEdge != -1 ? _leftWidgetRightEdge : GetLeftWidgetRightEdge(); + int clientLeftEdge = 0; + if (leftEdge != -1) + { + var pt = new NativeMethods.Point { X = leftEdge, Y = 0 }; + NativeMethods.ScreenToClient(_parentHwnd, ref pt); + clientLeftEdge = Math.Max(0, pt.X); + } - uint flags = NativeMethods.SWP_NOACTIVATE | NativeMethods.SWP_SHOWWINDOW; - if (_lastFloatRect.IsEmpty) - { - flags |= NativeMethods.SWP_FRAMECHANGED; - } + int appLeft = GetAppListLeftEdge(); + var appPt = new NativeMethods.Point { X = appLeft, Y = 0 }; + NativeMethods.ScreenToClient(_parentHwnd, ref appPt); + int clientAppLeft = Math.Max(clientLeftEdge, appPt.X); - ApplyLayeredAttributes(overlayHwnd); - bool success = NativeMethods.SetWindowPos( - overlayHwnd, NativeMethods.HWND_TOPMOST, - targetRect.X, targetRect.Y, targetRect.Width, targetRect.Height, - flags); - if (!success) - { - int err = Marshal.GetLastWin32Error(); - Log.Error($"SetWindowPos failed with Win32 error {err} during {errorContext}."); - State = OverlayDeploymentState.Failed; - return false; - } + int availableWidth = Math.Max(0, clientAppLeft - clientLeftEdge - (2 * offset)); + AvailableSlotWidth = availableWidth; + IsTaskbarSpaceConstrained = clientAppLeft > 0 && (availableWidth == 0 || checkWidth > availableWidth); - _lastFloatRect = targetRect; - return true; - } + int preferredX = clientLeftEdge + offset; + if (preferredX < clientAppLeft) + { + int maxX = Math.Max(clientLeftEdge, clientAppLeft - sz.Width - offset); + return Math.Clamp(preferredX, clientLeftEdge, maxX); + } - private int ComputeLeftFloatX() - { - if (_isWin11 && !IsTaskbarCentered()) - { - int appRight = GetAppListRightEdge(); - int leftBase = appRight > _taskbarRect.Left - ? appRight - : _taskbarRect.Left + WindowHelpers.Scale(360, 1f); - return leftBase + _cfg.Overlay.PlacementOffset; + return preferredX; } - int leftEdge = _leftWidgetRightEdge > 0 ? _leftWidgetRightEdge : GetLeftWidgetRightEdge(); - int defaultLeftBase = leftEdge > _taskbarRect.Left - ? leftEdge - : _taskbarRect.Left; + int appRight = GetAppListRightEdge(); + var rightAppPt = new NativeMethods.Point { X = appRight, Y = 0 }; + NativeMethods.ScreenToClient(_parentHwnd, ref rightAppPt); + int clientAppRight = Math.Max(0, rightAppPt.X); + + int availableRightWidth = Math.Max(0, clientRightBoundary - clientAppRight - (2 * offset)); + AvailableSlotWidth = availableRightWidth; + IsTaskbarSpaceConstrained = clientRightBoundary > 0 && (availableRightWidth == 0 || checkWidth > availableRightWidth); - return defaultLeftBase + _cfg.Overlay.PlacementOffset; + int preferredRightX = clientRightBoundary - sz.Width - offset; + int minRightX = clientAppRight + offset; + int maxRightX = Math.Max(minRightX, clientRightBoundary - sz.Width); + return Math.Clamp(preferredRightX, minRightX, maxRightX); } - private int ComputeRightFloatX(int widgetWidth) + internal static int ResolveTrayWidth(IntPtr currentTray, bool isSecondary) { - int rightBoundary = GetRightSideBoundary(); - if (rightBoundary > 0) + if (isSecondary || IsSecondaryTrayWindow(currentTray)) { - int x = rightBoundary - widgetWidth - _cfg.Overlay.PlacementOffset; - return Math.Max(x, _taskbarRect.Left); + uint dpi = currentTray != IntPtr.Zero ? NativeMethods.GetDpiForWindow(currentTray) : 96; + float scale = dpi > 0 ? dpi / 96f : 1f; + return WindowHelpers.Scale(80, scale); } - int trayWidth = EstimateTrayWidth(); - return _taskbarRect.Right - widgetWidth - trayWidth - _cfg.Overlay.PlacementOffset; - } - - private static int EstimateTrayWidth() - { int iconW = NativeMethods.GetSystemMetrics(NativeMethods.SM_CXSMICON); - int dpiScaledBase = WindowHelpers.Scale(360, 1f); - return Math.Max(iconW * 11 + 120, dpiScaledBase); + if (iconW <= 0) iconW = 16; + int dpiScaledBase = WindowHelpers.Scale(200, 1f); + return Math.Max(iconW * 6 + 90, dpiScaledBase); } - private static void RestoreLayeredStyles(IntPtr overlayHwnd) + internal static int EstimateTrayWidth() { - NativeMethods.SetParent(overlayHwnd, IntPtr.Zero); - - int ex = NativeMethods.GetWindowLong(overlayHwnd, NativeMethods.GWL_EXSTYLE); - ex |= NativeMethods.WS_EX_LAYERED | NativeMethods.WS_EX_NOACTIVATE - | NativeMethods.WS_EX_TOOLWINDOW; - NativeMethods.SetWindowLong(overlayHwnd, NativeMethods.GWL_EXSTYLE, ex); - - int style = NativeMethods.GetWindowLong(overlayHwnd, NativeMethods.GWL_STYLE); - style &= ~NativeMethods.WS_CHILD; - style |= NativeMethods.WS_POPUP; - NativeMethods.SetWindowLong(overlayHwnd, NativeMethods.GWL_STYLE, style); - - IntPtr tray = FindExplorerTrayWnd(); - if (tray != IntPtr.Zero) - { - NativeMethods.SetWindowLongPtr(overlayHwnd, NativeMethods.GWLP_HWNDPARENT, tray); - } + IntPtr currentTray = CurrentTargetTrayWnd.HasValue && CurrentTargetTrayWnd.Value != IntPtr.Zero + ? CurrentTargetTrayWnd.Value + : FindExplorerTrayWnd(); + return ResolveTrayWidth(currentTray, IsSecondaryTrayWindow(currentTray)); } } diff --git a/src/LocalTelemetry.App/Win32/WindowHelpers.cs b/src/LocalTelemetry.App/Win32/WindowHelpers.cs index 6da34e8..6a97ca9 100644 --- a/src/LocalTelemetry.App/Win32/WindowHelpers.cs +++ b/src/LocalTelemetry.App/Win32/WindowHelpers.cs @@ -108,7 +108,7 @@ private static void CreateStartupTask() action.WorkingDirectory = System.IO.Path.GetDirectoryName(exe) ?? string.Empty; root.RegisterTaskDefinition(TaskName, task, 6, string.Empty, string.Empty, 3, string.Empty); - Log.Debug($"Created startup scheduled task '{TaskName}' -> {exe} --minimized"); + Log.Info($"Created startup scheduled task '{TaskName}' -> {exe} --minimized"); } private static void RemoveStartupTask() @@ -132,11 +132,11 @@ private static void RemoveStartupTask() if (!exists) return; root.DeleteTask(TaskName, 0); - Log.Debug($"Removed startup scheduled task '{TaskName}'"); + Log.Info($"Removed startup scheduled task '{TaskName}'"); } catch (Exception ex) when (ex is COMException or System.IO.FileNotFoundException) { - Log.Debug($"Startup scheduled task '{TaskName}' delete failed ({ex.Message.TrimEnd('\r', '\n')})"); + Log.Info($"Startup scheduled task '{TaskName}' delete skipped ({ex.Message.TrimEnd('\r', '\n')})"); } try @@ -162,37 +162,17 @@ public static bool IsStartupEnabled() { try { - if (StartupQueryExitCode is not null) + if (IsScheduledTaskStartupEnabled()) { - if (StartupQueryExitCode() == 0) return true; - } - else - { - var psi = new System.Diagnostics.ProcessStartInfo - { - FileName = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "schtasks.exe"), - Arguments = $"/Query /TN \"{TaskName}\"", - UseShellExecute = false, - CreateNoWindow = true - }; - using var p = System.Diagnostics.Process.Start(psi); - p?.WaitForExit(2000); - if (p?.ExitCode == 0) return true; + return true; } - if (RunKeyQuery is not null) + if (IsRegistryStartupEnabled()) { - if (RunKeyQuery(AppName)) return true; - } - else - { - using RegistryKey? hkcuKey = Registry.CurrentUser.OpenSubKey(RunKey); - if (hkcuKey?.GetValue(AppName) is not null) return true; - - using RegistryKey? hklmKey = Registry.LocalMachine.OpenSubKey(RunKey); - if (hklmKey?.GetValue(AppName) is not null) return true; + return true; } + Log.Info($"Startup scheduled task '{TaskName}' does not exist or is disabled"); return false; } catch (Exception ex) @@ -202,6 +182,77 @@ public static bool IsStartupEnabled() } } + private static bool IsScheduledTaskStartupEnabled() + { + if (StartupQueryExitCode is not null) + { + return StartupQueryExitCode() == 0; + } + + try + { + dynamic scheduler = ConnectScheduler(); + dynamic root = scheduler.GetFolder("\\"); + dynamic task = root.GetTask(TaskName); + if (task is not null) + { + bool isEnabled = task.Enabled; + Log.Info($"Startup scheduled task '{TaskName}' found via Task Scheduler COM (enabled={isEnabled})"); + return isEnabled; + } + } + catch (Exception comEx) + { + Log.Debug(comEx, "Task Scheduler COM query failed, trying schtasks.exe fallback"); + return CheckSchtasksFallback(); + } + + return false; + } + + private static bool CheckSchtasksFallback() + { + var psi = new System.Diagnostics.ProcessStartInfo + { + FileName = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "schtasks.exe"), + Arguments = $"/Query /TN \"{TaskName}\"", + UseShellExecute = false, + CreateNoWindow = true + }; + using var p = System.Diagnostics.Process.Start(psi); + p?.WaitForExit(2000); + if (p?.ExitCode == 0) + { + Log.Info($"Startup scheduled task '{TaskName}' found via schtasks.exe fallback"); + return true; + } + return false; + } + + private static bool IsRegistryStartupEnabled() + { + if (RunKeyQuery is not null) + { + return RunKeyQuery(AppName); + } + + using RegistryKey? hkcuKey = Registry.CurrentUser.OpenSubKey(RunKey); + if (hkcuKey?.GetValue(AppName) is not null) + { + Log.Info("Found startup entry in HKCU Run registry key"); + return true; + } + + using RegistryKey? hklmKey = Registry.LocalMachine.OpenSubKey(RunKey); + if (hklmKey?.GetValue(AppName) is not null) + { + Log.Info("Found startup entry in HKLM Run registry key"); + return true; + } + + return false; + } + // color helpers /// /// Parses a CSS hex color string (#RRGGBB or RRGGBB). diff --git a/src/LocalTelemetry.Core/Config/AppSettings.cs b/src/LocalTelemetry.Core/Config/AppSettings.cs index 74be36e..e2ffcca 100644 --- a/src/LocalTelemetry.Core/Config/AppSettings.cs +++ b/src/LocalTelemetry.Core/Config/AppSettings.cs @@ -1,3 +1,4 @@ +using System.Reflection; using System.Text.Json; using System.Text.Json.Serialization; using LocalTelemetry.Core.Diagnostics; @@ -48,7 +49,7 @@ public static void InitPaths(string exeDir) catch (Exception ex) { LastDirectoryError = ex; - System.Diagnostics.Trace.WriteLine($"[AppSettings.InitPaths] Failed to create data directory '{dataDir}': {ex.Message}"); + System.Diagnostics.Trace.WriteLine($"Failed to create data directory '{dataDir}': {ex.Message}"); dataDir = exeDir; } } @@ -58,7 +59,7 @@ public static void InitPaths(string exeDir) catch (Exception ex) { LastDirectoryError = ex; - System.Diagnostics.Trace.WriteLine($"[AppSettings.InitPaths] Failed to create logs directory '{logsDir}': {ex.Message}"); + System.Diagnostics.Trace.WriteLine($"Failed to create logs directory '{logsDir}': {ex.Message}"); logsDir = dataDir; } LogsDir = logsDir; @@ -106,14 +107,18 @@ public static AppSettings Load() private static void MigrateConfig(AppSettings cfg) { - // Ensure MetricColors has all known metric entries (from older configs with fewer keys) + // Ensure MetricColors has all known metric entries var mc = cfg.Overlay.MetricColors; var allDefaults = BrandColorDefaults.BuildDefaultMetricColors(); + cfg.Overlay.DefaultMetricColors = allDefaults; bool dirty = false; - foreach (var kvp in allDefaults.Where(kvp => !mc.ContainsKey(kvp.Key))) + foreach (var (k, v) in allDefaults) { - mc[kvp.Key] = kvp.Value; - dirty = true; + if (!mc.ContainsKey(k)) + { + mc[k] = v; + dirty = true; + } } if (dirty) { @@ -124,9 +129,9 @@ private static void MigrateConfig(AppSettings cfg) // Ensure GroupColors has all known group entries (from configs saved before group colors existed) var gc = cfg.Overlay.GroupColors; bool groupDirty = false; - foreach (var kvp in BrandColorDefaults.BuildDefaultGroupColors(allDefaults).Where(kvp => !gc.ContainsKey(kvp.Key))) + foreach (var (groupKey, groupColor) in BrandColorDefaults.BuildDefaultGroupColors(allDefaults).Where(kvp => !gc.ContainsKey(kvp.Key))) { - gc[kvp.Key] = kvp.Value; + gc[groupKey] = groupColor; groupDirty = true; } if (groupDirty) @@ -134,6 +139,19 @@ private static void MigrateConfig(AppSettings cfg) cfg.Save(); Log.Debug($"Configuration migration completed: populated {gc.Count} group color entries"); } + if (cfg.Monitoring.PollIntervalMs < 1000) + { + cfg.Monitoring.PollIntervalMs = 1000; + cfg.Save(); + Log.Debug("Configuration migration: clamped polling interval to 1000ms minimum"); + } + // unless the user explicitly configured their preference in settings. + if (UpdateConfig.DefaultIncludePrereleases && !cfg.Updates.UserExplicitlySetIncludePrereleases && !cfg.Updates.IncludePrereleases) + { + cfg.Updates.IncludePrereleases = true; + cfg.Save(); + Log.Debug("Configuration migration: enabled pre-release updates by default for pre-release build"); + } } /// Serializes this instance to as JSON. @@ -154,6 +172,24 @@ public void Save() catch (Exception ex) { Log.Error(ex, "Failed to save configuration settings"); } } + /// Copies configuration values from another instance. + /// The source settings to copy from. + public void CopyFrom(AppSettings other) + { + RunAtStartup = other.RunAtStartup; + StartMinimized = other.StartMinimized; + MinimizeToTrayOnClose = other.MinimizeToTrayOnClose; + ShowSystemTrayIcon = other.ShowSystemTrayIcon; + EnableFileLogging = other.EnableFileLogging; + SystemLogLevel = other.SystemLogLevel; + WindowTheme = other.WindowTheme; + Monitoring = other.Monitoring; + Overlay = other.Overlay; + Alerts = other.Alerts; + NetUsage = other.NetUsage; + Updates = other.Updates; + } + /// Whether the app is registered to run automatically at user logon. public bool RunAtStartup { get; set; } = false; /// Whether the main window starts minimized to the tray. @@ -192,7 +228,7 @@ public void Save() /// Hardware monitoring poll configuration. public sealed class MonitoringConfig { - /// Polling interval in milliseconds (minimum 100). + /// Polling interval in milliseconds (minimum 1000). public int PollIntervalMs { get; set; } = 1000; /// Whether CPU usage/frequency monitoring is enabled. public bool EnableCpu { get; set; } = true; @@ -240,14 +276,14 @@ public sealed class OverlayConfig { /// Whether the overlay is visible on the taskbar. public bool Visible { get; set; } = false; + /// Display targeting mode: "primary", "all", "secondary", or "custom". + public string DisplayMode { get; set; } = "primary"; + /// List of enabled display keys when DisplayMode is "custom" (e.g. "primary", "display_2", "display_3"). + public List EnabledDisplays { get; set; } = ["primary"]; /// Taskbar placement: "left", "center" or "right". public string Placement { get; set; } = "left"; /// Horizontal offset in pixels from the chosen placement. public int PlacementOffset { get; set; } = 0; - /// Saved drag X for Approach-B float (-1 = auto). - public int FloatX { get; set; } = -1; - /// Saved drag Y for Approach-B float (-1 = auto). - public int FloatY { get; set; } = -1; /// Action on double-click: "none", "taskmanager", "settings". public string DoubleClickAction { get; set; } = "settings"; /// Overlay opacity percentage (0-100). @@ -265,38 +301,20 @@ public sealed class OverlayConfig /// Background color as a hex string. public string BgColor { get; set; } = "#1c1b19"; - private const string DefaultCyanColor = "#00E5FF"; - private const string DefaultSkyBlueColor = "#88CCFF"; + internal const string DefaultCyanColor = "#00E5FF"; + internal const string DefaultSkyBlueColor = "#88CCFF"; /// Per-metric value colors for the widget (overrides ValueColor). - public Dictionary MetricColors { get; set; } = new() - { - [Metrics.CpuPct] = DefaultCyanColor, - [Metrics.CpuTemp] = DefaultCyanColor, - [Metrics.CpuFreq] = DefaultCyanColor, - [Metrics.CpuPower] = DefaultCyanColor, - [Metrics.RamPct] = "#A78BFA", - [Metrics.RamUsed] = "#A78BFA", - [Metrics.GpuPct] = DefaultSkyBlueColor, - [Metrics.GpuTemp] = DefaultSkyBlueColor, - [Metrics.GpuVram] = DefaultSkyBlueColor, - [Metrics.GpuFreq] = DefaultSkyBlueColor, - [Metrics.GpuPower] = DefaultSkyBlueColor, - [Metrics.NetDown] = "#38BDF8", - [Metrics.NetUp] = "#4ADE80", - [Metrics.NetTotal] = "#FBBF24", - [Metrics.BatteryPct] = "#80E080", - [Metrics.BatteryRate] = "#80E080", - }; + public Dictionary MetricColors { get; set; } = BrandColorDefaults.BuildDefaultMetricColors(); /// /// Per-group colors shown by the Appearance page group pickers ("All CPU", "All GPU", ...). /// Keys: cpu, gpu, ram, network, battery, disk. - /// Defaults to the detected vendor-brand colors (see ApplyVendorColors). + /// Defaults are hardware-aware (brand colors where detectable, fallback to theme defaults). /// Independent of : changing a group color stamps all metrics in the /// group, but changing a single metric color does not affect the group color. /// - public Dictionary GroupColors { get; set; } = []; + public Dictionary GroupColors { get; set; } = BrandColorDefaults.BuildDefaultGroupColors(); /// Hardware-detected default colors (never saved, rebuilt on each launch). [JsonIgnore] @@ -311,8 +329,17 @@ public sealed class OverlayConfig /// Group keys whose colors were customized by the user (skip in ApplyVendorColors). public HashSet UserCustomizedGroupColors { get; set; } = []; - /// Combined metric ID list (even indices = top row, odd indices = bottom row). - public List Row1 { get; set; } = [Metrics.CpuPct, Metrics.CpuTemp, Metrics.GpuPct, Metrics.GpuTemp, Metrics.GpuVram, Metrics.NetTotal, Metrics.RamPct, Metrics.RamUsed, Metrics.NetDown, Metrics.NetUp]; + /// Active layout preset name ("default", "gaming", "compact", "micro", "thermals", "workstation", "network", "full", or "custom"). + public string LayoutPreset { get; set; } = "default"; + + /// Column list where each column contains 1 or 2 metric IDs (top and optional bottom row). + public List> Columns { get; set; } = [ + [Metrics.CpuPct, Metrics.CpuTemp], + [Metrics.GpuPct, Metrics.GpuTemp], + [Metrics.GpuVram, Metrics.NetTotal], + [Metrics.RamPct, Metrics.RamUsed], + [Metrics.NetDown, Metrics.NetUp] + ]; } // Alert Config @@ -327,6 +354,8 @@ public sealed class AlertConfig public bool AlertCpuTemp { get; set; } /// Alert when GPU temperature exceeds . public bool AlertGpuTemp { get; set; } + /// Alert when any disk temperature exceeds . + public bool AlertDiskTemp { get; set; } /// Alert when CPU usage exceeds . public bool AlertCpuUsage { get; set; } /// Alert when RAM usage exceeds . @@ -355,6 +384,8 @@ public sealed class AlertConfig public float CpuTempMaxC { get; set; } = 90f; /// GPU temperature threshold in Celsius. public float GpuTempMaxC { get; set; } = 85f; + /// Disk temperature threshold in Celsius. + public float DiskTempMaxC { get; set; } = 70f; /// CPU usage threshold in percent. public float CpuUsageMaxPct { get; set; } = 95f; /// RAM usage threshold in percent. @@ -383,6 +414,8 @@ public sealed class AlertConfig public bool ShowToastNotif { get; set; } = true; /// Whether to flash the overlay background on alert. public bool FlashOverlay { get; set; } = true; + /// Consecutive seconds a metric must continuously breach threshold before triggering alerts. + public int SustainedSecs { get; set; } = 3; /// Minimum seconds between repeated alerts for the same threshold. public int CooldownSecs { get; set; } = 60; /// When true, alerts fire only once per app session (cooldown is ignored). @@ -401,11 +434,42 @@ public sealed class NetUsageConfig /// Update checking configuration. public sealed class UpdateConfig { + private bool? _includePrereleases; + /// Update check frequency: "weekly", "monthly", or "manual". Default is "manual" for new installs. public string CheckFrequency { get; set; } = "manual"; /// Whether to include pre-release and Release Candidate (RC) builds when checking for updates. - public bool IncludePrereleases { get; set; } = false; + public bool IncludePrereleases + { + get => _includePrereleases ?? DefaultIncludePrereleases; + set => _includePrereleases = value; + } + + /// Whether the user has explicitly changed the pre-release setting in the UI. + public bool UserExplicitlySetIncludePrereleases { get; set; } + + /// Default value for IncludePrereleases based on whether the running version is a pre-release build. + public static bool DefaultIncludePrereleases { get; set; } = DetectPrereleaseBuild(); + + private static bool DetectPrereleaseBuild() + { + try + { + var asm = System.Reflection.Assembly.GetEntryAssembly() ?? typeof(AppSettings).Assembly; + var infoAttr = asm.GetCustomAttribute(); + string ver = infoAttr?.InformationalVersion ?? asm.GetName().Version?.ToString() ?? string.Empty; + int plusIdx = ver.IndexOf('+'); + if (plusIdx > 0) + ver = ver[..plusIdx]; + return ver.Contains('-'); + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to parse assembly product version for pre-release check"); + return false; + } + } /// UTC timestamp of the last update check. public DateTime LastCheckUtc { get; set; } = DateTime.MinValue; diff --git a/src/LocalTelemetry.Core/Diagnostics/Log.cs b/src/LocalTelemetry.Core/Diagnostics/Log.cs index f7813c2..c1d8db6 100644 --- a/src/LocalTelemetry.Core/Diagnostics/Log.cs +++ b/src/LocalTelemetry.Core/Diagnostics/Log.cs @@ -11,7 +11,8 @@ namespace LocalTelemetry.Core.Diagnostics; /// public static class Log { - private static readonly object _lock = new(); + private static readonly Lock _lock = new(); + private static readonly Mutex? _crossProcessMutex = CreateCrossProcessMutex(); private static StreamWriter? _sysWriter; private static StreamWriter? _metricWriter; private static string? _systemLogPath; @@ -22,6 +23,67 @@ public static class Log private static bool _sessionEnded; private static readonly System.Collections.Concurrent.ConcurrentDictionary _loggedMessages = new(); + private static Mutex? CreateCrossProcessMutex() + { + try + { + string name = OperatingSystem.IsWindows() + ? @"Local\LocalTelemetry_SystemLog_Mutex" + : "LocalTelemetry_SystemLog_Mutex"; + return new Mutex(false, name); + } + catch (Exception ex) + { + System.Diagnostics.Debug.WriteLine($"[Log] Failed to create cross-process mutex: {ex}"); + return null; + } + } + + private static void WriteLineAtomic(StreamWriter writer, string text) + { + try + { + lock (_lock) + { + bool hasMutex = false; + if (_crossProcessMutex is not null) + { + try + { + hasMutex = _crossProcessMutex.WaitOne(500); + } + catch (AbandonedMutexException) + { + hasMutex = true; + } + } + + try + { + if (writer.BaseStream.CanSeek) + { + writer.Flush(); + writer.BaseStream.Seek(0, SeekOrigin.End); + } + writer.WriteLine(text); + writer.Flush(); + } + finally + { + if (hasMutex) + { + _crossProcessMutex!.ReleaseMutex(); + } + } + } + } + catch (Exception ex) + { + LastWriteError = ex; + System.Diagnostics.Debug.WriteLine($"[Log.WriteLineAtomic] Write failure: {ex}"); + } + } + /// Resets the session deduplication cache. Primarily used for unit testing. public static void ResetDeduplication() => _loggedMessages.Clear(); @@ -57,13 +119,34 @@ public static void Init(string systemLogPath, string metricsLogPath, bool enable _sessionEnded = false; _loggedMessages.Clear(); - RotateSystemLog(systemLogPath); - try { _sysWriter = new StreamWriter(systemLogPath, append: true) { AutoFlush = true }; } - catch (Exception ex) + bool hasMutex = false; + if (_crossProcessMutex is not null) + { + try { hasMutex = _crossProcessMutex.WaitOne(1000); } + catch (AbandonedMutexException) { hasMutex = true; } + } + + try + { + RotateSystemLog(systemLogPath); + try + { + var fs = new FileStream(systemLogPath, FileMode.Append, FileAccess.Write, FileShare.ReadWrite); + _sysWriter = new StreamWriter(fs) { AutoFlush = true }; + } + catch (Exception ex) + { + LastInitError = ex; + System.Diagnostics.Debug.WriteLine($"[Log.Init] Failed to open system log '{systemLogPath}': {ex}"); + _sysWriter = null; + } + } + finally { - LastInitError = ex; - System.Diagnostics.Debug.WriteLine($"[Log.Init] Failed to open system log '{systemLogPath}': {ex}"); - _sysWriter = null; + if (hasMutex) + { + _crossProcessMutex!.ReleaseMutex(); + } } } } @@ -126,7 +209,11 @@ private static void RotateSystemLog(string systemLogPath) private static void OpenMetricsWriter() { - try { _metricWriter = new StreamWriter(_metricsPath!, append: true) { AutoFlush = true }; } + try + { + var fs = new FileStream(_metricsPath!, FileMode.Append, FileAccess.Write, FileShare.ReadWrite); + _metricWriter = new StreamWriter(fs) { AutoFlush = true }; + } catch (Exception ex) { LastMetricError = ex; @@ -326,7 +413,7 @@ private static void Write(StreamWriter? writer, Level level, string message, str try { - targetWriter.WriteLine(line); + WriteLineAtomic(targetWriter, line); // If this is the system writer, check if active file size crossed MaxSystemLogBytes if (!isMetrics && _systemLogPath is not null && MaxSystemLogBytes > 0) @@ -355,7 +442,7 @@ private static void CheckMidnightRollover() try { string dateStr = today.ToString("dd-MM-yyyy"); - _sysWriter.WriteLine($"---------------------------------- {dateStr} ----------------------------------"); + WriteLineAtomic(_sysWriter, $"---------------------------------- {dateStr} ----------------------------------"); } catch (Exception ex) { @@ -395,28 +482,68 @@ private static void CheckLiveSystemLogRoll() if (_sysWriter is null || _systemLogPath is null) return; try { - long length = _sysWriter.BaseStream.Length; - if (length >= MaxSystemLogBytes) + if (_sysWriter.BaseStream.Length >= MaxSystemLogBytes) { - _sysWriter.Flush(); - _sysWriter.Dispose(); - _sysWriter = null; + PerformLiveSystemLogRoll(_systemLogPath); + } + } + catch (Exception ex) + { + LastRotationError = ex; + System.Diagnostics.Debug.WriteLine($"[Log.CheckLiveSystemLogRoll] Live system log roll failed: {ex}"); + } + } - RotateSystemLog(_systemLogPath); + private static void PerformLiveSystemLogRoll(string path) + { + try + { + lock (_lock) + { + bool hasMutex = false; + if (_crossProcessMutex is not null) + { + try { hasMutex = _crossProcessMutex.WaitOne(1000); } + catch (AbandonedMutexException) { hasMutex = true; } + } - try { _sysWriter = new StreamWriter(_systemLogPath, append: true) { AutoFlush = true }; } - catch (Exception ex) + try { - LastInitError = ex; - System.Diagnostics.Debug.WriteLine($"[Log.CheckLiveSystemLogRoll] Failed to re-open system log writer: {ex}"); + _sysWriter?.Flush(); + _sysWriter?.Dispose(); _sysWriter = null; + + RotateSystemLog(path); + ReopenSystemLogWriter(path); + } + finally + { + if (hasMutex) + { + _crossProcessMutex!.ReleaseMutex(); + } } } } catch (Exception ex) { LastRotationError = ex; - System.Diagnostics.Debug.WriteLine($"[Log.CheckLiveSystemLogRoll] Live system log roll failed: {ex}"); + System.Diagnostics.Debug.WriteLine($"[Log.PerformLiveSystemLogRoll] Failed to rotate system log: {ex}"); + } + } + + private static void ReopenSystemLogWriter(string path) + { + try + { + var fs = new FileStream(path, FileMode.Append, FileAccess.Write, FileShare.ReadWrite); + _sysWriter = new StreamWriter(fs) { AutoFlush = true }; + } + catch (Exception ex) + { + LastInitError = ex; + System.Diagnostics.Debug.WriteLine($"[Log.CheckLiveSystemLogRoll] Failed to re-open system log writer: {ex}"); + _sysWriter = null; } } @@ -429,16 +556,10 @@ public static void SessionStart(string version, bool isAdmin, string configPath, try { string timestamp = DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss.fff tt"); - string osDesc = !string.IsNullOrWhiteSpace(osName) - ? osName - : System.Runtime.InteropServices.RuntimeInformation.OSDescription; string divider = new('-', 80); - _sysWriter.WriteLine(divider); - _sysWriter.WriteLine($" LocalTelemetry v{version} Started | Session: {timestamp}"); - _sysWriter.WriteLine($" OS: {osDesc} | Admin: {(isAdmin ? "Yes" : "No")} | Mode: {mode}"); - _sysWriter.WriteLine($" Config: {configPath}"); - _sysWriter.WriteLine(divider); + WriteLineAtomic(_sysWriter, divider); + WriteLineAtomic(_sysWriter, $"LocalTelemetry v{version} Started | Session: {timestamp} | Admin: {(isAdmin ? "Yes" : "No")} | Mode: {mode}"); } catch (Exception ex) { @@ -461,13 +582,7 @@ public static void SessionEnd(string reason, TimeSpan uptime) string uptimeStr = uptime.TotalHours >= 1 ? $"{(int)uptime.TotalHours}h {uptime.Minutes}m {uptime.Seconds}s" : $"{uptime.Minutes}m {uptime.Seconds}s"; - - string divider = new('-', 80); - - _sysWriter.WriteLine(divider); - _sysWriter.WriteLine($" LocalTelemetry Terminated | Reason: {reason}"); - _sysWriter.WriteLine($" Timestamp: {timestamp} | Session Uptime: {uptimeStr}"); - _sysWriter.WriteLine(divider); + WriteLineAtomic(_sysWriter, $"LocalTelemetry Terminated | Reason: {reason} | Timestamp: {timestamp} | Session Uptime: {uptimeStr}"); } catch (Exception ex) { diff --git a/src/LocalTelemetry.Core/Hardware/AmdGpuMonitor.cs b/src/LocalTelemetry.Core/Hardware/AmdGpuMonitor.cs index 2a55032..250100b 100644 --- a/src/LocalTelemetry.Core/Hardware/AmdGpuMonitor.cs +++ b/src/LocalTelemetry.Core/Hardware/AmdGpuMonitor.cs @@ -216,9 +216,22 @@ public int GetAdapterInfo(out int adapterIndex, out string adapterName) { int count = 0; var info = new AdlAdapterInfo[16]; + for (int j = 0; j < info.Length; j++) + { + info[j].iSize = Marshal.SizeOf(); + } int ret = AdapterInfoFunc(info, ref count); if (ret == 0 && count > 0) { + for (int j = 0; j < count && j < info.Length; j++) + { + if (info[j].iPresent > 0 && !string.IsNullOrEmpty(info[j].strAdapterName)) + { + adapterIndex = info[j].iAdapterIndex; + adapterName = info[j].strAdapterName ?? string.Empty; + return 0; + } + } adapterIndex = info[0].iAdapterIndex; adapterName = info[0].strAdapterName ?? string.Empty; return 0; @@ -345,9 +358,27 @@ public int GetPowerLimit(int adapterIndex, out int maxMilliW, out int defaultMil [StructLayout(LayoutKind.Sequential)] internal struct AdlAdapterInfo { + public int iSize; public int iAdapterIndex; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + public string? strUDID; + public int iBusNumber; + public int iDeviceNumber; + public int iFunctionNumber; + public int iVendorID; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string? strAdapterName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + public string? strDisplayName; + public int iPresent; + public int iExist; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + public string? strDriverPath; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + public string? strDriverPathExt; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + public string? strPNPString; + public int iOSDisplayIndex; } [StructLayout(LayoutKind.Sequential)] diff --git a/src/LocalTelemetry.Core/Hardware/DiskQuery.cs b/src/LocalTelemetry.Core/Hardware/DiskQuery.cs index c4d138b..415d9fe 100644 --- a/src/LocalTelemetry.Core/Hardware/DiskQuery.cs +++ b/src/LocalTelemetry.Core/Hardware/DiskQuery.cs @@ -28,6 +28,16 @@ public record DiskInfo public bool IsBootDrive { get; init; } /// Display-ready commercial capacity string (e.g. "1 TB", "512 GB"). public string FormattedSize => SizeBytes.HasValue ? DiskQuery.FormatCommercialCapacity(SizeBytes.Value) : string.Empty; + /// Drive health status ("Healthy", "Warning", "Unhealthy"). + public string HealthStatus { get; init; } = "Healthy"; + /// Drive temperature in degrees Celsius, or null if unavailable. + public int? TemperatureC { get; init; } + /// Remaining drive life percentage (0-100), or null if unavailable. + public int? RemainingLifePercent { get; init; } + /// Total lifetime terabytes written, or null if unavailable. + public double? TotalWrittenTb { get; init; } + /// Total lifetime terabytes read, or null if unavailable. + public double? TotalReadTb { get; init; } } /// Queries physical disk information via WMI and IOCTL. @@ -37,6 +47,13 @@ public static class DiskQuery private const uint IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS = 0x00560000; private const uint IOCTL_STORAGE_QUERY_PROPERTY = 0x002D1400; + private const uint StorageAdapterProtocolSpecificProperty = 49; + private const uint ProtocolTypeAta = 1; + private const uint ProtocolTypeNvme = 3; + private const uint NvmeDataTypeLogPage = 2; + private const uint NvmeLogPageHealthInfo = 2; + private const uint AtaDataTypeLogPage = 2; + private static readonly Lazy> _busTypeIoctlCache = new(() => new()); private static List? _cachedDrives; @@ -269,6 +286,7 @@ private static List EnumerateAllDrives() var results = new List(); int? bootIdx = GetBootDriveIndex(); var msftMediaTypes = QueryMsftMediaTypes(); + var msftHealthStatuses = QueryMsftHealthStatuses(); try { @@ -278,32 +296,45 @@ private static List EnumerateAllDrives() foreach (ManagementBaseObject mo in coll) { - int idx = Convert.ToInt32(mo["Index"]); - string model = mo["Model"]?.ToString()?.Trim() ?? ""; - string iface = mo["InterfaceType"]?.ToString()?.Trim() ?? ""; - string pnpId = mo["PNPDeviceID"]?.ToString() ?? ""; - string win32Media = mo["MediaType"]?.ToString() ?? ""; - ulong? size = mo["Size"] as ulong?; - - if (IsExcludedDrive(iface, pnpId, win32Media, idx, out string busType)) - continue; - - string mediaType = DetermineMediaType(msftMediaTypes, idx, busType, model); - string displayType = DetermineDisplayType(busType, mediaType); - bool isBoot = bootIdx.HasValue && bootIdx.Value == idx; - string vendor = ExtractVendorFromModel(model); - - results.Add(new DiskInfo + using (mo) { - DiskIndex = idx, - Model = model, - Vendor = vendor, - BusType = busType, - MediaType = mediaType, - DisplayType = displayType, - SizeBytes = (long?)size, - IsBootDrive = isBoot, - }); + int idx = Convert.ToInt32(mo["Index"]); + string model = mo["Model"]?.ToString()?.Trim() ?? ""; + string iface = mo["InterfaceType"]?.ToString()?.Trim() ?? ""; + string pnpId = mo["PNPDeviceID"]?.ToString() ?? ""; + string win32Media = mo["MediaType"]?.ToString() ?? ""; + ulong? size = mo["Size"] as ulong?; + + if (IsExcludedDrive(iface, pnpId, win32Media, idx, out string busType)) + continue; + + string mediaType = DetermineMediaType(msftMediaTypes, idx, busType, model); + string displayType = DetermineDisplayType(busType, mediaType); + bool isBoot = bootIdx.HasValue && bootIdx.Value == idx; + string vendor = ExtractVendorFromModel(model); + + msftHealthStatuses.TryGetValue(idx.ToString(), out string? defaultHealth); + defaultHealth ??= "Healthy"; + + var smart = QuerySmartTelemetry(idx, defaultHealth); + + results.Add(new DiskInfo + { + DiskIndex = idx, + Model = model, + Vendor = vendor, + BusType = busType, + MediaType = mediaType, + DisplayType = displayType, + SizeBytes = (long?)size, + IsBootDrive = isBoot, + HealthStatus = smart.HealthStatus, + TemperatureC = smart.TemperatureC, + RemainingLifePercent = smart.RemainingLifePercent, + TotalWrittenTb = smart.TotalWrittenTb, + TotalReadTb = smart.TotalReadTb, + }); + } } } catch (Exception ex) { Diagnostics.Log.Error(ex, "Failed to query physical drives"); } @@ -311,6 +342,51 @@ private static List EnumerateAllDrives() return results.OrderBy(d => d.DiskIndex).ToList(); } + private static Dictionary QueryMsftHealthStatuses() + { + var dict = new Dictionary(StringComparer.OrdinalIgnoreCase); + try + { + using var searcher = new ManagementObjectSearcher( + @"root\Microsoft\Windows\Storage", + "SELECT DeviceId, HealthStatus FROM MSFT_PhysicalDisk"); + using var coll = searcher.Get(); + foreach (ManagementBaseObject mo in coll) + { + using (mo) + { + string devId = mo["DeviceId"]?.ToString() ?? ""; + string health = ParseMsftHealthStatus(mo["HealthStatus"]); + if (!string.IsNullOrEmpty(devId)) + dict[devId] = health; + } + } + } + catch (Exception ex) + { + Diagnostics.Log.Debug(ex, "WMI query for MSFT_PhysicalDisk HealthStatus failed; defaulting to Healthy"); + } + return dict; + } + + internal static string ParseMsftHealthStatus(object? rawHealth) + { + int h = rawHealth switch + { + int i => i, + ushort u => (int)u, + byte b => (int)b, + _ => 0 + }; + return h switch + { + 0 => "Healthy", + 1 => "Warning", + 2 => "Unhealthy", + _ => "Healthy" + }; + } + private static Dictionary QueryMsftMediaTypes() { var msftMediaTypes = new Dictionary(StringComparer.OrdinalIgnoreCase); @@ -322,10 +398,13 @@ private static Dictionary QueryMsftMediaTypes() using var coll = searcher.Get(); foreach (ManagementBaseObject mo in coll) { - string devId = mo["DeviceId"]?.ToString() ?? ""; - string mType = ParseMsftMediaType(mo["MediaType"]); - if (!string.IsNullOrEmpty(devId) && !string.IsNullOrEmpty(mType)) - msftMediaTypes[devId] = mType; + using (mo) + { + string devId = mo["DeviceId"]?.ToString() ?? ""; + string mType = ParseMsftMediaType(mo["MediaType"]); + if (!string.IsNullOrEmpty(devId) && !string.IsNullOrEmpty(mType)) + msftMediaTypes[devId] = mType; + } } } catch (Exception ex) @@ -420,6 +499,183 @@ private static string DetermineMediaType(Dictionary msftMediaTyp _ => busType }; + internal record struct SmartTelemetry( + string HealthStatus, + int? TemperatureC, + int? RemainingLifePercent, + double? TotalWrittenTb, + double? TotalReadTb); + + internal static SmartTelemetry QuerySmartTelemetry(int diskIndex, string defaultHealth) + { + string path = $@"\\.\PhysicalDrive{diskIndex}"; + using var handle = CreateFileOverride != null + ? CreateFileOverride(path) + : NativeMethods.CreateFile(path, 0, + NativeMethods.FILE_SHARE_READ | NativeMethods.FILE_SHARE_WRITE, + IntPtr.Zero, NativeMethods.OPEN_EXISTING, 0, IntPtr.Zero); + + if (handle is null || handle.IsInvalid) + { + return new SmartTelemetry(defaultHealth, null, null, null, null); + } + + var nvme = QueryNvmeSmart(handle, defaultHealth); + if (nvme.HasValue) return nvme.Value; + + var ata = QueryAtaSmart(handle, defaultHealth); + if (ata.HasValue) return ata.Value; + + return new SmartTelemetry(defaultHealth, null, null, null, null); + } + + internal static SmartTelemetry? QueryNvmeSmart(SafeFileHandle handle, string defaultHealth) + { + int queryHeaderSize = 8; + int protocolDataSize = 40; + int payloadSize = 512; + int totalBufferSize = queryHeaderSize + protocolDataSize + payloadSize; + + byte[] inBuffer = new byte[totalBufferSize]; + byte[] outBuffer = new byte[totalBufferSize]; + + BitConverter.GetBytes(StorageAdapterProtocolSpecificProperty).CopyTo(inBuffer, 0); + BitConverter.GetBytes(0u).CopyTo(inBuffer, 4); + + BitConverter.GetBytes(ProtocolTypeNvme).CopyTo(inBuffer, 8); + BitConverter.GetBytes(NvmeDataTypeLogPage).CopyTo(inBuffer, 12); + BitConverter.GetBytes(NvmeLogPageHealthInfo).CopyTo(inBuffer, 16); + BitConverter.GetBytes((uint)protocolDataSize).CopyTo(inBuffer, 24); + BitConverter.GetBytes((uint)payloadSize).CopyTo(inBuffer, 28); + + bool success = DeviceIoControlOverride != null + ? DeviceIoControlOverride(handle, IOCTL_STORAGE_QUERY_PROPERTY, inBuffer, outBuffer) + : NativeMethods.DeviceIoControl(handle, IOCTL_STORAGE_QUERY_PROPERTY, + inBuffer, (uint)totalBufferSize, outBuffer, (uint)totalBufferSize, out uint _, IntPtr.Zero); + + if (!success) return null; + + int payload = queryHeaderSize + protocolDataSize; + if (payload + payloadSize > outBuffer.Length) return null; + + byte critWarn = outBuffer[payload]; + ushort tempK = BitConverter.ToUInt16(outBuffer, payload + 1); + int? tempC = tempK > 273 ? tempK - 273 : null; + byte percentUsed = outBuffer[payload + 5]; + int remainingLife = Math.Clamp(100 - (int)percentUsed, 0, 100); + + ulong readUnits = BitConverter.ToUInt64(outBuffer, payload + 32); + double totalReadTb = Math.Round((readUnits * 1000.0 * 512.0) / (1024.0 * 1024.0 * 1024.0 * 1024.0), 1); + + ulong writeUnits = BitConverter.ToUInt64(outBuffer, payload + 48); + double totalWrittenTb = Math.Round((writeUnits * 1000.0 * 512.0) / (1024.0 * 1024.0 * 1024.0 * 1024.0), 1); + + string health = critWarn == 0 ? defaultHealth : "Warning"; + + return new SmartTelemetry(health, tempC, remainingLife, totalWrittenTb, totalReadTb); + } + + internal static SmartTelemetry? QueryAtaSmart(SafeFileHandle handle, string defaultHealth) + { + const int queryHeaderSize = 8; + const int protocolDataSize = 40; + const int payloadSize = 512; + int totalBufferSize = queryHeaderSize + protocolDataSize + payloadSize; + + byte[] inBuffer = BuildAtaSmartQueryBuffer(totalBufferSize, protocolDataSize, payloadSize); + byte[] outBuffer = new byte[totalBufferSize]; + + bool success = DeviceIoControlOverride != null + ? DeviceIoControlOverride(handle, IOCTL_STORAGE_QUERY_PROPERTY, inBuffer, outBuffer) + : NativeMethods.DeviceIoControl(handle, IOCTL_STORAGE_QUERY_PROPERTY, + inBuffer, (uint)totalBufferSize, outBuffer, (uint)totalBufferSize, out uint _, IntPtr.Zero); + + if (!success) return null; + + int payload = queryHeaderSize + protocolDataSize; + if (payload + payloadSize > outBuffer.Length) return null; + + return ParseAtaSmartPayload(outBuffer, payload, payloadSize, defaultHealth); + } + + private static byte[] BuildAtaSmartQueryBuffer(int totalBufferSize, int protocolDataSize, int payloadSize) + { + byte[] inBuffer = new byte[totalBufferSize]; + BitConverter.GetBytes(StorageAdapterProtocolSpecificProperty).CopyTo(inBuffer, 0); + BitConverter.GetBytes(0u).CopyTo(inBuffer, 4); + + BitConverter.GetBytes(ProtocolTypeAta).CopyTo(inBuffer, 8); + BitConverter.GetBytes(AtaDataTypeLogPage).CopyTo(inBuffer, 12); + BitConverter.GetBytes(0x30u).CopyTo(inBuffer, 16); + BitConverter.GetBytes((uint)protocolDataSize).CopyTo(inBuffer, 24); + BitConverter.GetBytes((uint)payloadSize).CopyTo(inBuffer, 28); + return inBuffer; + } + + private struct AtaSmartAccumulator(string health) + { + public int? TempC; + public int? Life; + public double? WrittenTb; + public double? ReadTb; + public string Health = health; + } + + private static SmartTelemetry? ParseAtaSmartPayload(byte[] outBuffer, int payload, int payloadSize, string defaultHealth) + { + var acc = new AtaSmartAccumulator(defaultHealth); + + for (int i = payload + 2; i + 12 <= payload + payloadSize && i < payload + 362; i += 12) + { + byte id = outBuffer[i]; + if (id == 0) continue; + + byte normValue = outBuffer[i + 3]; + ulong raw = ReadAtaRawValue(outBuffer, i + 5); + ApplyAtaSmartAttribute(id, normValue, raw, ref acc); + } + + if (acc.TempC != null || acc.Life != null || acc.WrittenTb != null || acc.ReadTb != null) + { + return new SmartTelemetry(acc.Health, acc.TempC, acc.Life, acc.WrittenTb, acc.ReadTb); + } + + return null; + } + + private static ulong ReadAtaRawValue(byte[] outBuffer, int offset) + { + ulong raw = 0; + for (int b = 0; b < 6; b++) + { + raw |= ((ulong)outBuffer[offset + b]) << (b * 8); + } + return raw; + } + + private static void ApplyAtaSmartAttribute(byte id, byte normValue, ulong raw, ref AtaSmartAccumulator acc) + { + switch (id) + { + case 194 or 190 when acc.TempC == null: + int t = (int)(raw & 0xFF); + if (t is > 0 and < 120) acc.TempC = t; + break; + case 231 or 202 or 232 when acc.Life == null: + acc.Life = Math.Clamp((int)normValue, 0, 100); + break; + case 241 when acc.WrittenTb == null: + acc.WrittenTb = Math.Round((raw * 512.0) / (1024.0 * 1024.0 * 1024.0 * 1024.0), 1); + break; + case 242 when acc.ReadTb == null: + acc.ReadTb = Math.Round((raw * 512.0) / (1024.0 * 1024.0 * 1024.0 * 1024.0), 1); + break; + case 5 when raw > 10: + acc.Health = "Warning"; + break; + } + } + // Marshal helpers private static byte[] StructToBytes(T obj) where T : struct { @@ -523,8 +779,11 @@ private struct StorageAdapterDescriptor using var results = searcher.Get(); foreach (ManagementBaseObject mo in results) { - var di = mo["DiskIndex"]; - if (di is int idx) return idx; + using (mo) + { + var di = mo["DiskIndex"]; + if (di is int idx) return idx; + } } } catch (Exception ex) { Diagnostics.Log.Error(ex, "Failed to determine boot drive index via WMI disk partition"); } diff --git a/src/LocalTelemetry.Core/Hardware/HardwareInventory.cs b/src/LocalTelemetry.Core/Hardware/HardwareInventory.cs index 55afbd1..4ce8fa2 100644 --- a/src/LocalTelemetry.Core/Hardware/HardwareInventory.cs +++ b/src/LocalTelemetry.Core/Hardware/HardwareInventory.cs @@ -44,7 +44,7 @@ public static class HardwareInventory /// /// Evaluates hardware configuration, compares against , - /// logs the result (condensed if unchanged, full if changed/first-run), and updates the cached state file. + /// logs the result (condensed if unchanged, delta if changed, full on first-run), and updates the cached state file. /// public static HardwareState LogHardwareConfiguration( ISystemInfo sysInfo, @@ -52,11 +52,12 @@ public static HardwareState LogHardwareConfiguration( bool forceFull = false) { stateFilePath ??= AppSettings.HardwareStatePath; + HardwareState? previousState = ReadPreviousState(stateFilePath); var (systemLine, osVersion, formFactor) = BuildSystemInfo(sysInfo); string motherboardLine = BuildMotherboardInfo(sysInfo); string processorLine = BuildProcessorInfo(sysInfo); - var gpuLines = BuildGpuInfo(sysInfo); + var gpuLines = BuildGpuInfo(sysInfo, previousState); var (diskLines, primaryDiskType, diskCount) = BuildStorageInfo(sysInfo); string memoryLine = BuildMemoryInfo(sysInfo); var (batteryLine, batteryFingerprint) = BuildBatteryInfo(sysInfo); @@ -81,7 +82,6 @@ public static HardwareState LogHardwareConfiguration( Battery = batteryLine }; - HardwareState? previousState = ReadPreviousState(stateFilePath); bool unchanged = !forceFull && previousState is not null && string.Equals(previousState.Fingerprint, fingerprint, StringComparison.Ordinal); @@ -94,19 +94,27 @@ public static HardwareState LogHardwareConfiguration( return currentState; } - var logDetails = new HardwareLogDetails( - systemLine, - osVersion, - formFactor, - motherboardLine, - processorLine, - gpuLines, - diskLines, - primaryDiskType, - diskCount, - memoryLine, - batteryLine); - LogFullHardwareDetails(logDetails); + if (previousState is not null && !forceFull) + { + LogHardwareDelta(previousState, currentState, primaryDiskType, diskCount); + } + else + { + var logDetails = new HardwareLogDetails( + systemLine, + osVersion, + formFactor, + motherboardLine, + processorLine, + gpuLines, + diskLines, + primaryDiskType, + diskCount, + memoryLine, + batteryLine); + LogFullHardwareDetails(logDetails); + } + SaveStateQuietly(stateFilePath, currentState); return currentState; } @@ -152,33 +160,55 @@ private static string BuildProcessorInfo(ISystemInfo sysInfo) return $"{cpuName} ({string.Join(", ", cpuParts)})"; } - private static List BuildGpuInfo(ISystemInfo sysInfo) + private static List BuildGpuInfo(ISystemInfo sysInfo, HardwareState? previousState) { var gpuList = sysInfo.GetGpus(); var gpuLines = new List(); - if (gpuList == null) return gpuLines; - - foreach (var g in gpuList) + if (gpuList != null) { - var parts = new List - { - g.IsDedicated ? "Dedicated" : "Integrated" - }; - if (g.VramBytes.HasValue && g.VramBytes.Value > 0) + foreach (var g in gpuList) { - double vramGb = g.VramBytes.Value / (1024.0 * 1024.0 * 1024.0); - string vramStr = vramGb >= 1.0 ? $"{Math.Round(vramGb)} GB" : $"{Math.Round(g.VramBytes.Value / (1024.0 * 1024.0))} MB"; - parts.Add($"VRAM {vramStr}"); + gpuLines.Add(FormatGpuLine(g)); } - if (!string.IsNullOrWhiteSpace(g.DriverVersion)) - { - parts.Add($"driver {g.DriverVersion}"); - } - gpuLines.Add($"{g.Name} ({string.Join(", ", parts)})"); } + + AppendPreservedDedicatedGpus(gpuLines, previousState); return gpuLines; } + private static string FormatGpuLine((string Name, string Vendor, bool IsDedicated, long? VramBytes, string? DriverVersion) g) + { + var parts = new List + { + g.IsDedicated ? "Dedicated" : "Integrated" + }; + if (g.VramBytes is > 0) + { + double vramGb = g.VramBytes.Value / (1024.0 * 1024.0 * 1024.0); + string vramStr = vramGb >= 1.0 ? $"{Math.Round(vramGb)} GB" : $"{Math.Round(g.VramBytes.Value / (1024.0 * 1024.0))} MB"; + parts.Add($"VRAM {vramStr}"); + } + if (!string.IsNullOrWhiteSpace(g.DriverVersion)) + { + parts.Add($"driver {g.DriverVersion}"); + } + return $"{g.Name} ({string.Join(", ", parts)})"; + } + + private static void AppendPreservedDedicatedGpus(List gpuLines, HardwareState? previousState) + { + // If no dedicated GPU was detected in current active enumeration, but a dedicated GPU was previously recorded, + // preserve the dedicated GPU (e.g. laptop dGPU asleep in D3cold power state). + if (gpuLines.Any(line => line.Contains("(Dedicated", StringComparison.OrdinalIgnoreCase)) + || previousState?.Graphics == null) + { + return; + } + + gpuLines.AddRange(previousState.Graphics.Where(prevGpu => + prevGpu.Contains("(Dedicated", StringComparison.OrdinalIgnoreCase) && !gpuLines.Contains(prevGpu))); + } + private static (List DiskLines, string PrimaryDiskType, int DiskCount) BuildStorageInfo(ISystemInfo sysInfo) { var diskInfos = sysInfo.GetAllDisks(); @@ -252,8 +282,9 @@ private static (string BatteryLine, string BatteryFingerprint) BuildBatteryInfo( return (batteryLine, batteryFingerprint); } - private static HardwareState? ReadPreviousState(string? stateFilePath) + internal static HardwareState? ReadPreviousState(string? stateFilePath = null) { + stateFilePath ??= AppSettings.HardwareStatePath; if (string.IsNullOrEmpty(stateFilePath) || !File.Exists(stateFilePath)) return null; @@ -282,21 +313,91 @@ private sealed record HardwareLogDetails( string MemoryLine, string BatteryLine); + private static void LogHardwareDelta(HardwareState prev, HardwareState curr, string primaryDiskType, int diskCount) + { + var sb = new StringBuilder(); + sb.AppendLine("Hardware change detected:"); + + if (!string.Equals(prev.SystemModel, curr.SystemModel, StringComparison.Ordinal) + || !string.Equals(prev.OsVersion, curr.OsVersion, StringComparison.Ordinal) + || !string.Equals(prev.FormFactor, curr.FormFactor, StringComparison.Ordinal)) + { + sb.AppendLine($" System: {curr.SystemModel}, OS {curr.OsVersion}, form factor {curr.FormFactor}"); + } + + if (!string.Equals(prev.Motherboard, curr.Motherboard, StringComparison.Ordinal)) + { + sb.AppendLine($" Motherboard: {curr.Motherboard}"); + } + + if (!string.Equals(prev.Processor, curr.Processor, StringComparison.Ordinal)) + { + sb.AppendLine($" Processor: {curr.Processor}"); + } + + if (!prev.Graphics.SequenceEqual(curr.Graphics)) + { + foreach (var gpu in curr.Graphics) + { + sb.AppendLine($" Graphics: {gpu}"); + } + } + + if (!prev.Storage.SequenceEqual(curr.Storage)) + { + sb.AppendLine($" Storage: {diskCount} physical drive(s), primary {primaryDiskType}"); + foreach (var disk in curr.Storage) + { + sb.AppendLine($" {disk}"); + } + } + + if (!string.Equals(prev.Memory, curr.Memory, StringComparison.Ordinal)) + { + sb.AppendLine($" Memory: {curr.Memory}"); + } + + if (!string.Equals(prev.Battery, curr.Battery, StringComparison.Ordinal) + && !curr.Battery.StartsWith("None", StringComparison.OrdinalIgnoreCase)) + { + sb.AppendLine($" Battery: {curr.Battery}"); + } + + Log.Info(sb.ToString().TrimEnd()); + } + private static void LogFullHardwareDetails(HardwareLogDetails details) { - Log.Info("Hardware configuration detected"); - Log.Info($"Detected system {details.SystemLine}, OS {details.OsVersion}, form factor {details.FormFactor}"); + var sb = new StringBuilder(); + sb.AppendLine("Hardware configuration detected:"); + sb.AppendLine($" System: {details.SystemLine}, OS {details.OsVersion}, form factor {details.FormFactor}"); if (!string.IsNullOrWhiteSpace(details.MotherboardLine)) - Log.Info($"Detected motherboard {details.MotherboardLine}"); + { + sb.AppendLine($" Motherboard: {details.MotherboardLine}"); + } if (!string.IsNullOrWhiteSpace(details.ProcessorLine)) - Log.Info($"Detected processor {details.ProcessorLine}"); + { + sb.AppendLine($" Processor: {details.ProcessorLine}"); + } foreach (var gpu in details.GpuLines) - Log.Info($"Detected graphics adapter {gpu}"); - Log.Info($"Detected {details.DiskCount} physical drive(s), primary {details.PrimaryDiskType}"); - foreach (var d in details.DiskLines) - Log.Info($"Detected {d}"); - Log.Info($"Detected memory {details.MemoryLine}"); - Log.Info($"Detected battery {details.BatteryLine}"); + { + sb.AppendLine($" Graphics: {gpu}"); + } + sb.AppendLine($" Storage: {details.DiskCount} physical drive(s), primary {details.PrimaryDiskType}"); + foreach (var disk in details.DiskLines) + { + sb.AppendLine($" {disk}"); + } + if (!string.IsNullOrWhiteSpace(details.MemoryLine)) + { + sb.AppendLine($" Memory: {details.MemoryLine}"); + } + if (!string.IsNullOrWhiteSpace(details.BatteryLine) && !details.BatteryLine.StartsWith("None", StringComparison.OrdinalIgnoreCase)) + { + sb.AppendLine($" Battery: {details.BatteryLine}"); + } + + Log.Info(sb.ToString().TrimEnd()); } private static void SaveStateQuietly(string? path, HardwareState state) diff --git a/src/LocalTelemetry.Core/Hardware/HardwareLifecycleManager.cs b/src/LocalTelemetry.Core/Hardware/HardwareLifecycleManager.cs index 9bd2c5c..a45eeaa 100644 --- a/src/LocalTelemetry.Core/Hardware/HardwareLifecycleManager.cs +++ b/src/LocalTelemetry.Core/Hardware/HardwareLifecycleManager.cs @@ -26,6 +26,9 @@ public interface IHardwareLifecycleManager : IDisposable /// Fired when hardware devices (USB, storage, PnP) arrive or are removed. event Action? DevicePnPChanged; + /// Fired when the Windows user session is locked (true) or unlocked (false). + event Action? SessionLockStateChanged; + /// Notifies the manager of an external display configuration change (e.g. from WM_DISPLAYCHANGE). void NotifyDisplayChanged(); @@ -50,8 +53,11 @@ public sealed class HardwareLifecycleManager : IHardwareLifecycleManager public event Action? PowerResumed; public event Action? NetworkTopologyChanged; public event Action? DevicePnPChanged; + public event Action? SessionLockStateChanged; + + private static event Action? GlobalSessionLockStateChanged; - private readonly object _lock = new(); + private readonly Lock _lock = new(); private bool _disposed; private bool _isSuspended; private DateTime _lastDisplayEvent = DateTime.MinValue; @@ -62,6 +68,7 @@ public sealed class HardwareLifecycleManager : IHardwareLifecycleManager private int _lastMonitorCount; private const int DebounceMs = 3000; private const int NetworkDebounceMs = 2000; + private readonly Timer? _networkTrailingTimer; internal static Action? SubscribeSystemEventsHook { get; set; } internal static Action? SubscribeNetworkChangeHook { get; set; } @@ -73,6 +80,8 @@ public sealed class HardwareLifecycleManager : IHardwareLifecycleManager /// public HardwareLifecycleManager() { + _networkTrailingTimer = new Timer(_ => FireNetworkTopologyChanged(), null, Timeout.Infinite, Timeout.Infinite); + GlobalSessionLockStateChanged += OnGlobalSessionLockStateChanged; try { if (SubscribeSystemEventsHook is not null) @@ -152,15 +161,21 @@ private static void OnSessionEnding(object? sender, SessionEndingEventArgs e) } catch (Exception ex) { - System.Diagnostics.Trace.WriteLine($"[HardwareLifecycleManager] Error logging session ending: {ex.Message}"); + Log.Error(ex, "Error processing session ending event"); } } + private void OnGlobalSessionLockStateChanged(bool isLocked) + { + if (_disposed) return; + SessionLockStateChanged?.Invoke(isLocked); + } + private static void OnSessionSwitch(object? sender, SessionSwitchEventArgs e) { try { - string reason = e.Reason switch + string reason = e?.Reason switch { SessionSwitchReason.SessionLock => "Session locked", SessionSwitchReason.SessionUnlock => "Session unlocked", @@ -168,13 +183,25 @@ private static void OnSessionSwitch(object? sender, SessionSwitchEventArgs e) SessionSwitchReason.SessionLogoff => "User logged off", SessionSwitchReason.RemoteConnect => "Remote desktop connected", SessionSwitchReason.RemoteDisconnect => "Remote desktop disconnected", - _ => e.Reason.ToString() + _ => e?.Reason.ToString() ?? "Unknown" }; Log.Info($"Windows session event ({reason})"); + + if (e is not null) + { + if (e.Reason == SessionSwitchReason.SessionLock) + { + GlobalSessionLockStateChanged?.Invoke(true); + } + else if (e.Reason == SessionSwitchReason.SessionUnlock) + { + GlobalSessionLockStateChanged?.Invoke(false); + } + } } catch (Exception ex) { - System.Diagnostics.Trace.WriteLine($"[HardwareLifecycleManager] Error logging session switch: {ex.Message}"); + Log.Error(ex, "Error processing session switch event"); } } @@ -192,13 +219,38 @@ private void TriggerNetworkChange() { if (_isSuspended) return; + bool fireImmediate = false; lock (_lock) { var now = DateTime.UtcNow; - if ((now - _lastNetworkEvent).TotalMilliseconds < NetworkDebounceMs) return; - _lastNetworkEvent = now; + if ((now - _lastNetworkEvent).TotalMilliseconds >= NetworkDebounceMs) + { + _lastNetworkEvent = now; + fireImmediate = true; + } } + if (fireImmediate) + { + FireNetworkTopologyChanged(); + } + + try + { + if (!_disposed) + { + _networkTrailingTimer?.Change(750, Timeout.Infinite); + } + } + catch (ObjectDisposedException ex) + { + Log.Debug(ex, "Network trailing timer disposed during trigger"); + } + } + + private void FireNetworkTopologyChanged() + { + if (_isSuspended || _disposed) return; try { Log.Debug("Network topology or availability changed; notifying network monitor"); @@ -278,6 +330,8 @@ public void Dispose() { if (_disposed) return; _disposed = true; + GlobalSessionLockStateChanged -= OnGlobalSessionLockStateChanged; + _networkTrailingTimer?.Dispose(); } try diff --git a/src/LocalTelemetry.Core/Hardware/HardwareMonitor.cs b/src/LocalTelemetry.Core/Hardware/HardwareMonitor.cs index 6ceb0c1..46094b8 100644 --- a/src/LocalTelemetry.Core/Hardware/HardwareMonitor.cs +++ b/src/LocalTelemetry.Core/Hardware/HardwareMonitor.cs @@ -37,8 +37,9 @@ public sealed class HardwareMonitor : IDisposable private List<(PerformanceCounter read, PerformanceCounter write)>? _perDiskCounters; // Network via NetworkInterface.GetIPv4Statistics delta + private const string UnsetPreferredNic = "~~unset~~"; private string? _nicInstanceName; - private string _lastPreferredNic = "~~unset~~"; + private string _lastPreferredNic = UnsetPreferredNic; private string? _lastBoundNicId; private NetworkInterface? _nicInterface; private long _prevRx, _prevTx; @@ -46,6 +47,8 @@ public sealed class HardwareMonitor : IDisposable private bool _nicPrimed; private string _primaryDiskType = string.Empty; private List _diskBusTypes = []; + private readonly Dictionary _cachedDiskTemps = []; + private DateTime _lastDiskTempQuery = DateTime.MinValue; // GetSystemTimes fallback state private long _prevIdle, _prevKernel, _prevUser; @@ -86,6 +89,9 @@ public sealed class HardwareMonitor : IDisposable private ulong _prevPkgEnergy; private DateTime _prevEnergyTime; private bool _hasEnergyPrimed; + private ulong _prevGpuEnergy; + private DateTime _prevGpuEnergyTime; + private bool _hasGpuEnergyPrimed; private const string IntelVendor = "Intel"; private const string AmdVendor = "AMD"; @@ -96,6 +102,10 @@ public sealed class HardwareMonitor : IDisposable private string _cpuVendor = string.Empty; private string _gpuVendor = string.Empty; private string _gpuName = string.Empty; + private bool _hasDedicatedGpu; + + /// Gets whether an active dedicated graphics card is present. + public bool HasDedicatedGpu => _hasDedicatedGpu; // One-shot logging flags (prevent per-tick repeat warnings) private int _onceCpuTempIntelMsrNull; @@ -137,9 +147,13 @@ public sealed class HardwareMonitor : IDisposable internal static bool ThrowInDevicePnPForTesting { get; set; } internal static bool ThrowInGatewayCheckForTesting { get; set; } internal static bool ThrowInPrimeNicForTesting { get; set; } + internal string? ActiveGpuLuid { get; set; } private readonly IHardwareLifecycleManager _lifecycleManager; private volatile bool _isSuspended; + private volatile bool _isPowerSuspended; + private volatile bool _isSessionLocked; + private volatile bool _needsPowerResumeWarmUp; private bool _disposed; // Constructor @@ -159,6 +173,7 @@ public HardwareMonitor( _lifecycleManager.PowerResumed += OnPowerResumed; _lifecycleManager.NetworkTopologyChanged += OnNetworkTopologyChanged; _lifecycleManager.DevicePnPChanged += OnDevicePnPChanged; + _lifecycleManager.SessionLockStateChanged += OnSessionLockStateChanged; try { @@ -202,8 +217,13 @@ private void InitDiskCounters() _perDiskCounters = CreatePerDiskCounters(); if (_perDiskCounters is not null) { + var archPairs = _diskBusTypes.Select(b => ((string?)null, (string?)b)).ToList(); + var archLabels = ComputeDiskArchitectureLabels(archPairs); for (int i = 0; i < _perDiskCounters.Count; i++) - Metrics.RegisterDisk($"disk{i}", $"DISK{i}"); + { + string label = i < archLabels.Count ? archLabels[i] : $"Disk {i + 1}"; + Metrics.RegisterDisk($"disk{i}", label); + } } } @@ -457,18 +477,35 @@ private void InitGpu() DetectCpuVendor(); var displayGuid = NativeMethods.GUID_DISPLAY; - IntPtr devInfoSet = NativeMethods.SetupDiGetClassDevs(ref displayGuid, IntPtr.Zero, - IntPtr.Zero, NativeMethods.DIGCF_PRESENT); - if (devInfoSet.ToInt64() == -1) - return; + EnumerateDisplayAdaptersWithFlags(displayGuid, NativeMethods.DIGCF_PRESENT); + + // If no dedicated adapter was found with DIGCF_PRESENT, check all installed adapters (e.g. asleep in D3cold) + if (!_hasDedicatedGpu) + { + EnumerateDisplayAdaptersWithFlags(displayGuid, 0); + } + + // If still not found, check cached hardware state from previous runs + if (!_hasDedicatedGpu) + { + TryRestoreDedicatedGpuFromPreviousState(); + } + + string adapterLog = FormatActiveGpuAdapterLog(_gpuName, _gpuVendor, _hasDedicatedGpu); + Log.Info($"Active graphics adapter is {adapterLog}"); + InitWddmGpu(); + ActiveGpuLuid = WddmGpuMonitor.GetAdapterLuid(_gpuName); + InitVendorGpuMonitor(); + } + + private void EnumerateDisplayAdaptersWithFlags(Guid displayGuid, uint flags) + { + IntPtr devInfoSet = NativeMethods.SetupDiGetClassDevs(ref displayGuid, IntPtr.Zero, IntPtr.Zero, flags); + if (devInfoSet.ToInt64() == -1) return; try { EnumerateDisplayAdapters(devInfoSet); - string adapterLog = FormatActiveGpuAdapterLog(_gpuName, _gpuVendor); - Log.Info($"Active graphics adapter is {adapterLog}"); - InitWddmGpu(); - InitVendorGpuMonitor(); } finally { @@ -476,12 +513,47 @@ private void InitGpu() } } - private static string FormatActiveGpuAdapterLog(string gpuName, string gpuVendor) + private void TryRestoreDedicatedGpuFromPreviousState() { + var prevState = HardwareInventory.ReadPreviousState(); + if (prevState?.Graphics is not { Count: > 0 }) return; + + var prevDed = prevState.Graphics.FirstOrDefault(g => g.Contains("(Dedicated", StringComparison.OrdinalIgnoreCase)); + if (string.IsNullOrEmpty(prevDed)) return; + + string vendor = IntelVendor; + if (prevDed.Contains(NvidiaVendor, StringComparison.OrdinalIgnoreCase)) + { + vendor = NvidiaVendor; + } + else if (prevDed.Contains(AmdVendor, StringComparison.OrdinalIgnoreCase)) + { + vendor = AmdVendor; + } + + int parenIdx = prevDed.IndexOf(" (Dedicated", StringComparison.OrdinalIgnoreCase); + string name = parenIdx > 0 ? prevDed[..parenIdx] : prevDed; + + _hasDedicatedGpu = true; + _gpuVendor = vendor; + _gpuName = name; + if (vendor == NvidiaVendor) + { + InitNvGpu(); + } + else if (vendor == AmdVendor) + { + InitAmdGpu(); + } + } + + private static string FormatActiveGpuAdapterLog(string gpuName, string gpuVendor, bool hasDedicatedGpu) + { + string kind = hasDedicatedGpu ? "Dedicated" : "Integrated"; if (!string.IsNullOrEmpty(gpuName)) - return $"{gpuName} ({gpuVendor})"; + return $"{gpuName} ({kind}, {gpuVendor})"; - return !string.IsNullOrEmpty(gpuVendor) ? gpuVendor : "None"; + return !string.IsNullOrEmpty(gpuVendor) ? $"{gpuVendor} ({kind})" : "None"; } private void EnumerateDisplayAdapters(IntPtr devInfoSet) @@ -491,6 +563,9 @@ private void EnumerateDisplayAdapters(IntPtr devInfoSet) cbSize = (uint)Marshal.SizeOf() }; uint i = 0; + string? firstIntegratedVendor = null; + string firstIntegratedName = string.Empty; + bool foundDedicated = false; while (NativeMethods.SetupDiEnumDeviceInfo(devInfoSet, i++, ref devInfo)) { @@ -504,8 +579,31 @@ private void EnumerateDisplayAdapters(IntPtr devInfoSet) bool dedicated = IsDedicatedAdapter(vendor, name, devInfoSet, devInfo); Log.Debug($"Detected graphics adapter '{name}' (Vendor {vendor}, dedicated {dedicated})"); - if (TrySelectActiveGpuAdapter(vendor, name, dedicated)) - break; + if (dedicated) + { + foundDedicated = true; + if (TrySelectActiveGpuAdapter(vendor, name, true)) + { + _hasDedicatedGpu = true; + return; + } + } + else if (firstIntegratedVendor is null) + { + firstIntegratedVendor = vendor; + firstIntegratedName = name; + } + } + + if (foundDedicated) + { + _hasDedicatedGpu = true; + } + else if (!_hasDedicatedGpu && firstIntegratedVendor is not null) + { + _hasDedicatedGpu = false; + _gpuVendor = firstIntegratedVendor; + _gpuName = firstIntegratedName; } } @@ -535,21 +633,60 @@ private bool TrySelectActiveGpuAdapter(string vendor, string name, bool dedicate return false; } + internal static bool IsKnownIntegratedGpu(string name, string? vendor) + { + if (string.IsNullOrEmpty(name)) return false; + + if (vendor == IntelVendor) + { + return !name.Contains("Arc", StringComparison.OrdinalIgnoreCase) + && !name.Contains("DG1", StringComparison.OrdinalIgnoreCase); + } + + if (vendor == AmdVendor) + { + if (name.Contains("RX", StringComparison.OrdinalIgnoreCase) + || name.Contains("PRO", StringComparison.OrdinalIgnoreCase) + || name.Contains("VII", StringComparison.OrdinalIgnoreCase) + || name.Contains("WX", StringComparison.OrdinalIgnoreCase)) + { + return false; + } + + return name.Contains("Radeon(TM) Graphics", StringComparison.OrdinalIgnoreCase) + || name.Contains("Radeon Graphics", StringComparison.OrdinalIgnoreCase) + || System.Text.RegularExpressions.Regex.IsMatch(name, + @"\b(Vega \d+|\d{3}M)\b", System.Text.RegularExpressions.RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250)); + } + + return false; + } + private static bool IsDedicatedAdapter(string? vendor, string name, IntPtr devInfoSet, NativeMethods.SpDevinfoData devInfo) { + if (IsKnownIntegratedGpu(name, vendor)) + return false; + return vendor == NvidiaVendor || (vendor == IntelVendor && name.Contains("Arc", StringComparison.OrdinalIgnoreCase)) - || IsDiscreteBus(devInfoSet, devInfo) || (vendor == AmdVendor && System.Text.RegularExpressions.Regex.IsMatch(name, - @"\b(RX|PRO|VII|WX|W[36]\d{3})\b", System.Text.RegularExpressions.RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250))); + @"\b(RX|PRO|VII|WX|W[36]\d{3})\b", System.Text.RegularExpressions.RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250))) + || IsDiscreteBus(devInfoSet, devInfo); } private void InitVendorGpuMonitor() { - if (_gpuVendor == NvidiaVendor) { return; } - if (_gpuVendor == AmdVendor) { InitAmdGpu(); } - else if (_gpuVendor == IntelVendor) { InitIntelGpu(); } - else Log.Debug("No compatible dedicated GPU monitor found"); + if (_hasDedicatedGpu) + { + if (_gpuVendor == NvidiaVendor) { return; } + if (_gpuVendor == AmdVendor) { InitAmdGpu(); return; } + Log.Debug("No compatible dedicated GPU monitor found"); + return; + } + + // Integrated GPU monitoring is strictly for systems with NO dedicated GPU + if (_gpuVendor == IntelVendor) { InitIntelGpu(); } + else Log.Debug("No compatible GPU monitor found"); } private static bool IsDiscreteBus(IntPtr devInfoSet, NativeMethods.SpDevinfoData devInfo) @@ -578,12 +715,12 @@ private static string GetDevProp(IntPtr devInfoSet, NativeMethods.SpDevinfoData private static string? DetectGpuVendor(string hwId, string name) { - if (hwId.Contains("VEN_10DE") || name.Contains("NVIDIA", StringComparison.OrdinalIgnoreCase)) - return "NVIDIA"; - if (hwId.Contains("VEN_1002") || name.Contains("AMD", StringComparison.OrdinalIgnoreCase) || name.Contains("Radeon", StringComparison.OrdinalIgnoreCase)) - return "AMD"; - if (hwId.Contains("VEN_8086") || name.Contains("Intel", StringComparison.OrdinalIgnoreCase)) - return "Intel"; + if (hwId.Contains("VEN_10DE") || name.Contains(NvidiaVendor, StringComparison.OrdinalIgnoreCase)) + return NvidiaVendor; + if (hwId.Contains("VEN_1002") || name.Contains(AmdVendor, StringComparison.OrdinalIgnoreCase) || name.Contains("Radeon", StringComparison.OrdinalIgnoreCase)) + return AmdVendor; + if (hwId.Contains("VEN_8086") || name.Contains(IntelVendor, StringComparison.OrdinalIgnoreCase)) + return IntelVendor; return null; } @@ -602,8 +739,13 @@ private void InitDiskType() var diskInfos = DiskQuery.QueryAllDrives(); _primaryDiskType = diskInfos.Count > 0 ? (diskInfos[0].DisplayType ?? diskInfos[0].BusType ?? "DISK") : "DISK"; _diskBusTypes = diskInfos.Select(d => d.DisplayType ?? d.BusType ?? "DISK").ToList(); + var archPairs = diskInfos.Select(d => (d.DisplayType, (string?)d.BusType)).ToList(); + var archLabels = ComputeDiskArchitectureLabels(archPairs); for (int i = 0; i < diskInfos.Count; i++) - Metrics.RegisterDisk($"disk{i}", $"DISK{i}"); + { + string label = i < archLabels.Count ? archLabels[i] : $"Disk {i + 1}"; + Metrics.RegisterDisk($"disk{i}", label); + } Log.Debug($"Detected {diskInfos.Count} storage device(s), primary type {_primaryDiskType}"); } catch (Exception ex) @@ -614,6 +756,63 @@ private void InitDiskType() } } + /// Extracts a normalized disk architecture label (e.g. "NVMe", "SATA", "HDD") from display/bus type. + public static string ExtractDiskArchitecture(string? displayType, string? busType) + { + string raw = !string.IsNullOrWhiteSpace(displayType) ? displayType : (busType ?? string.Empty); + if (string.IsNullOrWhiteSpace(raw)) return "Disk"; + + if (raw.Contains("NVMe", StringComparison.OrdinalIgnoreCase)) return "NVMe"; + if (raw.Contains("SATA", StringComparison.OrdinalIgnoreCase)) return "SATA"; + if (raw.Contains("SCSI", StringComparison.OrdinalIgnoreCase)) return "SCSI"; + if (raw.Contains("USB", StringComparison.OrdinalIgnoreCase)) return "USB"; + if (raw.Contains("SSD", StringComparison.OrdinalIgnoreCase)) return "SSD"; + if (raw.Contains("HDD", StringComparison.OrdinalIgnoreCase)) return "HDD"; + + string clean = raw.Trim().ToUpperInvariant(); + if (clean.StartsWith("BUSTYPE", StringComparison.OrdinalIgnoreCase)) + clean = clean[7..].Trim(); + if (clean == "DISK" || clean == "UNKNOWN" || string.IsNullOrWhiteSpace(clean)) + return "Disk"; + + return clean; + } + + /// Computes indexed architecture labels (e.g. "NVMe 1", "NVMe 2") for a list of disks. + public static List ComputeDiskArchitectureLabels(IReadOnlyList<(string? DisplayType, string? BusType)> disks) + { + var archs = disks.Select(d => ExtractDiskArchitecture(d.DisplayType, d.BusType)).ToList(); + var counts = new Dictionary(StringComparer.OrdinalIgnoreCase); + foreach (var a in archs) + { + counts[a] = counts.TryGetValue(a, out int c) ? c + 1 : 1; + } + + var positions = new Dictionary(StringComparer.OrdinalIgnoreCase); + var labels = new List(disks.Count); + for (int i = 0; i < archs.Count; i++) + { + string arch = archs[i]; + int totalOfType = counts[arch]; + positions[arch] = positions.TryGetValue(arch, out int p) ? p + 1 : 1; + int pos = positions[arch]; + + if (arch.Equals("Disk", StringComparison.OrdinalIgnoreCase)) + { + labels.Add($"Disk {i + 1}"); + } + else if (totalOfType > 1) + { + labels.Add($"{arch} {pos}"); + } + else + { + labels.Add(arch); + } + } + return labels; + } + private static int CompareDiskCounters( (PerformanceCounter read, PerformanceCounter write) a, (PerformanceCounter read, PerformanceCounter write) b) @@ -668,7 +867,7 @@ private static string ExtractDiskIndex(string instanceName) // Poll private void Poll() { - if (_isSuspended || _disposed) return; + if (_isSuspended || _isPowerSuspended || _isSessionLocked || _disposed) return; if (Interlocked.CompareExchange(ref _isPolling, 1, 0) != 0) return; try { SnapshotReady?.Invoke(BuildSnapshot()); } @@ -676,18 +875,104 @@ private void Poll() finally { Volatile.Write(ref _isPolling, 0); } } + private readonly record struct MetricDemands( + bool NeedCpuPct, + bool NeedCpuTemp, + bool NeedCpuFreq, + bool NeedCpuPower, + bool NeedRam, + bool NeedGpuPct, + bool NeedGpuTemp, + bool NeedGpuVram, + bool NeedGpuFreq, + bool NeedGpuPower, + bool NeedNet, + bool NeedDisk, + bool NeedBattery); + + private MetricDemands GetMetricDemands() + { + if (_cfg.EnableFileLogging) + { + var mc = _cfg.Monitoring; + return new MetricDemands( + mc.EnableCpu, + mc.EnableCpu, + mc.EnableCpu, + mc.EnableCpu, + mc.EnableRam, + mc.EnableGpu, + mc.EnableGpu, + mc.EnableGpu, + mc.EnableGpu, + mc.EnableGpu, + mc.EnableNet, + mc.EnableDisk, + mc.EnableBattery); + } + + var row = _cfg.Overlay?.Columns is { Count: > 0 } cols + ? new HashSet(cols.SelectMany(c => c).Where(s => !string.IsNullOrEmpty(s)), StringComparer.OrdinalIgnoreCase) + : null; + var alerts = _cfg.Alerts is { Enabled: true } a ? a : null; + + return ComputeMetricDemands(row, alerts); + } + + private static bool NeedMetric(HashSet? row, string metric, bool alert) + => (row is not null && row.Contains(metric)) || alert; + + private static MetricDemands ComputeMetricDemands(HashSet? row, Config.AlertConfig? alerts) + { + bool needCpuTemp = NeedMetric(row, Metrics.CpuTemp, alerts?.AlertCpuTemp == true); + bool needCpuFreq = NeedMetric(row, Metrics.CpuFreq, alerts?.AlertCpuFreq == true); + bool needCpuPower = NeedMetric(row, Metrics.CpuPower, alerts?.AlertCpuPower == true); + + bool alertRam = alerts?.AlertRamUsage == true; + bool needRam = alertRam || (row is not null && (row.Contains(Metrics.RamPct) || row.Contains(Metrics.RamUsed))); + + bool needGpuTemp = NeedMetric(row, Metrics.GpuTemp, alerts?.AlertGpuTemp == true); + bool needGpuVram = NeedMetric(row, Metrics.GpuVram, alerts?.AlertGpuVram == true); + bool needGpuFreq = NeedMetric(row, Metrics.GpuFreq, alerts?.AlertGpuFreq == true); + bool needGpuPower = NeedMetric(row, Metrics.GpuPower, alerts?.AlertGpuPower == true); + + bool alertNet = alerts is not null && (alerts.AlertNetDaily || alerts.AlertNetMonthly); + bool needNet = alertNet || (row is not null && (row.Contains(Metrics.NetDown) || row.Contains(Metrics.NetUp) || row.Contains(Metrics.NetTotal))); + + bool needDisk = (alerts?.AlertDiskTemp == true) || (row is not null && row.Any(m => m.StartsWith("disk", StringComparison.OrdinalIgnoreCase))); + + bool alertBat = alerts?.AlertBatteryLow == true; + bool needBattery = alertBat || (row is not null && (row.Contains(Metrics.BatteryPct) || row.Contains(Metrics.BatteryRate))); + + return new MetricDemands( + true, + needCpuTemp, + needCpuFreq, + needCpuPower, + needRam, + true, + needGpuTemp, + needGpuVram, + needGpuFreq, + needGpuPower, + needNet, + needDisk, + needBattery); + } + private TelemetrySnapshot BuildSnapshot() { var mc = _cfg.Monitoring; + var demands = GetMetricDemands(); - var (cpuPct, cpuTemp, cpuFreq, cpuPower) = CollectCpuMetrics(mc); + var (cpuPct, cpuTemp, cpuFreq, cpuPower) = CollectCpuMetricsWithDemands(mc, demands); float ramPct = 0, ramUsedGb = 0, ramTotalGb = 0; - if (mc.EnableRam) ReadMemory(out ramPct, out ramUsedGb, out ramTotalGb); + if (mc.EnableRam && demands.NeedRam) ReadMemory(out ramPct, out ramUsedGb, out ramTotalGb); - var (gpuPct, gpuTemp, gpuVramUsed, gpuClock, gpuPower) = CollectGpuMetrics(mc); - var (netDown, netUp, nicName) = CollectNetMetrics(mc); - var (diskRead, diskWrite, disks) = CollectDiskMetrics(mc); - var (batteryPct, batteryCharging, batteryOnAC, batteryRate) = CollectBatteryMetrics(mc); + var (gpuPct, gpuTemp, gpuVramUsed, gpuClock, gpuPower) = CollectGpuMetricsWithDemands(mc, demands); + var (netDown, netUp, nicName) = CollectNetMetricsWithDemands(mc, demands); + var (diskRead, diskWrite, disks) = CollectDiskMetricsWithDemands(mc, demands); + var (batteryPct, batteryCharging, batteryOnAC, batteryRate) = CollectBatteryMetricsWithDemands(mc, demands); LogTickMetrics(mc, (cpuPct, cpuTemp, cpuFreq, cpuPower), @@ -697,7 +982,7 @@ private TelemetrySnapshot BuildSnapshot() (batteryPct, batteryCharging, batteryOnAC, batteryRate)); long netTotal = 0; - if (mc.EnableNet) + if (mc.EnableNet && demands.NeedNet) { var (d, u) = TrafficHistoryStore.GetToday(); netTotal = d + u; @@ -732,42 +1017,58 @@ private TelemetrySnapshot BuildSnapshot() }; } - private (float cpuPct, float cpuTemp, float cpuFreq, float cpuPower) CollectCpuMetrics(Config.MonitoringConfig mc) + private (float cpuPct, float cpuTemp, float cpuFreq, float cpuPower) CollectCpuMetricsWithDemands(Config.MonitoringConfig mc, MetricDemands demands) { if (!mc.EnableCpu) return (0, 0, 0, 0); - return (ReadCpuPct(), ReadCpuTemp(), ReadCpuFreq(), ReadCpuPowerRapl()); + float pct = demands.NeedCpuPct ? ReadCpuPct() : 0f; + float temp = demands.NeedCpuTemp ? ReadCpuTemp() : 0f; + float freq = demands.NeedCpuFreq ? ReadCpuFreq() : 0f; + float power = demands.NeedCpuPower ? ReadCpuPowerRapl() : 0f; + return (pct, temp, freq, power); } - private (float gpuPct, float gpuTemp, float gpuVramUsed, float gpuClock, float gpuPower) CollectGpuMetrics(Config.MonitoringConfig mc) + private (float gpuPct, float gpuTemp, float gpuVramUsed, float gpuClock, float gpuPower) CollectGpuMetricsWithDemands(Config.MonitoringConfig mc, MetricDemands demands) { if (!mc.EnableGpu) return (0, 0, 0, 0, 0); + if (!demands.NeedGpuPct && !demands.NeedGpuTemp && !demands.NeedGpuVram && !demands.NeedGpuFreq && !demands.NeedGpuPower) + { + return (0, 0, 0, 0, 0); + } + NvGpuMonitor.NvGpuData? gpuData = _nvGpu?.Query(); return ( - ReadGpuPct(gpuData), - ReadGpuTemp(gpuData), - ReadGpuVramUsedMb(gpuData), - ReadGpuFreqMHz(gpuData), - ReadGpuPowerW(gpuData) + demands.NeedGpuPct ? ReadGpuPct(gpuData) : 0f, + demands.NeedGpuTemp ? ReadGpuTemp(gpuData) : 0f, + demands.NeedGpuVram ? ReadGpuVramUsedMb(gpuData) : 0f, + demands.NeedGpuFreq ? ReadGpuFreqMHz(gpuData) : 0f, + demands.NeedGpuPower ? ReadGpuPowerW(gpuData) : 0f ); } - private (double netDown, double netUp, string nicName) CollectNetMetrics(Config.MonitoringConfig mc) + private (double netDown, double netUp, string nicName) CollectNetMetricsWithDemands(Config.MonitoringConfig mc, MetricDemands demands) { - if (!mc.EnableNet) return (0, 0, string.Empty); + if (!mc.EnableNet || !demands.NeedNet) return (0, 0, string.Empty); EnsureNicCounters(); var (down, up) = ReadNetBytes(); return (down, up, _nicInstanceName ?? string.Empty); } - private (double diskRead, double diskWrite, List disks) CollectDiskMetrics(Config.MonitoringConfig mc) + private (double diskRead, double diskWrite, List disks) CollectDiskMetricsWithDemands(Config.MonitoringConfig mc, MetricDemands demands) { - if (!mc.EnableDisk) return (0, 0, []); + if (!mc.EnableDisk || !demands.NeedDisk) return (0, 0, []); double diskRead = 0, diskWrite = 0; var disks = new List(); if (_perDiskCounters is not null) { + int sensorIntervalMs = Math.Max(2000, mc.PollIntervalMs); + bool shouldQueryTemps = (DateTime.UtcNow - _lastDiskTempQuery).TotalMilliseconds >= sensorIntervalMs; + if (shouldQueryTemps) + { + _lastDiskTempQuery = DateTime.UtcNow; + } + for (int i = 0; i < _perDiskCounters.Count; i++) { var (read, write) = _perDiskCounters[i]; @@ -775,6 +1076,8 @@ private TelemetrySnapshot BuildSnapshot() float w = ReadPdh(write) / (1000f * 1000f); diskRead += r; diskWrite += w; + + int? tempC = ResolveDiskTemperature(i, shouldQueryTemps); string busType = i < _diskBusTypes.Count ? _diskBusTypes[i] : _primaryDiskType; disks.Add(new DiskSnapshot { @@ -783,6 +1086,7 @@ private TelemetrySnapshot BuildSnapshot() BusType = busType, ReadMBps = r, WriteMBps = w, + TemperatureC = tempC, }); } } @@ -795,12 +1099,48 @@ private TelemetrySnapshot BuildSnapshot() return (diskRead, diskWrite, disks); } - private (float batteryPct, bool batteryCharging, bool batteryOnAC, float batteryRate) CollectBatteryMetrics(Config.MonitoringConfig mc) + private int? ResolveDiskTemperature(int diskIndex, bool shouldQueryTemps) + { + if (!shouldQueryTemps && _cachedDiskTemps.TryGetValue(diskIndex, out var cached)) + { + return cached; + } + + try + { + var smart = DiskQuery.QuerySmartTelemetry(diskIndex, "Healthy"); + int? tempC = smart.TemperatureC; + _cachedDiskTemps[diskIndex] = tempC; + return tempC; + } + catch (Exception ex) + { + LogMetricErrorOnce("disk", $"disk_{diskIndex}_temp_exception", $"Failed to query SMART temperature for disk {diskIndex}: {ex.Message}"); + return null; + } + } + + private (float batteryPct, bool batteryCharging, bool batteryOnAC, float batteryRate) CollectBatteryMetricsWithDemands(Config.MonitoringConfig mc, MetricDemands demands) { - if (!mc.EnableBattery) return (0, false, true, 0); + if (!mc.EnableBattery || !demands.NeedBattery) return (0, false, true, 0); return ReadBattery(); } + internal (float cpuPct, float cpuTemp, float cpuFreq, float cpuPower) CollectCpuMetrics(Config.MonitoringConfig mc) + => CollectCpuMetricsWithDemands(mc, new MetricDemands(true, true, true, true, true, true, true, true, true, true, true, true, true)); + + internal (float gpuPct, float gpuTemp, float gpuVramUsed, float gpuClock, float gpuPower) CollectGpuMetrics(Config.MonitoringConfig mc) + => CollectGpuMetricsWithDemands(mc, new MetricDemands(true, true, true, true, true, true, true, true, true, true, true, true, true)); + + internal (double netDown, double netUp, string nicName) CollectNetMetrics(Config.MonitoringConfig mc) + => CollectNetMetricsWithDemands(mc, new MetricDemands(true, true, true, true, true, true, true, true, true, true, true, true, true)); + + internal (double diskRead, double diskWrite, List disks) CollectDiskMetrics(Config.MonitoringConfig mc) + => CollectDiskMetricsWithDemands(mc, new MetricDemands(true, true, true, true, true, true, true, true, true, true, true, true, true)); + + internal (float batteryPct, bool batteryCharging, bool batteryOnAC, float batteryRate) CollectBatteryMetrics(Config.MonitoringConfig mc) + => CollectBatteryMetricsWithDemands(mc, new MetricDemands(true, true, true, true, true, true, true, true, true, true, true, true, true)); + private void LogTickMetrics( Config.MonitoringConfig mc, (float pct, float temp, float freq, float power) cpu, @@ -897,10 +1237,12 @@ private float ReadCpuFreq() private const uint MSR_IA32_MPERF = 0xE7; private const uint MSR_RAPL_POWER_UNIT = 0x606; private const uint MSR_PKG_ENERGY_STATUS = 0x611; + private const uint MSR_PP1_ENERGY_STATUS = 0x641; private static readonly ulong[] MsrAperfInput = [MSR_IA32_APERF]; private static readonly ulong[] MsrMperfInput = [MSR_IA32_MPERF]; private static readonly ulong[] MsrRaplPowerUnitInput = [MSR_RAPL_POWER_UNIT]; private static readonly ulong[] MsrPkgEnergyStatusInput = [MSR_PKG_ENERGY_STATUS]; + private static readonly ulong[] MsrPp1EnergyStatusInput = [MSR_PP1_ENERGY_STATUS]; private static readonly ulong[] MsrPkgPowerSkuInput = [MSR_PKG_POWER_SKU]; private float ReadCpuFreqMsr() @@ -1014,16 +1356,13 @@ private float ReadGpuTemp(NvGpuMonitor.NvGpuData? gpu = null) { try { - if (gpu.HasValue && gpu.Value.TempC >= 0) return gpu.Value.TempC; - if (_nvGpu is not null) + if (TryReadHardwareGpuTemp(gpu, out float temp)) + return temp; + + if (!_hasDedicatedGpu && !string.IsNullOrEmpty(_gpuVendor)) { - gpu = _nvGpu.Query(); - if (gpu.HasValue && gpu.Value.TempC >= 0) return gpu.Value.TempC; + return ReadCpuTemp(); } - if (_amdGpu is not null && _amdGpu.IsAvailable) - return _amdGpu.GetTempC(); - if (_intelGpu is not null && _intelGpu.IsAvailable) - return _intelGpu.GetTempC(); } catch (Exception ex) { @@ -1032,20 +1371,70 @@ private float ReadGpuTemp(NvGpuMonitor.NvGpuData? gpu = null) return 0f; } + private bool TryReadHardwareGpuTemp(NvGpuMonitor.NvGpuData? gpu, out float temp) + { + temp = 0f; + if (TryGetNvGpuTemp(gpu, out temp)) + return true; + + if (_amdGpu is { IsAvailable: true }) + { + temp = _amdGpu.GetTempC(); + if (temp > 0) return true; + } + + if (_intelGpu is { IsAvailable: true }) + { + temp = _intelGpu.GetTempC(); + if (temp > 0) return true; + } + + return false; + } + + private bool TryGetNvGpuTemp(NvGpuMonitor.NvGpuData? gpu, out float temp) + { + if (gpu is { TempC: >= 0 }) + { + temp = gpu.Value.TempC; + return true; + } + + if (_nvGpu is not null) + { + var queried = _nvGpu.Query(); + if (queried is { TempC: >= 0 }) + { + temp = queried.Value.TempC; + return true; + } + } + + temp = 0f; + return false; + } + + private const float MaxDedicatedVramMb = 524288f; + private float ReadGpuVramUsedMb(NvGpuMonitor.NvGpuData? gpu = null) { try { - if (gpu.HasValue) return gpu.Value.VramUsedMb; - if (_nvGpu is not null) + if (TryReadDedicatedGpuVram(gpu, out float dedicatedVram)) { - gpu = _nvGpu.Query(); - if (gpu.HasValue) return gpu.Value.VramUsedMb; + return dedicatedVram; + } + + if (_wddmGpu is not null) + { + float sharedMb = _wddmGpu.GetGpuMemoryUsedMb(ActiveGpuLuid); + if (sharedMb > 0) + { + long totalRamBytes = SystemInfo.GetTotalRamBytes(); + float maxSharedMemMb = totalRamBytes > 0 ? (float)(totalRamBytes / (1024.0 * 1024.0)) : 131072f; + return Math.Clamp(sharedMb, 0f, maxSharedMemMb); + } } - if (_amdGpu is not null && _amdGpu.IsAvailable) - return _amdGpu.GetVram().usedMb; - if (_intelGpu is not null && _intelGpu.IsAvailable) - return _intelGpu.GetVram().usedMb; } catch (Exception ex) { @@ -1054,6 +1443,48 @@ private float ReadGpuVramUsedMb(NvGpuMonitor.NvGpuData? gpu = null) return 0f; } + private bool TryReadDedicatedGpuVram(NvGpuMonitor.NvGpuData? gpu, out float vram) + { + if (gpu.HasValue && gpu.Value.VramUsedMb > 0 && gpu.Value.VramUsedMb <= MaxDedicatedVramMb) + { + vram = gpu.Value.VramUsedMb; + return true; + } + + if (_nvGpu is not null) + { + gpu = _nvGpu.Query(); + if (gpu.HasValue && gpu.Value.VramUsedMb > 0 && gpu.Value.VramUsedMb <= MaxDedicatedVramMb) + { + vram = gpu.Value.VramUsedMb; + return true; + } + } + + if (_amdGpu is { IsAvailable: true }) + { + float amdVram = _amdGpu.GetVram().usedMb; + if (amdVram > 0 && amdVram <= MaxDedicatedVramMb) + { + vram = amdVram; + return true; + } + } + + if (_intelGpu is { IsAvailable: true }) + { + float intelVram = _intelGpu.GetVram().usedMb; + if (intelVram > 0 && intelVram <= MaxDedicatedVramMb) + { + vram = intelVram; + return true; + } + } + + vram = 0f; + return false; + } + private float ReadGpuFreqMHz(NvGpuMonitor.NvGpuData? gpu = null) { try @@ -1091,6 +1522,10 @@ private float ReadGpuPowerW(NvGpuMonitor.NvGpuData? gpu = null) float w = _amdGpu.GetPowerDrawW(); if (w > 0) return w; } + if (!_hasDedicatedGpu && _gpuVendor == IntelVendor) + { + return ReadIntelGpuPowerRapl(); + } } catch (Exception ex) { @@ -1099,6 +1534,51 @@ private float ReadGpuPowerW(NvGpuMonitor.NvGpuData? gpu = null) return 0f; } + private float ReadIntelGpuPowerRapl() + { + if (_pawnIoDevice is null) + return 0f; + + if (_energyUnit <= 0) + ReadRaplPowerUnit(); + if (_energyUnit <= 0) + return 0f; + + try + { + var pp1Result = _pawnIoDevice.Execute(IoctlReadMsrCommand, MsrPp1EnergyStatusInput, 1); + if (pp1Result.Length < 1) + return 0f; + + ulong energy = pp1Result[0] & 0xFFFFFFFF; + + var now = DateTime.UtcNow; + if (!_hasGpuEnergyPrimed) + { + _prevGpuEnergy = energy; + _prevGpuEnergyTime = now; + _hasGpuEnergyPrimed = true; + return 0f; + } + + ulong dEnergy = (uint)(energy - _prevGpuEnergy); + double dt = (now - _prevGpuEnergyTime).TotalSeconds; + _prevGpuEnergy = energy; + _prevGpuEnergyTime = now; + + if (dt <= 0) return 0f; + + double joules = dEnergy * _energyUnit; + float watts = (float)(joules / dt); + return Math.Clamp(watts, 0f, 300f); + } + catch (Exception ex) + { + LogMetricErrorOnce("gpu", "rapl_pp1_energy_failed", $"Failed to read RAPL PP1 energy status: {ex.Message}"); + return 0f; + } + } + // RAPL CPU power (MSR_PKG_ENERGY_STATUS delta) private void ReadRaplPowerUnit() { @@ -1283,23 +1763,60 @@ private float LogAndFallbackAmdTemp(ref int loggedFlag, string errorMessage) return 0f; } + private static bool _wmiCpuTempAvailable = true; + private static int _wmiCpuTempFailures; + private static long _lastWmiCpuTempQueryTicks; + internal static bool ResetWmiCpuTempForTesting { get; set; } + private static float ReadWmiCpuTemp() { + if (ResetWmiCpuTempForTesting) + { + _wmiCpuTempAvailable = true; + _wmiCpuTempFailures = 0; + _lastWmiCpuTempQueryTicks = 0; + ResetWmiCpuTempForTesting = false; + } + + long now = Stopwatch.GetTimestamp(); + if (!_wmiCpuTempAvailable && _lastWmiCpuTempQueryTicks > 0 && + (now - _lastWmiCpuTempQueryTicks) < (Stopwatch.Frequency * 60)) + { + return 0f; + } + try { - using var searcher = new System.Management.ManagementObjectSearcher(@"root\wmi", "SELECT CurrentTemperature FROM MSAcpi_ThermalZoneTemperature"); - foreach (var obj in searcher.Get()) + _lastWmiCpuTempQueryTicks = now; + using var searcher = new ManagementObjectSearcher(@"root\wmi", "SELECT CurrentTemperature FROM MSAcpi_ThermalZoneTemperature"); + using var coll = searcher.Get(); + foreach (ManagementBaseObject obj in coll) { - if (obj["CurrentTemperature"] is uint rawKelvin10 && rawKelvin10 > 2732) + using (obj) { - float celsius = (rawKelvin10 - 2732) / 10.0f; - if (celsius is >= 15f and <= 125f) - return celsius; + if (obj["CurrentTemperature"] is uint rawKelvin10 && rawKelvin10 > 2732) + { + float celsius = (rawKelvin10 - 2732) / 10.0f; + if (celsius is >= 15f and <= 125f) + { + _wmiCpuTempAvailable = true; + _wmiCpuTempFailures = 0; + return celsius; + } + } } } + + _wmiCpuTempFailures++; + if (_wmiCpuTempFailures >= 2) + { + _wmiCpuTempAvailable = false; + } } catch (Exception ex) { + _wmiCpuTempFailures++; + _wmiCpuTempAvailable = false; Log.Debug(ex, "WMI thermal zone temperature query unavailable"); } return 0f; @@ -1307,7 +1824,7 @@ private static float ReadWmiCpuTemp() private bool _wasOfflineLogged; - // Network via NetworkInterface.GetIPv4Statistics delta + // Network via NetworkInterface.GetIPStatistics / GetIPv4Statistics delta private void EnsureNicCounters() { string pref = _cfg.Monitoring.PreferredNic; @@ -1315,10 +1832,8 @@ private void EnsureNicCounters() if (pref == _lastPreferredNic && _nicInterface is { OperationalStatus: OperationalStatus.Up }) return; - _lastPreferredNic = pref; - _nicInterface = null; - _nicPrimed = false; + _lastPreferredNic = pref; try { @@ -1327,21 +1842,23 @@ private void EnsureNicCounters() : SelectActiveNic(pref); if (selected is not null) { + bool adapterChanged = !string.Equals(_lastBoundNicId, selected.Id, StringComparison.OrdinalIgnoreCase); _nicInterface = selected; _nicInstanceName = selected.Name; _wasOfflineLogged = false; - if (!string.Equals(_lastBoundNicId, selected.Id, StringComparison.OrdinalIgnoreCase)) + if (adapterChanged) { _lastBoundNicId = selected.Id; Log.Info($"Connected to network adapter '{selected.Name}' ({selected.Description})"); + PrimeNicCounters(selected); } - PrimeNicCounters(selected); } else { _nicInterface = null; _nicInstanceName = string.Empty; _lastBoundNicId = null; + _nicPrimed = false; if (!_wasOfflineLogged) { Log.Info("Offline / no active network adapter connected"); @@ -1382,7 +1899,15 @@ private static (NetworkInterface? selected, bool hasGateway) SelectActiveNic(str || n.Description.Contains(pref, StringComparison.OrdinalIgnoreCase) || pref.Contains(n.Name, StringComparison.OrdinalIgnoreCase)); } - selected ??= withGateway.FirstOrDefault() ?? allNics.FirstOrDefault(); + + // Prioritize physical wired adapters with gateway, then physical wireless with gateway + selected ??= withGateway.FirstOrDefault(n => n.NetworkInterfaceType == NetworkInterfaceType.Ethernet) + ?? withGateway.FirstOrDefault(n => n.NetworkInterfaceType == NetworkInterfaceType.Wireless80211) + ?? withGateway.FirstOrDefault() + ?? allNics.FirstOrDefault(n => n.NetworkInterfaceType == NetworkInterfaceType.Ethernet) + ?? allNics.FirstOrDefault(n => n.NetworkInterfaceType == NetworkInterfaceType.Wireless80211) + ?? allNics.FirstOrDefault(); + return (selected, withGateway.Count > 0); } @@ -1411,9 +1936,23 @@ private void PrimeNicCounters(NetworkInterface selected) if (ThrowInPrimeNicForTesting) throw new InvalidOperationException("Simulated prime NIC error"); - var stats = selected.GetIPv4Statistics(); - _prevRx = stats.BytesReceived; - _prevTx = stats.BytesSent; + long rx, tx; + try + { + var stats = selected.GetIPStatistics(); + rx = stats.BytesReceived; + tx = stats.BytesSent; + } + catch (Exception ex) + { + Log.Debug(ex, $"GetIPStatistics failed on interface '{selected.Name}', querying GetIPv4Statistics"); + var stats4 = selected.GetIPv4Statistics(); + rx = stats4.BytesReceived; + tx = stats4.BytesSent; + } + + _prevRx = rx; + _prevTx = tx; _prevNicTime = DateTime.UtcNow; _nicPrimed = true; Log.Debug($"Network counters primed: RX {_prevRx} bytes, TX {_prevTx} bytes"); @@ -1440,10 +1979,19 @@ public static bool IsVirtualAdapter(NetworkInterface n) || desc.Contains("loopback", StringComparison.OrdinalIgnoreCase) || desc.Contains("wan miniport", StringComparison.OrdinalIgnoreCase) || desc.Contains("wfp native mac", StringComparison.OrdinalIgnoreCase) + || desc.Contains("filter driver", StringComparison.OrdinalIgnoreCase) + || desc.Contains("packet scheduler", StringComparison.OrdinalIgnoreCase) + || desc.Contains("lightweight filter", StringComparison.OrdinalIgnoreCase) || desc.Contains("filter-", StringComparison.OrdinalIgnoreCase) + || desc.Contains("-filter", StringComparison.OrdinalIgnoreCase) + || desc.Contains("virtual switch", StringComparison.OrdinalIgnoreCase) || name.StartsWith("vEthernet", StringComparison.OrdinalIgnoreCase) || name.StartsWith("WSL", StringComparison.OrdinalIgnoreCase) - || name.StartsWith("Local Area Connection*", StringComparison.OrdinalIgnoreCase); + || name.StartsWith("Local Area Connection*", StringComparison.OrdinalIgnoreCase) + || name.Contains("-WFP", StringComparison.OrdinalIgnoreCase) + || name.Contains("-QoS", StringComparison.OrdinalIgnoreCase) + || name.Contains("-Native WiFi", StringComparison.OrdinalIgnoreCase) + || name.Contains("-Filter", StringComparison.OrdinalIgnoreCase); } private (double downBps, double upBps) ReadNetBytes() @@ -1455,12 +2003,29 @@ public static bool IsVirtualAdapter(NetworkInterface n) try { - var stats = _nicInterface.GetIPv4Statistics(); - return CalculateNetBytesDelta(stats.BytesReceived, stats.BytesSent); + long rx, tx; + try + { + var stats = _nicInterface.GetIPStatistics(); + rx = stats.BytesReceived; + tx = stats.BytesSent; + } + catch (Exception ex) + { + Log.Debug(ex, $"GetIPStatistics failed on interface '{_nicInterface.Name}', querying GetIPv4Statistics"); + var stats4 = _nicInterface.GetIPv4Statistics(); + rx = stats4.BytesReceived; + tx = stats4.BytesSent; + } + + return CalculateNetBytesDelta(rx, tx); } catch (Exception ex) { LogMetricErrorOnce("net", "net_read_exception", $"Failed to read network adapter statistics: {ex.Message}"); + _nicInterface = null; + _nicPrimed = false; + _lastPreferredNic = UnsetPreferredNic; return (0, 0); } } @@ -1543,7 +2108,7 @@ private float QueryBatteryRateW() new ObjectQuery("SELECT RemainingCapacity, ChargeRate, DischargeRate FROM BatteryStatus")); using var coll = _batterySearcher.Get(); - var mo = coll.Cast().FirstOrDefault(); + using var mo = coll.Cast().FirstOrDefault(); if (mo is null) return 0f; // Direct charge/discharge rate (milliwatts) - same source as HWInfo @@ -1678,6 +2243,7 @@ private void ResetGpuMonitors(string reason) private void OnPowerSuspended() { + _isPowerSuspended = true; _isSuspended = true; try { @@ -1701,28 +2267,34 @@ private void OnPowerResumed() try { await Task.Delay(PowerResumeWarmUpDelayMs).ConfigureAwait(false); + _isPowerSuspended = false; + if (_isSessionLocked) + { + _needsPowerResumeWarmUp = true; + _isSuspended = true; + Log.Info("System resumed from sleep, but workstation is locked: keeping hardware polling paused until unlock"); + return; + } + + _isSuspended = false; ExecutePowerResumeWarmUp(); } catch (Exception ex) { Log.Error($"Error during resume warm-up: {ex.Message}"); } - finally - { - _isSuspended = false; - } }); } internal void ExecutePowerResumeWarmUp() { - if (_disposed) return; + if (_disposed || _isSessionLocked) return; if (ThrowInPowerResumeWarmUpForTesting) throw new InvalidOperationException("Simulated power resume warm-up error"); ResetGpuMonitors("system power resume"); - _lastPreferredNic = "~~unset~~"; + _lastPreferredNic = UnsetPreferredNic; EnsureNicCounters(); int ms = Math.Max(100, _cfg.Monitoring.PollIntervalMs); @@ -1732,14 +2304,14 @@ internal void ExecutePowerResumeWarmUp() private void OnNetworkTopologyChanged() { - if (_isSuspended) return; + if (_isSuspended || _isPowerSuspended || _isSessionLocked) return; try { if (ThrowInNetworkChangeForTesting) throw new InvalidOperationException("Simulated network change error"); Log.Debug("Network topology changed, refreshing NIC binding"); - _lastPreferredNic = "~~unset~~"; + _lastPreferredNic = UnsetPreferredNic; EnsureNicCounters(); } catch (Exception ex) @@ -1750,7 +2322,7 @@ private void OnNetworkTopologyChanged() private void OnDevicePnPChanged() { - if (_isSuspended) return; + if (_isSuspended || _isPowerSuspended || _isSessionLocked) return; try { if (ThrowInDevicePnPForTesting) @@ -1758,6 +2330,8 @@ private void OnDevicePnPChanged() Log.Debug("Device PnP event, refreshing disk cache"); DiskQuery.RefreshDiskCache(); + _cachedDiskTemps.Clear(); + _lastDiskTempQuery = DateTime.MinValue; } catch (Exception ex) { @@ -1765,6 +2339,39 @@ private void OnDevicePnPChanged() } } + private void OnSessionLockStateChanged(bool isLocked) + { + if (_disposed) return; + _isSessionLocked = isLocked; + _isSuspended = _isPowerSuspended || _isSessionLocked; + + if (isLocked) + { + Log.Info("Workstation locked: pausing hardware polling"); + _timer?.Change(Timeout.Infinite, Timeout.Infinite); + } + else + { + Log.Info("Workstation unlocked: resuming hardware polling"); + if (_isPowerSuspended) + { + Log.Debug("System power is still suspended; keeping polling paused"); + return; + } + + if (_needsPowerResumeWarmUp) + { + _needsPowerResumeWarmUp = false; + ExecutePowerResumeWarmUp(); + } + else + { + int ms = Math.Max(100, _cfg.Monitoring.PollIntervalMs); + _timer?.Change(0, ms); + } + } + } + /// Releases all managed and unmanaged resources. public void Dispose() { @@ -1776,6 +2383,7 @@ public void Dispose() _lifecycleManager.PowerResumed -= OnPowerResumed; _lifecycleManager.NetworkTopologyChanged -= OnNetworkTopologyChanged; _lifecycleManager.DevicePnPChanged -= OnDevicePnPChanged; + _lifecycleManager.SessionLockStateChanged -= OnSessionLockStateChanged; _timer?.Dispose(); _diskRead?.Dispose(); @@ -1784,8 +2392,8 @@ public void Dispose() { foreach (var (read, write) in _perDiskCounters) { - read.Dispose(); - write.Dispose(); + read?.Dispose(); + write?.Dispose(); } } _intelPwrGadget?.Dispose(); diff --git a/src/LocalTelemetry.Core/Hardware/IntelGpuMonitor.cs b/src/LocalTelemetry.Core/Hardware/IntelGpuMonitor.cs index 9fffa8b..0804e67 100644 --- a/src/LocalTelemetry.Core/Hardware/IntelGpuMonitor.cs +++ b/src/LocalTelemetry.Core/Hardware/IntelGpuMonitor.cs @@ -91,7 +91,7 @@ public float GetClockMHz() { if (!IsAvailable || _memHandle == IntPtr.Zero) return (0, 0); int ret = _native.GetVram(_memHandle, out ulong totalBytes, out ulong freeBytes); - if (ret != CtlResultSuccess) return (0, 0); + if (ret != CtlResultSuccess || totalBytes == 0 || freeBytes > totalBytes) return (0, 0); float totalMb = (float)(totalBytes / (1024.0 * 1024.0)); float usedMb = (float)((totalBytes - freeBytes) / (1024.0 * 1024.0)); return (usedMb, totalMb); @@ -212,6 +212,7 @@ public int Init(out IntPtr apiHandle) var initArgs = default(CtlInitArgs); initArgs.Size = (uint)Marshal.SizeOf(); initArgs.Version = 0; + initArgs.AppVersion = 1 << 16; initArgs.flags = 1; return InitFunc(ref initArgs, out apiHandle); } @@ -428,9 +429,9 @@ internal struct CtlInitArgs { public uint Size; public byte Version; - public ulong AppVersion; + public uint AppVersion; public uint flags; - public ulong SupportedVersion; + public uint SupportedVersion; public Guid ApplicationUID; } @@ -442,32 +443,24 @@ internal struct CtlDeviceAdapterProperties public IntPtr pDeviceID; public uint device_id_size; public uint device_type; - public uint supported_subfunction_flags; - public ulong driver_version; - public CtlFirmwareVersion firmware_version; - public uint pci_vendor_id; - public uint pci_device_id; + public uint flags; public uint rev_id; - public uint num_eus_per_sub_slice; - public uint num_sub_slices_per_slice; - public uint num_slices; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + public uint subsys_id; + public uint subsys_vendor_id; + public uint graphics_vendor_id; + public uint device_vendor_id; + public ulong driver_version; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)] public string? name; - public uint graphics_adapter_properties; - public uint Frequency; - public ushort pci_subsys_id; - public ushort pci_subsys_vendor_id; - public CtlAdapterBdf adapter_bdf; - public uint num_xe_cores; - } - - [StructLayout(LayoutKind.Sequential)] - internal struct CtlFirmwareVersion - { - public ushort major; - public ushort minor; - public ushort build; - public ushort revision; + public CtlAdapterBdf address; + public ulong max_mem_bandwidth; + public ulong max_gpu_clock_freq; + public uint num_eus_per_subslice; + public uint num_subslices_per_slice; + public uint num_slices; + public ulong memory_size; + public uint memory_type; + public uint core_frequency; } [StructLayout(LayoutKind.Sequential)] diff --git a/src/LocalTelemetry.Core/Hardware/JsonlTrafficImporter.cs b/src/LocalTelemetry.Core/Hardware/JsonlTrafficImporter.cs index 0943ae0..7391549 100644 --- a/src/LocalTelemetry.Core/Hardware/JsonlTrafficImporter.cs +++ b/src/LocalTelemetry.Core/Hardware/JsonlTrafficImporter.cs @@ -1,20 +1,60 @@ +using System.Globalization; using System.Text.Json; namespace LocalTelemetry.Core.Hardware; -/// Imports network traffic usage records from JSON Lines (.jsonl) backup files. +/// Imports network traffic usage records from JSON Lines (.jsonl) or JSON array backup files. public static class JsonlTrafficImporter { - /// Parses JSONL content and merges valid records into . - /// Raw JSONL string containing line-delimited JSON usage records. + /// Parses JSONL or JSON array content and merges valid records into . + /// Raw string containing line-delimited JSON or a JSON array of usage records. /// Number of distinct days successfully imported or updated. public static int Import(string content) { if (string.IsNullOrWhiteSpace(content)) return 0; + string trimmed = content.TrimStart('\uFEFF', ' ', '\t', '\r', '\n'); + if (string.IsNullOrWhiteSpace(trimmed)) return 0; + var uniqueDays = new HashSet<(int year, int month, int day)>(); - using var reader = new StringReader(content); + if (trimmed.StartsWith('[')) + { + ImportJsonArray(trimmed, uniqueDays); + } + else + { + ImportJsonLines(trimmed, uniqueDays); + } + + return uniqueDays.Count; + } + + private static void ImportJsonArray(string content, HashSet<(int year, int month, int day)> uniqueDays) + { + try + { + using var doc = JsonDocument.Parse(content); + if (doc.RootElement.ValueKind != JsonValueKind.Array) return; + + foreach (var element in doc.RootElement.EnumerateArray()) + { + if (element.ValueKind == JsonValueKind.Object && TryParseElement(element, out var record)) + { + ApplyRecord(record, uniqueDays); + } + } + } + catch (JsonException ex) + { + Diagnostics.Log.Debug(ex, "Failed to parse content as single JSON array, reading as line-by-line JSONL"); + ImportJsonLines(content, uniqueDays); + } + } + + private static void ImportJsonLines(string content, HashSet<(int year, int month, int day)> uniqueDays) + { + using var reader = new StringReader(content); string? line; while ((line = reader.ReadLine()) is not null) { @@ -22,20 +62,23 @@ public static int Import(string content) if (TryParseRecord(line, out var record)) { - TrafficHistoryStore.SetDay( - record.Year, - record.Month, - record.Day, - record.DownBytes, - record.UpBytes, - string.IsNullOrEmpty(record.Interface) ? "Backup" : record.Interface, - string.IsNullOrEmpty(record.Source) ? "JsonlImport" : record.Source); - - uniqueDays.Add((record.Year, record.Month, record.Day)); + ApplyRecord(record, uniqueDays); } } + } - return uniqueDays.Count; + private static void ApplyRecord(DailyRecord record, HashSet<(int year, int month, int day)> uniqueDays) + { + TrafficHistoryStore.SetDay( + record.Year, + record.Month, + record.Day, + record.DownBytes, + record.UpBytes, + string.IsNullOrEmpty(record.Interface) ? "Backup" : record.Interface, + string.IsNullOrEmpty(record.Source) ? "JsonlImport" : record.Source); + + uniqueDays.Add((record.Year, record.Month, record.Day)); } private static bool TryParseRecord(string line, out DailyRecord record) @@ -48,26 +91,48 @@ record = default; var root = doc.RootElement; if (root.ValueKind != JsonValueKind.Object) return false; - string? dateStr = root.TryGetProperty("date", out var d) ? d.GetString() : null; - if (string.IsNullOrWhiteSpace(dateStr) || dateStr.Length < 10) return false; - - if (!TryParseDate(dateStr, out int year, out int month, out int day)) return false; - - var (downBytes, upBytes) = ParseByteCounts(root); - string iface = root.TryGetProperty("interface", out var i) ? i.GetString() ?? "" : ""; - string source = root.TryGetProperty("source", out var s) ? s.GetString() ?? "JsonlImport" : "JsonlImport"; - - record = new DailyRecord(year, month, day, downBytes, upBytes, iface, source); - return true; + return TryParseElement(root, out record); } - catch (JsonException) + catch (JsonException ex) { + Diagnostics.Log.Debug(ex, "Failed to parse JSONL line as JSON document"); return false; } - catch (FormatException) + } + + private static bool TryParseElement(JsonElement root, out DailyRecord record) + { + record = default; + + string? dateStr = root.TryGetProperty("date", out var d) ? d.GetString() : null; + if (string.IsNullOrWhiteSpace(dateStr)) return false; + + dateStr = dateStr.Trim(); + int tIdx = dateStr.IndexOfAny(['T', 't', ' ']); + if (tIdx > 0) { - return false; + dateStr = dateStr[..tIdx]; } + + if (dateStr.Length < 10) return false; + + if (!TryParseDate(dateStr, out int year, out int month, out int day)) return false; + + if (!TryParseByteCounts(root, out long downBytes, out long upBytes)) return false; + + string iface = SanitizeString(root.TryGetProperty("interface", out var i) ? i.GetString() : null, 64, "Backup"); + string source = SanitizeString(root.TryGetProperty("source", out var s) ? s.GetString() : null, 64, "JsonlImport"); + + record = new DailyRecord(year, month, day, downBytes, upBytes, iface, source); + return true; + } + + private static string SanitizeString(string? raw, int maxLength, string fallback) + { + if (string.IsNullOrWhiteSpace(raw)) return fallback; + string cleaned = raw.Replace('\r', ' ').Replace('\n', ' ').Trim(); + if (cleaned.Length > maxLength) cleaned = cleaned[..maxLength].Trim(); + return string.IsNullOrEmpty(cleaned) ? fallback : cleaned; } private static bool TryParseDate(string s, out int year, out int month, out int day) @@ -77,32 +142,85 @@ private static bool TryParseDate(string s, out int year, out int month, out int { char sep = s[2]; var p = s.Split(sep); - if (p.Length == 3 && int.TryParse(p[2], out year) && int.TryParse(p[1], out month) && int.TryParse(p[0], out day)) + if (p.Length == 3 && int.TryParse(p[2], NumberStyles.Integer, CultureInfo.InvariantCulture, out year) + && int.TryParse(p[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out month) + && int.TryParse(p[0], NumberStyles.Integer, CultureInfo.InvariantCulture, out day)) + { return year >= 2000 && year <= 2100 && month >= 1 && month <= 12 && day >= 1 && day <= 31; + } } - else if (s.Length >= 10 && s[4] == '-') + else if (s.Length >= 10 && (s[4] == '-' || s[4] == '/')) { - var p = s.Split('-'); - if (p.Length == 3 && int.TryParse(p[0], out year) && int.TryParse(p[1], out month) && int.TryParse(p[2], out day)) + char sep = s[4]; + var p = s.Split(sep); + if (p.Length == 3 && int.TryParse(p[0], NumberStyles.Integer, CultureInfo.InvariantCulture, out year) + && int.TryParse(p[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out month) + && int.TryParse(p[2], NumberStyles.Integer, CultureInfo.InvariantCulture, out day)) + { return year >= 2000 && year <= 2100 && month >= 1 && month <= 12 && day >= 1 && day <= 31; + } } return false; } - private static (long downBytes, long upBytes) ParseByteCounts(JsonElement root) + private static bool TryParseByteCounts(JsonElement root, out long downBytes, out long upBytes) { - if (root.TryGetProperty("download_bytes", out var db) && root.TryGetProperty("upload_bytes", out var ub)) + downBytes = 0; + upBytes = 0; + + if (root.TryGetProperty("download_bytes", out _) || root.TryGetProperty("upload_bytes", out _)) { - return (db.GetInt64(), ub.GetInt64()); + return TryReadByteCount(root, "download_bytes", out downBytes) + && TryReadByteCount(root, "upload_bytes", out upBytes); } - if (root.TryGetProperty("down", out var dn) && root.TryGetProperty("up", out var up)) + + if (root.TryGetProperty("down", out _) || root.TryGetProperty("up", out _)) { - return (dn.GetInt64(), up.GetInt64()); + return TryReadByteCount(root, "down", out downBytes) + && TryReadByteCount(root, "up", out upBytes); } - long downBytes = root.TryGetProperty("down_bytes", out var dnb) ? dnb.GetInt64() : 0; - long upBytes = root.TryGetProperty("up_bytes", out var upb) ? upb.GetInt64() : 0; - return (downBytes, upBytes); + if (root.TryGetProperty("down_bytes", out _) || root.TryGetProperty("up_bytes", out _)) + { + return TryReadByteCount(root, "down_bytes", out downBytes) + && TryReadByteCount(root, "up_bytes", out upBytes); + } + + if (root.TryGetProperty("rx_bytes", out _) || root.TryGetProperty("tx_bytes", out _)) + { + return TryReadByteCount(root, "rx_bytes", out downBytes) + && TryReadByteCount(root, "tx_bytes", out upBytes); + } + + if (root.TryGetProperty("bytes_in", out _) || root.TryGetProperty("bytes_out", out _)) + { + return TryReadByteCount(root, "bytes_in", out downBytes) + && TryReadByteCount(root, "bytes_out", out upBytes); + } + + return true; + } + + private static bool TryReadByteCount(JsonElement root, string propName, out long bytes) + { + bytes = 0; + if (!root.TryGetProperty(propName, out var el)) + { + return true; + } + + if (el.ValueKind == JsonValueKind.Number) + { + return el.TryGetInt64(out bytes) && bytes >= 0; + } + + if (el.ValueKind == JsonValueKind.String) + { + string? s = el.GetString(); + return long.TryParse(s, NumberStyles.Integer, CultureInfo.InvariantCulture, out bytes) && bytes >= 0; + } + + return false; } } diff --git a/src/LocalTelemetry.Core/Hardware/NetUsageLogger.cs b/src/LocalTelemetry.Core/Hardware/NetUsageLogger.cs index 617e9ac..992f5f6 100644 --- a/src/LocalTelemetry.Core/Hardware/NetUsageLogger.cs +++ b/src/LocalTelemetry.Core/Hardware/NetUsageLogger.cs @@ -9,10 +9,11 @@ public sealed class NetUsageLogger : IDisposable { private readonly AppSettings _cfg; private readonly TrafficHistoryFile _historyFile; - private readonly object _lock = new(); + private readonly Lock _lock = new(); private readonly Dictionary _perInterface = []; private DateTime _lastDate; private DateTime _lastSnapTime; + private DateTime _lastFlushTime = DateTime.UtcNow; public TrafficHistoryFile HistoryFile => _historyFile; @@ -60,6 +61,8 @@ public void SyncWithHistory() public void Record(TelemetrySnapshot snap) { if (!_cfg.NetUsage.Enabled) return; + if (double.IsNaN(snap.NetDownBps) || double.IsNaN(snap.NetUpBps)) return; + if (snap.NetDownBps < 0 || snap.NetUpBps < 0) return; string activeNic = snap.NetInterfaceName; double actualDt = CalculateDeltaSeconds(snap.Timestamp); @@ -80,15 +83,34 @@ public void Record(TelemetrySnapshot snap) var val = _perInterface[activeNic]; _historyFile.SetDay(today.Year, today.Month, today.Day, (long)val.down, (long)val.up, activeNic, "LocalTelemetry"); + + if ((DateTime.UtcNow - _lastFlushTime).TotalSeconds >= 60) + { + _lastFlushTime = DateTime.UtcNow; + _historyFile.Save(); + } } } private double CalculateDeltaSeconds(DateTime timestamp) { - double dt = _lastSnapTime == default - ? _cfg.Monitoring.PollIntervalMs / 1000.0 - : (timestamp - _lastSnapTime).TotalSeconds; + double normalDt = _cfg.Monitoring.PollIntervalMs / 1000.0; + if (_lastSnapTime == default) + { + _lastSnapTime = timestamp; + return normalDt; + } + + double dt = (timestamp - _lastSnapTime).TotalSeconds; _lastSnapTime = timestamp; + + // If clock jumped backwards or excessive pause occurred (e.g. system sleep/hibernation), + // clamp dt to poll interval to prevent huge anomalous traffic spikes. + if (dt <= 0 || dt > normalDt * 3.0) + { + return normalDt; + } + return dt; } @@ -107,6 +129,7 @@ private void HandleDayRollover(DateTime today) _lastDate = today; SeedTodayRecords(today); + TrafficHistoryStore.NotifyHistoryUpdated(); } private void SeedTodayRecords(DateTime today) diff --git a/src/LocalTelemetry.Core/Hardware/NvGpuMonitor.cs b/src/LocalTelemetry.Core/Hardware/NvGpuMonitor.cs index 4f0aa18..6e9900c 100644 --- a/src/LocalTelemetry.Core/Hardware/NvGpuMonitor.cs +++ b/src/LocalTelemetry.Core/Hardware/NvGpuMonitor.cs @@ -24,7 +24,7 @@ public sealed class NvGpuMonitor : IDisposable public static NvGpuData? LatestData { get; private set; } private readonly INvGpuNative _native; - private readonly object _syncLock = new(); + private readonly Lock _syncLock = new(); private IntPtr _device = IntPtr.Zero; private bool _initialized; private DateTime _lastFailureTime = DateTime.MinValue; @@ -155,8 +155,7 @@ private void HandleDeviceLost(int ret) if (!ReadTemperature(ref data, ref metricsRead) || !ReadUtilization(ref data, ref metricsRead) || - !ReadMemory(ref data, ref metricsRead) || - !ReadClocksAndPower(ref data, ref metricsRead)) + !ReadMemory(ref data, ref metricsRead)) { return null; } @@ -166,6 +165,11 @@ private void HandleDeviceLost(int ret) return HandleNoMetricsRead(); } + if (!ReadClocksAndPower(ref data, ref metricsRead)) + { + return null; + } + _consecutiveUnknownFailures = 0; LatestData = data; return data; diff --git a/src/LocalTelemetry.Core/Hardware/PawnIo/PawnIoDevice.cs b/src/LocalTelemetry.Core/Hardware/PawnIo/PawnIoDevice.cs index e5d00ca..4c3e566 100644 --- a/src/LocalTelemetry.Core/Hardware/PawnIo/PawnIoDevice.cs +++ b/src/LocalTelemetry.Core/Hardware/PawnIo/PawnIoDevice.cs @@ -304,6 +304,8 @@ public static bool TryInstall() try { File.Delete(installerPath); } catch (Exception ex) { Log.Error(ex, "Failed to delete temporary installer file"); } } + DeletePawnIoTempFiles(); + Log.Info($"PawnIO installer completed with exit code {exitCode}"); if (exitCode == 0) @@ -386,6 +388,41 @@ public static void CleanupStaleInstall() string programFilesPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "PawnIO"); try { if (Directory.Exists(programFilesPath)) Directory.Delete(programFilesPath, true); } catch (Exception ex) { Log.Error(ex, "Delete Program Files cleanup failed"); } + + DeletePawnIoTempFiles(); + } + + internal static void DeletePawnIoTempFiles() + { + var tempDirs = new List { Path.GetTempPath() }; + string winTemp = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "Temp"); + if (!tempDirs.Contains(winTemp, StringComparer.OrdinalIgnoreCase)) + tempDirs.Add(winTemp); + + foreach (string dir in tempDirs.Where(Directory.Exists)) + { + DeletePawnIoEntriesInDirectory(dir); + } + } + + private static void DeletePawnIoEntriesInDirectory(string dir) + { + try + { + foreach (string file in Directory.EnumerateFiles(dir, "PawnIO_*")) + { + try { File.Delete(file); } catch (Exception ex) { Log.Debug(ex, $"Failed to delete temp file: {file}"); } + } + + foreach (string subDir in Directory.EnumerateDirectories(dir, "PawnIO_*")) + { + try { Directory.Delete(subDir, true); } catch (Exception ex) { Log.Debug(ex, $"Failed to delete temp directory: {subDir}"); } + } + } + catch (Exception ex) + { + Log.Debug(ex, $"Failed to enumerate temp files in: {dir}"); + } } private static void RunSc(string args) diff --git a/src/LocalTelemetry.Core/Hardware/SystemInfo.cs b/src/LocalTelemetry.Core/Hardware/SystemInfo.cs index b81c89d..a68cbd4 100644 --- a/src/LocalTelemetry.Core/Hardware/SystemInfo.cs +++ b/src/LocalTelemetry.Core/Hardware/SystemInfo.cs @@ -36,7 +36,10 @@ public static class SystemInfo // Vendor and label constants private const string IntelVendor = "Intel"; private const string NvidiaVendor = "NVIDIA"; + private const string AmdVendor = "AMD"; private const string UnknownLabel = "Unknown"; + private const string ManufacturerProperty = "Manufacturer"; + private const string LgEnergyBrand = "LG Energy"; private const string SkipSmbiosSpeedForTestingMessage = "Skip SMBIOS speed for testing"; // Caches (populated on first call, never re-read) @@ -68,11 +71,14 @@ private static string QueryWmiFirst(string query, string property) using var results = searcher.Get(); foreach (ManagementBaseObject mo in results) { - object? val = mo[property]; - if (val is not null) + using (mo) { - string s = val.ToString()?.Trim() ?? ""; - if (s.Length > 0) return s; + object? val = mo[property]; + if (val is not null) + { + string s = val.ToString()?.Trim() ?? ""; + if (s.Length > 0) return s; + } } } } @@ -93,11 +99,14 @@ private static int QueryWmiFirstInt(string query, string property) using var results = searcher.Get(); foreach (ManagementBaseObject mo in results) { - object? val = mo[property]; - if (val is not null) + using (mo) { - string s = val.ToString()?.Trim() ?? ""; - if (s.Length > 0 && int.TryParse(s, out int n)) return n; + object? val = mo[property]; + if (val is not null) + { + string s = val.ToString()?.Trim() ?? ""; + if (s.Length > 0 && int.TryParse(s, out int n)) return n; + } } } } @@ -922,11 +931,38 @@ public static int GetCpuBaseSpeedMhz() public static (string Name, string Vendor, bool IsDedicated, long? VramBytes, string? DriverVersion)[] GetGpus() { if (_gpusCache is not null) return _gpusCache; - var results = new List<(string, string, bool, long?, string?)>(); + var results = new List<(string Name, string Vendor, bool IsDedicated, long? VramBytes, string? DriverVersion)>(); var displayGuid = NativeMethods.GUID_DISPLAY; - IntPtr devInfoSet = NativeMethods.SetupDiGetClassDevs(ref displayGuid, IntPtr.Zero, - IntPtr.Zero, NativeMethods.DIGCF_PRESENT); - if (devInfoSet.ToInt64() == -1) return []; + + if (!EnumerateGpusFromDeviceSet(displayGuid, NativeMethods.DIGCF_PRESENT, results, dedicatedOnly: false)) + { + return []; + } + + // If no dedicated GPU was found among active devices, query all installed display adapters (including sleeping D3cold devices) + if (!results.Any(g => g.IsDedicated)) + { + EnumerateGpusFromDeviceSet(displayGuid, 0, results, dedicatedOnly: true); + } + + // If still no dedicated GPU detected, check cached hardware state from previous runs + if (!results.Any(g => g.IsDedicated)) + { + AppendDedicatedGpusFromPreviousState(results); + } + + _gpusCache = results.ToArray(); + return _gpusCache; + } + + private static bool EnumerateGpusFromDeviceSet( + Guid displayGuid, + uint flags, + List<(string Name, string Vendor, bool IsDedicated, long? VramBytes, string? DriverVersion)> results, + bool dedicatedOnly) + { + IntPtr devInfoSet = NativeMethods.SetupDiGetClassDevs(ref displayGuid, IntPtr.Zero, IntPtr.Zero, flags); + if (devInfoSet.ToInt64() == -1) return false; try { @@ -936,22 +972,64 @@ public static (string Name, string Vendor, bool IsDedicated, long? VramBytes, st while (NativeMethods.SetupDiEnumDeviceInfo(devInfoSet, i++, ref devInfo)) { - string name = GetDevPropStr(devInfoSet, devInfo, NativeMethods.SPDRP_DEVICEDESC); - if (string.IsNullOrEmpty(name)) continue; + TryAddGpuFromDeviceInfo(devInfoSet, devInfo, results, dedicatedOnly); + } + } + finally + { + NativeMethods.SetupDiDestroyDeviceInfoList(devInfoSet); + } - string hwId = GetDevPropStr(devInfoSet, devInfo, NativeMethods.SPDRP_HARDWAREID); - string vendor = ParseVendor(hwId, name); - if (string.IsNullOrEmpty(vendor)) continue; + return true; + } - bool dedicated = vendor == NvidiaVendor || IsDiscreteGpu(name, vendor, devInfoSet, devInfo); + private static void TryAddGpuFromDeviceInfo( + IntPtr devInfoSet, + NativeMethods.SpDevinfoData devInfo, + List<(string Name, string Vendor, bool IsDedicated, long? VramBytes, string? DriverVersion)> results, + bool dedicatedOnly) + { + string name = GetDevPropStr(devInfoSet, devInfo, NativeMethods.SPDRP_DEVICEDESC); + if (string.IsNullOrEmpty(name)) return; + + string hwId = GetDevPropStr(devInfoSet, devInfo, NativeMethods.SPDRP_HARDWAREID); + string vendor = ParseVendor(hwId, name); + if (string.IsNullOrEmpty(vendor)) return; + + bool dedicated = vendor == NvidiaVendor || IsDiscreteGpu(name, vendor, devInfoSet, devInfo); + if (dedicatedOnly && (!dedicated || results.Any(r => r.Name.Equals(name, StringComparison.OrdinalIgnoreCase)))) + { + return; + } + + (long? vram, string? driver) = GetGpuRegistryData(name); + results.Add((name, vendor, dedicated, vram, driver)); + } + + private static void AppendDedicatedGpusFromPreviousState( + List<(string Name, string Vendor, bool IsDedicated, long? VramBytes, string? DriverVersion)> results) + { + var prevState = HardwareInventory.ReadPreviousState(); + if (prevState?.Graphics is not { Count: > 0 }) return; + + foreach (var prevGpu in prevState.Graphics.Where(g => g.Contains("(Dedicated", StringComparison.OrdinalIgnoreCase))) + { + string vendor = ResolveGpuVendorFromLabel(prevGpu, IntelVendor); + int parenIdx = prevGpu.IndexOf(" (Dedicated", StringComparison.OrdinalIgnoreCase); + string name = parenIdx > 0 ? prevGpu[..parenIdx] : prevGpu; + if (!results.Any(r => r.Name.Equals(name, StringComparison.OrdinalIgnoreCase))) + { (long? vram, string? driver) = GetGpuRegistryData(name); - results.Add((name, vendor, dedicated, vram, driver)); + results.Add((name, vendor, true, vram, driver)); } } - finally { NativeMethods.SetupDiDestroyDeviceInfoList(devInfoSet); } + } - _gpusCache = results.ToArray(); - return _gpusCache; + private static string ResolveGpuVendorFromLabel(string label, string fallbackVendor) + { + if (label.Contains(NvidiaVendor, StringComparison.OrdinalIgnoreCase)) return NvidiaVendor; + if (label.Contains(AmdVendor, StringComparison.OrdinalIgnoreCase)) return AmdVendor; + return fallbackVendor; } private static (long? VramBytes, string? DriverVersion) GetGpuRegistryData(string deviceDesc) @@ -1074,7 +1152,7 @@ public static string GetMotherboardManufacturer() { string reg = GetBiosRegValue("BaseBoardManufacturer"); if (reg.Length > 0) return reg; - return QueryWmiFirst("SELECT Manufacturer FROM Win32_BaseBoard", "Manufacturer"); + return QueryWmiFirst("SELECT Manufacturer FROM Win32_BaseBoard", ManufacturerProperty); } /// Gets the motherboard product name, from registry then WMI fallback. @@ -1135,7 +1213,7 @@ public static bool GetBiosIsUefi() /// e.g. Dell Inc., ASUS or empty if unavailable. public static string GetSystemManufacturer() { - string wmi = QueryWmiFirst("SELECT Manufacturer FROM Win32_ComputerSystem", "Manufacturer"); + string wmi = QueryWmiFirst("SELECT Manufacturer FROM Win32_ComputerSystem", ManufacturerProperty); if (wmi.Length > 0 && !FallbackToSmbiosSystemInfoForTesting) return wmi; try { @@ -1197,40 +1275,44 @@ public static string GetSystemModel() try { using var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMemory"); - foreach (ManagementBaseObject mo in searcher.Get()) + using var coll = searcher.Get(); + foreach (ManagementBaseObject mo in coll) { - ulong capacity = Convert.ToUInt64(mo["Capacity"] ?? 0UL); - if (capacity == 0) continue; - - string mfr = moduleIdx < smbiosMfrs.Count ? smbiosMfrs[moduleIdx] : ""; - if (string.IsNullOrEmpty(mfr)) - mfr = (mo["Manufacturer"] as string ?? "").Trim(); - moduleIdx++; - - string partNumber = (mo["PartNumber"] as string ?? "").Trim(); - string serial = (mo["SerialNumber"] as string ?? "").Trim(); - uint configuredSpeed = Convert.ToUInt32(mo["ConfiguredClockSpeed"] ?? 0U); - uint ratedSpeed = Convert.ToUInt32(mo["Speed"] ?? 0U); - string speedDisplay = FormatRamModuleSpeed(configuredSpeed, ratedSpeed); - - ushort ff = Convert.ToUInt16(mo["FormFactor"] ?? (ushort)0); - ushort mt = Convert.ToUInt16(mo["MemoryType"] ?? (ushort)0); - if (mt == 0) - mt = Convert.ToUInt16(mo["SMBIOSMemoryType"] ?? (ushort)0); - - results.Add(new() + using (mo) { - ["manufacturer"] = mfr, - ["partNumber"] = partNumber, - ["serial"] = serial, - ["sizeGb"] = capacity / (1024.0 * 1024.0 * 1024.0), - ["speed"] = speedDisplay, - ["configuredSpeed"] = configuredSpeed, - ["ratedSpeed"] = ratedSpeed, - ["ecc"] = false, - ["formFactor"] = FormFactorLabel(ff), - ["type"] = MemoryTypeLabel(mt), - }); + ulong capacity = Convert.ToUInt64(mo["Capacity"] ?? 0UL); + if (capacity == 0) continue; + + string mfr = moduleIdx < smbiosMfrs.Count ? smbiosMfrs[moduleIdx] : ""; + if (string.IsNullOrEmpty(mfr)) + mfr = (mo[ManufacturerProperty] as string ?? "").Trim(); + moduleIdx++; + + string partNumber = (mo["PartNumber"] as string ?? "").Trim(); + string serial = (mo["SerialNumber"] as string ?? "").Trim(); + uint configuredSpeed = Convert.ToUInt32(mo["ConfiguredClockSpeed"] ?? 0U); + uint ratedSpeed = Convert.ToUInt32(mo["Speed"] ?? 0U); + string speedDisplay = FormatRamModuleSpeed(configuredSpeed, ratedSpeed); + + ushort ff = Convert.ToUInt16(mo["FormFactor"] ?? (ushort)0); + ushort mt = Convert.ToUInt16(mo["MemoryType"] ?? (ushort)0); + if (mt == 0) + mt = Convert.ToUInt16(mo["SMBIOSMemoryType"] ?? (ushort)0); + + results.Add(new() + { + ["manufacturer"] = mfr, + ["partNumber"] = partNumber, + ["serial"] = serial, + ["sizeGb"] = capacity / (1024.0 * 1024.0 * 1024.0), + ["speed"] = speedDisplay, + ["configuredSpeed"] = configuredSpeed, + ["ratedSpeed"] = ratedSpeed, + ["ecc"] = false, + ["formFactor"] = FormFactorLabel(ff), + ["type"] = MemoryTypeLabel(mt), + }); + } } } catch (Exception ex) { Diagnostics.Log.Error(ex, "Failed to query physical memory modules via system management"); } @@ -1347,10 +1429,13 @@ private static string QueryRamTypeWmi() using var results = searcher.Get(); foreach (ManagementBaseObject mo in results) { - ushort mt = Convert.ToUInt16(mo["MemoryType"] ?? (ushort)0); - if (mt == 0) - mt = Convert.ToUInt16(mo["SMBIOSMemoryType"] ?? (ushort)0); - if (mt != 0) return MemoryTypeLabel(mt); + using (mo) + { + ushort mt = Convert.ToUInt16(mo["MemoryType"] ?? (ushort)0); + if (mt == 0) + mt = Convert.ToUInt16(mo["SMBIOSMemoryType"] ?? (ushort)0); + if (mt != 0) return MemoryTypeLabel(mt); + } } } catch (Exception ex) { Diagnostics.Log.Error(ex, "Failed to detect memory type via system management"); } @@ -1539,8 +1624,11 @@ private static string QueryRootWmiString(string className, string property) using var results = searcher.Get(); foreach (ManagementBaseObject mo in results) { - string val = (mo[property] as string ?? "").Trim(); - if (val.Length > 0) return val; + using (mo) + { + string val = (mo[property] as string ?? "").Trim(); + if (val.Length > 0) return val; + } } } catch (ManagementException ex) @@ -1570,7 +1658,7 @@ private static int QueryRootWmiInt(string className, string property) scope.Connect(); using var searcher = new ManagementObjectSearcher(scope, new ObjectQuery($"SELECT {property} FROM {className}")); using var results = searcher.Get(); - var mo = results.Cast().FirstOrDefault(); + using var mo = results.Cast().FirstOrDefault(); if (mo is not null) return TryParseWmiInt(mo[property]); } @@ -1613,8 +1701,11 @@ private static string QueryWin32BatteryName() using var results = searcher.Get(); foreach (ManagementBaseObject mo in results) { - string name = (mo["Name"] as string ?? "").Trim(); - if (name.Length > 0) return name; + using (mo) + { + string name = (mo["Name"] as string ?? "").Trim(); + if (name.Length > 0) return name; + } } } catch (ManagementException ex) { Diagnostics.Log.Debug($"Failed to query battery device name from system management: {ex.Message}"); } @@ -1622,6 +1713,62 @@ private static string QueryWin32BatteryName() return ""; } + private static readonly (string Pattern, string Brand)[] KnownBatteryVendors = + [ + ("Sunwoda", "Sunwoda"), + ("Simplo", "Simplo"), + ("Celxpert", "Celxpert"), + (LgEnergyBrand, LgEnergyBrand), + ("LG Chem", LgEnergyBrand), + ("Dynapack", "Dynapack"), + ("Panasonic", "Panasonic"), + ("Coslight", "Coslight"), + ("Samsung", "Samsung"), + ("Murata", "Murata"), + ("Sony", "Murata"), + ]; + + private static readonly (string Code, string Brand)[] KnownBatteryCodes = + [ + ("BYD", "BYD"), + ("SMP", "Simplo"), + ("CEL", "Celxpert"), + ("LGC", LgEnergyBrand), + ("SWD", "Sunwoda"), + ("SEC", "Samsung"), + ("DP", "Dynapack"), + ("Pana", "Panasonic"), + ]; + + internal static string ResolveBatteryVendorToken(string text) + { + if (string.IsNullOrWhiteSpace(text)) return ""; + + foreach (var (pattern, brand) in KnownBatteryVendors) + { + if (text.Contains(pattern, StringComparison.OrdinalIgnoreCase)) + return brand; + } + + foreach (var (code, brand) in KnownBatteryCodes) + { + if (text.Equals(code, StringComparison.OrdinalIgnoreCase)) + return brand; + + int idx = text.IndexOf(code, StringComparison.OrdinalIgnoreCase); + if (idx >= 0) + { + bool leftBoundary = idx == 0 || !char.IsLetter(text[idx - 1]); + int rightIdx = idx + code.Length; + bool rightBoundary = rightIdx >= text.Length || !char.IsLower(text[rightIdx]); + if (leftBoundary && rightBoundary) + return brand; + } + } + + return ""; + } + private static string QueryWin32BatteryManufacturer() { try @@ -1630,17 +1777,15 @@ private static string QueryWin32BatteryManufacturer() throw new ManagementException("Simulated Win32_Battery devid failure"); if (ThrowInWin32BatteryGenericExceptionForTesting) throw new InvalidOperationException("Simulated Win32_Battery generic devid failure"); - using var searcher = new ManagementObjectSearcher("SELECT DeviceID FROM Win32_Battery"); + using var searcher = new ManagementObjectSearcher("SELECT DeviceID, Manufacturer, Name FROM Win32_Battery"); using var results = searcher.Get(); foreach (ManagementBaseObject mo in results) { - string devId = (mo["DeviceID"] as string ?? "").Trim(); - if (devId.Length == 0) continue; - - var matchedBrand = BrandColorDefaults.BatteryColors.Keys - .FirstOrDefault(brand => devId.Contains(brand, StringComparison.OrdinalIgnoreCase)); - if (matchedBrand != null) - return matchedBrand; + using (mo) + { + string mfr = ResolveManufacturerFromBatteryObject(mo); + if (mfr.Length > 0) return mfr; + } } } catch (ManagementException ex) { Diagnostics.Log.Debug($"Failed to query battery manufacturer from Win32_Battery: {ex.Message}"); } @@ -1648,8 +1793,25 @@ private static string QueryWin32BatteryManufacturer() return ""; } + private static string ResolveManufacturerFromBatteryObject(ManagementBaseObject mo) + { + string mfrProp = (mo[ManufacturerProperty] as string ?? "").Trim(); + if (IsValidBatteryString(mfrProp)) + { + string resolved = ResolveBatteryVendorToken(mfrProp); + return resolved.Length > 0 ? resolved : mfrProp; + } + + string devId = (mo["DeviceID"] as string ?? "").Trim(); + string devResolved = ResolveBatteryVendorToken(devId); + if (devResolved.Length > 0) return devResolved; + + string name = (mo["Name"] as string ?? "").Trim(); + return ResolveBatteryVendorToken(name); + } + /// Gets the battery manufacturer name from WMI or SMBIOS. - /// e.g. Sunwoda, LGC or empty if no battery present. + /// e.g. Sunwoda, BYD, Simplo or empty if no battery present. public static string GetBatteryManufacturer() { if (!HasBattery()) return ""; @@ -1657,16 +1819,37 @@ public static string GetBatteryManufacturer() // 1. Live ACPI battery static data from root\wmi (queried from battery BMS) string wmi = QueryRootWmiString("BatteryStaticData", "ManufactureName"); - if (IsValidBatteryString(wmi)) return _batteryManufacturerCache = wmi; + if (IsValidBatteryString(wmi)) + { + foreach (var (code, brand) in KnownBatteryCodes) + { + if (wmi.Equals(code, StringComparison.OrdinalIgnoreCase)) + return _batteryManufacturerCache = brand; + } + return _batteryManufacturerCache = wmi; + } // 2. SMBIOS Type 22 (Portable Battery) if valid and not a virtual/dummy placeholder string smbios = GetSmbiosBatteryString(0x05); - if (IsValidBatteryString(smbios)) return _batteryManufacturerCache = smbios; + if (IsValidBatteryString(smbios)) + { + foreach (var (code, brand) in KnownBatteryCodes) + { + if (smbios.Equals(code, StringComparison.OrdinalIgnoreCase)) + return _batteryManufacturerCache = brand; + } + return _batteryManufacturerCache = smbios; + } // 3. Fallback: Parse manufacturer from Win32_Battery DeviceID (e.g. "818SunwodaL24D4PC0") string win32Mfr = QueryWin32BatteryManufacturer(); if (IsValidBatteryString(win32Mfr)) return _batteryManufacturerCache = win32Mfr; + // 4. Fallback: System OEM + string oem = GetSystemManufacturer(); + if (IsValidBatteryString(oem) && !oem.Equals("System manufacturer", StringComparison.OrdinalIgnoreCase)) + return _batteryManufacturerCache = oem; + return _batteryManufacturerCache = ""; } @@ -1998,6 +2181,10 @@ public static string GetGpuColor() if (!string.IsNullOrEmpty(ded.Vendor)) return BrandColorDefaults.GpuColors.TryGetValue(ded.Vendor, out var c) ? c : ""; + string prevVendor = ResolveDedicatedGpuVendorFromPreviousState(); + if (!string.IsNullOrEmpty(prevVendor) && BrandColorDefaults.GpuColors.TryGetValue(prevVendor, out var pc)) + return pc; + foreach (var g in gpus) if (BrandColorDefaults.GpuColors.TryGetValue(g.Vendor, out var c)) return c; @@ -2010,9 +2197,24 @@ public static string GetGpuVendor() var gpus = GetGpus(); var ded = gpus.FirstOrDefault(g => g.IsDedicated); if (!string.IsNullOrEmpty(ded.Vendor)) return ded.Vendor; + + string prevVendor = ResolveDedicatedGpuVendorFromPreviousState(); + if (!string.IsNullOrEmpty(prevVendor)) return prevVendor; + return gpus.Length > 0 ? gpus[0].Vendor : UnknownLabel; } + private static string ResolveDedicatedGpuVendorFromPreviousState() + { + var prevState = HardwareInventory.ReadPreviousState(); + if (prevState?.Graphics is not { Count: > 0 }) return string.Empty; + + var prevDed = prevState.Graphics.FirstOrDefault(g => g.Contains("(Dedicated", StringComparison.OrdinalIgnoreCase)); + return string.IsNullOrEmpty(prevDed) + ? string.Empty + : ResolveGpuVendorFromLabel(prevDed, string.Empty); + } + /// Gets the brand color hex for the primary disk manufacturer. /// Hex color string or empty if unknown. public static string GetDiskColor() @@ -2067,6 +2269,9 @@ internal static string ParseVendor(string hwId, string name) private static bool IsDiscreteGpu(string name, string vendor, IntPtr devInfoSet, NativeMethods.SpDevinfoData devInfo) { + if (HardwareMonitor.IsKnownIntegratedGpu(name, vendor)) + return false; + if (vendor == IntelVendor && name.Contains("Arc", StringComparison.OrdinalIgnoreCase)) return true; if (vendor == "AMD" && (name.Contains("RX", StringComparison.OrdinalIgnoreCase) || name.Contains("PRO", StringComparison.OrdinalIgnoreCase) diff --git a/src/LocalTelemetry.Core/Hardware/TrafficHistoryFile.cs b/src/LocalTelemetry.Core/Hardware/TrafficHistoryFile.cs index 544c33d..e9df991 100644 --- a/src/LocalTelemetry.Core/Hardware/TrafficHistoryFile.cs +++ b/src/LocalTelemetry.Core/Hardware/TrafficHistoryFile.cs @@ -7,7 +7,7 @@ public sealed class TrafficHistoryFile { private readonly string _filePath; private List _records = []; - private readonly object _lock = new(); + private readonly Lock _lock = new(); private bool _dirtySinceLastSave; public string FilePath => _filePath; @@ -49,7 +49,10 @@ private void ReadAndParseRecords() var seen = new HashSet<(int, int, int, string)>(); try { - foreach (string line in File.ReadLines(_filePath)) + using var stream = new FileStream(_filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); + using var reader = new StreamReader(stream); + string? line; + while ((line = reader.ReadLine()) is not null) { lineCount++; if (string.IsNullOrWhiteSpace(line)) continue; @@ -179,7 +182,7 @@ public void Save() if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir)) Directory.CreateDirectory(dir); - using var stream = new FileStream(_filePath, FileMode.Create, FileAccess.Write, FileShare.Read); + using var stream = new FileStream(_filePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite); using var writer = new StreamWriter(stream); // Sort descending so file always has newest-first order regardless of how records were added. diff --git a/src/LocalTelemetry.Core/Hardware/TrafficHistoryStore.cs b/src/LocalTelemetry.Core/Hardware/TrafficHistoryStore.cs index 453e806..66f8a3b 100644 --- a/src/LocalTelemetry.Core/Hardware/TrafficHistoryStore.cs +++ b/src/LocalTelemetry.Core/Hardware/TrafficHistoryStore.cs @@ -14,6 +14,9 @@ public static void Initialize(TrafficHistoryFile file) /// Gets the underlying instance. public static TrafficHistoryFile HistoryFile => Instance; + /// Reloads network history records from disk. + public static void Reload() => Instance.Load(); + private static TrafficHistoryFile Instance => _instance ?? throw new InvalidOperationException("TrafficHistoryStore not initialized. Call Initialize() first."); diff --git a/src/LocalTelemetry.Core/Hardware/WddmGpuMonitor.cs b/src/LocalTelemetry.Core/Hardware/WddmGpuMonitor.cs index 9156c89..913824e 100644 --- a/src/LocalTelemetry.Core/Hardware/WddmGpuMonitor.cs +++ b/src/LocalTelemetry.Core/Hardware/WddmGpuMonitor.cs @@ -11,17 +11,19 @@ namespace LocalTelemetry.Core.Hardware; /// managed allocations. /// [SupportedOSPlatform("windows")] -public sealed class WddmGpuMonitor : IDisposable +public sealed partial class WddmGpuMonitor : IDisposable { private IntPtr _query; private IntPtr _counter; + private IntPtr _sharedMemCounter; + private IntPtr _committedMemCounter; private IntPtr _buffer; private int _bufferCapacity; private bool _primed; private bool _disposed; /// Reused per poll to avoid dictionary allocation churn; keyed by engine hash. - private readonly Dictionary _engineSums = new(16); + private readonly Dictionary _engineSums = []; /// Whether the WDDM GPU Engine counters were initialised successfully. public bool IsAvailable { get; private set; } @@ -84,6 +86,28 @@ private void Init() return; } + int memStatus = PdhAddEnglishCounterFunc( + _query, + @"\GPU Adapter Memory(*)\Shared Usage", + IntPtr.Zero, + out _sharedMemCounter); + if (memStatus != 0) + { + Log.Debug($"Failed to add GPU adapter shared memory counter (status 0x{memStatus:X8})"); + _sharedMemCounter = IntPtr.Zero; + } + + int committedStatus = PdhAddEnglishCounterFunc( + _query, + @"\GPU Adapter Memory(*)\Total Committed", + IntPtr.Zero, + out _committedMemCounter); + if (committedStatus != 0) + { + Log.Debug($"Failed to add GPU adapter committed memory counter (status 0x{committedStatus:X8})"); + _committedMemCounter = IntPtr.Zero; + } + // Collect initial baseline - rate counters need two samples for a delta. status = PdhCollectQueryDataFunc(_query); if (status != 0) @@ -118,6 +142,8 @@ public void Reset() PdhCloseQuery(_query); _query = IntPtr.Zero; _counter = IntPtr.Zero; + _sharedMemCounter = IntPtr.Zero; + _committedMemCounter = IntPtr.Zero; } if (_buffer != IntPtr.Zero) @@ -165,7 +191,7 @@ public float GetUsagePct() return 0f; } - if (!FetchCounterArray(out uint itemCount)) + if (!FetchCounterArray(_counter, out uint itemCount)) { return 0f; } @@ -179,6 +205,87 @@ public float GetUsagePct() } } + /// + /// Returns current GPU memory usage in megabytes for the specified adapter LUID or overall active adapters. + /// Used for integrated GPUs which dynamically allocate from host system RAM. + /// + public float GetGpuMemoryUsedMb(string? luidFilter = null) + { + if (!IsAvailable || _disposed) return 0f; + + IntPtr counter = _committedMemCounter != IntPtr.Zero ? _committedMemCounter : _sharedMemCounter; + if (counter == IntPtr.Zero) return 0f; + + try + { + if (!FetchCounterArray(counter, out uint itemCount)) + return 0f; + + long totalRamBytes = SystemInfo.GetTotalRamBytes(); + if (totalRamBytes <= 0) totalRamBytes = 128L * 1024 * 1024 * 1024; + + double chosenBytes = SelectAdapterMemoryBytes(itemCount, luidFilter, totalRamBytes); + return (float)(chosenBytes / (1024.0 * 1024.0)); + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to query WDDM GPU memory usage"); + return 0f; + } + } + + private double SelectAdapterMemoryBytes(uint itemCount, string? luidFilter, long totalRamBytes) + { + double matchedBytes = 0.0; + double maxFallbackBytes = 0.0; + + for (uint i = 0; i < itemCount; i++) + { + if (!TryReadItemBytes((int)i * ItemStride, totalRamBytes, out double bytes, out string? instanceName)) + continue; + + if (MatchesLuid(instanceName, luidFilter)) + { + matchedBytes = bytes; + break; + } + + if (bytes > maxFallbackBytes) + maxFallbackBytes = bytes; + } + + return matchedBytes > 0.0 ? matchedBytes : maxFallbackBytes; + } + + private bool TryReadItemBytes(int offset, long totalRamBytes, out double bytes, out string? instanceName) + { + bytes = 0.0; + instanceName = null; + + uint cStatus = unchecked((uint)Marshal.ReadInt32(_buffer, offset + CStatusOffset)); + if (cStatus != 0) return false; + + bytes = BitConverter.Int64BitsToDouble(Marshal.ReadInt64(_buffer, offset + ValueOffset)); + if (bytes <= 0.0 || bytes >= totalRamBytes || double.IsNaN(bytes) || double.IsInfinity(bytes)) + return false; + + IntPtr namePtr = Marshal.ReadIntPtr(_buffer, offset + NameOffset); + instanceName = namePtr != IntPtr.Zero ? Marshal.PtrToStringUni(namePtr) : null; + return instanceName is null || !instanceName.Contains("1414", StringComparison.OrdinalIgnoreCase); + } + + private static bool MatchesLuid(string? instanceName, string? luidFilter) + { + return !string.IsNullOrEmpty(luidFilter) + && instanceName is not null + && instanceName.Contains(luidFilter, StringComparison.OrdinalIgnoreCase); + } + + /// + /// Legacy overload for backward compatibility with existing callers and tests. + /// + public float GetSharedMemoryUsedMb() => GetGpuMemoryUsedMb(); + private void HandleQueryError() { _consecutiveErrors++; @@ -189,19 +296,19 @@ private void HandleQueryError() } } - private bool FetchCounterArray(out uint itemCount) + private bool FetchCounterArray(IntPtr counterHandle, out uint itemCount) { itemCount = 0; uint bufSize = 0; int status = PdhGetFormattedCounterArrayFunc( - _counter, PdhFmtDouble, ref bufSize, ref itemCount, IntPtr.Zero); + counterHandle, PdhFmtDouble, ref bufSize, ref itemCount, IntPtr.Zero); if (itemCount == 0 || status != PdhMoreData) return false; EnsureBuffer((int)bufSize); status = PdhGetFormattedCounterArrayFunc( - _counter, PdhFmtDouble, ref bufSize, ref itemCount, _buffer); + counterHandle, PdhFmtDouble, ref bufSize, ref itemCount, _buffer); return status == 0; } @@ -291,6 +398,8 @@ public void Dispose() if (_buffer != IntPtr.Zero) Marshal.FreeHGlobal(_buffer); _query = IntPtr.Zero; _counter = IntPtr.Zero; + _sharedMemCounter = IntPtr.Zero; + _committedMemCounter = IntPtr.Zero; _buffer = IntPtr.Zero; _bufferCapacity = 0; } @@ -331,4 +440,96 @@ private static extern int PdhGetFormattedCounterArray( [DllImport("pdh.dll")] private static extern int PdhCloseQuery(IntPtr query); + + // DXGI Interop for GPU adapter LUID resolution + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + private struct DxgiAdapterDesc1 + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] + public string Description; + public uint VendorId; + public uint DeviceId; + public uint SubSysId; + public uint Revision; + public UIntPtr DedicatedVideoMemory; + public UIntPtr DedicatedSystemMemory; + public UIntPtr SharedSystemMemory; + public uint LuidLow; + public int LuidHigh; + public uint Flags; + } + + [LibraryImport("dxgi.dll")] + private static partial int CreateDXGIFactory1(ref Guid riid, out IntPtr ppFactory); + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate int EnumAdapters1Delegate(IntPtr thisPtr, uint Adapter, out IntPtr ppAdapter); + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate int GetDesc1Delegate(IntPtr thisPtr, out DxgiAdapterDesc1 pDesc); + + /// + /// Resolves the adapter LUID string (e.g. luid_0x00000000_0x000144e4) matching the active GPU via DXGI. + /// Used to target performance counter instances precisely. + /// + public static string? GetAdapterLuid(string? gpuName = null) + { + try + { + Guid factoryGuid = new("7b7166ec-21c7-44ae-b21a-c9ae321ae369"); + if (CreateDXGIFactory1(ref factoryGuid, out IntPtr factoryPtr) != 0 || factoryPtr == IntPtr.Zero) + return null; + + try + { + IntPtr factoryVtable = Marshal.ReadIntPtr(factoryPtr); + IntPtr enumPtr = Marshal.ReadIntPtr(factoryVtable, 12 * IntPtr.Size); + var enumAdapters1 = Marshal.GetDelegateForFunctionPointer(enumPtr); + + uint i = 0; + string? firstHardwareLuid = null; + + while (enumAdapters1(factoryPtr, i, out IntPtr adapterPtr) == 0 && adapterPtr != IntPtr.Zero) + { + try + { + IntPtr vtable = Marshal.ReadIntPtr(adapterPtr); + IntPtr getDesc1Ptr = Marshal.ReadIntPtr(vtable, 10 * IntPtr.Size); + var getDesc1 = Marshal.GetDelegateForFunctionPointer(getDesc1Ptr); + getDesc1(adapterPtr, out DxgiAdapterDesc1 desc); + + // Skip software renderers (DXGI_ADAPTER_FLAG_SOFTWARE = 2) + if ((desc.Flags & 2) == 0) + { + string luidStr = $"luid_0x{desc.LuidHigh:x8}_0x{desc.LuidLow:x8}"; + if (!string.IsNullOrEmpty(gpuName) && + (desc.Description.Contains(gpuName, StringComparison.OrdinalIgnoreCase) || + gpuName.Contains(desc.Description, StringComparison.OrdinalIgnoreCase))) + { + return luidStr; + } + + firstHardwareLuid ??= luidStr; + } + } + finally + { + Marshal.Release(adapterPtr); + } + i++; + } + + return firstHardwareLuid; + } + finally + { + Marshal.Release(factoryPtr); + } + } + catch (Exception ex) + { + Log.Debug(ex, "Failed to resolve GPU adapter LUID via DXGI"); + return null; + } + } } diff --git a/src/LocalTelemetry.Core/Hardware/WindowsNetworkUsageProvider.cs b/src/LocalTelemetry.Core/Hardware/WindowsNetworkUsageProvider.cs index c2e1afe..25a98fa 100644 --- a/src/LocalTelemetry.Core/Hardware/WindowsNetworkUsageProvider.cs +++ b/src/LocalTelemetry.Core/Hardware/WindowsNetworkUsageProvider.cs @@ -463,7 +463,7 @@ private static async Task ImportHistoricalRecordsAsync( if (historicalAdded > 0) Diagnostics.Log.Info($"Imported {historicalAdded} days of network usage history ({start:dd-MM-yyyy} to {end:dd-MM-yyyy})"); else - Diagnostics.Log.Info("Network usage history is up to date"); + Diagnostics.Log.Debug("Network usage history is up to date"); return historicalAdded; } @@ -505,7 +505,7 @@ private static async Task ImportTodayBaselineAsync(TrafficHistoryFile hist { historyFile.SetDay(todayDate.Year, todayDate.Month, todayDate.Day, tr.DownBytes, tr.UpBytes, tr.InterfaceType, "WindowsImport"); todayUpdated = true; - Diagnostics.Log.Info($"Today's network usage baseline with download {Metrics.Format("net_down", new() { NetDownBps = tr.DownBytes }, false, false).Replace("/s", "")}, upload {Metrics.Format("net_up", new() { NetUpBps = tr.UpBytes }, false, false).Replace("/s", "")}"); + Diagnostics.Log.Debug($"Today's network usage baseline with download {Metrics.Format("net_down", new() { NetDownBps = tr.DownBytes }, false, false).Replace("/s", "")}, upload {Metrics.Format("net_up", new() { NetUpBps = tr.UpBytes }, false, false).Replace("/s", "")}"); } else { @@ -517,7 +517,7 @@ private static async Task ImportTodayBaselineAsync(TrafficHistoryFile hist long finalUp = Math.Max(curToday.Value.UpBytes, tr.UpBytes); historyFile.SetDay(todayDate.Year, todayDate.Month, todayDate.Day, finalDown, finalUp, tr.InterfaceType, "WindowsImport"); todayUpdated = true; - Diagnostics.Log.Info($"Updated today's network usage baseline with download {Metrics.Format("net_down", new() { NetDownBps = finalDown }, false, false).Replace("/s", "")}, upload {Metrics.Format("net_up", new() { NetUpBps = finalUp }, false, false).Replace("/s", "")}"); + Diagnostics.Log.Debug($"Updated today's network usage baseline with download {Metrics.Format("net_down", new() { NetDownBps = finalDown }, false, false).Replace("/s", "")}, upload {Metrics.Format("net_up", new() { NetUpBps = finalUp }, false, false).Replace("/s", "")}"); } } } diff --git a/src/LocalTelemetry.Core/LocalTelemetry.Core.csproj b/src/LocalTelemetry.Core/LocalTelemetry.Core.csproj index 8c59215..e86ca92 100644 --- a/src/LocalTelemetry.Core/LocalTelemetry.Core.csproj +++ b/src/LocalTelemetry.Core/LocalTelemetry.Core.csproj @@ -1,20 +1,20 @@ - net10.0-windows10.0.19041.0 + net11.0-windows10.0.19041.0 enable enable x64 x64 + true $(NoWarn);CA1416;CS0649;CA1861;CA1845;CS8600;CS8601;CS8602;CS8603;CS8604;CS8619;CS8620;CS8625 GPL-3.0-or-later - - - - + + + diff --git a/src/LocalTelemetry.Core/Models/BrandColorDefaults.cs b/src/LocalTelemetry.Core/Models/BrandColorDefaults.cs index 2c6d0e3..e0d28b7 100644 --- a/src/LocalTelemetry.Core/Models/BrandColorDefaults.cs +++ b/src/LocalTelemetry.Core/Models/BrandColorDefaults.cs @@ -14,6 +14,8 @@ public static class BrandColorDefaults private const string SkHynixBrand = "SK Hynix"; private const string WesternDigitalBrand = "Western Digital"; private const string GSkillBrand = "G Skill"; + private const string LgEnergyBrand = "LG Energy"; + private const string CrimsonRedDefaultColor = "#ED1C24"; private const string CyanDefaultColor = "#00E5FF"; private const string LightBlueDefaultColor = "#88CCFF"; @@ -21,8 +23,8 @@ public static class BrandColorDefaults private static readonly Dictionary _brand = new(StringComparer.OrdinalIgnoreCase) { // Processors & Major Silicon - [IntelBrand] = "#0068B5", // Intel Blue (2020 Rebrand) - ["AMD"] = "#ED1C24", // AMD Red + [IntelBrand] = "#0068B5", // Intel Blue (2020 Rebrand) + ["AMD"] = CrimsonRedDefaultColor, // AMD Red ["NVIDIA"] = "#76B900", // NVIDIA Green ["Qualcomm"] = "#3253DC", // Qualcomm Blue ["Atheros"] = "#3253DC", // Acquired by Qualcomm @@ -35,19 +37,19 @@ public static class BrandColorDefaults ["ASIX"] = "#0066A1", // ASIX Blue // Memory & Storage - [SamsungBrand] = "#1428A0", // Samsung Blue + [SamsungBrand] = "#1428A0", // Samsung Blue ["Micron"] = "#0033A0", // Micron Corporate Blue ["Crucial"] = "#0068FF", // Crucial Blue Ribbon ["Ballistix"] = "#E31937", // Historical Ballistix Red - [SkHynixBrand] = "#EA002C", // SK Group Red - [WesternDigitalBrand] = "#005195", // WD Blue + [SkHynixBrand] = "#EA002C", // SK Group Red + [WesternDigitalBrand] = "#005195",// WD Blue ["SanDisk"] = "#E10600", // SanDisk Red ["HGST"] = "#0072CE", // WD/HGST Blue ["Seagate"] = "#6EBE49", // Seagate Green ["Toshiba"] = "#FF0000", // Toshiba Red ["Kioxia"] = "#00A4E4", // Kioxia Cyan ["Corsair"] = "#FFE500", // Corsair Gaming Yellow - [GSkillBrand] = "#ED1C23", // Torch Red + [GSkillBrand] = "#ED1C23", // Torch Red ["Kingston"] = "#ED1A3B", // Kingston Rex Red ["Patriot"] = "#DA291C", // Patriot Red ["PNY"] = "#003087", // PNY Blue @@ -60,7 +62,7 @@ public static class BrandColorDefaults // Motherboards, OEMs & Peripherals ["ASUS"] = "#006CE1", // ASUS Science Blue - ["MSI"] = "#ED1C24", // MSI Red + ["MSI"] = CrimsonRedDefaultColor, // MSI Red ["Gigabyte"] = "#005B9A", // Gigabyte Blue ["Dell"] = "#0076CE", // Dell Blue ["HP"] = "#0096D6", // HP Blue @@ -77,9 +79,12 @@ public static class BrandColorDefaults ["Sunwoda"] = "#005691", // Sunwoda Blue ["Simplo"] = "#009087", // Simplo Teal ["Dynapack"] = "#E2001A", // Dynapack Red - ["BYD"] = "#ED1C24", // BYD Red - ["LG Energy"] = "#E6007E", // LG Pink + ["BYD"] = CrimsonRedDefaultColor, // BYD Red + [LgEnergyBrand] = "#E6007E", // LG Pink ["Panasonic"] = "#004085", // Panasonic Blue + ["Celxpert"] = "#005BAA", // Celxpert Blue + ["Coslight"] = "#003399", // Coslight Blue + ["Murata"] = CrimsonRedDefaultColor,// Murata Red }; // Category brand lists @@ -120,7 +125,8 @@ public static class BrandColorDefaults ], ["battery"] = [ - "Sunwoda", "Simplo", "Dynapack", "BYD", "LG Energy", "Panasonic", + "Sunwoda", "Simplo", "Dynapack", "BYD", LgEnergyBrand, "Panasonic", + "Celxpert", "Coslight", SamsungBrand, "Murata", ], }; @@ -136,6 +142,16 @@ public static class BrandColorDefaults ["WD"] = "Western Digital", ["WDC"] = "Western Digital", ["Hewlett"] = "HP", + ["SMP"] = "Simplo", + ["CEL"] = "Celxpert", + ["LGC"] = LgEnergyBrand, + ["LG Chem"] = LgEnergyBrand, + ["LG"] = LgEnergyBrand, + ["SWD"] = "Sunwoda", + ["SEC"] = SamsungBrand, + ["DP"] = "Dynapack", + ["Pana"] = "Panasonic", + ["Sony"] = "Murata", }; // Auto-built category dictionaries @@ -219,7 +235,15 @@ public static string DetectBatteryColor() var mfr = SystemInfo.GetBatteryManufacturer(); if (string.IsNullOrEmpty(mfr)) return string.Empty; var match = BatteryColors.FirstOrDefault(kvp => mfr.Contains(kvp.Key, StringComparison.OrdinalIgnoreCase)); - return match.Value ?? string.Empty; + if (!string.IsNullOrEmpty(match.Value)) return match.Value; + + if (_alias.TryGetValue(mfr, out var canonical) && BatteryColors.TryGetValue(canonical, out var aliasColor)) + return aliasColor; + + if (SystemOemColors.TryGetValue(mfr, out var oemColor)) + return oemColor; + + return string.Empty; } private static string LogAndResolveColor(string hardwareName, string vendor, string detectedColor, string fallbackColor) @@ -238,16 +262,22 @@ private static string LogAndResolveColor(string hardwareName, string vendor, str private static void PopulateDiskMetrics(Dictionary result) { var disks = SystemInfo.GetAllDisks(); + string oemColor = SystemInfo.GetSystemOemColor(); bool multiDisk = disks.Count > 1; for (int i = 0; i < disks.Count; i++) { var disk = disks[i]; string perDiskColor = ResolveDiskColor(disk.Vendor, disk.Model); + if (string.IsNullOrEmpty(perDiskColor)) + { + perDiskColor = oemColor; + } string label = multiDisk ? $"DISK {i + 1}" : "DISK"; string mfr = string.IsNullOrEmpty(disk.Vendor) ? disk.Model : disk.Vendor; - string color = LogAndResolveColor(label, mfr, perDiskColor, "#AAAAAA"); - result[$"disk_disk{i}_read"] = color; - result[$"disk_disk{i}_write"] = color; + Log.Debug($"Detected {label} vendor: {mfr} ({perDiskColor})"); + result[$"disk_disk{i}_read"] = perDiskColor; + result[$"disk_disk{i}_write"] = perDiskColor; + result[$"disk_disk{i}_temp"] = perDiskColor; } } diff --git a/src/LocalTelemetry.Core/Models/Metrics.cs b/src/LocalTelemetry.Core/Models/Metrics.cs index fa8b5ac..849c4e9 100644 --- a/src/LocalTelemetry.Core/Models/Metrics.cs +++ b/src/LocalTelemetry.Core/Models/Metrics.cs @@ -60,27 +60,37 @@ public static class Metrics new(BatteryRate, "BAT", "Charge Rate", "W", "battery"), ]; + private static readonly Dictionary _allMetricsById = AllMetrics.ToDictionary(m => m.Id); + /// Lookup dictionary by metric ID for fast O(1) access in render hot paths. -#pragma warning disable S2386, S3887 // AllMetricsById is mutated dynamically by RegisterDisk when physical disks are discovered - public static readonly Dictionary AllMetricsById = AllMetrics.ToDictionary(m => m.Id); -#pragma warning restore S2386, S3887 + public static IReadOnlyDictionary AllMetricsById => _allMetricsById; - /// Registers per-disk metric descriptors for a given disk index. + /// Registers or updates per-disk metric descriptors for a given disk index. /// Disk identifier (e.g. "disk0"). - /// Display label (e.g. "DISK0"). + /// Display label (e.g. "NVMe 1" or "DISK0"). public static void RegisterDisk(string id, string label) { - string key = $"disk_{id}_read"; - if (AllMetricsById.ContainsKey(key)) return; var list = new MetricDescriptor[] { new($"disk_{id}_read", label, $"{label} Read", "MB/s", "disk"), new($"disk_{id}_write", label, $"{label} Write", "MB/s", "disk"), + new($"disk_{id}_temp", label, $"{label} Temp", "°C", "disk"), }; foreach (var m in list) { - AllMetrics.Add(m); - AllMetricsById[m.Id] = m; + if (_allMetricsById.TryGetValue(m.Id, out var existing)) + { + int idx = AllMetrics.IndexOf(existing); + if (idx >= 0) + { + AllMetrics[idx] = m; + } + } + else + { + AllMetrics.Add(m); + } + _allMetricsById[m.Id] = m; } } @@ -115,7 +125,7 @@ public static string Format( NetTotal => FormatTotalBytes(s.NetTotalBytes), BatteryPct => s.BatteryPct > 0 ? $"{s.BatteryPct:F0}%" : "--", BatteryRate => FormatBatteryRate(s.BatteryPct, s.BatteryChargeRateW), - _ => DiskValue(id, s), + _ => DiskValue(id, s, useFahrenheit), }; private static string FormatBatteryRate(float pct, float rateW) @@ -153,7 +163,7 @@ private static string FormatTotalBytes(long bytes) }; } - private static string DiskValue(string id, TelemetrySnapshot s) + private static string DiskValue(string id, TelemetrySnapshot s, bool useFahrenheit) { int last = id.LastIndexOf('_'); if (last < 0 || last < 5) return "--"; @@ -165,6 +175,10 @@ private static string DiskValue(string id, TelemetrySnapshot s) if (s.Disks[i].Id == rawId) { disk = s.Disks[i]; break; } } if (disk is null) return "--"; + if (aspect == "temp") + { + return disk.TemperatureC.HasValue ? Temp(disk.TemperatureC.Value, useFahrenheit) : "--"; + } float mbps = aspect switch { "read" => disk.ReadMBps, @@ -206,6 +220,7 @@ private static string FormatRate(float mbps) NetDown or NetUp => useBits ? "9999.9Gb/s" : "999.9GB/s", NetTotal => "999.99TB", BatteryRate => "+999.9W", + _ when id.StartsWith("disk_", StringComparison.Ordinal) && id.EndsWith("_temp", StringComparison.Ordinal) => useFahrenheit ? "212°F" : "100°C", _ when id.StartsWith("disk_", StringComparison.Ordinal) => "999.9GB/s", _ => "9999", }; diff --git a/src/LocalTelemetry.Core/Models/TelemetrySnapshot.cs b/src/LocalTelemetry.Core/Models/TelemetrySnapshot.cs index e39c298..982a6b9 100644 --- a/src/LocalTelemetry.Core/Models/TelemetrySnapshot.cs +++ b/src/LocalTelemetry.Core/Models/TelemetrySnapshot.cs @@ -80,5 +80,7 @@ public sealed record DiskSnapshot public float ReadMBps { get; init; } /// Disk write speed in MB/s. public float WriteMBps { get; init; } + /// Disk temperature in degrees Celsius, or null if unavailable. + public int? TemperatureC { get; init; } } diff --git a/src/LocalTelemetry.Notifier/LocalTelemetry.Notifier.csproj b/src/LocalTelemetry.Notifier/LocalTelemetry.Notifier.csproj index f09751d..81d6a21 100644 --- a/src/LocalTelemetry.Notifier/LocalTelemetry.Notifier.csproj +++ b/src/LocalTelemetry.Notifier/LocalTelemetry.Notifier.csproj @@ -1,21 +1,18 @@ WinExe - net10.0-windows10.0.19041.0 + net11.0-windows10.0.19041.0 enable enable x64 x64 + true win-x64 true - true LocalTelemetry.Notifier LocalTelemetry.Notifier GPL-3.0-or-later - - - diff --git a/src/LocalTelemetry.Notifier/NotifierLog.cs b/src/LocalTelemetry.Notifier/NotifierLog.cs index 097c5a5..9bc5dc1 100644 --- a/src/LocalTelemetry.Notifier/NotifierLog.cs +++ b/src/LocalTelemetry.Notifier/NotifierLog.cs @@ -1,4 +1,3 @@ -using System.IO; using System.Runtime.CompilerServices; namespace LocalTelemetry.Notifier; @@ -10,7 +9,7 @@ namespace LocalTelemetry.Notifier; ///
internal static class NotifierLog { - private static readonly object _lock = new(); + private static readonly Lock _lock = new(); private static StreamWriter? _writer; /// Captures the last error encountered during logging operations. @@ -34,6 +33,7 @@ internal static void Init(string logPath) { _writer = null; LastError = ex; + System.Diagnostics.Trace.WriteLine($"Failed to open notifier log file '{logPath}': {ex.Message}"); } } } @@ -53,6 +53,7 @@ internal static void Shutdown() catch (Exception ex) { LastError = ex; + System.Diagnostics.Trace.WriteLine($"Failed during notifier writer shutdown: {ex.Message}"); } finally { @@ -93,6 +94,7 @@ private static void Write(string levelStr, string message, string? callerPath, E catch (Exception writeEx) { LastError = writeEx; + System.Diagnostics.Trace.WriteLine($"Failed to write notifier log entry: {writeEx.Message}"); } } } diff --git a/src/LocalTelemetry.Notifier/Program.cs b/src/LocalTelemetry.Notifier/Program.cs index 57eddf3..75ef61c 100644 --- a/src/LocalTelemetry.Notifier/Program.cs +++ b/src/LocalTelemetry.Notifier/Program.cs @@ -1,6 +1,6 @@ using System.Diagnostics; -using System.IO; using System.IO.Pipes; +using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Text.Json; @@ -8,8 +8,24 @@ namespace LocalTelemetry.Notifier; [SupportedOSPlatform("windows")] -internal static class Program +internal static partial class Program { + [LibraryImport("psapi.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static partial bool EmptyWorkingSet(IntPtr hProcess); + + internal static void TrimWorkingSet() + { + try + { + EmptyWorkingSet(Process.GetCurrentProcess().Handle); + } + catch (Exception ex) + { + NotifierLog.Debug($"TrimWorkingSet warning: {ex.Message}"); + } + } + internal static string PipeName { get; set; } = "LocalTelemetryNotifier"; internal static int ReconnectDelayMs { get; set; } = 1000; @@ -23,11 +39,7 @@ private static void Main(string[] args) // otherwise toast forms are bitmap-stretched after a display scale change. Application.SetHighDpiMode(HighDpiMode.PerMonitorV2); - AppDomain.CurrentDomain.UnhandledException += (_, e) => - { - if (e.ExceptionObject is Exception ex) - NotifierLog.Error(ex, "Unhandled AppDomain exception in Notifier process"); - }; + AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; string logPath = ResolveLogPath(); NotifierLog.Init(logPath); @@ -54,6 +66,7 @@ private static void Main(string[] args) { _ = Task.Run(() => RunPipeServerAsync(shutdownCts, (title, body) => hiddenForm.BeginInvoke(() => ShowToast(title, body)))); + TrimWorkingSet(); }; hiddenForm.FormClosing += (_, _) => NotifierLog.Info("Message pump exiting"); @@ -105,7 +118,8 @@ private static string ResolveLogPath() string dataDir = File.Exists(markerFile) ? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "LocalTelemetry") : exeDir; - return Path.Combine(dataDir, "lt_notifier.log"); + string logsDir = Path.Combine(dataDir, "logs"); + return Path.Combine(logsDir, "lt_notifier.log"); } internal static async Task MonitorParentProcessAsync(Func waitForParentExit, CancellationTokenSource cts) @@ -128,14 +142,14 @@ internal static async Task RunPipeServerAsync(CancellationTokenSource cts, Actio { using var server = CreatePipeServer(); - NotifierLog.Info("Waiting for connection..."); + NotifierLog.Debug("Waiting for connection..."); await server.WaitForConnectionAsync(ct); - NotifierLog.Info("Client connected"); + NotifierLog.Debug("Client connected"); using var reader = new StreamReader(server.Stream, Encoding.UTF8); await ProcessMessageStreamAsync(reader, cts, toastDispatcher); - NotifierLog.Info("Client disconnected"); + NotifierLog.Debug("Client disconnected"); } catch (OperationCanceledException) { throw; } catch (Exception ex) @@ -235,6 +249,14 @@ internal static void ShowToast(string title, string body) } } + internal static void OnUnhandledException(object? sender, UnhandledExceptionEventArgs e) + { + if (e.ExceptionObject is Exception ex) + { + NotifierLog.Error(ex, "Unhandled AppDomain exception in Notifier process"); + } + } + // Message contract internal sealed record NotificationMessage { diff --git a/src/LocalTelemetry.Notifier/ToastForm.cs b/src/LocalTelemetry.Notifier/ToastForm.cs index c039585..3220c82 100644 --- a/src/LocalTelemetry.Notifier/ToastForm.cs +++ b/src/LocalTelemetry.Notifier/ToastForm.cs @@ -145,6 +145,12 @@ private void OnPaint(object? sender, PaintEventArgs e) } // Disposal + protected override void OnFormClosed(FormClosedEventArgs e) + { + base.OnFormClosed(e); + Program.TrimWorkingSet(); + } + protected override void Dispose(bool disposing) { if (disposing) diff --git a/tests/LocalTelemetry.App.Tests/AppTests.cs b/tests/LocalTelemetry.App.Tests/AppTests.cs index 0ffd891..854d971 100644 --- a/tests/LocalTelemetry.App.Tests/AppTests.cs +++ b/tests/LocalTelemetry.App.Tests/AppTests.cs @@ -20,13 +20,14 @@ using NSubstitute; using Xunit; -[assembly: CollectionBehavior(DisableTestParallelization = true)] +[assembly: Xunit.v3.Parallelization(Mode = Xunit.Sdk.ParallelMode.None)] namespace LocalTelemetry.App.Tests; public class AppTests { private static readonly string[] NonElevatedArgs = ["--minimized"]; + private static readonly string[] SettingsElevatedArgs = ["--settings", "--elevated"]; private static IPawnIoManager CreateMockPawnIoManager() { @@ -49,6 +50,7 @@ internal static void InstallSafetyNet() } App.IsAdministratorCheck = () => true; + App.EnforceSingleInstance = false; App.ElevateAndExitAction = _ => { }; App.NotifierLauncherAction = _ => { }; App.TaskManagerLauncherAction = _ => { }; @@ -215,6 +217,7 @@ public void App_OnStartup_HandlesUnelevatedExecution() elevatedCalled.Should().BeTrue(); App.IsAdministratorCheck = () => true; + App.EnforceSingleInstance = false; App.ElevateAndExitAction = _ => { }; App.NotifierLauncherAction = null; } @@ -491,7 +494,7 @@ public void App_EnsureNotifierLaunched_And_EnsureNotifierStopped_WithProcessAndL public void App_EnsureNotifierStopped_WhenProcessNotNullAndExited_DisposesProcessSafely() { var app = GetOrCreateApp(); - var proc = new System.Diagnostics.Process(); + var proc = new Process(); typeof(App).GetField("_notifierProcess", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(app, proc); typeof(App).GetField("_notifierLaunched", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(app, true); @@ -553,7 +556,7 @@ public void App_HandleSettingsApplied_ExercisesPollIntervalChangeAndAlertsToggli { var app = GetOrCreateApp(); var cfg = new AppSettings { RunAtStartup = false }; - cfg.Monitoring.PollIntervalMs = 500; + cfg.Monitoring.PollIntervalMs = 2000; cfg.Alerts.Enabled = false; cfg.Alerts.ShowToastNotif = false; cfg.Overlay.Visible = true; @@ -738,9 +741,9 @@ public void App_ExceptionHandlers_HandleSafelyWithoutCrashing() actUnobserved.Should().NotThrow(); var dispatcherMethod = typeof(App).GetMethod("HandleDispatcherUnhandledException", BindingFlags.NonPublic | BindingFlags.Static); - var dispArgs = (System.Windows.Threading.DispatcherUnhandledExceptionEventArgs) - RuntimeHelpers.GetUninitializedObject(typeof(System.Windows.Threading.DispatcherUnhandledExceptionEventArgs)); - typeof(System.Windows.Threading.DispatcherUnhandledExceptionEventArgs) + var dispArgs = (DispatcherUnhandledExceptionEventArgs) + RuntimeHelpers.GetUninitializedObject(typeof(DispatcherUnhandledExceptionEventArgs)); + typeof(DispatcherUnhandledExceptionEventArgs) .GetField("_exception", BindingFlags.NonPublic | BindingFlags.Instance)? .SetValue(dispArgs, new InvalidOperationException("Test dispatcher ex")); var actDisp = () => dispatcherMethod!.Invoke(null, [new object(), dispArgs]); @@ -756,10 +759,10 @@ public void App_OnStartup_NonElevated_InvokesElevateAndExitAction() var app = GetOrCreateApp(); var onStartupMethod = typeof(App).GetMethod("OnStartup", BindingFlags.NonPublic | BindingFlags.Instance); - var args = (System.Windows.StartupEventArgs) - RuntimeHelpers.GetUninitializedObject(typeof(System.Windows.StartupEventArgs)); + var args = (StartupEventArgs) + RuntimeHelpers.GetUninitializedObject(typeof(StartupEventArgs)); - var field = typeof(System.Windows.StartupEventArgs).GetField("_args", BindingFlags.NonPublic | BindingFlags.Instance); + var field = typeof(StartupEventArgs).GetField("_args", BindingFlags.NonPublic | BindingFlags.Instance); field?.SetValue(args, NonElevatedArgs); onStartupMethod!.Invoke(app, [args]); @@ -767,6 +770,7 @@ public void App_OnStartup_NonElevated_InvokesElevateAndExitAction() // Restore App.IsAdministratorCheck = () => true; + App.EnforceSingleInstance = false; App.ElevateAndExitAction = _ => { }; } @@ -835,8 +839,8 @@ public void App_OnExit_DisposesAllComponentsCleanly() appFields.GetField("_notifClient", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(app, notifClient); var onExitMethod = typeof(App).GetMethod("OnExit", BindingFlags.NonPublic | BindingFlags.Instance); - var exitArgs = (System.Windows.ExitEventArgs) - RuntimeHelpers.GetUninitializedObject(typeof(System.Windows.ExitEventArgs)); + var exitArgs = (ExitEventArgs) + RuntimeHelpers.GetUninitializedObject(typeof(ExitEventArgs)); var act = () => onExitMethod!.Invoke(app, [exitArgs]); act.Should().NotThrow(); @@ -903,7 +907,7 @@ public void App_BuildContainer_WithoutPawnIoOverride_RegistersWrapper() public void App_LaunchTaskManager_WhenProcessLauncherThrows_HandlesErrorGracefully() { var app = GetOrCreateApp(); - Action? priorLauncher = App.TaskManagerProcessLauncher; + Action? priorLauncher = App.TaskManagerProcessLauncher; try { App.TaskManagerProcessLauncher = _ => throw new InvalidOperationException("Failed to launch task manager"); @@ -938,7 +942,7 @@ public void App_HandleSettingsApplied_AllBranchesCoverage() // Branch 1: Overlay visible = true, startup toggled, poll interval changed, alerts toast enabled cfg.Overlay.Visible = true; cfg.RunAtStartup = true; - cfg.Monitoring.PollIntervalMs = 500; + cfg.Monitoring.PollIntervalMs = 2000; cfg.Alerts.Enabled = true; cfg.Alerts.ShowToastNotif = true; cfg.EnableFileLogging = true; @@ -1135,9 +1139,9 @@ public void App_ExceptionHandlers_And_SessionEnding_Coverage() // 3. HandleDispatcherUnhandledException var handleDispatcher = typeof(App).GetMethod("HandleDispatcherUnhandledException", BindingFlags.NonPublic | BindingFlags.Static); - var dispArgs = (System.Windows.Threading.DispatcherUnhandledExceptionEventArgs)RuntimeHelpers.GetUninitializedObject( - typeof(System.Windows.Threading.DispatcherUnhandledExceptionEventArgs)); - typeof(System.Windows.Threading.DispatcherUnhandledExceptionEventArgs) + var dispArgs = (DispatcherUnhandledExceptionEventArgs)RuntimeHelpers.GetUninitializedObject( + typeof(DispatcherUnhandledExceptionEventArgs)); + typeof(DispatcherUnhandledExceptionEventArgs) .GetField("_exception", BindingFlags.NonPublic | BindingFlags.Instance)? .SetValue(dispArgs, new InvalidOperationException("Dispatcher boom")); handleDispatcher!.Invoke(null, [app, dispArgs]); @@ -1419,8 +1423,10 @@ public void App_Notifier_And_OverlayWiring_Coverage() // 2. LaunchTaskManager reflection invocation var origTaskMgr = App.TaskManagerProcessLauncher; + var origTaskMgrAction = App.TaskManagerLauncherAction; try { + App.TaskManagerLauncherAction = null; bool taskMgrFired = false; App.TaskManagerProcessLauncher = _ => taskMgrFired = true; var launchTaskMgr = typeof(App).GetMethod("LaunchTaskManager", BindingFlags.NonPublic | BindingFlags.Instance)!; @@ -1429,6 +1435,7 @@ public void App_Notifier_And_OverlayWiring_Coverage() } finally { + App.TaskManagerLauncherAction = origTaskMgrAction; App.TaskManagerProcessLauncher = origTaskMgr; } } @@ -1562,10 +1569,10 @@ public void App_OverlayActions_And_SnapshotReady_Coverage() var cfg = new AppSettings(); var history = new TrafficHistoryFile(tmp); using var netLogger = new NetUsageLogger(cfg, history); - using var notifClient = new global::LocalTelemetry.App.Services.NotificationClient(); - using var overlayFallback = overlay is null ? new TaskbarOverlay(cfg, new global::LocalTelemetry.App.Win32.TaskbarEmbedder(cfg)) : null; + using var notifClient = new NotificationClient(); + using var overlayFallback = overlay is null ? new TaskbarOverlay(cfg, new TaskbarEmbedder(cfg)) : null; var effectiveOverlay = overlay ?? overlayFallback!; - var alerts = new global::LocalTelemetry.App.Services.AlertService(cfg, effectiveOverlay, notifClient, netLogger); + var alerts = new AlertService(cfg, effectiveOverlay, notifClient, netLogger); overlayFieldToRestore.SetValue(app, effectiveOverlay); netLoggerField.SetValue(app, netLogger); @@ -1740,10 +1747,12 @@ public void App_RemainingBranches_Coverage() var openSettings = typeof(App).GetMethod("OpenSettings", BindingFlags.NonPublic | BindingFlags.Instance)!; var origShellFactory = App.SettingsShellFactory; var origSuppressSettings = App.SuppressSettingsWindowForTesting; + var origOutOfProc = App.LaunchSettingsOutOfProcess; try { App.SettingsShellFactory = null; App.SuppressSettingsWindowForTesting = false; + App.LaunchSettingsOutOfProcess = false; SettingsShell.SkipShowForTesting = true; openSettings.Invoke(app, null); @@ -1754,6 +1763,7 @@ public void App_RemainingBranches_Coverage() { App.SettingsShellFactory = origShellFactory; App.SuppressSettingsWindowForTesting = origSuppressSettings; + App.LaunchSettingsOutOfProcess = origOutOfProc; } // 10. Test StartUserInterface with Suppress flags false (lines 234, 237) @@ -1800,4 +1810,776 @@ public void App_RemainingBranches_Coverage() try { if (Directory.Exists(tempDir)) Directory.Delete(tempDir, true); } catch (IOException ex) { System.Diagnostics.Trace.WriteLine(ex.Message); } } } + + [Fact] + public void App_WhenInstanceAlreadyRunning_SignalsExistingInstanceAndExits() + { + InstallSafetyNet(); + int exitCode = -1; + App.ExitHandler = code => exitCode = code; + + string originalMutexName = App.SingleInstanceMutexName; + string originalEventName = App.SingleInstanceEventName; + string uniqueTestSuffix = Guid.NewGuid().ToString("N"); + App.SingleInstanceMutexName = @"Local\LocalTelemetry_App_SingleInstance_Test_" + uniqueTestSuffix; + App.SingleInstanceEventName = @"Local\LocalTelemetry_App_ShowSettingsEvent_Test_" + uniqueTestSuffix; + + using var existingMutex = new Mutex(true, App.SingleInstanceMutexName, out bool createdNew); + createdNew.Should().BeTrue(); + + try + { + App.EnforceSingleInstance = true; + var app = GetOrCreateApp(); + var onStartup = typeof(App).GetMethod("OnStartup", BindingFlags.NonPublic | BindingFlags.Instance)!; + var startupEventArgs = (StartupEventArgs)RuntimeHelpers.GetUninitializedObject(typeof(StartupEventArgs)); + typeof(StartupEventArgs).GetField("_args", BindingFlags.NonPublic | BindingFlags.Instance)?.SetValue(startupEventArgs, ElevatedArgs); + + onStartup.Invoke(app, [startupEventArgs]); + exitCode.Should().Be(0); + } + finally + { + App.EnforceSingleInstance = false; + App.ExitHandler = null; + App.SingleInstanceMutexName = originalMutexName; + App.SingleInstanceEventName = originalEventName; + } + } + + [WpfFact] + public void App_LaunchSettingsProcess_WhenCalled_LaunchesOutOfProcessSettings() + { + var app = GetOrCreateApp(); + ProcessStartInfo? capturedPsi = null; + var origLauncher = App.SettingsProcessLauncher; + var origShowEvent = App.SettingsShowEventName; + string suffix = Guid.NewGuid().ToString("N"); + App.SettingsShowEventName = @"Local\LocalTelemetry_Settings_ShowEvent_Test_" + suffix; + + try + { + App.SettingsProcessLauncher = psi => capturedPsi = psi; + var launchMethod = typeof(App).GetMethod("LaunchSettingsProcess", BindingFlags.NonPublic | BindingFlags.Instance)!; + launchMethod.Invoke(app, null); + + capturedPsi.Should().NotBeNull(); + capturedPsi.Arguments.Should().Be("--settings"); + capturedPsi.UseShellExecute.Should().BeTrue(); + } + finally + { + App.SettingsProcessLauncher = origLauncher; + App.SettingsShowEventName = origShowEvent; + } + } + + [WpfFact] + public void App_LaunchSettingsProcess_WhenSettingsAlreadyRunning_SignalsShowEvent() + { + var app = GetOrCreateApp(); + bool launcherCalled = false; + var origLauncher = App.SettingsProcessLauncher; + var origShowEvent = App.SettingsShowEventName; + var origMutex = App.SettingsMutexName; + string suffix = Guid.NewGuid().ToString("N"); + App.SettingsShowEventName = @"Local\LocalTelemetry_Settings_ShowEvent_Test_" + suffix; + App.SettingsMutexName = @"Local\LocalTelemetry_Settings_Mutex_Test_" + suffix; + + using var mutex = new Mutex(true, App.SettingsMutexName); + using var showEvent = new EventWaitHandle(false, EventResetMode.AutoReset, App.SettingsShowEventName); + + try + { + App.SettingsProcessLauncher = _ => launcherCalled = true; + var launchMethod = typeof(App).GetMethod("LaunchSettingsProcess", BindingFlags.NonPublic | BindingFlags.Instance)!; + launchMethod.Invoke(app, null); + + launcherCalled.Should().BeFalse(); + } + finally + { + App.SettingsProcessLauncher = origLauncher; + App.SettingsShowEventName = origShowEvent; + App.SettingsMutexName = origMutex; + } + } + + [Fact] + public void App_StartSettingsMode_WhenAlreadyRunning_SignalsShowEventAndExits() + { + InstallSafetyNet(); + int exitCode = -1; + App.ExitHandler = code => exitCode = code; + + string origMutex = App.SettingsMutexName; + string origShowEvent = App.SettingsShowEventName; + string suffix = Guid.NewGuid().ToString("N"); + App.SettingsMutexName = @"Local\LocalTelemetry_Settings_SingleInstance_Test_" + suffix; + App.SettingsShowEventName = @"Local\LocalTelemetry_Settings_ShowEvent_Test_" + suffix; + + using var mutex = new Mutex(true, App.SettingsMutexName, out bool createdNew); + createdNew.Should().BeTrue(); + using var showWait = new EventWaitHandle(false, EventResetMode.AutoReset, App.SettingsShowEventName); + + try + { + App.EnforceSingleInstance = true; + var app = GetOrCreateApp(); + var startSettings = typeof(App).GetMethod("StartSettingsMode", BindingFlags.NonPublic | BindingFlags.Instance)!; + startSettings.Invoke(app, [SettingsElevatedArgs]); + + exitCode.Should().Be(0); + } + finally + { + App.EnforceSingleInstance = false; + App.ExitHandler = null; + App.SettingsMutexName = origMutex; + App.SettingsShowEventName = origShowEvent; + } + } + + [Fact] + public void AppSettings_CopyFrom_CopiesAllProperties() + { + var source = new AppSettings + { + RunAtStartup = true, + StartMinimized = true, + MinimizeToTrayOnClose = true, + ShowSystemTrayIcon = false, + EnableFileLogging = false, + SystemLogLevel = "Debug", + WindowTheme = "custom", + }; + source.Monitoring.PollIntervalMs = 500; + source.Overlay.Visible = false; + source.Alerts.Enabled = false; + + var target = new AppSettings(); + target.CopyFrom(source); + + target.RunAtStartup.Should().BeTrue(); + target.StartMinimized.Should().BeTrue(); + target.MinimizeToTrayOnClose.Should().BeTrue(); + target.ShowSystemTrayIcon.Should().BeFalse(); + target.EnableFileLogging.Should().BeFalse(); + target.SystemLogLevel.Should().Be("Debug"); + target.WindowTheme.Should().Be("custom"); + target.Monitoring.PollIntervalMs.Should().Be(500); + target.Overlay.Visible.Should().BeFalse(); + target.Alerts.Enabled.Should().BeFalse(); + } + + [WpfFact] + public void App_HandleTaskbarSpaceConstraintChanged_TogglesWarningState() + { + var app = GetOrCreateApp(); + + // Reset state + app.HandleTaskbarSpaceConstraintChanged(false, 300); + app.SpaceWarningFired.Should().BeFalse(); + + // When constrained + app.HandleTaskbarSpaceConstraintChanged(true, 50); + app.SpaceWarningFired.Should().BeTrue(); + + // Second call while still constrained does not re-fire + app.HandleTaskbarSpaceConstraintChanged(true, 50); + app.SpaceWarningFired.Should().BeTrue(); + + // When space is zero + app.HandleTaskbarSpaceConstraintChanged(true, 0); + app.SpaceWarningFired.Should().BeTrue(); + + // When space is restored + app.HandleTaskbarSpaceConstraintChanged(false, 600); + app.SpaceWarningFired.Should().BeFalse(); + } + + [WpfFact] + public void App_EnsureNotifierLaunched_ForceLaunchesEvenWhenAlertsDisabled() + { + var app = GetOrCreateApp(); + bool launcherCalled = false; + var origLauncher = App.NotifierLauncherAction; + try + { + App.NotifierLauncherAction = _ => launcherCalled = true; + typeof(App).GetField("_notifierLaunched", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, false); + + // Force launch + app.ForceLaunchNotifier(); + launcherCalled.Should().BeTrue(); + } + finally + { + App.NotifierLauncherAction = origLauncher; + typeof(App).GetField("_notifierLaunched", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, false); + } + } + + [WpfFact] + public void App_SettingsWaitHandles_And_ExitSettingsProcess_Coverage() + { + var app = GetOrCreateApp(); + var origEnforce = App.EnforceSingleInstance; + try + { + App.EnforceSingleInstance = true; + var regWait = typeof(App).GetMethod("RegisterSettingsWaitHandles", BindingFlags.Instance | BindingFlags.NonPublic)!; + regWait.Invoke(app, null); + + var regSingle = typeof(App).GetMethod("RegisterSingleInstanceWaitHandle", BindingFlags.Instance | BindingFlags.NonPublic)!; + regSingle.Invoke(app, null); + + // ActivateSettingsShellWindow when _settingsShell is null (no-op) + var activate = typeof(App).GetMethod("ActivateSettingsShellWindow", BindingFlags.Instance | BindingFlags.NonPublic)!; + activate.Invoke(app, null); + + // ExitSettingsProcess cleans up handles cleanly + var exitSettings = typeof(App).GetMethod("ExitSettingsProcess", BindingFlags.Instance | BindingFlags.NonPublic)!; + var exitArgsCtor = typeof(System.Windows.ExitEventArgs).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, [typeof(int)], null); + var exitArgs = (System.Windows.ExitEventArgs)exitArgsCtor!.Invoke([0]); + var act = () => exitSettings.Invoke(app, [exitArgs]); + act.Should().NotThrow(); + } + finally + { + App.EnforceSingleInstance = origEnforce; + } + } + + [WpfFact] + public void App_PowerSuspension_And_SessionLock_StateCoverage() + { + var app = GetOrCreateApp(); + + var onSuspended = typeof(App).GetMethod("HandlePowerSuspended", BindingFlags.Instance | BindingFlags.NonPublic)!; + var onResumed = typeof(App).GetMethod("HandlePowerResumed", BindingFlags.Instance | BindingFlags.NonPublic)!; + var onLock = typeof(App).GetMethod("HandleSessionLockStateChanged", BindingFlags.Instance | BindingFlags.NonPublic)!; + + // Suspend -> resume while unlocked + onSuspended.Invoke(app, null); + ((bool)typeof(App).GetField("_isAppPowerSuspended", BindingFlags.Instance | BindingFlags.NonPublic)!.GetValue(app)!).Should().BeTrue(); + + onResumed.Invoke(app, null); + ((bool)typeof(App).GetField("_isAppPowerSuspended", BindingFlags.Instance | BindingFlags.NonPublic)!.GetValue(app)!).Should().BeFalse(); + + // Lock session -> resume while locked (should not resume timers) + onLock.Invoke(app, [true]); + ((bool)typeof(App).GetField("_isAppSessionLocked", BindingFlags.Instance | BindingFlags.NonPublic)!.GetValue(app)!).Should().BeTrue(); + + onSuspended.Invoke(app, null); + onResumed.Invoke(app, null); + + // Unlock session while suspended (should not resume timers) + onSuspended.Invoke(app, null); + onLock.Invoke(app, [false]); + + // Clean state: resume and unlock + onResumed.Invoke(app, null); + onLock.Invoke(app, [false]); + ((bool)typeof(App).GetField("_isAppPowerSuspended", BindingFlags.Instance | BindingFlags.NonPublic)!.GetValue(app)!).Should().BeFalse(); + ((bool)typeof(App).GetField("_isAppSessionLocked", BindingFlags.Instance | BindingFlags.NonPublic)!.GetValue(app)!).Should().BeFalse(); + } + + [WpfFact] + public void App_SignalTrafficUpdated_And_CloseExternalSettingsProcess_Coverage() + { + var app = GetOrCreateApp(); + string testTrafficEvent = @"Local\Test_TrafficUpdated_" + Guid.NewGuid().ToString("N"); + string testCloseEvent = @"Local\Test_SettingsClose_" + Guid.NewGuid().ToString("N"); + + var origTrafficName = App.SettingsTrafficUpdatedEventName; + var origCloseName = App.SettingsCloseEventName; + + try + { + App.SettingsTrafficUpdatedEventName = testTrafficEvent; + App.SettingsCloseEventName = testCloseEvent; + + var signalTraffic = typeof(App).GetMethod("SignalTrafficUpdated", BindingFlags.Static | BindingFlags.NonPublic)!; + var closeExternal = typeof(App).GetMethod("CloseExternalSettingsProcess", BindingFlags.Instance | BindingFlags.NonPublic)!; + + // 1. When events do not exist (TryOpenExisting returns false) + var actTrafficMissing = () => signalTraffic.Invoke(null, null); + actTrafficMissing.Should().NotThrow(); + + var actCloseMissing = () => closeExternal.Invoke(app, null); + actCloseMissing.Should().NotThrow(); + + // 2. When events exist (signal sets them) + using (var trafficWaitHandle = new EventWaitHandle(false, EventResetMode.AutoReset, testTrafficEvent)) + { + signalTraffic.Invoke(null, null); + trafficWaitHandle.WaitOne(500).Should().BeTrue(); + } + + using (var closeWaitHandle = new EventWaitHandle(false, EventResetMode.AutoReset, testCloseEvent)) + { + closeExternal.Invoke(app, null); + closeWaitHandle.WaitOne(500).Should().BeTrue(); + } + + var cleanUpHandles = typeof(App).GetMethod("CleanUpIpcAndInstanceHandles", BindingFlags.Instance | BindingFlags.NonPublic)!; + cleanUpHandles.Invoke(app, null); + } + finally + { + App.SettingsTrafficUpdatedEventName = origTrafficName; + App.SettingsCloseEventName = origCloseName; + } + } + + [WpfFact] + public void App_SetupSettingsProcessMainWindow_And_ActivateSettingsShell_Coverage() + { + var app = GetOrCreateApp(); + var origSuppress = App.SuppressSettingsWindowForTesting; + var origReloadEvent = App.SettingsReloadEventName; + string testReloadName = @"Local\Test_SettingsReload_" + Guid.NewGuid().ToString("N"); + + try + { + App.SuppressSettingsWindowForTesting = true; + App.SettingsReloadEventName = testReloadName; + + var setupSettings = typeof(App).GetMethod("SetupSettingsProcessMainWindow", BindingFlags.Instance | BindingFlags.NonPublic)!; + setupSettings.Invoke(app, null); + + var shell = (SettingsShell?)typeof(App).GetField("_settingsShell", BindingFlags.Instance | BindingFlags.NonPublic)!.GetValue(app); + shell.Should().NotBeNull(); + + // Test ActivateSettingsShellWindow when minimized + shell.WindowState = WindowState.Minimized; + var activate = typeof(App).GetMethod("ActivateSettingsShellWindow", BindingFlags.Instance | BindingFlags.NonPublic)!; + activate.Invoke(app, null); + shell.WindowState.Should().Be(WindowState.Normal); + + // Test settings applied handler attached by SetupSettingsProcessMainWindow + using (var reloadWaitHandle = new EventWaitHandle(false, EventResetMode.AutoReset, testReloadName)) + { + var appliedField = typeof(SettingsShell).GetField("SettingsApplied", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + if (appliedField?.GetValue(shell) is Action appliedHandler) + { + appliedHandler.Invoke(); + reloadWaitHandle.WaitOne(500).Should().BeTrue(); + } + } + + // Static helper kill orphaned notifiers call + var killOrphans = typeof(App).GetMethod("KillOrphanedNotifierProcesses", BindingFlags.Static | BindingFlags.NonPublic)!; + var actKill = () => killOrphans.Invoke(null, null); + actKill.Should().NotThrow(); + } + finally + { + App.SuppressSettingsWindowForTesting = origSuppress; + App.SettingsReloadEventName = origReloadEvent; + } + } + + [WpfFact] + public void App_SignalRunningInstances_And_QuitApp_Coverage() + { + var app = GetOrCreateApp(); + + // 1. SignalRunningMainInstance with and without event + var sigMain = typeof(App).GetMethod("SignalRunningMainInstance", BindingFlags.Static | BindingFlags.NonPublic)!; + var actSigMain = () => sigMain.Invoke(null, null); + actSigMain.Should().NotThrow(); + + string testMainEvent = @"Local\Test_MainInst_" + Guid.NewGuid().ToString("N"); + var origMainName = App.SingleInstanceEventName; + try + { + App.SingleInstanceEventName = testMainEvent; + using var waitHandle = new EventWaitHandle(false, EventResetMode.AutoReset, testMainEvent); + sigMain.Invoke(null, null); + waitHandle.WaitOne(500).Should().BeTrue(); + } + finally + { + App.SingleInstanceEventName = origMainName; + } + + // 2. SignalRunningSettingsInstance with and without event + var sigSettings = typeof(App).GetMethod("SignalRunningSettingsInstance", BindingFlags.Static | BindingFlags.NonPublic)!; + var actSigSettings = () => sigSettings.Invoke(null, null); + actSigSettings.Should().NotThrow(); + + string testSettingsEvent = @"Local\Test_SettingsInst_" + Guid.NewGuid().ToString("N"); + var origSettingsName = App.SettingsShowEventName; + try + { + App.SettingsShowEventName = testSettingsEvent; + using var waitHandle = new EventWaitHandle(false, EventResetMode.AutoReset, testSettingsEvent); + sigSettings.Invoke(null, null); + waitHandle.WaitOne(500).Should().BeTrue(); + } + finally + { + App.SettingsShowEventName = origSettingsName; + } + + // 3. TryActivateExistingSettingsShell when null and when set + var tryActivate = typeof(App).GetMethod("TryActivateExistingSettingsShell", BindingFlags.Instance | BindingFlags.NonPublic)!; + ((bool)tryActivate.Invoke(app, null)!).Should().BeFalse(); + + // 4. QuitApp with QuitAppAction override + bool quitFired = false; + var origQuit = App.QuitAppAction; + try + { + App.QuitAppAction = () => quitFired = true; + var quitMethod = typeof(App).GetMethod("QuitApp", BindingFlags.Instance | BindingFlags.NonPublic)!; + quitMethod.Invoke(app, null); + quitFired.Should().BeTrue(); + } + finally + { + App.QuitAppAction = origQuit; + } + } + + [WpfFact] + public void App_CleanUpIpcAndInstanceHandles_FullCoverage() + { + var app = GetOrCreateApp(); + + using var evReload = new EventWaitHandle(false, EventResetMode.AutoReset); + using var evShow = new EventWaitHandle(false, EventResetMode.AutoReset); + using var evClose = new EventWaitHandle(false, EventResetMode.AutoReset); + using var evTraffic = new EventWaitHandle(false, EventResetMode.AutoReset); + using var evSingle = new EventWaitHandle(false, EventResetMode.AutoReset); + + var whReload = ThreadPool.RegisterWaitForSingleObject(evReload, (_, _) => { }, null, -1, true); + var whShow = ThreadPool.RegisterWaitForSingleObject(evShow, (_, _) => { }, null, -1, true); + var whClose = ThreadPool.RegisterWaitForSingleObject(evClose, (_, _) => { }, null, -1, true); + var whTraffic = ThreadPool.RegisterWaitForSingleObject(evTraffic, (_, _) => { }, null, -1, true); + var whSingle = ThreadPool.RegisterWaitForSingleObject(evSingle, (_, _) => { }, null, -1, true); + + var mutexSettings = new Mutex(false); + var mutexSingle = new Mutex(false); + + typeof(App).GetField("_settingsReloadEvent", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, evReload); + typeof(App).GetField("_settingsReloadWaitHandle", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, whReload); + typeof(App).GetField("_settingsShowEvent", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, evShow); + typeof(App).GetField("_settingsShowWaitHandle", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, whShow); + typeof(App).GetField("_settingsCloseEvent", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, evClose); + typeof(App).GetField("_settingsCloseWaitHandle", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, whClose); + typeof(App).GetField("_settingsTrafficUpdatedEvent", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, evTraffic); + typeof(App).GetField("_settingsTrafficUpdatedWaitHandle", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, whTraffic); + typeof(App).GetField("_singleInstanceEvent", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, evSingle); + typeof(App).GetField("_singleInstanceWaitHandle", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, whSingle); + typeof(App).GetField("_settingsMutex", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, mutexSettings); + typeof(App).GetField("_singleInstanceMutex", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, mutexSingle); + + var cleanup = typeof(App).GetMethod("CleanUpIpcAndInstanceHandles", BindingFlags.Instance | BindingFlags.NonPublic)!; + cleanup.Invoke(app, null); + + typeof(App).GetField("_settingsReloadEvent", BindingFlags.Instance | BindingFlags.NonPublic)!.GetValue(app).Should().BeNull(); + typeof(App).GetField("_settingsShowEvent", BindingFlags.Instance | BindingFlags.NonPublic)!.GetValue(app).Should().BeNull(); + typeof(App).GetField("_settingsMutex", BindingFlags.Instance | BindingFlags.NonPublic)!.GetValue(app).Should().BeNull(); + } + + [WpfFact] + public void App_LaunchSettingsProcess_Coverage() + { + var app = GetOrCreateApp(); + + string testMutex = @"Local\Test_SettingsMut_" + Guid.NewGuid().ToString("N"); + string testShow = @"Local\Test_SettingsShow_" + Guid.NewGuid().ToString("N"); + + var origMutexName = App.SettingsMutexName; + var origShowName = App.SettingsShowEventName; + var origLauncher = App.SettingsProcessLauncher; + + try + { + App.SettingsMutexName = testMutex; + App.SettingsShowEventName = testShow; + + // 1. Mutex and event exist -> signals event + using var mutex = new Mutex(false, testMutex); + using var showEvent = new EventWaitHandle(false, EventResetMode.AutoReset, testShow); + + var launch = typeof(App).GetMethod("LaunchSettingsProcess", BindingFlags.Instance | BindingFlags.NonPublic)!; + launch.Invoke(app, null); + showEvent.WaitOne(500).Should().BeTrue(); + + // 2. Neither exists -> launches process via SettingsProcessLauncher + App.SettingsMutexName = @"Local\NonExistent_" + Guid.NewGuid().ToString("N"); + App.SettingsShowEventName = @"Local\NonExistent_" + Guid.NewGuid().ToString("N"); + + bool launcherCalled = false; + App.SettingsProcessLauncher = _ => launcherCalled = true; + launch.Invoke(app, null); + launcherCalled.Should().BeTrue(); + } + finally + { + App.SettingsMutexName = origMutexName; + App.SettingsShowEventName = origShowName; + App.SettingsProcessLauncher = origLauncher; + } + } + + [WpfFact] + public void App_EnsureNotifierStopped_WithProcess_Coverage() + { + var app = GetOrCreateApp(); + + using var dummyProc = Process.Start(new ProcessStartInfo("cmd.exe", "/c exit 0") { CreateNoWindow = true, UseShellExecute = false })!; + dummyProc.WaitForExit(2000); + + typeof(App).GetField("_notifierProcess", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, dummyProc); + typeof(App).GetField("_notifierLaunched", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, true); + + app.EnsureNotifierStopped(); + typeof(App).GetField("_notifierProcess", BindingFlags.Instance | BindingFlags.NonPublic)!.GetValue(app).Should().BeNull(); + } + + [WpfFact] + public void App_SettingsProcessAndLifecycle_FullCoverage() + { + var app = GetOrCreateApp(); + + // 1. CloseExternalSettingsProcess with exited and running processes + using (var exitedProc = Process.Start(new ProcessStartInfo("cmd.exe", "/c exit 0") { CreateNoWindow = true, UseShellExecute = false })!) + { + exitedProc.WaitForExit(2000); + typeof(App).GetField("_settingsProcess", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, exitedProc); + var closeMethod = typeof(App).GetMethod("CloseExternalSettingsProcess", BindingFlags.Instance | BindingFlags.NonPublic)!; + closeMethod.Invoke(app, null); + } + + using (var runningProc = Process.Start(new ProcessStartInfo("cmd.exe", "/c ping 127.0.0.1 -n 3 > nul") { CreateNoWindow = true, UseShellExecute = false })!) + { + typeof(App).GetField("_settingsProcess", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, runningProc); + var closeMethod = typeof(App).GetMethod("CloseExternalSettingsProcess", BindingFlags.Instance | BindingFlags.NonPublic)!; + closeMethod.Invoke(app, null); + } + + // 2. LaunchSettingsProcess with ProcessStarter + var origLauncher = App.SettingsProcessLauncher; + var origStarter = App.ProcessStarter; + try + { + App.SettingsProcessLauncher = null; + App.ProcessStarter = _ => null; + var launchMethod = typeof(App).GetMethod("LaunchSettingsProcess", BindingFlags.Instance | BindingFlags.NonPublic)!; + launchMethod.Invoke(app, null); + } + finally + { + App.SettingsProcessLauncher = origLauncher; + App.ProcessStarter = origStarter; + } + + // 3. TryActivateExistingSettingsShell & WireSettingsShellLifecycle + var origSuppress = App.SuppressSettingsWindowForTesting; + try + { + App.SuppressSettingsWindowForTesting = false; + var shell = new SettingsShell(new AppSettings()); + new System.Windows.Interop.WindowInteropHelper(shell).EnsureHandle(); + typeof(App).GetField("_settingsShell", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, shell); + + shell.WindowState = WindowState.Minimized; + var tryActivate = typeof(App).GetMethod("TryActivateExistingSettingsShell", BindingFlags.Instance | BindingFlags.NonPublic)!; + ((bool)tryActivate.Invoke(app, null)!).Should().BeTrue(); + + var wireLifecycle = typeof(App).GetMethod("WireSettingsShellLifecycle", BindingFlags.Instance | BindingFlags.NonPublic)!; + Action dummySlotHandler = (_, _) => { }; + wireLifecycle.Invoke(app, [dummySlotHandler]); + + shell.Close(); + } + finally + { + App.SuppressSettingsWindowForTesting = origSuppress; + } + + // 4. ExitSettingsProcess with active handles + using var evShow = new EventWaitHandle(false, EventResetMode.AutoReset); + using var evClose = new EventWaitHandle(false, EventResetMode.AutoReset); + using var evTraffic = new EventWaitHandle(false, EventResetMode.AutoReset); + var whShow = ThreadPool.RegisterWaitForSingleObject(evShow, (_, _) => { }, null, -1, true); + var whClose = ThreadPool.RegisterWaitForSingleObject(evClose, (_, _) => { }, null, -1, true); + var whTraffic = ThreadPool.RegisterWaitForSingleObject(evTraffic, (_, _) => { }, null, -1, true); + var mutexSettings = new Mutex(false); + + typeof(App).GetField("_settingsShowEvent", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, evShow); + typeof(App).GetField("_settingsShowWaitHandle", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, whShow); + typeof(App).GetField("_settingsCloseEvent", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, evClose); + typeof(App).GetField("_settingsCloseWaitHandle", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, whClose); + typeof(App).GetField("_settingsTrafficUpdatedEvent", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, evTraffic); + typeof(App).GetField("_settingsTrafficUpdatedWaitHandle", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, whTraffic); + typeof(App).GetField("_settingsMutex", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, mutexSettings); + + var exitSettings = typeof(App).GetMethod("ExitSettingsProcess", BindingFlags.Instance | BindingFlags.NonPublic)!; + var exitArgsCtor = typeof(System.Windows.ExitEventArgs).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, [typeof(int)], null); + var exitArgs = (System.Windows.ExitEventArgs)exitArgsCtor!.Invoke([0]); + var actExit = () => exitSettings.Invoke(app, [exitArgs]); + actExit.Should().NotThrow(); + } + + [WpfFact] + public void App_CrossProcessSignaling_And_WaitHandles_ErrorCoverage() + { + var app = GetOrCreateApp(); + + // 1. SignalRunningMainInstance with invalid event name + var origMainName = App.SingleInstanceEventName; + try + { + App.SingleInstanceEventName = new string('X', 300); + var sigMain = typeof(App).GetMethod("SignalRunningMainInstance", BindingFlags.Static | BindingFlags.NonPublic)!; + var act = () => sigMain.Invoke(null, null); + act.Should().NotThrow(); + } + finally + { + App.SingleInstanceEventName = origMainName; + } + + // 2. SignalRunningSettingsInstance with invalid event name + var origSettingsName = App.SettingsShowEventName; + try + { + App.SettingsShowEventName = new string('X', 300); + var sigSettings = typeof(App).GetMethod("SignalRunningSettingsInstance", BindingFlags.Static | BindingFlags.NonPublic)!; + var act = () => sigSettings.Invoke(null, null); + act.Should().NotThrow(); + } + finally + { + App.SettingsShowEventName = origSettingsName; + } + + // 3. RegisterSettingsWaitHandles catch blocks + var origShow = App.SettingsShowEventName; + var origClose = App.SettingsCloseEventName; + var origTraffic = App.SettingsTrafficUpdatedEventName; + try + { + App.SettingsShowEventName = new string('X', 300); + App.SettingsCloseEventName = new string('X', 300); + App.SettingsTrafficUpdatedEventName = new string('X', 300); + var regHandles = typeof(App).GetMethod("RegisterSettingsWaitHandles", BindingFlags.Instance | BindingFlags.NonPublic)!; + var act = () => regHandles.Invoke(app, null); + act.Should().NotThrow(); + } + finally + { + App.SettingsShowEventName = origShow; + App.SettingsCloseEventName = origClose; + App.SettingsTrafficUpdatedEventName = origTraffic; + } + + // 4. RegisterSettingsReloadListener catch block + var origReload = App.SettingsReloadEventName; + try + { + App.SettingsReloadEventName = new string('X', 300); + var regReload = typeof(App).GetMethod("RegisterSettingsReloadListener", BindingFlags.Instance | BindingFlags.NonPublic)!; + var act = () => regReload.Invoke(app, null); + act.Should().NotThrow(); + } + finally + { + App.SettingsReloadEventName = origReload; + } + + // 5. RegisterSingleInstanceWaitHandle catch block + var origSingle = App.SingleInstanceEventName; + try + { + App.SingleInstanceEventName = new string('X', 300); + var regSingle = typeof(App).GetMethod("RegisterSingleInstanceWaitHandle", BindingFlags.Instance | BindingFlags.NonPublic)!; + var act = () => regSingle.Invoke(app, null); + act.Should().NotThrow(); + } + finally + { + App.SingleInstanceEventName = origSingle; + } + + // 6. QuitApp with existing settings close event + string testCloseName = @"Local\Test_CloseEvent_" + Guid.NewGuid().ToString("N"); + var origCloseEv = App.SettingsCloseEventName; + try + { + App.SettingsCloseEventName = testCloseName; + using var closeEvent = new EventWaitHandle(false, EventResetMode.AutoReset, testCloseName); + var quitMethod = typeof(App).GetMethod("QuitApp", BindingFlags.Instance | BindingFlags.NonPublic)!; + quitMethod.Invoke(app, null); + closeEvent.WaitOne(500).Should().BeTrue(); + } + finally + { + App.SettingsCloseEventName = origCloseEv; + } + } + + [WpfFact] + public async Task App_OpenSettings_ThreadAndException_Coverage() + { + var app = GetOrCreateApp(); + var origSuppress = App.SuppressSettingsWindowForTesting; + var origLauncher = App.SettingsProcessLauncher; + try + { + App.SuppressSettingsWindowForTesting = false; + App.SettingsProcessLauncher = _ => { }; + + // 1. OpenSettings from background thread (Dispatcher.CheckAccess() == false) + var openSettings = typeof(App).GetMethod("OpenSettings", BindingFlags.Instance | BindingFlags.NonPublic)!; + await Task.Run(() => openSettings.Invoke(app, null)); + + // 2. RunInProcessSettings catch block + var origFactory = App.SettingsShellFactory; + try + { + App.SettingsShellFactory = (_, _) => throw new InvalidOperationException("Simulated shell open failure"); + var runInProc = typeof(App).GetMethod("RunInProcessSettings", BindingFlags.Instance | BindingFlags.NonPublic)!; + var act = () => runInProc.Invoke(app, null); + act.Should().NotThrow(); + } + finally + { + App.SettingsShellFactory = origFactory; + } + + // 3. ActivateSettingsShellWindow with valid HWND + var shell = new SettingsShell(new AppSettings()); + new System.Windows.Interop.WindowInteropHelper(shell).EnsureHandle(); + typeof(App).GetField("_settingsShell", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, shell); + var actWindow = typeof(App).GetMethod("ActivateSettingsShellWindow", BindingFlags.Instance | BindingFlags.NonPublic)!; + var actActWindow = () => actWindow.Invoke(app, null); + actActWindow.Should().NotThrow(); + shell.Close(); + + // 4. LaunchSettingsProcess with exited _settingsProcess + var psi = new ProcessStartInfo("cmd.exe", "/c exit 0") + { + CreateNoWindow = true, + UseShellExecute = false, + }; + var proc = Process.Start(psi)!; + await proc.WaitForExitAsync(); + typeof(App).GetField("_settingsProcess", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(app, proc); + + var launchSettings = typeof(App).GetMethod("LaunchSettingsProcess", BindingFlags.Instance | BindingFlags.NonPublic)!; + launchSettings.Invoke(app, null); + } + finally + { + App.SettingsProcessLauncher = origLauncher; + App.SuppressSettingsWindowForTesting = origSuppress; + } + } } diff --git a/tests/LocalTelemetry.App.Tests/LocalTelemetry.App.Tests.csproj b/tests/LocalTelemetry.App.Tests/LocalTelemetry.App.Tests.csproj index bcf5cd9..72fefd3 100644 --- a/tests/LocalTelemetry.App.Tests/LocalTelemetry.App.Tests.csproj +++ b/tests/LocalTelemetry.App.Tests/LocalTelemetry.App.Tests.csproj @@ -1,7 +1,10 @@ - net10.0-windows10.0.19041.0 + net11.0-windows10.0.19041.0 + Exe + true + true enable enable true @@ -10,25 +13,15 @@ true x64 x64 - $(MSBuildProjectDirectory)\coverlet.runsettings $(NoWarn);CA1707;CA2007;CA1062;CA1515 - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - + + - - + diff --git a/tests/LocalTelemetry.App.Tests/Overlay/TaskbarOverlayManagerTests.cs b/tests/LocalTelemetry.App.Tests/Overlay/TaskbarOverlayManagerTests.cs new file mode 100644 index 0000000..606bb1e --- /dev/null +++ b/tests/LocalTelemetry.App.Tests/Overlay/TaskbarOverlayManagerTests.cs @@ -0,0 +1,367 @@ +using System.Reflection; +using FluentAssertions; +using LocalTelemetry.App.Overlay; +using LocalTelemetry.App.Settings; +using LocalTelemetry.App.Win32; +using LocalTelemetry.Core.Config; +using LocalTelemetry.Core.Models; +using Xunit; + +namespace LocalTelemetry.App.Tests.Overlay; + +public sealed class TaskbarOverlayManagerTests : IDisposable +{ + public TaskbarOverlayManagerTests() + { + TaskbarOverlay.SkipShowWindowForTesting = true; + TaskbarOverlay.SkipMouseHookForTesting = true; + TaskbarOverlay.SkipTimersForTesting = true; + TaskbarOverlay.SkipEmbedForTesting = true; + TaskbarOverlayManager.SkipDisplaySettingsChangedHookForTesting = true; + DisplayInfo.SkipIsWindowCheckForTesting = true; + } + + public void Dispose() + { + DisplayInfo.EnumerateDisplaysOverride = null; + DisplayInfo.SkipIsWindowCheckForTesting = false; + TaskbarEmbedder.ExplorerSecondaryTrayWndsOverride = null; + TaskbarEmbedder.ExplorerTrayWndOverride = null; + } + + [Fact] + public void TaskbarOverlayManager_Show_WithPrimaryMode_SpawnsOnlyPrimary() + { + var cfg = new AppSettings(); + cfg.Overlay.Visible = true; + cfg.Overlay.DisplayMode = "primary"; + + DisplayInfo.EnumerateDisplaysOverride = () => + [ + new DisplayInfo { Id = "primary", Index = 0, IsPrimary = true, TaskbarHwnd = new IntPtr(0x1001) }, + new DisplayInfo { Id = "display_2", Index = 1, IsPrimary = false, TaskbarHwnd = new IntPtr(0x2002) } + ]; + + var createdOverlays = new List(); + using var manager = new TaskbarOverlayManager(cfg); + manager.OverlayFactory = (c, d) => + { + var overlay = new TaskbarOverlay(c, d); + createdOverlays.Add(overlay); + return overlay; + }; + + manager.Show(); + + manager.GetActiveOverlays().Should().HaveCount(1); + manager.PrimaryOverlay.Should().NotBeNull(); + createdOverlays.Should().HaveCount(1); + createdOverlays[0].TargetDisplay?.Id.Should().Be("primary"); + } + + [Fact] + public void TaskbarOverlayManager_Show_WithAllMode_SpawnsAllAvailableTaskbars() + { + var cfg = new AppSettings(); + cfg.Overlay.Visible = true; + cfg.Overlay.DisplayMode = "all"; + + DisplayInfo.EnumerateDisplaysOverride = () => + [ + new DisplayInfo { Id = "primary", Index = 0, IsPrimary = true, TaskbarHwnd = new IntPtr(0x1001) }, + new DisplayInfo { Id = "display_2", Index = 1, IsPrimary = false, TaskbarHwnd = new IntPtr(0x2002) }, + new DisplayInfo { Id = "display_3", Index = 2, IsPrimary = false, TaskbarHwnd = IntPtr.Zero } + ]; + + var createdOverlays = new List(); + using var manager = new TaskbarOverlayManager(cfg); + manager.OverlayFactory = (c, d) => + { + var overlay = new TaskbarOverlay(c, d); + createdOverlays.Add(overlay); + return overlay; + }; + + manager.Show(); + + manager.GetActiveOverlays().Should().HaveCount(2); + createdOverlays.Should().HaveCount(2); + createdOverlays.Select(o => o.TargetDisplay?.Id).Should().Contain(["primary", "display_2"]); + } + + [Fact] + public void TaskbarOverlayManager_Show_WithCustomMode_SpawnsOnlySelected() + { + var cfg = new AppSettings(); + cfg.Overlay.Visible = true; + cfg.Overlay.DisplayMode = "custom"; + cfg.Overlay.EnabledDisplays = ["display_2"]; + + DisplayInfo.EnumerateDisplaysOverride = () => + [ + new DisplayInfo { Id = "primary", Index = 0, IsPrimary = true, TaskbarHwnd = new IntPtr(0x1001) }, + new DisplayInfo { Id = "display_2", Index = 1, IsPrimary = false, TaskbarHwnd = new IntPtr(0x2002) } + ]; + + var createdOverlays = new List(); + using var manager = new TaskbarOverlayManager(cfg); + manager.OverlayFactory = (c, d) => + { + var overlay = new TaskbarOverlay(c, d); + createdOverlays.Add(overlay); + return overlay; + }; + + manager.Show(); + + manager.GetActiveOverlays().Should().HaveCount(1); + createdOverlays[0].TargetDisplay?.Id.Should().Be("display_2"); + } + + [Fact] + public void TaskbarOverlayManager_UpdateSnapshot_BroadcastsToAllActiveOverlays() + { + var cfg = new AppSettings(); + cfg.Overlay.Visible = true; + cfg.Overlay.DisplayMode = "all"; + + DisplayInfo.EnumerateDisplaysOverride = () => + [ + new DisplayInfo { Id = "primary", Index = 0, IsPrimary = true, TaskbarHwnd = new IntPtr(0x1001) }, + new DisplayInfo { Id = "display_2", Index = 1, IsPrimary = false, TaskbarHwnd = new IntPtr(0x2002) } + ]; + + var snap = new TelemetrySnapshot { CpuUsagePct = 42f }; + using var manager = new TaskbarOverlayManager(cfg); + var createdOverlays = new List(); + manager.OverlayFactory = (c, d) => + { + var overlay = new TaskbarOverlay(c, d); + createdOverlays.Add(overlay); + return overlay; + }; + + manager.Show(); + manager.UpdateSnapshot(snap); + + foreach (var overlay in createdOverlays) + { + var snapField = typeof(TaskbarOverlay).GetField("_snap", BindingFlags.NonPublic | BindingFlags.Instance); + snapField?.GetValue(overlay).Should().Be(snap); + } + } + + [Fact] + public void TaskbarOverlayManager_DoubleClick_ForwardedToManagerEvent() + { + var cfg = new AppSettings(); + cfg.Overlay.Visible = true; + cfg.Overlay.DisplayMode = "primary"; + + DisplayInfo.EnumerateDisplaysOverride = () => + [ + new DisplayInfo { Id = "primary", Index = 0, IsPrimary = true, TaskbarHwnd = new IntPtr(0x1001) } + ]; + + using var manager = new TaskbarOverlayManager(cfg); + TaskbarOverlay? created = null; + manager.OverlayFactory = (c, d) => + { + created = new TaskbarOverlay(c, d); + return created; + }; + + string? receivedAction = null; + manager.OnDoubleClick += action => receivedAction = action; + + manager.Show(); + created.Should().NotBeNull(); + + created.OnDoubleClick?.Invoke("taskmanager"); + + receivedAction.Should().Be("taskmanager"); + } + + [Fact] + public void SettingsDtoMapping_MultiDisplayProperties_RoundTrips() + { + var cfg = new AppSettings(); + cfg.Overlay.DisplayMode = "custom"; + cfg.Overlay.EnabledDisplays = ["primary", "display_2"]; + + DisplayInfo.EnumerateDisplaysOverride = () => + [ + new DisplayInfo { Id = "primary", FriendlyName = "Primary Display", IsPrimary = true, TaskbarHwnd = new IntPtr(0x1001) }, + new DisplayInfo { Id = "display_2", FriendlyName = "Secondary Display", IsPrimary = false, TaskbarHwnd = new IntPtr(0x2002) } + ]; + + var dto = SettingsDtoMapping.ToDto(cfg); + dto.Overlay.DisplayMode.Should().Be("custom"); + dto.Overlay.EnabledDisplays.Should().BeEquivalentTo("primary", "display_2"); + dto.Overlay.DetectedDisplays.Should().HaveCount(2); + dto.Overlay.DetectedDisplays[0].Name.Should().Be("Primary Display"); + + var targetCfg = new AppSettings(); + SettingsDtoMapping.ApplyTo(targetCfg, dto); + targetCfg.Overlay.DisplayMode.Should().Be("custom"); + targetCfg.Overlay.EnabledDisplays.Should().BeEquivalentTo("primary", "display_2"); + } + + [Fact] + public void TaskbarOverlayManager_Show_WithSecondaryMode_SpawnsOnlySecondary() + { + var cfg = new AppSettings(); + cfg.Overlay.Visible = true; + cfg.Overlay.DisplayMode = "secondary"; + + DisplayInfo.EnumerateDisplaysOverride = () => + [ + new DisplayInfo { Id = "primary", Index = 0, IsPrimary = true, TaskbarHwnd = new IntPtr(0x1001) }, + new DisplayInfo { Id = "display_2", Index = 1, IsPrimary = false, TaskbarHwnd = new IntPtr(0x2002) } + ]; + + var createdOverlays = new List(); + using var manager = new TaskbarOverlayManager(cfg); + manager.OverlayFactory = (c, d) => + { + var overlay = new TaskbarOverlay(c, d); + createdOverlays.Add(overlay); + return overlay; + }; + + manager.Show(); + + manager.GetActiveOverlays().Should().HaveCount(1); + createdOverlays.Should().HaveCount(1); + createdOverlays[0].TargetDisplay?.Id.Should().Be("display_2"); + } + + [Fact] + public void TaskbarOverlayManager_Show_WithSecondaryMode_SingleDisplayFallbackToPrimary() + { + var cfg = new AppSettings(); + cfg.Overlay.Visible = true; + cfg.Overlay.DisplayMode = "secondary"; + + DisplayInfo.EnumerateDisplaysOverride = () => + [ + new DisplayInfo { Id = "primary", Index = 0, IsPrimary = true, TaskbarHwnd = new IntPtr(0x1001) } + ]; + + var createdOverlays = new List(); + using var manager = new TaskbarOverlayManager(cfg); + manager.OverlayFactory = (c, d) => + { + var overlay = new TaskbarOverlay(c, d); + createdOverlays.Add(overlay); + return overlay; + }; + + manager.Show(); + + manager.GetActiveOverlays().Should().HaveCount(1); + createdOverlays.Should().HaveCount(1); + createdOverlays[0].TargetDisplay?.Id.Should().Be("primary"); + } + + [WpfFact] + public void TaskbarOverlayManager_Lifecycle_Sync_Timers_And_Constraints() + { + var displays = new List + { + new() { Id = "primary", Index = 0, IsPrimary = true, FriendlyName = "Display 1", TaskbarHwnd = new IntPtr(0x1001) }, + new() { Id = "display_2", Index = 1, IsPrimary = false, FriendlyName = "Display 2", TaskbarHwnd = new IntPtr(0x2002) } + }; + DisplayInfo.EnumerateDisplaysOverride = () => displays; + + var cfg = new AppSettings(); + cfg.Overlay.Visible = true; + cfg.Overlay.DisplayMode = "all"; + + var manager = new TaskbarOverlayManager(cfg); + manager.OverlayFactory = (c, d) => new TaskbarOverlay(c, d); + + // Before Show: properties return defaults + manager.IsTaskbarSpaceConstrained.Should().BeFalse(); + manager.AvailableSlotWidth.Should().Be(0); + + bool constraintFired = false; + manager.TaskbarSpaceConstraintChanged += (_, _) => constraintFired = true; + + manager.Show(); + manager.GetActiveOverlays().Should().HaveCount(2); + + // Update existing overlays via SyncOverlays + manager.SyncOverlays("Re-sync"); + manager.GetActiveOverlays().Should().HaveCount(2); + + // Update snapshot, refresh, and hide while overlays active + manager.UpdateSnapshot(new LocalTelemetry.Core.Models.TelemetrySnapshot { CpuUsagePct = 25f }); + manager.RefreshOverlays(); + manager.Hide(); + manager.Show(); + + // Remove obsolete overlay when display_2 disconnects + displays.RemoveAt(1); + manager.SyncOverlays("Disconnect"); + manager.GetActiveOverlays().Should().HaveCount(1); + + // Forward constraint event via reflection + var onConstraint = typeof(TaskbarOverlayManager).GetMethod("OnPrimaryConstraintChanged", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + onConstraint!.Invoke(manager, [true, 180]); + constraintFired.Should().BeTrue(); + + // Timers, mouse hook, recovery, and display settings changed handler + manager.PauseAllTimers(); + manager.ResumeAllTimers(); + manager.StopMouseHook(); + manager.RecoverTaskbars("TestRecovery"); + + var onDisplayChanged = typeof(TaskbarOverlayManager).GetMethod("OnDisplaySettingsChanged", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + onDisplayChanged!.Invoke(manager, [null, EventArgs.Empty]); + + // Dispose and verify no-op paths after disposal + manager.Dispose(); + onDisplayChanged.Invoke(manager, [null, EventArgs.Empty]); + manager.RecoverTaskbars("AfterDispose"); + manager.SyncOverlays("AfterDispose"); + } + + [WpfFact] + public void TaskbarOverlayManager_SystemEventsHook_Coverage() + { + var cfg = new AppSettings(); + var origSkipHook = TaskbarOverlayManager.SkipDisplaySettingsChangedHookForTesting; + try + { + TaskbarOverlayManager.SkipDisplaySettingsChangedHookForTesting = false; + var manager = new TaskbarOverlayManager(cfg); + manager.Should().NotBeNull(); + manager.Dispose(); + } + finally + { + TaskbarOverlayManager.SkipDisplaySettingsChangedHookForTesting = origSkipHook; + } + } + + [WpfFact] + public void TaskbarOverlayManager_OnDisplaySettingsChanged_ErrorHandling_Coverage() + { + var cfg = new AppSettings(); + using var manager = new TaskbarOverlayManager(cfg); + + var origEnum = DisplayInfo.EnumerateDisplaysOverride; + try + { + DisplayInfo.EnumerateDisplaysOverride = () => throw new InvalidOperationException("Simulated display change sync error"); + var onDisplayChanged = typeof(TaskbarOverlayManager).GetMethod("OnDisplaySettingsChanged", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)!; + var act = () => onDisplayChanged.Invoke(manager, [null, EventArgs.Empty]); + act.Should().NotThrow(); + } + finally + { + DisplayInfo.EnumerateDisplaysOverride = origEnum; + } + } +} diff --git a/tests/LocalTelemetry.App.Tests/Overlay/TaskbarOverlayTests.cs b/tests/LocalTelemetry.App.Tests/Overlay/TaskbarOverlayTests.cs index bf1bf0b..1a9fcc3 100644 --- a/tests/LocalTelemetry.App.Tests/Overlay/TaskbarOverlayTests.cs +++ b/tests/LocalTelemetry.App.Tests/Overlay/TaskbarOverlayTests.cs @@ -73,7 +73,7 @@ public void ValuesChanged_DiffersOnAllProperties() public void InternalDrawing_Row1AndRow2_FlashAndThemeRendering() { var cfg = new AppSettings(); - cfg.Overlay.Row1 = ["cpu_pct", "cpu_temp", "ram_pct", "net_down", "gpu_pct", "gpu_temp", "ram_used", "net_up"]; + cfg.Overlay.Columns = [["cpu_pct", "cpu_temp"], ["ram_pct", "net_down"], ["gpu_pct", "gpu_temp"], ["ram_used", "net_up"]]; cfg.Overlay.MetricColors["cpu_pct"] = "#FF0000"; var embedder = new TaskbarEmbedder(cfg); @@ -200,6 +200,33 @@ public void MakeValueBrush_CachesBrushesByArgb() brush1.Should().BeSameAs(brush2); } + [WpfFact] + public void SetAlertActive_UpdatesAlertStateAndChangesBrushColor() + { + var cfg = new AppSettings(); + var embedder = new TaskbarEmbedder(cfg); + using var overlay = new TaskbarOverlay(cfg, embedder); + + overlay.IsAlertActive(Metrics.CpuTemp).Should().BeFalse(); + + var makeBrush = typeof(TaskbarOverlay).GetMethod("MakeValueBrush", BindingFlags.NonPublic | BindingFlags.Instance); + var normalBrush = (SolidBrush)makeBrush!.Invoke(overlay, [Metrics.CpuTemp, cfg.Overlay])!; + + overlay.SetAlertActive(Metrics.CpuTemp, true); + overlay.IsAlertActive(Metrics.CpuTemp).Should().BeTrue(); + + var alertBrush = (SolidBrush)makeBrush.Invoke(overlay, [Metrics.CpuTemp, cfg.Overlay])!; + alertBrush.Color.R.Should().Be(255); + alertBrush.Color.G.Should().Be(68); + alertBrush.Color.B.Should().Be(68); + + overlay.SetAlertActive(Metrics.CpuTemp, false); + overlay.IsAlertActive(Metrics.CpuTemp).Should().BeFalse(); + + var revertedBrush = (SolidBrush)makeBrush.Invoke(overlay, [Metrics.CpuTemp, cfg.Overlay])!; + revertedBrush.Color.Should().Be(normalBrush.Color); + } + [WpfFact] public void TaskbarOverlay_FullWindowLifecycleAndWndProc() { @@ -207,13 +234,13 @@ public void TaskbarOverlay_FullWindowLifecycleAndWndProc() cfg.Overlay.Visible = true; cfg.Overlay.FollowWindowsTheme = true; cfg.Overlay.DoubleClickAction = "settings"; - cfg.Overlay.Row1 = [ - "cpu_pct", "cpu_temp", "cpu_freq", "cpu_power", - "ram_pct", "ram_used", - "gpu_pct", "gpu_temp", "gpu_vram", "gpu_freq", "gpu_power", - "net_down", "net_up", "net_total", - "battery_pct", "battery_rate", - "disk_disk0_read", "disk_disk0_write" + cfg.Overlay.Columns = [ + ["cpu_pct", "cpu_temp"], ["cpu_freq", "cpu_power"], + ["ram_pct", "ram_used"], + ["gpu_pct", "gpu_temp"], ["gpu_vram", "gpu_freq"], ["gpu_power", "net_down"], + ["net_up", "net_total"], + ["battery_pct", "battery_rate"], + ["disk_disk0_read", "disk_disk0_write"] ]; var embedder = new TaskbarEmbedder(cfg); @@ -266,12 +293,8 @@ public void TaskbarOverlay_FullWindowLifecycleAndWndProc() clickedAction.Should().Be("settings"); // Reflection invocations for timer handlers & rendering - typeof(TaskbarEmbedder).GetProperty("IsFallback", BindingFlags.Public | BindingFlags.Instance)!.GetSetMethod(true)!.Invoke(embedder, [false]); typeof(TaskbarEmbedder).GetProperty("IsEmbedded", BindingFlags.Public | BindingFlags.Instance)!.GetSetMethod(true)!.Invoke(embedder, [false]); - var renderFloat = typeof(TaskbarOverlay).GetMethod("RenderFloat", BindingFlags.NonPublic | BindingFlags.Instance); - renderFloat!.Invoke(overlay, null); - var posTick = typeof(TaskbarOverlay).GetMethod("PosTick", BindingFlags.NonPublic | BindingFlags.Instance); posTick!.Invoke(overlay, null); @@ -296,7 +319,7 @@ public void TaskbarOverlay_ThemeTick_MeasureSize_And_MouseHook_Coverage() { var cfg = new AppSettings(); cfg.Overlay.Visible = true; - cfg.Overlay.Row1 = [Metrics.CpuPct, Metrics.RamPct, Metrics.GpuPct, Metrics.NetDown]; + cfg.Overlay.Columns = [[Metrics.CpuPct, Metrics.RamPct], [Metrics.GpuPct, Metrics.NetDown]]; var embedder = new TaskbarEmbedder(cfg); using var overlay = new TaskbarOverlay(cfg, embedder); @@ -316,13 +339,14 @@ public void TaskbarOverlay_ThemeTick_MeasureSize_And_MouseHook_Coverage() // Exercise mouse hook procedure var mouseProc = typeof(TaskbarOverlay).GetMethod("MouseHookCallback", BindingFlags.NonPublic | BindingFlags.Instance); - var structPtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf()); + var structPtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf()); try { - System.Runtime.InteropServices.Marshal.StructureToPtr(new NativeMethods.MSLLHOOKSTRUCT { pt = new NativeMethods.POINT { X = 10, Y = 10 } }, structPtr, false); + System.Runtime.InteropServices.Marshal.StructureToPtr(new NativeMethods.MsllHookStruct { pt = new NativeMethods.Point { X = 10, Y = 10 } }, structPtr, false); - // WM_RBUTTONUP (context menu) - mouseProc!.Invoke(overlay, [0, (IntPtr)NativeMethods.WM_RBUTTONUP, structPtr]); + // WM_RBUTTONDOWN then WM_RBUTTONUP (context menu) + mouseProc!.Invoke(overlay, [0, (IntPtr)NativeMethods.WM_RBUTTONDOWN, structPtr]); + mouseProc.Invoke(overlay, [0, (IntPtr)NativeMethods.WM_RBUTTONUP, structPtr]); // WM_LBUTTONDOWN & WM_LBUTTONDBLCLK mouseProc.Invoke(overlay, [0, (IntPtr)NativeMethods.WM_LBUTTONDOWN, structPtr]); @@ -336,6 +360,43 @@ public void TaskbarOverlay_ThemeTick_MeasureSize_And_MouseHook_Coverage() overlay.Hide(); } + [WpfFact] + public void TaskbarOverlay_MeasureSize_AutoScalesDown_WhenConstrained() + { + var cfg = new AppSettings(); + cfg.Overlay.Visible = true; + cfg.Overlay.Columns = [ + [Metrics.CpuPct, Metrics.RamPct], + [Metrics.GpuPct, Metrics.NetDown], + [Metrics.GpuTemp, Metrics.NetUp] + ]; + + var embedder = new TaskbarEmbedder(cfg); + using var overlay = new TaskbarOverlay(cfg, embedder); + + overlay.Show(); + + var measureSize = typeof(TaskbarOverlay).GetMethod("MeasureSize", BindingFlags.NonPublic | BindingFlags.Instance)!; + var unconstrained = (Size)measureSize.Invoke(overlay, null)!; + + // Simulate slot constrained to 200px + typeof(TaskbarEmbedder).GetProperty(nameof(TaskbarEmbedder.AvailableSlotWidth))! + .GetSetMethod(true)!.Invoke(embedder, [200]); + typeof(TaskbarEmbedder).GetProperty(nameof(TaskbarEmbedder.IsTaskbarSpaceConstrained))! + .GetSetMethod(true)!.Invoke(embedder, [true]); + + var constrainedSz = (Size)measureSize.Invoke(overlay, null)!; + constrainedSz.Width.Should().BeLessThan(unconstrained.Width); + + // Simulate slot constrained to 0px + typeof(TaskbarEmbedder).GetProperty(nameof(TaskbarEmbedder.AvailableSlotWidth))! + .GetSetMethod(true)!.Invoke(embedder, [0]); + var zeroSlotSz = (Size)measureSize.Invoke(overlay, null)!; + zeroSlotSz.Width.Should().BeLessThan(unconstrained.Width); + + overlay.Hide(); + } + [WpfFact] public void TaskbarOverlay_GetDiskLabel_FormatsSingleAndMultipleDisksCorrectly() { @@ -361,7 +422,7 @@ public void TaskbarOverlay_GetDiskLabel_FormatsSingleAndMultipleDisksCorrectly() getDiskLabel.Should().NotBeNull(); // Disks of same type get numbered - ((string)getDiskLabel!.Invoke(overlay, ["disk_disk0_read"])!).Should().Be("NVMe1R"); + ((string)getDiskLabel.Invoke(overlay, ["disk_disk0_read"])!).Should().Be("NVMe1R"); ((string)getDiskLabel.Invoke(overlay, ["disk_disk1_write"])!).Should().Be("NVMe2W"); ((string)getDiskLabel.Invoke(overlay, ["disk_disk2_read"])!).Should().Be("SATAR"); ((string)getDiskLabel.Invoke(overlay, ["disk_disk3_write"])!).Should().Be("HDDW"); @@ -376,7 +437,7 @@ public void TaskbarOverlay_GetDiskLabel_FormatsSingleAndMultipleDisksCorrectly() public void TaskbarOverlay_DrawItems_SingleRow_And_CustomSettings_Coverage() { var cfg = new AppSettings(); - cfg.Overlay.Row1 = [Metrics.CpuPct]; // Single row layout + cfg.Overlay.Columns = [[Metrics.CpuPct]]; // Single row layout cfg.Overlay.FontBold = false; cfg.Overlay.ScalePct = 120; cfg.Overlay.ValueColor = "#00FF00"; @@ -396,7 +457,7 @@ public void TaskbarOverlay_DrawItems_SingleRow_And_CustomSettings_Coverage() actDrawSingle.Should().NotThrow(); // Empty row - cfg.Overlay.Row1 = []; + cfg.Overlay.Columns = []; var actDrawEmpty = () => drawContent!.Invoke(overlay, [g]); actDrawEmpty.Should().NotThrow(); } @@ -420,7 +481,7 @@ public void TaskbarOverlay_HandleOverlayMouseMessage_ExercisesAllMouseActions() // WM_SETCURSOR / WM_MOUSEMOVE object[] setCursorArgs = [NativeMethods.WM_SETCURSOR, IntPtr.Zero]; - ((bool)handleMouse!.Invoke(overlay, setCursorArgs)!).Should().BeFalse(); + ((bool)handleMouse.Invoke(overlay, setCursorArgs)!).Should().BeFalse(); // WM_RBUTTONDOWN object[] rBtnDownArgs = [NativeMethods.WM_RBUTTONDOWN, IntPtr.Zero]; @@ -440,6 +501,22 @@ public void TaskbarOverlay_HandleOverlayMouseMessage_ExercisesAllMouseActions() ((bool)handleMouse.Invoke(overlay, unhandledArgs)!).Should().BeFalse(); } + [WpfFact] + public void TaskbarOverlay_IsOverlayOrTaskbarAtPoint_ValidatesPointHierarchy() + { + var cfg = new AppSettings(); + var embedder = new TaskbarEmbedder(cfg); + using var overlay = new TaskbarOverlay(cfg, embedder); + overlay.Show(); + + var method = typeof(TaskbarOverlay).GetMethod("IsOverlayOrTaskbarAtPoint", BindingFlags.NonPublic | BindingFlags.Instance); + method.Should().NotBeNull(); + + // In test mode (SkipEmbedForTesting || SkipShowWindowForTesting), returns true + var result = (bool)method.Invoke(overlay, [new NativeMethods.Point { X = 50, Y = 50 }])!; + result.Should().BeTrue(); + } + [WpfFact] public void TaskbarOverlay_ReShow_And_DuplicateDispose_Lifecycle() { @@ -493,7 +570,6 @@ public void TaskbarOverlay_PosTick_And_WatchTick_ChildModeAndTrayChanged() overlay.Show(); typeof(TaskbarEmbedder).GetProperty("IsEmbedded", BindingFlags.Public | BindingFlags.Instance)!.GetSetMethod(true)!.Invoke(embedder, [true]); - typeof(TaskbarEmbedder).GetProperty("IsFallback", BindingFlags.Public | BindingFlags.Instance)!.GetSetMethod(true)!.Invoke(embedder, [false]); // Exercise PosTick when IsChildMode is true and DPI changes typeof(TaskbarOverlay).GetField("_dpi", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(overlay, 0.5f); @@ -619,11 +695,11 @@ public void TaskbarOverlay_MouseHook_ClosesContextMenuWhenClickedOutside() overlay.CloseContextMenuAction = () => closeContextMenuCalled = true; var mouseProc = typeof(TaskbarOverlay).GetMethod("MouseHookCallback", BindingFlags.NonPublic | BindingFlags.Instance); - var structPtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf()); + var structPtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf()); try { // Click outside the context menu bounds (at 10, 10) - System.Runtime.InteropServices.Marshal.StructureToPtr(new NativeMethods.MSLLHOOKSTRUCT { pt = new NativeMethods.POINT { X = 10, Y = 10 } }, structPtr, false); + System.Runtime.InteropServices.Marshal.StructureToPtr(new NativeMethods.MsllHookStruct { pt = new NativeMethods.Point { X = 10, Y = 10 } }, structPtr, false); mouseProc!.Invoke(overlay, [0, (IntPtr)NativeMethods.WM_LBUTTONDOWN, structPtr]); closeContextMenuCalled.Should().BeTrue(); @@ -642,6 +718,9 @@ public void TaskbarOverlay_ShowAndHide_RealLifecycleAndSnapshotDispatch() bool priorEmbed = TaskbarOverlay.SkipEmbedForTesting; bool priorMouse = TaskbarOverlay.SkipMouseHookForTesting; + using var fakeTray = new Form { Bounds = new Rectangle(0, 1000, 1920, 48) }; + TaskbarEmbedder.ExplorerTrayWndOverride = () => fakeTray.Handle; + TaskbarOverlay.SkipShowWindowForTesting = false; TaskbarOverlay.SkipEmbedForTesting = false; TaskbarOverlay.SkipMouseHookForTesting = false; @@ -650,7 +729,7 @@ public void TaskbarOverlay_ShowAndHide_RealLifecycleAndSnapshotDispatch() { var cfg = new AppSettings(); cfg.Overlay.Visible = true; - cfg.Overlay.Row1 = ["cpu_pct", "ram_pct"]; + cfg.Overlay.Columns = [["cpu_pct", "ram_pct"]]; var embedder = new TaskbarEmbedder(cfg); using var overlay = new TaskbarOverlay(cfg, embedder); @@ -677,6 +756,7 @@ public void TaskbarOverlay_ShowAndHide_RealLifecycleAndSnapshotDispatch() } finally { + TaskbarEmbedder.ExplorerTrayWndOverride = null; TaskbarOverlay.SkipShowWindowForTesting = priorShow; TaskbarOverlay.SkipEmbedForTesting = priorEmbed; TaskbarOverlay.SkipMouseHookForTesting = priorMouse; @@ -837,4 +917,287 @@ public void TaskbarOverlay_Lifecycle_Theme_And_Mouse_Coverage() TaskbarOverlay.SkipEmbedForTesting = origSkipEmbed; } } + + [Fact] + public void TaskbarOverlay_CheckAndNotifySpaceConstraint_FiresEventWhenStateChanges() + { + var cfg = new AppSettings(); + var embedder = new TaskbarEmbedder(cfg); + using var overlay = new TaskbarOverlay(cfg, embedder); + + bool? notifiedConstrained = null; + int? notifiedWidth = null; + int eventCount = 0; + + overlay.TaskbarSpaceConstraintChanged += (constrained, width) => + { + notifiedConstrained = constrained; + notifiedWidth = width; + eventCount++; + }; + + // Initially _lastReportedSpaceConstrained is false and _lastReportedSlotWidth is -1 + overlay.CheckAndNotifySpaceConstraint(); + eventCount.Should().Be(1); + notifiedConstrained.Should().Be(false); + notifiedWidth.Should().Be(0); + + // Calling again without change should not re-fire + overlay.CheckAndNotifySpaceConstraint(); + eventCount.Should().Be(1); + + // Simulate change in embedder constraint state + typeof(TaskbarEmbedder).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance)! + .SetValue(embedder, true); + typeof(TaskbarEmbedder).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance)! + .SetValue(embedder, 180); + + overlay.CheckAndNotifySpaceConstraint(); + eventCount.Should().Be(2); + notifiedConstrained.Should().Be(true); + notifiedWidth.Should().Be(180); + + // Simulate returning to normal (unconstrained, wider slot) + typeof(TaskbarEmbedder).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance)! + .SetValue(embedder, false); + typeof(TaskbarEmbedder).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance)! + .SetValue(embedder, 500); + + overlay.CheckAndNotifySpaceConstraint(); + eventCount.Should().Be(3); + notifiedConstrained.Should().Be(false); + notifiedWidth.Should().Be(500); + } + + [WpfFact] + public void TaskbarOverlay_MeasureSize_MultiStageDownsizing_Stage1_CompressesSpacing() + { + var cfg = new AppSettings(); + cfg.Overlay.Columns = [[Metrics.CpuPct, Metrics.RamPct], [Metrics.GpuPct, Metrics.NetDown]]; + var embedder = new TaskbarEmbedder(cfg); + using var overlay = new TaskbarOverlay(cfg, embedder); + + var measureInternal = typeof(TaskbarOverlay).GetMethod("MeasureSizeInternal", BindingFlags.NonPublic | BindingFlags.Instance)!; + var initialSize = (Size)measureInternal.Invoke(overlay, null)!; + + // Stage 1 target: slot width matches compressed width with spacing compressed to 0.5f + var spacingField = typeof(TaskbarOverlay).GetField("_spacingScaleFactor", BindingFlags.NonPublic | BindingFlags.Instance)!; + spacingField.SetValue(overlay, 0.5f); + var compressedSize = (Size)measureInternal.Invoke(overlay, null)!; + spacingField.SetValue(overlay, 1.0f); + + typeof(TaskbarEmbedder).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance)! + .SetValue(embedder, compressedSize.Width); + + var measureSize = typeof(TaskbarOverlay).GetMethod("MeasureSize", BindingFlags.NonPublic | BindingFlags.Instance)!; + var measured = (Size)measureSize.Invoke(overlay, null)!; + + var autoScaleField = typeof(TaskbarOverlay).GetField("_autoScaleFactor", BindingFlags.NonPublic | BindingFlags.Instance)!; + + measured.Width.Should().BeLessThanOrEqualTo(initialSize.Width); + ((float)spacingField.GetValue(overlay)!).Should().Be(0.5f); + ((float)autoScaleField.GetValue(overlay)!).Should().Be(1.0f); + } + + [WpfFact] + public void TaskbarOverlay_MeasureSize_MultiStageDownsizing_Stage2_ContinuousScaling() + { + var cfg = new AppSettings(); + cfg.Overlay.Columns = [[Metrics.CpuPct, Metrics.RamPct], [Metrics.GpuPct, Metrics.NetDown]]; + var embedder = new TaskbarEmbedder(cfg); + using var overlay = new TaskbarOverlay(cfg, embedder); + + var measureInternal = typeof(TaskbarOverlay).GetMethod("MeasureSizeInternal", BindingFlags.NonPublic | BindingFlags.Instance)!; + var initialSize = (Size)measureInternal.Invoke(overlay, null)!; + + // Target: 75% of initial width, requiring continuous scaling factor between 0.60 and 0.90 + int targetWidth = (int)(initialSize.Width * 0.75f); + typeof(TaskbarEmbedder).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance)! + .SetValue(embedder, targetWidth); + + var measureSize = typeof(TaskbarOverlay).GetMethod("MeasureSize", BindingFlags.NonPublic | BindingFlags.Instance)!; + var measured = (Size)measureSize.Invoke(overlay, null)!; + + var spacingField = typeof(TaskbarOverlay).GetField("_spacingScaleFactor", BindingFlags.NonPublic | BindingFlags.Instance)!; + var autoScaleField = typeof(TaskbarOverlay).GetField("_autoScaleFactor", BindingFlags.NonPublic | BindingFlags.Instance)!; + + ((float)spacingField.GetValue(overlay)!).Should().Be(0.5f); + ((float)autoScaleField.GetValue(overlay)!).Should().BeInRange(0.60f, 0.90f); + measured.Width.Should().BeLessThanOrEqualTo(initialSize.Width); + } + + [WpfFact] + public void TaskbarOverlay_MeasureSize_MultiStageDownsizing_Stage3_ReadabilityFloorClamp() + { + var cfg = new AppSettings(); + cfg.Overlay.Columns = [[Metrics.CpuPct, Metrics.RamPct], [Metrics.GpuPct, Metrics.NetDown]]; + var embedder = new TaskbarEmbedder(cfg); + using var overlay = new TaskbarOverlay(cfg, embedder); + + // Target: extremely narrow slot (e.g. 15px) requiring clamp to 0.60f floor + typeof(TaskbarEmbedder).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance)! + .SetValue(embedder, 15); + + var measureSize = typeof(TaskbarOverlay).GetMethod("MeasureSize", BindingFlags.NonPublic | BindingFlags.Instance)!; + var measured = (Size)measureSize.Invoke(overlay, null)!; + + var autoScaleField = typeof(TaskbarOverlay).GetField("_autoScaleFactor", BindingFlags.NonPublic | BindingFlags.Instance)!; + + ((float)autoScaleField.GetValue(overlay)!).Should().Be(0.60f); + measured.Width.Should().BeGreaterThan(0); + } + + [WpfFact] + public void TaskbarOverlay_SingleMetricColumn_MeasuresAndRendersWithoutExtraRowHeight() + { + var cfgSingle = new AppSettings(); + cfgSingle.Overlay.Columns = [[Metrics.CpuPct]]; + var embedderSingle = new TaskbarEmbedder(cfgSingle); + using var overlaySingle = new TaskbarOverlay(cfgSingle, embedderSingle); + + var measureSingle = typeof(TaskbarOverlay).GetMethod("MeasureSize", BindingFlags.NonPublic | BindingFlags.Instance)!; + var szSingle = (Size)measureSingle.Invoke(overlaySingle, null)!; + + var cfgDual = new AppSettings(); + cfgDual.Overlay.Columns = [[Metrics.CpuPct, Metrics.CpuTemp]]; + var embedderDual = new TaskbarEmbedder(cfgDual); + using var overlayDual = new TaskbarOverlay(cfgDual, embedderDual); + + var szDual = (Size)measureSingle.Invoke(overlayDual, null)!; + + // Single metric overlay should be strictly shorter than dual metric overlay + szSingle.Height.Should().BeLessThan(szDual.Height); + } + + [WpfFact] + public void TaskbarOverlay_MixedColumns_RendersTopRowOnlyInSingleMetricColumn() + { + var cfg = new AppSettings(); + // Col 0 has 1 metric; Col 1 has 2 metrics + cfg.Overlay.Columns = [[Metrics.CpuPct], [Metrics.GpuPct, Metrics.GpuTemp]]; + var embedder = new TaskbarEmbedder(cfg); + using var overlay = new TaskbarOverlay(cfg, embedder); + + using var bmp = new Bitmap(300, 50); + using var g = Graphics.FromImage(bmp); + + var drawContent = typeof(TaskbarOverlay).GetMethod("DrawContent", BindingFlags.NonPublic | BindingFlags.Instance)!; + var act = () => drawContent.Invoke(overlay, [g]); + act.Should().NotThrow(); + } + + [WpfFact] + public void TaskbarOverlay_Alerts_MouseHook_And_ThemeDetection_Coverage() + { + var cfg = new AppSettings(); + var embedder = new TaskbarEmbedder(cfg); + using var overlay = new TaskbarOverlay(cfg, embedder); + + // 1. Alert activation and deactivation + overlay.SetAlertActive("cpu", true); + overlay.SetAlertActive("cpu", true); // duplicate add + overlay.SetAlertActive("cpu", false); + overlay.SetAlertActive("cpu", false); // duplicate remove + + // 2. Mouse hook state and stop + overlay.IsMouseHookActive.Should().BeFalse(); + overlay.StopMouseHook(); + + // 3. IsOverlayOrTaskbarAtPoint + var pt = new LocalTelemetry.App.Win32.NativeMethods.Point { X = 100, Y = 100 }; + var priorSkipEmbed = TaskbarOverlay.SkipEmbedForTesting; + var priorSkipShow = TaskbarOverlay.SkipShowWindowForTesting; + try + { + TaskbarOverlay.SkipEmbedForTesting = true; + overlay.IsOverlayOrTaskbarAtPoint(pt).Should().BeTrue(); + + TaskbarOverlay.SkipEmbedForTesting = false; + TaskbarOverlay.SkipShowWindowForTesting = false; + overlay.IsOverlayOrTaskbarAtPoint(pt).Should().BeFalse(); + } + finally + { + TaskbarOverlay.SkipEmbedForTesting = priorSkipEmbed; + TaskbarOverlay.SkipShowWindowForTesting = priorSkipShow; + } + + // 4. HandleOutsideContextMenuClick & TryHandleOverlayClick + var hookStruct = new LocalTelemetry.App.Win32.NativeMethods.MsllHookStruct + { + pt = new LocalTelemetry.App.Win32.NativeMethods.Point { X = 200, Y = 200 } + }; + IntPtr ptr = System.Runtime.InteropServices.Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf(hookStruct)); + try + { + System.Runtime.InteropServices.Marshal.StructureToPtr(hookStruct, ptr, false); + + var handleOutside = typeof(TaskbarOverlay).GetMethod("HandleOutsideContextMenuClick", BindingFlags.Instance | BindingFlags.NonPublic)!; + handleOutside.Invoke(overlay, [LocalTelemetry.App.Win32.NativeMethods.WM_LBUTTONDOWN, ptr]); + + // With IsContextMenuOpen returning true + overlay.IsContextMenuOpen = () => true; + overlay.CloseContextMenuAction = () => { }; + overlay.IsPointInsideContextMenu = _ => false; + handleOutside.Invoke(overlay, [LocalTelemetry.App.Win32.NativeMethods.WM_LBUTTONDOWN, ptr]); + + var tryHandle = typeof(TaskbarOverlay).GetMethod("TryHandleOverlayClick", BindingFlags.Instance | BindingFlags.NonPublic)!; + object?[] tryArgs = [LocalTelemetry.App.Win32.NativeMethods.WM_MOUSEMOVE, ptr, IntPtr.Zero]; + var resMove = (bool)tryHandle.Invoke(overlay, tryArgs)!; + resMove.Should().BeFalse(); + + tryArgs = [LocalTelemetry.App.Win32.NativeMethods.WM_RBUTTONDOWN, ptr, IntPtr.Zero]; + tryHandle.Invoke(overlay, tryArgs); + } + finally + { + System.Runtime.InteropServices.Marshal.FreeHGlobal(ptr); + } + + // 5. ThemeTick and DetectSystemTheme + var themeTick = typeof(TaskbarOverlay).GetMethod("ThemeTick", BindingFlags.Instance | BindingFlags.NonPublic)!; + var actTheme = () => themeTick.Invoke(overlay, null); + actTheme.Should().NotThrow(); + } + + [WpfFact] + public void TaskbarOverlay_MouseHook_And_Timers_Coverage() + { + var cfg = new AppSettings(); + var embedder = new TaskbarEmbedder(cfg); + using var overlay = new TaskbarOverlay(cfg, embedder); + + // 1. StartMouseHook with SkipMouseHookForTesting = false + var priorSkipHook = TaskbarOverlay.SkipMouseHookForTesting; + try + { + TaskbarOverlay.SkipMouseHookForTesting = false; + var startHook = typeof(TaskbarOverlay).GetMethod("StartMouseHook", BindingFlags.Instance | BindingFlags.NonPublic)!; + startHook.Invoke(overlay, null); + overlay.IsMouseHookActive.Should().BeTrue(); + overlay.StopMouseHook(); + overlay.IsMouseHookActive.Should().BeFalse(); + } + finally + { + TaskbarOverlay.SkipMouseHookForTesting = priorSkipHook; + } + + // 2. ResumeTimers and PosTick with SkipTimersForTesting = false + var priorSkipTimers = TaskbarOverlay.SkipTimersForTesting; + try + { + TaskbarOverlay.SkipTimersForTesting = false; + overlay.PauseTimers(); + overlay.ResumeTimers(); + + var posTick = typeof(TaskbarOverlay).GetMethod("PosTick", BindingFlags.Instance | BindingFlags.NonPublic)!; + var actPos = () => posTick.Invoke(overlay, null); + actPos.Should().NotThrow(); + } + finally + { + TaskbarOverlay.SkipTimersForTesting = priorSkipTimers; + } + } } diff --git a/tests/LocalTelemetry.App.Tests/Services/AlertServiceTests.cs b/tests/LocalTelemetry.App.Tests/Services/AlertServiceTests.cs index 3b230a2..6653ca7 100644 --- a/tests/LocalTelemetry.App.Tests/Services/AlertServiceTests.cs +++ b/tests/LocalTelemetry.App.Tests/Services/AlertServiceTests.cs @@ -19,13 +19,26 @@ private static void BypassStartupGracePeriod(AlertService service) field?.SetValue(service, DateTime.UtcNow.AddSeconds(-20)); } + private sealed class ManualTimeProvider : TimeProvider + { + private DateTimeOffset _utcNow = DateTimeOffset.UtcNow; + + public void Advance(TimeSpan delta) => _utcNow += delta; + public override DateTimeOffset GetUtcNow() => _utcNow; + } + private static (AlertService service, TaskbarOverlay overlay, NotificationClient notifClient) - CreateService(AppSettings cfg) + CreateService(AppSettings cfg, TimeProvider? timeProvider = null, bool defaultZeroSustained = true) { + if (defaultZeroSustained && cfg.Alerts.SustainedSecs == 3) + { + cfg.Alerts.SustainedSecs = 0; + } + var embedder = new TaskbarEmbedder(cfg); var overlay = new TaskbarOverlay(cfg, embedder); var notifClient = Substitute.For(); - var service = new AlertService(cfg, overlay, notifClient); + var service = new AlertService(cfg, overlay, notifClient, null, timeProvider); BypassStartupGracePeriod(service); return (service, overlay, notifClient); } @@ -373,14 +386,15 @@ public void Evaluate_NetAlerts_DailyAndMonthlyUsage_TriggersAlerts() cfg.Alerts.AlertNetMonthly = true; cfg.Alerts.NetDailyMaxGb = 0.001f; cfg.Alerts.NetMonthlyMaxGb = 0.001f; + cfg.Alerts.SustainedSecs = 0; cfg.Alerts.FlashOverlay = true; cfg.Alerts.ShowToastNotif = true; string tempPath = Path.Combine(Path.GetTempPath(), $"traffic_alert_test_{Guid.NewGuid():N}.dat"); try { - var historyFile = new LocalTelemetry.Core.Hardware.TrafficHistoryFile(tempPath); - using var netLogger = new LocalTelemetry.Core.Hardware.NetUsageLogger(cfg, historyFile); + var historyFile = new Core.Hardware.TrafficHistoryFile(tempPath); + using var netLogger = new Core.Hardware.NetUsageLogger(cfg, historyFile); var embedder = new TaskbarEmbedder(cfg); var overlay = new TaskbarOverlay(cfg, embedder); @@ -437,7 +451,7 @@ public void Evaluate_Hysteresis_SuppressesAlertsDuringFluctuationsUntilFullRecov var cfg = new AppSettings(); cfg.Alerts.Enabled = true; cfg.Alerts.AlertCpuTemp = true; - cfg.Alerts.CpuTempMaxC = 90f; // Threshold 90°C, Hysteresis 6°C -> Recovery at <= 84°C + cfg.Alerts.CpuTempMaxC = 90f; // Threshold 90°C, Hysteresis 10°C -> Recovery at <= 80°C cfg.Alerts.ShowToastNotif = true; cfg.Alerts.CooldownSecs = 0; // Disable time cooldown to test pure hysteresis behavior @@ -447,15 +461,16 @@ public void Evaluate_Hysteresis_SuppressesAlertsDuringFluctuationsUntilFullRecov service.Evaluate(new TelemetrySnapshot { CpuTempPackageC = 91f }); _ = notifClient.Received(1).SendToastAsync(Arg.Is(s => s.Contains("CPU Temperature High")), Arg.Any()); - // 2. Fluctuations typical of laptop gaming (92°C, 88°C, 91°C, 85°C): should NOT fire again + // 2. Fluctuations typical of laptop gaming (92°C, 88°C, 91°C, 85°C, 83°C): should NOT fire again service.Evaluate(new TelemetrySnapshot { CpuTempPackageC = 92f }); service.Evaluate(new TelemetrySnapshot { CpuTempPackageC = 88f }); service.Evaluate(new TelemetrySnapshot { CpuTempPackageC = 91f }); service.Evaluate(new TelemetrySnapshot { CpuTempPackageC = 85f }); + service.Evaluate(new TelemetrySnapshot { CpuTempPackageC = 83f }); _ = notifClient.Received(1).SendToastAsync(Arg.Any(), Arg.Any()); - // 3. Cools down below 90 - 6 = 84°C (e.g. 83°C): recovers/normalizes - service.Evaluate(new TelemetrySnapshot { CpuTempPackageC = 83f }); + // 3. Cools down below 90 - 10 = 80°C (e.g. 79°C): recovers/normalizes + service.Evaluate(new TelemetrySnapshot { CpuTempPackageC = 79f }); _ = notifClient.Received(1).SendToastAsync(Arg.Any(), Arg.Any()); // 4. Climbs back to 91°C: should fire again as a new breach @@ -487,4 +502,169 @@ public void Evaluate_Escalation_TriggersEscalationAlertWhenTempSurges() service.Evaluate(new TelemetrySnapshot { CpuTempPackageC = 96f }); _ = notifClient.Received(1).SendToastAsync(Arg.Is(s => s.Contains("CPU Temperature Critical")), Arg.Any()); } + + [WpfFact] + public void Evaluate_SpikeUnderSustainedDuration_DoesNotFireAlertOrSetOverlayActive() + { + var cfg = new AppSettings(); + cfg.Alerts.Enabled = true; + cfg.Alerts.AlertCpuTemp = true; + cfg.Alerts.CpuTempMaxC = 90f; + cfg.Alerts.SustainedSecs = 3; + cfg.Alerts.ShowToastNotif = true; + + var timeProvider = new ManualTimeProvider(); + var (service, overlay, notifClient) = CreateService(cfg, timeProvider, defaultZeroSustained: false); + + // Tick 1: 95°C at t=0s -> breach starts, no notification + service.Evaluate(new TelemetrySnapshot { CpuTempPackageC = 95f }); + _ = notifClient.DidNotReceiveWithAnyArgs().SendToastAsync(default!, default!); + overlay.IsAlertActive(Metrics.CpuTemp).Should().BeFalse(); + + // Tick 2: 95°C at t=2s (only 2s elapsed < 3s sustained) -> no notification + timeProvider.Advance(TimeSpan.FromSeconds(2)); + service.Evaluate(new TelemetrySnapshot { CpuTempPackageC = 95f }); + _ = notifClient.DidNotReceiveWithAnyArgs().SendToastAsync(default!, default!); + overlay.IsAlertActive(Metrics.CpuTemp).Should().BeFalse(); + + // Tick 3: Drops to 85°C (spike ended) -> breach tracking cleared + timeProvider.Advance(TimeSpan.FromSeconds(0.5)); + service.Evaluate(new TelemetrySnapshot { CpuTempPackageC = 85f }); + _ = notifClient.DidNotReceiveWithAnyArgs().SendToastAsync(default!, default!); + overlay.IsAlertActive(Metrics.CpuTemp).Should().BeFalse(); + } + + [WpfFact] + public void Evaluate_SustainedBreach_FiresAlertAndSetsOverlayActive() + { + var cfg = new AppSettings(); + cfg.Alerts.Enabled = true; + cfg.Alerts.AlertCpuTemp = true; + cfg.Alerts.CpuTempMaxC = 90f; + cfg.Alerts.SustainedSecs = 3; + cfg.Alerts.ShowToastNotif = true; + + var timeProvider = new ManualTimeProvider(); + var (service, overlay, notifClient) = CreateService(cfg, timeProvider, defaultZeroSustained: false); + + // Tick 1: 95°C at t=0s + service.Evaluate(new TelemetrySnapshot { CpuTempPackageC = 95f }); + overlay.IsAlertActive(Metrics.CpuTemp).Should().BeFalse(); + + // Tick 2: 95°C at t=3.5s (sustained >= 3s) -> fires! + timeProvider.Advance(TimeSpan.FromSeconds(3.5)); + service.Evaluate(new TelemetrySnapshot { CpuTempPackageC = 95f }); + + _ = notifClient.Received(1).SendToastAsync(Arg.Is(s => s.Contains("CPU Temperature High")), Arg.Any()); + overlay.IsAlertActive(Metrics.CpuTemp).Should().BeTrue(); + } + + [WpfFact] + public void Evaluate_RecoveryAfterSustainedBreach_ClearsOverlayActive() + { + var cfg = new AppSettings(); + cfg.Alerts.Enabled = true; + cfg.Alerts.AlertCpuTemp = true; + cfg.Alerts.CpuTempMaxC = 90f; // Hysteresis is 10°C, recovers at <= 80°C + cfg.Alerts.SustainedSecs = 3; + + var timeProvider = new ManualTimeProvider(); + var (service, overlay, _) = CreateService(cfg, timeProvider, defaultZeroSustained: false); + + // Initial sustained breach + service.Evaluate(new TelemetrySnapshot { CpuTempPackageC = 95f }); + timeProvider.Advance(TimeSpan.FromSeconds(3.5)); + service.Evaluate(new TelemetrySnapshot { CpuTempPackageC = 95f }); + overlay.IsAlertActive(Metrics.CpuTemp).Should().BeTrue(); + + // Cools down to 85°C: still within hysteresis band (90 - 10 = 80°C), remains active + service.Evaluate(new TelemetrySnapshot { CpuTempPackageC = 85f }); + overlay.IsAlertActive(Metrics.CpuTemp).Should().BeTrue(); + + // Cools down to 79°C: recovers! + service.Evaluate(new TelemetrySnapshot { CpuTempPackageC = 79f }); + overlay.IsAlertActive(Metrics.CpuTemp).Should().BeFalse(); + } + + [WpfFact] + public void Evaluate_DisabledAlerts_ClearsActiveOverlayWarnings() + { + var cfg = new AppSettings(); + cfg.Alerts.Enabled = true; + cfg.Alerts.AlertCpuTemp = true; + cfg.Alerts.CpuTempMaxC = 90f; + cfg.Alerts.SustainedSecs = 0; + + var (service, overlay, _) = CreateService(cfg); + + // Breach fires immediately + service.Evaluate(new TelemetrySnapshot { CpuTempPackageC = 95f }); + overlay.IsAlertActive(Metrics.CpuTemp).Should().BeTrue(); + + // User disables alerts + cfg.Alerts.Enabled = false; + service.Evaluate(new TelemetrySnapshot { CpuTempPackageC = 95f }); + overlay.IsAlertActive(Metrics.CpuTemp).Should().BeFalse(); + } + + [WpfFact] + public void Evaluate_DiskTempAlert_FiresAndRecovers() + { + var cfg = new AppSettings(); + cfg.Alerts.Enabled = true; + cfg.Alerts.AlertDiskTemp = true; + cfg.Alerts.DiskTempMaxC = 70f; + cfg.Alerts.SustainedSecs = 0; + + var (service, overlay, notifClient) = CreateService(cfg); + + var snap = new TelemetrySnapshot + { + Disks = [new DiskSnapshot { Id = "disk0", Label = "NVMe 1", TemperatureC = 75 }] + }; + + service.Evaluate(snap); + overlay.IsAlertActive("disk_disk0_temp").Should().BeTrue(); + _ = notifClient.Received(1).SendToastAsync(Arg.Is(s => s.Contains("NVMe 1 Temperature")), Arg.Any()); + + // Recovers when temp drops below threshold minus hysteresis (70 - 5 = 65°C) + var recoveredSnap = new TelemetrySnapshot + { + Disks = [new DiskSnapshot { Id = "disk0", Label = "NVMe 1", TemperatureC = 64 }] + }; + service.Evaluate(recoveredSnap); + overlay.IsAlertActive("disk_disk0_temp").Should().BeFalse(); + } + + [WpfFact] + public void AlertService_CleanUpDisabledAlerts_And_Cooldowns_Coverage() + { + var cfg = new AppSettings(); + cfg.Alerts.Enabled = true; + cfg.Alerts.AlertCpuTemp = true; + cfg.Alerts.CpuTempMaxC = 80f; + cfg.Alerts.SustainedSecs = 0; + cfg.Alerts.FireOncePerSession = false; + cfg.Alerts.CooldownSecs = 60; + + var (service, overlay, _) = CreateService(cfg); + + // 1. Trigger CPU alert + service.Evaluate(new TelemetrySnapshot { CpuTempPackageC = 95f }); + overlay.IsAlertActive(Metrics.CpuTemp).Should().BeTrue(); + + // 2. Disable CPU alert while keeping alerts enabled -> CleanUpDisabledAlerts removes it + cfg.Alerts.AlertCpuTemp = false; + service.Evaluate(new TelemetrySnapshot { CpuTempPackageC = 95f }); + overlay.IsAlertActive(Metrics.CpuTemp).Should().BeFalse(); + + // 3. IsMetricAlertEnabled with unknown metric ID returns false + var isEnabledMethod = typeof(AlertService).GetMethod("IsMetricAlertEnabled", BindingFlags.Instance | BindingFlags.NonPublic)!; + ((bool)isEnabledMethod.Invoke(service, ["unknown_metric"])!).Should().BeFalse(); + + // 4. CanFireAlert with CooldownSecs returning false + var canFireMethod = typeof(AlertService).GetMethod("CanFireAlert", BindingFlags.Instance | BindingFlags.NonPublic)!; + ((bool)canFireMethod.Invoke(service, ["test_cooldown"])!).Should().BeTrue(); + ((bool)canFireMethod.Invoke(service, ["test_cooldown"])!).Should().BeFalse(); + } } diff --git a/tests/LocalTelemetry.App.Tests/Services/NotificationClientTests.cs b/tests/LocalTelemetry.App.Tests/Services/NotificationClientTests.cs index 7787c63..bfcbf8a 100644 --- a/tests/LocalTelemetry.App.Tests/Services/NotificationClientTests.cs +++ b/tests/LocalTelemetry.App.Tests/Services/NotificationClientTests.cs @@ -51,7 +51,7 @@ public async Task NotificationClient_SendToastAsync_HandlesLockAcquisitionCancel { using var client = new NotificationClient("NonExistentPipe_" + Guid.NewGuid().ToString("N"), 1000); using var cts = new CancellationTokenSource(); - cts.Cancel(); // Already canceled token before entering wait + await cts.CancelAsync(); // Already canceled token before entering wait var act = async () => await client.SendToastAsync("Title", "Body", null, cts.Token); await act.Should().NotThrowAsync(); @@ -71,13 +71,13 @@ public async Task NotificationClient_SendToastAsync_SuccessfulPipeCommunication( await server.WaitForConnectionAsync(); using var reader = new StreamReader(server, Encoding.UTF8); received = await reader.ReadLineAsync(); - }); + }, TestContext.Current.CancellationToken); - if (serverReady.Wait(TimeSpan.FromSeconds(2))) + if (serverReady.Wait(TimeSpan.FromSeconds(2), TestContext.Current.CancellationToken)) { using var client = new NotificationClient(pipeName, 2000); - await client.SendToastAsync("Test Title", "Test Body", "TestTag"); - await serverTask.WaitAsync(TimeSpan.FromSeconds(2)); + await client.SendToastAsync("Test Title", "Test Body", "TestTag", TestContext.Current.CancellationToken); + await serverTask.WaitAsync(TimeSpan.FromSeconds(2), TestContext.Current.CancellationToken); received.Should().NotBeNullOrEmpty(); received.Should().Contain("ShowToast"); @@ -100,13 +100,13 @@ public async Task NotificationClient_SendShutdownAsync_SuccessfulPipeCommunicati await server.WaitForConnectionAsync(); using var reader = new StreamReader(server, Encoding.UTF8); received = await reader.ReadLineAsync(); - }); + }, TestContext.Current.CancellationToken); - if (serverReady.Wait(TimeSpan.FromSeconds(2))) + if (serverReady.Wait(TimeSpan.FromSeconds(2), TestContext.Current.CancellationToken)) { using var client = new NotificationClient(pipeName, 2000); - await client.SendShutdownAsync(); - await serverTask.WaitAsync(TimeSpan.FromSeconds(2)); + await client.SendShutdownAsync(TestContext.Current.CancellationToken); + await serverTask.WaitAsync(TimeSpan.FromSeconds(2), TestContext.Current.CancellationToken); received.Should().NotBeNullOrEmpty(); received.Should().Contain("Shutdown"); @@ -134,7 +134,7 @@ public async Task NotificationClient_ExecuteAttemptAsync_UnexpectedException_Han msgType.GetProperty("Action")?.SetValue(msg, "ShowToast"); // Passing invalid negative timeout (-5) causes ConnectAsync to throw ArgumentOutOfRangeException, hitting catch (Exception ex) - var task = (Task)method!.Invoke(client, [msg, 0, -5, CancellationToken.None])!; + var task = (Task)method.Invoke(client, [msg, 0, -5, CancellationToken.None])!; await task; } } diff --git a/tests/LocalTelemetry.App.Tests/Services/UpdateCheckServiceTests.cs b/tests/LocalTelemetry.App.Tests/Services/UpdateCheckServiceTests.cs index f74a407..4beeeda 100644 --- a/tests/LocalTelemetry.App.Tests/Services/UpdateCheckServiceTests.cs +++ b/tests/LocalTelemetry.App.Tests/Services/UpdateCheckServiceTests.cs @@ -278,4 +278,19 @@ public void IsVersionNewer_NumericVsAlphaAndBuildMetadata_Coverage() Assert.True(UpdateCheckService.IsVersionNewer("v1.0.0+build1", "v1.1.0+build2")); Assert.False(UpdateCheckService.IsVersionNewer("v1.1.0+build1", "v1.0.0+build2")); } + + [Fact] + public void IsPrereleaseVersion_IdentifiesBetaAndStableVersionsCorrectly() + { + Assert.True(UpdateCheckService.IsPrereleaseVersion("1.3.0-beta.1")); + Assert.True(UpdateCheckService.IsPrereleaseVersion("1.0.0-rc.2")); + Assert.True(UpdateCheckService.IsPrereleaseVersion("v2.0.0-alpha.5")); + Assert.False(UpdateCheckService.IsPrereleaseVersion("1.3.0")); + Assert.False(UpdateCheckService.IsPrereleaseVersion("v1.0.0")); + Assert.False(UpdateCheckService.IsPrereleaseVersion("2.1.4")); + + // Current version evaluation (should not throw) + bool currentIsPrerelease = UpdateCheckService.IsPrereleaseVersion(); + Assert.Equal(UpdateCheckService.GetCurrentVersionString().Contains('-'), currentIsPrerelease); + } } diff --git a/tests/LocalTelemetry.App.Tests/Settings/SettingsDtoTests.cs b/tests/LocalTelemetry.App.Tests/Settings/SettingsDtoTests.cs index 0900173..5e948f4 100644 --- a/tests/LocalTelemetry.App.Tests/Settings/SettingsDtoTests.cs +++ b/tests/LocalTelemetry.App.Tests/Settings/SettingsDtoTests.cs @@ -47,13 +47,15 @@ public void SettingsDtoMapping_ToDto_MapsAllFieldsCorrectly() BgColor = "#222222", ValueColor = "#333333", FollowWindowsTheme = false, - Row1 = ["cpu_pct", "gpu_pct"] + Columns = [["cpu_pct", "gpu_pct"]] }, Alerts = new AlertConfig { Enabled = true, AlertCpuTemp = true, CpuTempMaxC = 95f, + AlertDiskTemp = true, + DiskTempMaxC = 75, CooldownSecs = 120 } }; @@ -85,7 +87,10 @@ public void SettingsDtoMapping_ToDto_MapsAllFieldsCorrectly() dto.Alerts.Enabled.Should().BeTrue(); dto.Alerts.AlertCpuTemp.Should().BeTrue(); dto.Alerts.CpuTempMaxC.Should().Be(95f); + dto.Alerts.AlertDiskTemp.Should().BeTrue(); + dto.Alerts.DiskTempMaxC.Should().Be(75); dto.Alerts.CooldownSecs.Should().Be(120); + dto.Alerts.SustainedSecs.Should().Be(3); } [Fact] @@ -168,13 +173,14 @@ public void SettingsDtoMapping_ApplyTo_UpdatesAppSettings() BgColor = "#BBBBBB", TextColor = "#CCCCCC", FollowWindowsTheme = true, - Row1 = ["ram_pct", "ram_used"] + Columns = [["ram_pct", "ram_used"]] }, Alerts = new AlertsDto { Enabled = true, AlertRamUsage = true, RamUsageMaxPct = 88f, + SustainedSecs = 5, CooldownSecs = 45 } }; @@ -193,11 +199,12 @@ public void SettingsDtoMapping_ApplyTo_UpdatesAppSettings() target.Overlay.Visible.Should().BeTrue(); target.Overlay.Placement.Should().Be("right"); target.Overlay.PlacementOffset.Should().Be(50); - target.Overlay.Row1.Should().Contain("ram_pct"); + target.Overlay.Columns.SelectMany(c => c).Should().Contain("ram_pct"); target.Alerts.Enabled.Should().BeTrue(); target.Alerts.AlertRamUsage.Should().BeTrue(); target.Alerts.RamUsageMaxPct.Should().Be(88f); + target.Alerts.SustainedSecs.Should().Be(5); } [Fact] @@ -240,12 +247,12 @@ public void SettingsDtoMapping_TaskbarAlignment_And_BesideApps_Roundtrip() try { var dto = SettingsDtoMapping.ToDto(src); - dto.Overlay.Position.Should().Be("beside_apps"); + dto.Overlay.Position.Should().Be("left"); dto.Overlay.TaskbarAlignment.Should().Be("left"); var target = new AppSettings(); SettingsDtoMapping.ApplyTo(target, dto); - target.Overlay.Placement.Should().Be("beside_apps"); + target.Overlay.Placement.Should().Be("left"); } finally { diff --git a/tests/LocalTelemetry.App.Tests/Settings/SettingsShellTests.cs b/tests/LocalTelemetry.App.Tests/Settings/SettingsShellTests.cs index a5d1001..491328a 100644 --- a/tests/LocalTelemetry.App.Tests/Settings/SettingsShellTests.cs +++ b/tests/LocalTelemetry.App.Tests/Settings/SettingsShellTests.cs @@ -549,6 +549,9 @@ public void SettingsShell_WindowEvents_And_OpenFolder_Coverage() ctx.Shell.SendUpdatedSettings(); posted.Should().Contain(s => s.Contains("\"type\":\"settings\"")); + ctx.Shell.NotifyTaskbarSlotChanged(true, 180); + posted.Should().Contain(s => s.Contains("\"type\":\"taskbarSlotChanged\"") && s.Contains("\"taskbarSpaceConstrained\":true") && s.Contains("\"availableSlotWidth\":180")); + ctx.Shell.HandleWebMessageJson("""{"type":"openFolder","payload":{"target":"app"}}"""); ctx.Shell.HandleWebMessageJson("""{"type":"openFolder","payload":{"target":"data"}}"""); ctx.Shell.HandleWebMessageJson("""{"type":"getSettings"}"""); @@ -571,14 +574,14 @@ public void SettingsShell_WindowEvents_And_OpenFolder_Coverage() var titleBarMethod = typeof(SettingsShell).GetMethod("TitleBar_MouseLeftButtonDown", BindingFlags.NonPublic | BindingFlags.Instance); if (titleBarMethod is not null) { - var doubleClickArgs = new System.Windows.Input.MouseButtonEventArgs( + var doubleClickArgs = new MouseButtonEventArgs( Mouse.PrimaryDevice, 0, MouseButton.Left) { RoutedEvent = UIElement.MouseLeftButtonDownEvent }; - typeof(System.Windows.Input.MouseButtonEventArgs).GetProperty("ClickCount")?.SetValue(doubleClickArgs, 2); + typeof(MouseButtonEventArgs).GetProperty("ClickCount")?.SetValue(doubleClickArgs, 2); var actDblClick = () => titleBarMethod.Invoke(ctx.Shell, [null!, doubleClickArgs]); actDblClick.Should().NotThrow(); @@ -618,7 +621,7 @@ public void SettingsShell_FormatHumanReadableChange_AllCategories_Coverage() "alerts.alertnetmonthly", "alerts.fireoncepersession", "alerts.cputempmaxc", "alerts.gputempmaxc", "alerts.cpuusagemaxpct", "alerts.ramusagemaxpct", "alerts.gpuusagemaxpct", "alerts.gpuvrammaxmb", "alerts.batterylowpct", "alerts.cpufreqminmhz", "alerts.cpupowermaxw", "alerts.gpufreqminmhz", - "alerts.gpupowermaxw", "alerts.netdailymaxgb", "alerts.netmonthlymaxgb", "alerts.cooldownsecs", + "alerts.gpupowermaxw", "alerts.netdailymaxgb", "alerts.netmonthlymaxgb", "alerts.sustainedsecs", "alerts.cooldownsecs", "alerts.showtoastnotif", "alerts.flashoverlay", "netusage.enabled", "updates.checkfrequency", "updates.includeprereleases", "custom.unknown.setting" @@ -820,7 +823,7 @@ public void SettingsShell_LocationChanged_WhenWebViewReady_ExecutesSafely() { using var ctx = new ShellContext(); typeof(SettingsShell).GetField("_webViewReady", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(ctx.Shell, true); - var onLocationChanged = typeof(System.Windows.Window).GetMethod("OnLocationChanged", BindingFlags.NonPublic | BindingFlags.Instance); + var onLocationChanged = typeof(Window).GetMethod("OnLocationChanged", BindingFlags.NonPublic | BindingFlags.Instance); var act = () => onLocationChanged?.Invoke(ctx.Shell, [EventArgs.Empty]); act.Should().NotThrow(); } @@ -852,7 +855,7 @@ public void SettingsShell_OnLoaded_WhenSkipInit_ReturnsEarly() { using var ctx = new ShellContext(); SettingsShell.SkipWebView2InitForTesting = true; - var onLoaded = typeof(SettingsShell).GetMethod("OnLoaded", BindingFlags.NonPublic | BindingFlags.Instance, null, [typeof(object), typeof(System.Windows.RoutedEventArgs)], null); + var onLoaded = typeof(SettingsShell).GetMethod("OnLoaded", BindingFlags.NonPublic | BindingFlags.Instance, null, [typeof(object), typeof(RoutedEventArgs)], null); var act = () => onLoaded!.Invoke(ctx.Shell, [null!, null!]); act.Should().NotThrow(); } @@ -915,6 +918,67 @@ public void SettingsShell_HandleOpenFolder_AppLogsData_Coverage() openedFolders.Should().NotBeEmpty(); } + [WpfFact] + public void SettingsShell_HandleOpenFolder_WithFilePath_OpensFolder() + { + using var ctx = new ShellContext(); + string? opened = null; + SettingsShell.FolderLauncherAction = path => opened = path; + + string tempFile = Path.GetTempFileName(); + try + { + string json = JsonSerializer.Serialize(new { payload = new { path = tempFile } }); + using var doc = JsonDocument.Parse(json); + var method = typeof(SettingsShell).GetMethod("HandleOpenFolder", BindingFlags.NonPublic | BindingFlags.Static); + method!.Invoke(null, [doc.RootElement]); + + opened.Should().Be(tempFile); + } + finally + { + SettingsShell.FolderLauncherAction = null; + if (File.Exists(tempFile)) File.Delete(tempFile); + } + } + + [WpfFact] + public void SettingsShell_HandleExportDatabase_SuccessAndCancelled_PostsExpectedResult() + { + using var ctx = new ShellContext(); + var posted = new List(); + SettingsShell.PostJsonActionOverride = posted.Add; + + string targetFile = Path.Combine(Path.GetTempPath(), "test_export_" + Guid.NewGuid().ToString("N") + ".jsonl"); + try + { + SettingsShell.SaveFileDialogOverride = _ => (true, targetFile); + + ctx.Shell.HandleWebMessageJson(""" + {"type":"exportDatabase","payload":{"content":"{\"test\":1}\n","defaultFileName":"test.jsonl"}} + """); + + File.Exists(targetFile).Should().BeTrue(); + File.ReadAllText(targetFile).Should().Contain("{\"test\":1}"); + posted.Should().Contain(p => p.Contains("exportDatabaseResult") && p.Contains("\"success\":true")); + + posted.Clear(); + SettingsShell.SaveFileDialogOverride = _ => (false, null); + + ctx.Shell.HandleWebMessageJson(""" + {"type":"exportDatabase","payload":{"content":"{\"test\":2}\n","defaultFileName":"test2.jsonl"}} + """); + + posted.Should().Contain(p => p.Contains("exportDatabaseResult") && p.Contains("\"cancelled\":true")); + } + finally + { + SettingsShell.SaveFileDialogOverride = null; + SettingsShell.PostJsonActionOverride = null; + if (File.Exists(targetFile)) File.Delete(targetFile); + } + } + private sealed class MockThrowingHandler : HttpMessageHandler { protected override Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) @@ -971,7 +1035,7 @@ public void SettingsShell_OnClosed_WhenWebViewReady_CleansUpTimersAndDisposes() { using var ctx = new ShellContext(); typeof(SettingsShell).GetField("_webViewReady", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(ctx.Shell, true); - var onClosed = typeof(System.Windows.Window).GetMethod("OnClosed", BindingFlags.NonPublic | BindingFlags.Instance); + var onClosed = typeof(Window).GetMethod("OnClosed", BindingFlags.NonPublic | BindingFlags.Instance); var act = () => onClosed?.Invoke(ctx.Shell, [EventArgs.Empty]); act.Should().NotThrow(); } @@ -1208,8 +1272,10 @@ public void SettingsShell_FormatOverlayChange_AllBranches() ((string?)method.Invoke(null, ["overlay.showlabels", "overlay.showlabels", "", "true"])).Should().Be("Labels shown"); ((string?)method.Invoke(null, ["overlay.showlabels", "overlay.showlabels", "", "false"])).Should().Be("Labels hidden"); ((string?)method.Invoke(null, ["overlay.doubleclickaction", "overlay.doubleclickaction", "", "taskmanager"])).Should().Be("Double-click action set to Task Manager"); + ((string?)method.Invoke(null, ["overlay.doubleclickaction", "overlay.doubleclickaction", "", "none"])).Should().Be("Double-click action set to None"); ((string?)method.Invoke(null, ["overlay.doubleclickaction", "overlay.doubleclickaction", "", "settings"])).Should().Be("Double-click action set to Open Settings"); ((string?)method.Invoke(null, ["overlay.followwindowstheme", "overlay.followwindowstheme", "", "true"])).Should().Be("Follow Windows theme enabled"); + ((string?)method.Invoke(null, ["overlay.layoutpreset", "overlay.layoutpreset", "default", "gaming"])).Should().Be("Layout preset updated to 'Gaming'"); ((string?)method.Invoke(null, ["overlay.row1", "overlay.row1", "", "[\"cpu_pct\",\"gpu_temp\"]"])).Should().Be("Metrics layout updated (2 metrics - CPU Usage, GPU Temperature)"); ((string?)method.Invoke(null, ["overlay.row1", "overlay.row1", "", ""])).Should().Be("Metrics layout cleared (0 metrics)"); ((string?)method.Invoke(null, ["overlay.row1", "overlay.row1", "", "val"])).Should().Be("Metrics layout updated (1 metric - val)"); @@ -1219,6 +1285,12 @@ public void SettingsShell_FormatOverlayChange_AllBranches() ((string?)method.Invoke(null, ["overlay.row1", "overlay.row1", "[\"cpu_pct\",\"gpu_temp\"]", "[\"gpu_temp\",\"cpu_pct\"]"])).Should().Be("Metrics layout reordered"); ((string?)method.Invoke(null, ["overlay.metriccolors.cpu_pct", "overlay.metriccolors.cpu_pct", "#fff", "#000"])).Should().Contain("CPU Usage"); ((string?)method.Invoke(null, ["overlay.groupcolors.cpu", "overlay.groupcolors.cpu", "#fff", "#000"])).Should().Contain("Cpu"); + ((string?)method.Invoke(null, ["overlay.displaymode", "overlay.displaymode", "primary", "secondary"])).Should().Be("Overlay display mode set to Secondary Displays"); + ((string?)method.Invoke(null, ["overlay.displaymode", "overlay.displaymode", "secondary", "all"])).Should().Be("Overlay display mode set to All Displays"); + ((string?)method.Invoke(null, ["overlay.displaymode", "overlay.displaymode", "all", "primary"])).Should().Be("Overlay display mode set to Primary Display"); + ((string?)method.Invoke(null, ["overlay.displaymode", "overlay.displaymode", "primary", "custom"])).Should().Be("Overlay display mode set to Custom Displays"); + ((string?)method.Invoke(null, ["overlay.enableddisplays", "overlay.enableddisplays", "", "[\"primary\"]"])).Should().Be("Enabled displays set to [\"primary\"]"); + ((string?)method.Invoke(null, ["overlay.taskbarspaceconstrained", "overlay.taskbarspaceconstrained", "", "true"])).Should().BeEmpty(); ((string?)method.Invoke(null, ["overlay.usercustomized", "overlay.usercustomized", "", ""])).Should().BeEmpty(); ((string?)method.Invoke(null, ["overlay.unknown", "overlay.unknown", "", ""])).Should().BeNull(); } @@ -1238,13 +1310,13 @@ public void SettingsShell_FormatAppearanceAlertsOrUpdatesChange_AllBranches() "alerts.cputempmaxc", "alerts.gputempmaxc", "alerts.cpuusagemaxpct", "alerts.ramusagemaxpct", "alerts.gpuusagemaxpct", "alerts.gpuvrammaxmb", "alerts.batterylowpct", "alerts.cpufreqminmhz", "alerts.cpupowermaxw", "alerts.gpufreqminmhz", "alerts.gpupowermaxw", "alerts.netdailymaxgb", - "alerts.netmonthlymaxgb", "alerts.cooldownsecs", "alerts.showtoastnotif", "alerts.flashoverlay", + "alerts.netmonthlymaxgb", "alerts.sustainedsecs", "alerts.cooldownsecs", "alerts.showtoastnotif", "alerts.flashoverlay", "netusage.enabled", "updates.includeprereleases", "updates.checkfrequency" ]; foreach (var p in paths) { - var res = (string?)method.Invoke(null, [p, p.Contains("max") || p.Contains("min") || p.Contains("cooldown") ? "50" : "true"]); + var res = (string?)method.Invoke(null, [p, p.Contains("max") || p.Contains("min") || p.Contains("cooldown") || p.Contains("sustained") ? "50" : "true"]); res.Should().NotBeNull(); } @@ -1352,6 +1424,81 @@ public void SettingsShell_FormatOverlayLayoutChange_AllBranches_Coverage() res10.Should().BeEmpty(); } + [Fact] + public void SettingsShell_ConsolidateLayoutDiff_And_DiskArchitecture_Coverage() + { + var method = typeof(SettingsShell).GetMethod("ConsolidateLayoutDiff", BindingFlags.NonPublic | BindingFlags.Static); + method.Should().NotBeNull(); + + // 1. Preset updated to Gaming + var res1 = (List?)method.Invoke(null, [new List<(string Path, string OldVal, string NewVal)> + { + ("overlay.layoutpreset", "default", "gaming"), + ("overlay.row1", "[\"cpu_pct\"]", "[\"cpu_pct\",\"gpu_pct\"]") + }]); + res1.Should().ContainSingle().Which.Should().Be("Layout preset updated to 'Gaming'"); + + // 2. Preset updated to Compact + var res2 = (List?)method.Invoke(null, [new List<(string Path, string OldVal, string NewVal)> + { + ("overlay.layoutpreset", "gaming", "compact") + }]); + res2.Should().ContainSingle().Which.Should().Be("Layout preset updated to 'Compact'"); + + // 3. Preset updated to Full Telemetry + var res3 = (List?)method.Invoke(null, [new List<(string Path, string OldVal, string NewVal)> + { + ("overlay.layoutpreset", "default", "full") + }]); + res3.Should().ContainSingle().Which.Should().Be("Layout preset updated to 'Full Telemetry'"); + + // 4. Preset updated to Default + var res4 = (List?)method.Invoke(null, [new List<(string Path, string OldVal, string NewVal)> + { + ("overlay.layoutpreset", "custom", "default") + }]); + res4.Should().ContainSingle().Which.Should().Be("Layout preset updated to 'Default'"); + + // 5. Preset updated to Custom (with added metric) + var res5 = (List?)method.Invoke(null, [new List<(string Path, string OldVal, string NewVal)> + { + ("overlay.layoutpreset", "gaming", "custom"), + ("overlay.row1", "[\"cpu_pct\"]", "[\"cpu_pct\",\"cpu_freq\"]") + }]); + res5.Should().ContainSingle().Which.Should().Be("Layout preset updated to 'Custom' (Added CPU Frequency)"); + + // 6. Preset updated to Custom (with removed metric) + var res6 = (List?)method.Invoke(null, [new List<(string Path, string OldVal, string NewVal)> + { + ("overlay.layoutpreset", "gaming", "custom"), + ("overlay.row1", "[\"cpu_pct\",\"ram_used\"]", "[\"cpu_pct\"]") + }]); + res6.Should().ContainSingle().Which.Should().Be("Layout preset updated to 'Custom' (Removed RAM Used)"); + + // 7. Preset updated to Custom (with reorder) + var res7 = (List?)method.Invoke(null, [new List<(string Path, string OldVal, string NewVal)> + { + ("overlay.layoutpreset", "gaming", "custom"), + ("overlay.row1", "[\"cpu_pct\",\"ram_used\"]", "[\"ram_used\",\"cpu_pct\"]") + }]); + res7.Should().ContainSingle().Which.Should().Be("Layout preset updated to 'Custom' (Metrics layout reordered)"); + + // 8. Row-only change (manual add) + var res8 = (List?)method.Invoke(null, [new List<(string Path, string OldVal, string NewVal)> + { + ("overlay.row1", "[\"cpu_pct\"]", "[\"cpu_pct\",\"gpu_pct\"]") + }]); + res8.Should().ContainSingle().Which.Should().Be("Added metric to overlay (GPU Usage)"); + + // 9. Disk metric naming resolution + var getMetricNameMethod = typeof(SettingsShell).GetMethod("GetMetricName", BindingFlags.NonPublic | BindingFlags.Static); + getMetricNameMethod.Should().NotBeNull(); + var diskName = (string?)getMetricNameMethod.Invoke(null, ["disk_disk0_read"]); + diskName.Should().NotBeNull(); + diskName.Should().Contain("Read"); + diskName.Should().NotStartWith("DISK0"); + } + [WpfFact] public void SettingsShell_TitleBar_MouseLeftButtonDown_And_CloseButton_Coverage() { @@ -1454,7 +1601,7 @@ public void SettingsShell_FormatAlertsSummary_AllEdgeCases_Coverage() ("alerts.alertcpufreq", "false", "true") }; string s1 = (string)method.Invoke(null, [changes1])!; - s1.Should().Contain("CPU throttle enabled"); + s1.Should().Be("Alerts enabled: CPU throttle"); // 2. Alert enabled: empty summaries (line 1006) var changes2 = new List<(string Path, string OldVal, string NewVal)> @@ -1666,21 +1813,14 @@ public void SettingsShell_GpuFormatting_And_TitleBar_And_TimerCallbacks_Coverage var procField = typeof(SettingsShell).GetField("_currentProcess", BindingFlags.NonPublic | BindingFlags.Instance); procField?.SetValue(shell, System.Diagnostics.Process.GetCurrentProcess()); - var tickMethod = typeof(SettingsShell).GetMethods(BindingFlags.NonPublic | BindingFlags.Instance) - .FirstOrDefault(m => m.Name.Contains("b__")); - tickMethod?.Invoke(shell, [null, EventArgs.Empty]); + shell.OnAppUsageTick(null, EventArgs.Empty); titleBlock.Text.Should().Contain("LocalTelemetry"); + titleBlock.Text.Should().Contain("% CPU"); + titleBlock.Text.Should().Contain("MB RAM"); + shell.Title.Should().Contain("LocalTelemetry"); procField?.SetValue(shell, null); - tickMethod?.Invoke(shell, [null, EventArgs.Empty]); - - // 4. LocationChanged blur callback - var locMethod = typeof(SettingsShell).GetMethods(BindingFlags.NonPublic | BindingFlags.Instance) - .FirstOrDefault(m => m.Name.Contains("<.ctor>b__")); - typeof(SettingsShell).GetField("_webViewReady", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(shell, false); - locMethod?.Invoke(shell, [null, EventArgs.Empty]); - typeof(SettingsShell).GetField("_webViewReady", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(shell, true); - locMethod?.Invoke(shell, [null, EventArgs.Empty]); + shell.OnAppUsageTick(null, EventArgs.Empty); // 5. Timer callbacks for debounce & periodic push var timer1 = typeof(SettingsShell).GetMethod("b__54_0", BindingFlags.NonPublic | BindingFlags.Instance); @@ -1756,18 +1896,18 @@ public async Task SettingsShell_HandleImportWindowsUsage_DetailedCoverage() method.Should().NotBeNull(); // 1. Missing or invalid date formats - var invalidStart = JsonDocument.Parse("{\"startDate\":\"not-a-date\",\"endDate\":\"01-10-2026\"}").RootElement; + var invalidStart = JsonElement.Parse("{\"startDate\":\"not-a-date\",\"endDate\":\"01-10-2026\"}"); await (Task)method.Invoke(shell, [invalidStart])!; - var invalidEnd = JsonDocument.Parse("{\"startDate\":\"01-10-2026\",\"endDate\":\"bad-end-date\"}").RootElement; + var invalidEnd = JsonElement.Parse("{\"startDate\":\"01-10-2026\",\"endDate\":\"bad-end-date\"}"); await (Task)method.Invoke(shell, [invalidEnd])!; // 2. Valid dates with initialized store - var validRange = JsonDocument.Parse("{\"startDate\":\"01-10-2026\",\"endDate\":\"05-10-2026\"}").RootElement; + var validRange = JsonElement.Parse("{\"startDate\":\"01-10-2026\",\"endDate\":\"05-10-2026\"}"); await (Task)method.Invoke(shell, [validRange])!; // 3. Exception in parsing (missing root properties causing exception) - var malformed = JsonDocument.Parse("{}").RootElement; + var malformed = JsonElement.Parse("{}"); await (Task)method.Invoke(shell, [malformed])!; // 4. TrafficHistoryStore uninitialized error path @@ -2001,7 +2141,7 @@ public void SettingsShell_TitleBarAndClose_Coverage() } [WpfFact] - public void SettingsShell_WindowIcon_And_LocationChanged_Coverage() + public void SettingsShell_WindowIcon_Coverage() { // 1. SetWindowIcon failure branch try @@ -2014,30 +2154,6 @@ public void SettingsShell_WindowIcon_And_LocationChanged_Coverage() { SettingsShell.ThrowInSetWindowIconForTesting = false; } - - using var ctx = new ShellContext(); - var onLoc = typeof(SettingsShell).GetMethod("HandleWindowLocationChanged", BindingFlags.NonPublic | BindingFlags.Instance); - typeof(SettingsShell).GetField("_webViewReady", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(ctx.Shell, true); - - // 2. OnLocationChanged with ScriptExecutorAsyncOverride - try - { - string? capturedScript = null; - SettingsShell.ScriptExecutorOverride = null; - SettingsShell.ScriptExecutorAsyncOverride = s => { capturedScript = s; return Task.CompletedTask; }; - onLoc?.Invoke(ctx.Shell, null); - capturedScript.Should().Contain("blur"); - - // 3. OnLocationChanged error catch branch - SettingsShell.ScriptExecutorAsyncOverride = _ => throw new InvalidOperationException("Simulated script blur failure"); - var act = () => onLoc?.Invoke(ctx.Shell, null); - act.Should().NotThrow(); - } - finally - { - SettingsShell.ScriptExecutorAsyncOverride = null; - SettingsShell.ScriptExecutorOverride = null; - } } [WpfFact] @@ -2068,28 +2184,7 @@ public async Task SettingsShell_RemainingEdgeCases_Coverage() SettingsShell.FolderProcessLauncher = origFolderLauncher; } - // 3. LocationChanged with ScriptExecutorOverride (normal + throwing) - var origScript = SettingsShell.ScriptExecutorOverride; - var onLocationChanged = typeof(Window).GetMethod("OnLocationChanged", BindingFlags.NonPublic | BindingFlags.Instance)!; - typeof(SettingsShell).GetField("_webViewReady", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(ctx.Shell, true); - try - { - bool executedScript = false; - SettingsShell.ScriptExecutorOverride = _ => executedScript = true; - onLocationChanged.Invoke(ctx.Shell, [EventArgs.Empty]); - executedScript.Should().BeTrue(); - - // Throwing path (lines 124-125) - SettingsShell.ScriptExecutorOverride = _ => throw new InvalidOperationException("Simulated script error"); - var actMove = () => onLocationChanged.Invoke(ctx.Shell, [EventArgs.Empty]); - actMove.Should().NotThrow(); - } - finally - { - SettingsShell.ScriptExecutorOverride = origScript; - } - - // 4. Show and Activate with SkipShowForTesting false (lines 38, 44) + // 3. Show and Activate with SkipShowForTesting false (lines 38, 44) var origSkipShow = SettingsShell.SkipShowForTesting; try { @@ -2211,7 +2306,7 @@ public async Task SettingsShell_RemainingEdgeCases_Coverage() try { SettingsShell.SkipDragMoveForTesting = true; - var clickArgs = new System.Windows.Input.MouseButtonEventArgs( + var clickArgs = new MouseButtonEventArgs( System.Windows.Input.Mouse.PrimaryDevice, 0, System.Windows.Input.MouseButton.Left) @@ -2279,6 +2374,122 @@ public async Task SettingsShell_WebMessage_And_ImportWindowsUsage_Branches_Cover } } + [WpfFact] + public void SettingsShell_TrafficTimers_And_OpenSpecificFolder_Coverage() + { + using var ctx = new ShellContext(); + var shell = ctx.Shell; + + var priorSkip = SettingsShell.SkipShowForTesting; + try + { + SettingsShell.SkipShowForTesting = true; + var onTick = typeof(SettingsShell).GetMethod("OnTrafficTodayTimerTick", BindingFlags.NonPublic | BindingFlags.Instance)!; + var actTick = () => onTick.Invoke(shell, null); + actTick.Should().NotThrow(); + + typeof(SettingsShell).GetField("_webViewReady", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(shell, false); + shell.RefreshTrafficHistory(); + + typeof(SettingsShell).GetField("_webViewReady", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(shell, true); + shell.RefreshTrafficHistory(); + } + finally + { + SettingsShell.SkipShowForTesting = priorSkip; + } + + bool folderLaunched = false; + var priorLauncher = SettingsShell.FolderLauncherAction; + try + { + SettingsShell.FolderLauncherAction = _ => folderLaunched = true; + var openFolder = typeof(SettingsShell).GetMethod("OpenSpecificFolder", BindingFlags.NonPublic | BindingFlags.Static)!; + openFolder.Invoke(null, [AppContext.BaseDirectory]); + folderLaunched.Should().BeTrue(); + } + finally + { + SettingsShell.FolderLauncherAction = priorLauncher; + } + } + + [WpfFact] + public void SettingsShell_HandleExportDatabase_Exception_Coverage() + { + using var ctx = new ShellContext(); + var shell = ctx.Shell; + + var priorSave = SettingsShell.SaveFileDialogOverride; + try + { + SettingsShell.SaveFileDialogOverride = _ => throw new IOException("Disk error"); + var jsonDoc = System.Text.Json.JsonDocument.Parse("{\"payload\":{\"content\":\"test\",\"defaultFileName\":\"data.jsonl\"}}"); + var actThrow = () => shell.HandleExportDatabase(jsonDoc.RootElement); + actThrow.Should().NotThrow(); + + // Cancelled dialog branch + SettingsShell.SaveFileDialogOverride = _ => (false, null); + var actCancel = () => shell.HandleExportDatabase(jsonDoc.RootElement); + actCancel.Should().NotThrow(); + } + finally + { + SettingsShell.SaveFileDialogOverride = priorSave; + } + } + + [WpfFact] + public void SettingsShell_OpenSpecificFolder_DefaultProcess_And_WorkingSet_Coverage() + { + var cfg = new AppSettings(); + string tempPath = Path.Combine(Path.GetTempPath(), $"traffic_spec_{Guid.NewGuid():N}.dat"); + try + { + var historyFile = new TrafficHistoryFile(tempPath); + using var netLogger = new NetUsageLogger(cfg, historyFile); + var shell = new SettingsShell(cfg, netLogger); + + // 1. OpenSpecificFolder with FolderLauncherAction == null and FolderProcessLauncher set + var priorLauncher = SettingsShell.FolderLauncherAction; + var priorProcess = SettingsShell.FolderProcessLauncher; + try + { + System.Diagnostics.ProcessStartInfo? capturedPsi = null; + SettingsShell.FolderLauncherAction = null; + SettingsShell.FolderProcessLauncher = psi => capturedPsi = psi; + + var openSpecific = typeof(SettingsShell).GetMethod("OpenSpecificFolder", BindingFlags.Static | BindingFlags.NonPublic)!; + openSpecific.Invoke(null, [Path.GetTempPath()]); + capturedPsi.Should().NotBeNull(); + capturedPsi.FileName.Should().Contain("explorer.exe"); + } + finally + { + SettingsShell.FolderLauncherAction = priorLauncher; + SettingsShell.FolderProcessLauncher = priorProcess; + } + + // 2. OnAppUsageTick when SkipShowForTesting is false and WindowState is Minimized + var priorSkip = SettingsShell.SkipShowForTesting; + try + { + SettingsShell.SkipShowForTesting = false; + shell.WindowState = System.Windows.WindowState.Minimized; + var act = () => shell.OnAppUsageTick(null, EventArgs.Empty); + act.Should().NotThrow(); + } + finally + { + SettingsShell.SkipShowForTesting = priorSkip; + } + } + finally + { + if (File.Exists(tempPath)) File.Delete(tempPath); + } + } + private sealed class MockAppNetworkAdapter( string profileName, string adapterId, diff --git a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/bun.lock b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/bun.lock index edcafe4..3d2e4b7 100644 --- a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/bun.lock +++ b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/bun.lock @@ -5,15 +5,15 @@ "": { "name": "localtelemetry-frontend-tests", "dependencies": { - "@lucide/svelte": "^1.59.0", + "@lucide/svelte": "^1.84.0", "lucide-svelte": "^1.0.1", }, "devDependencies": { - "@sveltejs/vite-plugin-svelte": "^7.3.1", - "@vitest/coverage-v8": "^5.0.5", + "@sveltejs/vite-plugin-svelte": "^7.3.2", + "@vitest/coverage-v8": "^5.1.2", "happy-dom": "^21.0.4", - "svelte": "^5.57.2", - "vitest": "^5.0.5", + "svelte": "^5.59.2", + "vitest": "^5.1.2", }, }, }, @@ -34,13 +34,13 @@ "vite": "^8.3.4", }, "packages": { - "@babel/helper-string-parser": ["@babel/helper-string-parser@7.29.7", "", {}, "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw=="], + "@babel/helper-string-parser": ["@babel/helper-string-parser@7.29.15", "", {}, "sha512-C2FuapQ2Kh1OnVHAoLi5rD3GBJ8COb9Q609T6HEpLqaBAo560PDP5OxBE5dCI/h951MBO/+bCUYU5SZ+8ZlV+w=="], "@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.29.7", "", {}, "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg=="], - "@babel/parser": ["@babel/parser@7.29.8", "", { "dependencies": { "@babel/types": "^7.29.8" }, "bin": "./bin/babel-parser.js" }, "sha512-E8lTAYNB1KW+FH+VGJuZM1ioAx2E6oVlvQFRrf5P8ZZmsiJXYAD9vTFV7yyEURNzgh1dFqMZuO6tUwcARbqFCA=="], + "@babel/parser": ["@babel/parser@7.29.15", "", { "dependencies": { "@babel/types": "^7.29.15" }, "bin": "./bin/babel-parser.js" }, "sha512-RpKWyisHoP81twtSCgmE02iU0RnPcq1DN5bBEbpUePrjA9Q3wXhufnCJrrayPpoZieqFh3zyZQqwtSK0gGccRA=="], - "@babel/types": ["@babel/types@7.29.8", "", { "dependencies": { "@babel/helper-string-parser": "^7.29.7", "@babel/helper-validator-identifier": "^7.29.7" } }, "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg=="], + "@babel/types": ["@babel/types@7.29.15", "", { "dependencies": { "@babel/helper-string-parser": "^7.29.15", "@babel/helper-validator-identifier": "^7.29.7" } }, "sha512-/XKpKDakL//LZ66bq1XsZOswuqeI5MZqPLDu18o3XdkU1fNJ7bdPtzgnc4ZNS+bBGHV0FJG8jjb8SwcC3nNVQQ=="], "@bcoe/v8-coverage": ["@bcoe/v8-coverage@1.0.2", "", {}, "sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA=="], @@ -48,81 +48,83 @@ "@jridgewell/remapping": ["@jridgewell/remapping@2.3.5", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ=="], - "@jridgewell/resolve-uri": ["@jridgewell/resolve-uri@3.1.2", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="], + "@jridgewell/resolve-uri": ["@jridgewell/resolve-uri@3.1.3", "", {}, "sha512-lhTtjtoEArWBjismtfS761S9Hlyn+nIZqOZVYoZ1Xn82PMNMVnk+jj/NhC4fAXGTs7ydONcJiR5vyQBTMDu27g=="], "@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.6.0", "", {}, "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw=="], "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="], - "@lucide/svelte": ["@lucide/svelte@1.61.0", "", { "peerDependencies": { "svelte": "^5" } }, "sha512-Vwj4ADoKgVogLFpEbXv2PS2hh2fj+aAqPuiNydI88Zkyb1l7veL4fXgRrOX3tgpESHhIGneNkSSYhHupvCBshg=="], + "@lucide/svelte": ["@lucide/svelte@1.84.0", "", { "peerDependencies": { "svelte": "^5" } }, "sha512-MdC8yG6N0Qc0vYlPa44KnFQ7Uaduy+YVsaNQy31C1gMvXTjyUTGvw/WlGfJLdnC11FM0jN4XSqPiwb1dZj9piw=="], - "@oxc-project/types": ["@oxc-project/types@0.155.0", "", {}, "sha512-SeE8JPwW1xs1tHeNycjUtUBdhorRa8o4jlvjwk49R7/Z291i+4DQa7JJIgOm/TaYQZx+QrPQbVJ/9c8dMIZN8Q=="], + "@oxc-project/types": ["@oxc-project/types@0.160.0", "", {}, "sha512-gw4k9syEmnckbOgw2A2FU1TBDdX9hfwV9jEn/uio65pguPzwWiXQS3OIJDMEhv9m06tj9XiEe6RoD0YA+LgreA=="], - "@rolldown/binding-android-arm-eabi": ["@rolldown/binding-android-arm-eabi@1.2.15", "", { "os": "android", "cpu": "arm" }, "sha512-aLcgK9gIJ3YRvrrtfSBbRa27F5WrpiTaPulnFpsHPxpUHgFlSgnU4854MHwoRGEBhfRJDWCS2WQ7lIjskE9Olw=="], + "@rolldown/binding-android-arm-eabi": ["@rolldown/binding-android-arm-eabi@1.3.4", "", { "os": "android", "cpu": "arm" }, "sha512-xCW8CkL/ualx/SbYqeG9iK87lJCZGDQ0soE+kaORJ0Bd+pHALyE4qK7BStmEAyYWLEzZ3/biSIpA6/7GDFvzIg=="], - "@rolldown/binding-android-arm64": ["@rolldown/binding-android-arm64@1.2.15", "", { "os": "android", "cpu": "arm64" }, "sha512-xD7DdZCrbThKuxNg7ooQmvp07ys4J/pnSEMTG3/OdOWl6daC67m/Q4fL78sRHMxTH/N4fGUbYhcPM0MF5WFHkg=="], + "@rolldown/binding-android-arm64": ["@rolldown/binding-android-arm64@1.3.4", "", { "os": "android", "cpu": "arm64" }, "sha512-5lifIO+b/prcM9sx/bkPN4w6UEToEfQ3gjhx0+0neuL+dkYskI792CfAq03T51jc8JFcaYXs2hi3l8RjiH/VWQ=="], - "@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.2.15", "", { "os": "darwin", "cpu": "arm64" }, "sha512-m2WuQ6r0B4OTYxyPpNLtXaMRbRDUbG8YQV2Q3KTdSSK8Th6KHCnC8jVCJt8bvYeSB5WivkkNbc85mKadaSdOxA=="], + "@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.3.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-RCgxTI4AJQxhVF//BI3ImQOsXTHrF4Eg+f99jBy8WoETA2kSEGFxpnrVmW0leQq/2aBR4R5AC6csmy3rc66e3Q=="], - "@rolldown/binding-darwin-x64": ["@rolldown/binding-darwin-x64@1.2.15", "", { "os": "darwin", "cpu": "x64" }, "sha512-5RtnsHM36nodM9WbMy+zip0LGS/G+y5wro5RHrpOlr4ac24+1zSi9kiV2MP1myZeZ/ifEHfulQcWjnAXzc2C2A=="], + "@rolldown/binding-darwin-x64": ["@rolldown/binding-darwin-x64@1.3.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-zNPJVVPUaDEj+L0lImoK3rFv2b+Z5gNijI6DWu/fcD3/1TfmRXKb9ZyxbSN+2AhlctqjbNzUvCsMa+EBhnEM4Q=="], - "@rolldown/binding-freebsd-x64": ["@rolldown/binding-freebsd-x64@1.2.15", "", { "os": "freebsd", "cpu": "x64" }, "sha512-g3l09pyFqhu+135JKkbkwiKGQmwU5hUMUPJ4VdBADvuqR8d33L6H578rh8m7rtxbdp+VmX/+nzI7nvhSZlzpUQ=="], + "@rolldown/binding-freebsd-x64": ["@rolldown/binding-freebsd-x64@1.3.4", "", { "os": "freebsd", "cpu": "x64" }, "sha512-upP6g7ZIRy5by1RDQ/EphHIdJ5xK0eUD7sUgfZFWJ49s4XdbYsIvIlAPtrFpayR70Hhf9J22lb4Pm8/9FhrZmg=="], - "@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/binding-linux-arm-gnueabihf@1.2.15", "", { "os": "linux", "cpu": "arm" }, "sha512-nIe3VugI97nGQtspPxDqA4sXMUpeiocKIP/CqpY/u/vgbT+alX+cVxu1C/oVBPKg4feNTmYovE91v4DgXvXNwQ=="], + "@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/binding-linux-arm-gnueabihf@1.3.4", "", { "os": "linux", "cpu": "arm" }, "sha512-SAX5C5+poMLCxu8dkPF6h5yst40rkzs+9Y3cbPn2OFSydmHjAEprrGi64zGgnYyPIVZfdGUFqJ2fJbfbnHI+mA=="], - "@rolldown/binding-linux-arm64-gnu": ["@rolldown/binding-linux-arm64-gnu@1.2.15", "", { "os": "linux", "cpu": "arm64" }, "sha512-iTBjXx+B5QSvgI89lJfmqh4wTh8NabR1YZIIN3hNx4zSG0EVfVqkOvLulNpG4251pbd6/IAmZ/LefVk1Y4rPhw=="], + "@rolldown/binding-linux-arm64-gnu": ["@rolldown/binding-linux-arm64-gnu@1.3.4", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-nwHqdlRZS6GWBef3dG5/pMY6RNTBBUjj7s0Da+m6xsFpe7jx6IC46SLZcCu8f46JOfCovZmwnrz51EzGE+7Fyw=="], - "@rolldown/binding-linux-arm64-musl": ["@rolldown/binding-linux-arm64-musl@1.2.15", "", { "os": "linux", "cpu": "arm64" }, "sha512-uN26XOnVR7rqQupG3V9oAG2EGGatWjcJHOeDOHUFCh4TBWmP2tHTFoVN13aYbwfm0aHqJAEmcwhAu6sooIjfqQ=="], + "@rolldown/binding-linux-arm64-musl": ["@rolldown/binding-linux-arm64-musl@1.3.4", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-Gr78X2ur/AgLCkmZgHffk/FerIX8S5zb/eII4bCcvJo0ANzeXhTShahdNbpnY6bpiszIAgIfiuKS9ziziWsamw=="], - "@rolldown/binding-linux-ppc64-gnu": ["@rolldown/binding-linux-ppc64-gnu@1.2.15", "", { "os": "linux", "cpu": "ppc64" }, "sha512-9nWkcdd+H+XhaA3fQIwpHnKIrfx/PQ6rO0pivr78Og07tXlUlctBBJoEYLPfhTmCR/QxEVdn6uPjHV5SymPhdw=="], + "@rolldown/binding-linux-ppc64-gnu": ["@rolldown/binding-linux-ppc64-gnu@1.3.4", "", { "os": "linux", "cpu": "ppc64", "libc": "glibc" }, "sha512-o9Wcn8nWrsQasaBRYM4d//FwhlBsTJYWkPVlhlt6FwzpwEoovY4IopRZjk5Fq3+ntRuSDORJjF/nA8sFeF2q6w=="], - "@rolldown/binding-linux-s390x-gnu": ["@rolldown/binding-linux-s390x-gnu@1.2.15", "", { "os": "linux", "cpu": "s390x" }, "sha512-Ggh0ciFjLwIusLSLz7LZYEaGdxOAUJXI+Qu5JCbhPJJHEt8vP+IjRATTJheiJsdzzTYgUiHUiw3X1Ea3ZpMBdA=="], + "@rolldown/binding-linux-s390x-gnu": ["@rolldown/binding-linux-s390x-gnu@1.3.4", "", { "os": "linux", "cpu": "s390x", "libc": "glibc" }, "sha512-UDWu4jkVcx2kiBKm3Ec//4lVCbeTWj8gmJ9SyLWCdLWtTlyq7fQVeVV/14nXvRtSLErvJ2+yA/Ux5taS31Y17Q=="], - "@rolldown/binding-linux-x64-gnu": ["@rolldown/binding-linux-x64-gnu@1.2.15", "", { "os": "linux", "cpu": "x64" }, "sha512-FHg60rS6DBePAYZ9X9F67x+JObFdmgn6tupA1C/a3B+CufFmTD4mX+e8M75tCiAO3foR/6xwVBI0KQiI7sn/rw=="], + "@rolldown/binding-linux-x64-gnu": ["@rolldown/binding-linux-x64-gnu@1.3.4", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-W9mGtTa0w4fWh8RLMNPyaEhhcuqUfO07Q4I1bBc4PDMNg7gQSw0yPQNQ3D0qwbkXwxbyL4YrIzc8n6k1vuFExQ=="], - "@rolldown/binding-linux-x64-musl": ["@rolldown/binding-linux-x64-musl@1.2.15", "", { "os": "linux", "cpu": "x64" }, "sha512-/cvV/7v5VGz/moiz0XKRj2dE8DzsKyhIu1KpOvJGPjRywg3yscON889UGvAe8zfiJLHup7VLjBduoGWi3HusWQ=="], + "@rolldown/binding-linux-x64-musl": ["@rolldown/binding-linux-x64-musl@1.3.4", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-8B+ofyQZ7/aCmkqnyMonPr5zKLqMVNczhRGFNtdIuItiwNn8iQWJawMq2E58r7bxD1XEbtRRsULY/eCWwZQ01Q=="], - "@rolldown/binding-openharmony-arm64": ["@rolldown/binding-openharmony-arm64@1.2.15", "", { "os": "none", "cpu": "arm64" }, "sha512-MyzC5Hrv/sm+Z7TSGKP/j8001RO2xQm1zOpCNVL4j0cY/VhBZviludA2YFQ7i4lH6ZAXxQm0lcMdBzM+99mE7w=="], + "@rolldown/binding-openharmony-arm64": ["@rolldown/binding-openharmony-arm64@1.3.4", "", { "os": "none", "cpu": "arm64" }, "sha512-TlD0FSZaC7o2B4NCe9V5N11ugTnhzTM9ksj4sgRLvrKosDzjEkvlsTX3ehkw4ZlPv8AADimZZTvJGEa16pfXug=="], - "@rolldown/binding-win32-arm64-msvc": ["@rolldown/binding-win32-arm64-msvc@1.2.15", "", { "os": "win32", "cpu": "arm64" }, "sha512-+PgYiS+AH5omy6L45ZLxybasauJaj3M8buoT83D+nzPmCayXlxUV9hydhciCKVyIg0B/v0BtXPDE1uGqNwCPpg=="], + "@rolldown/binding-wasm32-wasi": ["@rolldown/binding-wasm32-wasi@1.3.4", "", { "dependencies": { "@oxc-project/types": "0.160.0" }, "cpu": "none" }, "sha512-jwO8P3o53ygo7b5061B7BeaJ1BGv3BKZ6jroFdw/01qWry7Z+qNBlDvulzbTle5s/A0Fc1FRgsTxrke9DvsSbA=="], - "@rolldown/binding-win32-x64-msvc": ["@rolldown/binding-win32-x64-msvc@1.2.15", "", { "os": "win32", "cpu": "x64" }, "sha512-HFZd2QNQYn1JbIi+Hpd7H+r/lkWxcfIu28nirZ6eCn2LafuvmExMlb/P96Sfx5tf7pPArw39IdhmCF8vmV+NhQ=="], + "@rolldown/binding-win32-arm64-msvc": ["@rolldown/binding-win32-arm64-msvc@1.3.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-8adGMrNtrdzi2WD1ozhYapER59gD8Q/DV6SCKJlyG2HqULPdeQUBvMa33lTsiEYwIqTZUaIU2MmvPp5f1wbtXA=="], - "@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.1", "", {}, "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw=="], + "@rolldown/binding-win32-x64-msvc": ["@rolldown/binding-win32-x64-msvc@1.3.4", "", { "os": "win32", "cpu": "x64" }, "sha512-rIMjtESdXJCIoOiUTroQ1Y1rjVDZkuUVRUxs3APX2vNv175D7TDWvzdELiIhzGq9cUNUFat+co+PTmPHPqSREg=="], + + "@rolldown/pluginutils": ["@rolldown/pluginutils@1.1.1", "", {}, "sha512-glFIJDvLNDtJhT9qrMFWLPbvS+skxgt4L0K8Ei2YtnhPysAJnsI7nyxSJxKj4ADeKX0OLjC4ntRkwpLOoS3rwA=="], "@sveltejs/acorn-typescript": ["@sveltejs/acorn-typescript@1.0.13", "", { "peerDependencies": { "acorn": "^8.9.0" } }, "sha512-wgKggnhZVL9Bfx1OaKKTrYY9BFRk6C8UAkQNUcIv1+llzYrIqy+RZm5HPKzn0NpEBvTVhTqB4kQyllZywsRBRQ=="], - "@sveltejs/vite-plugin-svelte": ["@sveltejs/vite-plugin-svelte@7.3.1", "", { "dependencies": { "deepmerge": "^4.3.1", "magic-string": "^1.0.0", "obug": "^2.1.0", "vitefu": "^1.1.2" }, "peerDependencies": { "svelte": "^5.46.4", "vite": "^8.0.0-beta.7 || ^8.0.0" } }, "sha512-ZPsLN8B1e/En+Ak5s4V7srFDT532oS0qieLsQwu63NGKsS+iAjoO2Js1BochlHlglcU+Pt7WAO3C5Ee+4f6gVA=="], + "@sveltejs/vite-plugin-svelte": ["@sveltejs/vite-plugin-svelte@7.3.2", "", { "dependencies": { "deepmerge": "^4.3.1", "obug": "^3.0.0", "vitefu": "^1.1.2" }, "peerDependencies": { "svelte": "^5.46.4", "vite": "^8.0.0-beta.7 || ^8.0.0" } }, "sha512-86J4nBLeTqYYIx/paBIRqYJMFYlpTS2sepUdQ6tUyU1jxqRV72ejOrIV2wsqlOsKlkM+h0G1SgwoHI30N+n9CA=="], "@types/chai": ["@types/chai@5.2.3", "", { "dependencies": { "@types/deep-eql": "*", "assertion-error": "^2.0.1" } }, "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA=="], "@types/deep-eql": ["@types/deep-eql@4.0.2", "", {}, "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw=="], - "@types/estree": ["@types/estree@1.0.9", "", {}, "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg=="], + "@types/estree": ["@types/estree@1.0.11", "", {}, "sha512-YBdNe5JcjYR0sPhJW1QIeRCmI11YhYvaRuGCs9+WCeTTb+Yhb2BE2XMe5/wAqF10FK5g3+q1PDhQABfT7aX0gg=="], - "@types/node": ["@types/node@20.19.43", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-6oYBAi5ikg4Pl+kGsoYtawUMBT2zZMCvPNF7pVLnHZfd1zf38DRiWn/gT01RYCdUqkv7Fhr+C9ot4/tb+2sVvA=="], + "@types/node": ["@types/node@26.6.11", "", { "dependencies": { "undici-types": "~8.9.0" } }, "sha512-uUyQ2XLEz+EXh34lmS3GhKrkqn/8FU7KUiKRpk347At2bmnMVWss45yz8b4FG/tUtmV1tV/+TVkITItPROyeeQ=="], "@types/whatwg-mimetype": ["@types/whatwg-mimetype@3.0.2", "", {}, "sha512-c2AKvDT8ToxLIOUlN51gTiHXflsfIFisS4pO7pDPoKouJCESkhZnEy623gwP9laCy5lnLDAw1vAzu2vM2YLOrA=="], - "@types/ws": ["@types/ws@8.18.1", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="], + "@types/ws": ["@types/ws@8.18.2", "", { "dependencies": { "@types/node": "*" } }, "sha512-67MQl+fpWKVTT1NYdnmo3U4sc/xPo/zQBncVnI74qmQa0z/b+1g6iYqNmGCPbxO+zz2aklb08a0oHfegiVd0/w=="], - "@vitest/coverage-v8": ["@vitest/coverage-v8@5.0.5", "", { "dependencies": { "@bcoe/v8-coverage": "^1.0.2", "@vitest/istanbul-lib-coverage": "^1.0.2", "@vitest/istanbul-lib-report": "^1.0.2", "ast-v8-to-istanbul": "^1.0.7", "magicast": "^0.5.5", "obug": "^3.0.0", "std-env": "^4.3.0", "tinyrainbow": "^3.2.0" }, "peerDependencies": { "@vitest/browser": "5.0.5", "vitest": "5.0.5" }, "optionalPeers": ["@vitest/browser"] }, "sha512-4KpkGdIrSqBihx/JyP/e+S+IKB98etg1XDQiLAxksLfcShnwi1VReGeOT9NI43hLHbknosKp/1CCLn9Zgcs8mg=="], + "@vitest/coverage-v8": ["@vitest/coverage-v8@5.1.2", "", { "dependencies": { "@bcoe/v8-coverage": "^1.0.2", "@vitest/istanbul-lib-coverage": "^2.1.1", "@vitest/istanbul-lib-report": "^2.1.1", "ast-v8-to-istanbul": "^1.0.8", "magicast": "^0.5.5", "obug": "^3.0.0", "std-env": "^4.3.0", "tinyrainbow": "^3.2.0" }, "peerDependencies": { "@vitest/browser": "5.1.2", "vitest": "5.1.2" }, "optionalPeers": ["@vitest/browser"] }, "sha512-VG0JLv0T4kr1fR6QAfe8PTou+Frc4t0u4j+oKgDH3djJpFawzBfGyX14/z56NXoCTNem3OEphzCJhc4DkE62xQ=="], - "@vitest/istanbul-lib-coverage": ["@vitest/istanbul-lib-coverage@1.0.2", "", {}, "sha512-9J/JMwOf9AoJhAywhrn7ScKTL38hsWQP/qPG60OtaAFcQ5OXPwKsxZFlbnuCKmZ61m8/lGgHYnFpdyQZUvG/iA=="], + "@vitest/istanbul-lib-coverage": ["@vitest/istanbul-lib-coverage@2.1.1", "", {}, "sha512-pF9nMHHuyQzyEXdkWX3d4wElEKjymfL5TEoofegJn/jK2WjmTLOcJKfJ7/YwYGYdbZf8Ebrt4VDUoBPiTuO9zg=="], - "@vitest/istanbul-lib-report": ["@vitest/istanbul-lib-report@1.0.2", "", { "dependencies": { "@vitest/istanbul-lib-coverage": "1.0.2" } }, "sha512-gUsfXZJbzPamoIY5TvHFiMMoXESBrUMo+xqaj+rYrWI69+EnvRlYBlP96ZnHPY4vX8kyUpgAnFUCg5wZG/HkDQ=="], + "@vitest/istanbul-lib-report": ["@vitest/istanbul-lib-report@2.1.1", "", { "dependencies": { "@vitest/istanbul-lib-coverage": "2.1.1" } }, "sha512-Qba+8OpQQAbWrmq3u1olh6jqE/vyW4OYJe6TLrrTBpXhjJhbY7Os69wyVvMQmNA64KJhGd5nQ/c7l4io8tPCHQ=="], - "@vitest/mocker": ["@vitest/mocker@5.0.5", "", { "dependencies": { "@jridgewell/trace-mapping": "0.3.31", "@vitest/spy": "5.0.5", "estree-walker": "^3.0.3", "magic-string": "^1.4.3" }, "peerDependencies": { "msw": "^2.4.9 || ^3.0.0", "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["msw", "vite"] }, "sha512-xLL3lkDegJZw+MGoGaCCsFayDZthGgpAtr3Vziyfc4p7xH89K7KRPcRBBh/kEYm0Aqkt5DtTmkYpBtRV/FrHZg=="], + "@vitest/mocker": ["@vitest/mocker@5.1.2", "", { "dependencies": { "@jridgewell/trace-mapping": "0.3.31", "@vitest/spy": "5.1.2", "estree-walker": "^3.0.3", "magic-string": "^1.4.5" }, "peerDependencies": { "msw": "^2.4.9 || ^3.0.0", "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["msw", "vite"] }, "sha512-UGc97wUIy0Ji2+9GxzHEJiOhiwkaukgE7VYcUNnjpX3sWnwQ8XogmNXX4WyOukxYgKb8Nh2XFa7KId0ZjpmVhQ=="], - "@vitest/spy": ["@vitest/spy@5.0.5", "", {}, "sha512-lwJRExuH417257Q5wv9QYugN9IMJkoxcrKrYxGPQkBzl7wlNpTUxD/5yNX4ESKVUIShKPgkGchYPFMWOOk0wzw=="], + "@vitest/spy": ["@vitest/spy@5.1.2", "", {}, "sha512-PQl0/3+p9GaY71+MHywN6oyHfLhVDD5kcbm7oNRldA2F0ExMU3S8RQdnpteJ9gFAdK5P6KCgE6LqCpUgy57KzA=="], - "acorn": ["acorn@8.18.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ=="], + "acorn": ["acorn@8.19.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw=="], "aria-query": ["aria-query@5.3.1", "", {}, "sha512-Z/ZeOgVl7bcSYZ/u/rh0fOpvEpq//LZmdbkXyc7syVzjPAhfOa9ebsdTSjEBDU4vs5nC98Kfduj1uFo0qyET3g=="], "assertion-error": ["assertion-error@2.0.1", "", {}, "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA=="], - "ast-v8-to-istanbul": ["ast-v8-to-istanbul@1.0.7", "", { "dependencies": { "@jridgewell/trace-mapping": "^0.3.31", "estree-walker": "^3.0.3", "js-tokens": "^10.0.0" } }, "sha512-kFL68AG6ajd8fg248zwM9GQrUWEp79gsmjum34OEXjs4yHuUMZfYKwOLW9GMmB4oNvVrj+EAGxsP7ye2UR9UlA=="], + "ast-v8-to-istanbul": ["ast-v8-to-istanbul@1.0.8", "", { "dependencies": { "@jridgewell/trace-mapping": "^0.3.31", "estree-walker": "^3.0.3", "js-tokens": "^10.0.0" } }, "sha512-lPdpagk13ANXV+HClJEpCZM7kUsl5XcvgqKzZhaj6Ve1ZFICcY2sGhAN1n1vT0tML6EclT7bfVgTxqL57Gkpow=="], "axobject-query": ["axobject-query@4.1.0", "", {}, "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ=="], @@ -144,7 +146,7 @@ "esm-env": ["esm-env@1.2.2", "", {}, "sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA=="], - "esrap": ["esrap@2.4.0", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.4.15" }, "peerDependencies": { "@typescript-eslint/types": "^8.2.0" }, "optionalPeers": ["@typescript-eslint/types"] }, "sha512-CQPcneEHw/czj32uwQC52nYnax8H4SXt25FCM+LIwGZ49cMIxpOj3bP8wmzcI+Z0HIy5KkClaPhRLfCySzwHPA=="], + "esrap": ["esrap@2.4.2", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.4.15" }, "peerDependencies": { "@typescript-eslint/types": "^8.2.0" }, "optionalPeers": ["@typescript-eslint/types"] }, "sha512-WpVZsWnSheHBy+fGrO/0duwnbe6ODZH1QyBbjupreSCJGojaBWRncrq+HVeIJ8eHQjEwSJg9hC4yPJyNVOrpqg=="], "estree-walker": ["estree-walker@3.0.3", "", { "dependencies": { "@types/estree": "^1.0.0" } }, "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g=="], @@ -158,7 +160,7 @@ "is-reference": ["is-reference@3.0.3", "", { "dependencies": { "@types/estree": "^1.0.6" } }, "sha512-ixkJoqQvAP88E6wLydLGGqCJsrFUnqoH6HnaczB8XmDH1oaWU+xxdptvikTgaEhtZ53Ky6YXiBuUI2WXLMCwjw=="], - "js-tokens": ["js-tokens@10.0.0", "", {}, "sha512-lM/UBzQmfJRo9ABXbPWemivdCW8V2G8FHaHdypQaIy523snUjog0W71ayWXTjiR+ixeMyVHN2XcpnTd/liPg/Q=="], + "js-tokens": ["js-tokens@10.0.2", "", {}, "sha512-DXL98F5NsFBwDz7kcb4UUlrg9ePDgBCPjK4inUYi5gahxsTrKNW8Oh6F3WAuh7hntbP41EL/DkUYccRsDfLQLQ=="], "lightningcss": ["lightningcss@1.33.0", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-android-arm64": "1.33.0", "lightningcss-darwin-arm64": "1.33.0", "lightningcss-darwin-x64": "1.33.0", "lightningcss-freebsd-x64": "1.33.0", "lightningcss-linux-arm-gnueabihf": "1.33.0", "lightningcss-linux-arm64-gnu": "1.33.0", "lightningcss-linux-arm64-musl": "1.33.0", "lightningcss-linux-x64-gnu": "1.33.0", "lightningcss-linux-x64-musl": "1.33.0", "lightningcss-win32-arm64-msvc": "1.33.0", "lightningcss-win32-x64-msvc": "1.33.0" } }, "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA=="], @@ -188,64 +190,56 @@ "lucide-svelte": ["lucide-svelte@1.0.1", "", { "peerDependencies": { "svelte": "^3 || ^4 || ^5.0.0-next.42" } }, "sha512-WvzZgk0pqzgda+AErLvgWxHkfg/+GgUwqKMRHvzt0IqyMdmyEDzDCk3Z+Wo/3y753oIgx8u9Q4eUbWkghFa8Jg=="], - "magic-string": ["magic-string@1.4.3", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.6.0" } }, "sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ=="], + "magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="], "magicast": ["magicast@0.5.5", "", { "dependencies": { "@babel/parser": "^7.29.7", "@babel/types": "^7.29.7", "source-map-js": "^1.2.1" } }, "sha512-UicdXN8zQ3JHlxVq+28afMXPr1z7WNY6+7EJnzTdQWkTAlMLF5fNCCKxJHBQwGaNGR11581EiQmQzx73+MvszA=="], - "nanoid": ["nanoid@3.3.18", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w=="], + "nanoid": ["nanoid@3.3.20", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ=="], + + "napi-windows-process-start-time": ["napi-windows-process-start-time@0.1.0", "", { "os": "win32", "cpu": [ "x64", "arm64", ] }, "sha512-zHxhzKsIFu3elch3eFw69WEUGc79DFhbc3nD/WEOzWL/pFFLZRW13EHnuO0c+0YjncE5uCaS9ICHxOBXkb6vPw=="], - "obug": ["obug@2.1.4", "", {}, "sha512-4a+OsYv9UktOJKE+l1A4OufDgdRF9PifWj+tJnHURo/P+WOxpG4GzUFL9qCalmWauao6ogiG+QvnCovwPoyAWA=="], + "obug": ["obug@3.0.0", "", {}, "sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw=="], "picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="], "picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="], - "postcss": ["postcss@8.5.31", "", { "dependencies": { "nanoid": "^3.3.20", "picocolors": "^1.1.1", "source-map-js": "^1.2.2" } }, "sha512-YUbWYCgErwnMAVkjUnYa+KlMBzGpHwiIt/DE7f0G33AuX2LH9UcTk6KgWxd3zRU+pN3u/C+Xl3EnMLM4Hea7Sg=="], + "postcss": ["postcss@8.5.34", "", { "dependencies": { "nanoid": "^3.3.20", "picocolors": "^1.1.1", "source-map-js": "^1.2.4" } }, "sha512-P1Qzj0XXZjMda74C7qiVnBG90UKNbyNUAOeQRBW8X63RsIMV57gevRqjnkELdwtZ/S2/uQFksJhmwuN8xShLPw=="], - "rolldown": ["rolldown@1.2.15", "", { "dependencies": { "@oxc-project/types": "=0.155.0", "@rolldown/pluginutils": "^1.0.0" }, "optionalDependencies": { "@rolldown/binding-android-arm-eabi": "1.2.15", "@rolldown/binding-android-arm64": "1.2.15", "@rolldown/binding-darwin-arm64": "1.2.15", "@rolldown/binding-darwin-x64": "1.2.15", "@rolldown/binding-freebsd-x64": "1.2.15", "@rolldown/binding-linux-arm-gnueabihf": "1.2.15", "@rolldown/binding-linux-arm64-gnu": "1.2.15", "@rolldown/binding-linux-arm64-musl": "1.2.15", "@rolldown/binding-linux-ppc64-gnu": "1.2.15", "@rolldown/binding-linux-s390x-gnu": "1.2.15", "@rolldown/binding-linux-x64-gnu": "1.2.15", "@rolldown/binding-linux-x64-musl": "1.2.15", "@rolldown/binding-openharmony-arm64": "1.2.15", "@rolldown/binding-win32-arm64-msvc": "1.2.15", "@rolldown/binding-win32-x64-msvc": "1.2.15" }, "bin": { "rolldown": "./bin/cli.mjs" } }, "sha512-6odND+fel5zVw3I4Yc2e69gvguDnX0CAAGiNDZSq4ik5WUcaLrkD2GLuog0XcODbor31hZ5ayEMgVDno+KPV5g=="], + "rolldown": ["rolldown@1.3.4", "", { "dependencies": { "@oxc-project/types": "=0.160.0", "@rolldown/pluginutils": "^1.0.0" }, "optionalDependencies": { "@rolldown/binding-android-arm-eabi": "1.3.4", "@rolldown/binding-android-arm64": "1.3.4", "@rolldown/binding-darwin-arm64": "1.3.4", "@rolldown/binding-darwin-x64": "1.3.4", "@rolldown/binding-freebsd-x64": "1.3.4", "@rolldown/binding-linux-arm-gnueabihf": "1.3.4", "@rolldown/binding-linux-arm64-gnu": "1.3.4", "@rolldown/binding-linux-arm64-musl": "1.3.4", "@rolldown/binding-linux-ppc64-gnu": "1.3.4", "@rolldown/binding-linux-s390x-gnu": "1.3.4", "@rolldown/binding-linux-x64-gnu": "1.3.4", "@rolldown/binding-linux-x64-musl": "1.3.4", "@rolldown/binding-openharmony-arm64": "1.3.4", "@rolldown/binding-wasm32-wasi": "1.3.4", "@rolldown/binding-win32-arm64-msvc": "1.3.4", "@rolldown/binding-win32-x64-msvc": "1.3.4" }, "bin": { "rolldown": "./bin/cli.mjs" } }, "sha512-p2rq4bfBmF0M6yaR8+A89fbkBQynZI2fxUW4G07eq9kpctAkpo7q5BZ4X4Mo4XZ7HHROu33cX9PeopUFN6u+2Q=="], - "source-map-js": ["source-map-js@1.2.2", "", {}, "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw=="], + "source-map-js": ["source-map-js@1.2.4", "", {}, "sha512-J7ZjMvHd9O1fcT/5V09QWaaSl2BbWx3F6O08spde82Namf9UB0GxRVIPiNbVsdKkoizHiSpTodo3vp2bAy91MA=="], "std-env": ["std-env@4.3.0", "", {}, "sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag=="], - "svelte": ["svelte@5.57.2", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "@jridgewell/sourcemap-codec": "^1.6.0", "@sveltejs/acorn-typescript": "^1.0.13", "@types/estree": "^1.0.9", "acorn": "^8.18.0", "aria-query": "5.3.1", "axobject-query": "^4.1.0", "clsx": "^2.1.1", "devalue": "^5.9.2", "esm-env": "^1.2.1", "esrap": "^2.3.6", "is-reference": "^3.0.3", "locate-character": "^3.0.0", "magic-string": "^0.30.11", "zimmerframe": "^1.1.2" } }, "sha512-1YiPCAXT0Ct6g1vOMmSLa0Nsc3QRMvtDF32ihgglGVrugIuIK38RyDiFNXVDhtQ81TJjSO57NdMw6DyYLqSGDQ=="], + "svelte": ["svelte@5.59.2", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "@jridgewell/sourcemap-codec": "^1.6.0", "@sveltejs/acorn-typescript": "^1.0.13", "@types/estree": "^1.0.9", "acorn": "^8.18.0", "aria-query": "5.3.1", "axobject-query": "^4.1.0", "clsx": "^2.1.1", "devalue": "^6.0.4", "esm-env": "^1.2.1", "esrap": "^2.4.2", "is-reference": "^3.0.3", "locate-character": "^3.0.0", "magic-string": "^0.30.11", "zimmerframe": "^1.1.2" } }, "sha512-XsSgJYzoRJ1GfD5IOJorwRy77eIEv8I1p+3wDQGkDIEbVd8BFXCy4PTQ8diPtuazRRHq6IWidBg2m3rDrqNtcA=="], - "tinybench": ["tinybench@6.2.2", "", {}, "sha512-nIZ2N2dFpjBsg2hgitKu7mA+FvsIJuGJOwysRngmVRRmWgR/UyPjwJj8c/fT/dhm8EkHnF5EOogRf+0Z2qrimA=="], + "tinybench": ["tinybench@6.2.5", "", {}, "sha512-b/8GRMdnY4cqkfCLyaFpTGIv1qwfi3oT0mWaepwT++6Z/ZrYehNfZZ2JDKVLKGhNoEkS3IIB1ELtCT0XS5DtOA=="], - "tinyexec": ["tinyexec@1.3.1", "", {}, "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA=="], + "tinyexec": ["tinyexec@1.4.0", "", {}, "sha512-PV6lIcJQh57aFeJDwx16JNHmgFRh5xguzallrDW1qe8nAghYgr5MKz2K5k7wEyV/ygZhdnIAP8+HZSarHPBCsg=="], "tinyglobby": ["tinyglobby@0.2.17", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" } }, "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g=="], "tinyrainbow": ["tinyrainbow@3.2.0", "", {}, "sha512-LgO3D9yZJjApUiuUfl9iFAwrtaX4+lok3wJIqttGoKCHlWUqHqbQpnxCf82L8FjgKsh4iGo78hqJwgL8F6To2A=="], - "undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="], + "undici-types": ["undici-types@8.9.0", "", {}, "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg=="], - "vite": ["vite@8.3.5", "", { "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.7", "postcss": "^8.5.30", "rolldown": "~1.2.14", "tinyglobby": "^0.2.17" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.7.1 || ^0.8.0", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-z1YpjieJ9g0ebTmQpLBv/oq9E3F9EIlOe+7LahW8SrE3LTiG3udBRUXQOlYXP9b+IC2q2phHeVxj9xGlw34OEQ=="], + "vite": ["vite@8.4.0", "", { "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.7", "postcss": "^8.5.33", "rolldown": "~1.3.2", "tinyglobby": "^0.2.17" }, "optionalDependencies": { "fsevents": "~2.3.3", "napi-windows-process-start-time": "^0.1.0" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.7.1 || ^0.8.0", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-X2nUJg+9cutlz3hzqyO6p+WTwk9H257DjwAEf9EQYUFrQbDItmetadi9gYmb+l7VDy4r3VXLUnmLTwuPmzejDw=="], - "vitefu": ["vitefu@1.1.3", "", { "peerDependencies": { "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["vite"] }, "sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg=="], + "vitefu": ["vitefu@1.1.4", "", { "peerDependencies": { "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["vite"] }, "sha512-qbEIDswfXH3x3IYRMScl/bf1AVW0dn7Z8qkr7g7nohkusfuC7tcFa7t5EoTOz60AunosLM9sDrDjHxsX+Up+CQ=="], - "vitest": ["vitest@5.0.5", "", { "dependencies": { "@types/chai": "^5.2.2", "@vitest/mocker": "5.0.5", "chai": "^6.3.0", "es-module-lexer": "^2.3.2", "expect-type": "^1.4.0", "magic-string": "^1.4.3", "obug": "^3.0.0", "picomatch": "^4.0.7", "std-env": "^4.3.0", "tinybench": "^6.2.2", "tinyexec": "^1.3.1", "tinyglobby": "^0.2.17", "why-is-node-running": "3.2.1" }, "peerDependencies": { "@edge-runtime/vm": "*", "@opentelemetry/api": "^1.9.0", "@types/node": "^22.0.0 || >=24.0.0", "@vitest/browser-playwright": "5.0.5", "@vitest/browser-preview": "5.0.5", "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0", "@vitest/coverage-istanbul": "5.0.5", "@vitest/coverage-v8": "5.0.5", "@vitest/ui": "5.0.5", "happy-dom": "*", "jsdom": "*", "vite": "^6.4.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["@edge-runtime/vm", "@opentelemetry/api", "@types/node", "@vitest/browser-playwright", "@vitest/browser-preview", "@vitest/browser-webdriverio", "@vitest/coverage-istanbul", "@vitest/coverage-v8", "@vitest/ui", "happy-dom", "jsdom"], "bin": { "vitest": "./vitest.mjs" } }, "sha512-cPODOMF8YnkiiYtDdHo6n4wWmBrOBBbOIYH2d33M4l3CdNn72h+qMmO6uXffUN6A5AZFXNND/d+krS9mgkXRfg=="], + "vitest": ["vitest@5.1.2", "", { "dependencies": { "@types/chai": "^5.2.2", "@vitest/mocker": "5.1.2", "chai": "^6.3.0", "es-module-lexer": "^2.3.2", "expect-type": "^1.4.0", "magic-string": "^1.4.5", "obug": "^3.0.0", "picomatch": "^4.0.7", "std-env": "^4.3.0", "tinybench": "^6.2.3", "tinyexec": "^1.3.1", "tinyglobby": "^0.2.17", "why-is-node-running": "3.2.1" }, "peerDependencies": { "@edge-runtime/vm": "*", "@opentelemetry/api": "^1.9.0", "@types/node": "^22.0.0 || >=24.0.0", "@vitest/browser-playwright": "5.1.2", "@vitest/browser-preview": "5.1.2", "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0", "@vitest/coverage-istanbul": "5.1.2", "@vitest/coverage-v8": "5.1.2", "@vitest/ui": "5.1.2", "happy-dom": "*", "jsdom": "*", "vite": "^6.4.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["@edge-runtime/vm", "@opentelemetry/api", "@types/node", "@vitest/browser-playwright", "@vitest/browser-preview", "@vitest/browser-webdriverio", "@vitest/coverage-istanbul", "@vitest/coverage-v8", "@vitest/ui", "happy-dom", "jsdom"], "bin": { "vitest": "./vitest.mjs" } }, "sha512-VIa2wXV208WraXUbzH+dQUrGcFpPuaiRA8HlhXS8R6/sy9cynw6OMqGj8fmAlH1hot7huTCtWUE14+FdXU3eLw=="], "whatwg-mimetype": ["whatwg-mimetype@3.0.0", "", {}, "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q=="], "why-is-node-running": ["why-is-node-running@3.2.1", "", { "bin": { "why-is-node-running": "cli.js" } }, "sha512-Tb2FUhB4vUsGQlfSquQLYkApkuPAFQXGFzxWKHHumVz2dK+X1RUm/HnID4+TfIGYJ1kTcwOaCk/buYCEJr6YjQ=="], - "ws": ["ws@8.21.2", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-54dMVAo4WIe6SKy3vBgN+9bJZqqQ8IMRevAkOLQALhi49qkkQDQfWdAZ8KQlXiEabw88ARXXdUrlvtbKQX+aKw=="], - - "zimmerframe": ["zimmerframe@1.1.4", "", {}, "sha512-B58NGBEoc8Y9MWWCQGl/gq9xBCe4IiKM0a2x7GZdQKOW5Exr8S1W24J6OgM1njK8xCRGvAJIL/MxXHf6SkmQKQ=="], - - "@jridgewell/gen-mapping/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.5", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="], - - "@jridgewell/trace-mapping/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.5", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="], - - "@vitest/coverage-v8/obug": ["obug@3.0.0", "", {}, "sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw=="], - - "svelte/magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="], + "ws": ["ws@8.23.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-1rzWDSN0NOi3tpwgHsQExjWRoKUGtjCkJ2gZRaaRtzhYLboMytOI9pj9PU7yCgY37auqdd4OyLofZDbkeuZmPA=="], - "tinyglobby/picomatch": ["picomatch@4.0.5", "", {}, "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A=="], + "zimmerframe": ["zimmerframe@1.1.5", "", {}, "sha512-msJxIvYDYcoNL+PJsu+7qmpDWsYmAxTY+2TNYXXF0hzBzBk0BMecOqDOG/EckUoKCuKwObfbugIl8QpqHDXeFA=="], - "vitest/obug": ["obug@3.0.0", "", {}, "sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw=="], + "@vitest/mocker/magic-string": ["magic-string@1.4.5", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.6.0" } }, "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w=="], - "svelte/magic-string/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.5", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="], + "vitest/magic-string": ["magic-string@1.4.5", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.6.0" } }, "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w=="], } } diff --git a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/package.json b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/package.json index 14b364d..49230c1 100644 --- a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/package.json +++ b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/package.json @@ -7,14 +7,14 @@ "test:coverage": "vitest run --coverage" }, "devDependencies": { - "@sveltejs/vite-plugin-svelte": "^7.3.1", - "vitest": "^5.0.5", - "svelte": "^5.57.2", - "@vitest/coverage-v8": "^5.0.5", + "@sveltejs/vite-plugin-svelte": "^7.3.2", + "vitest": "^5.1.2", + "svelte": "^5.59.2", + "@vitest/coverage-v8": "^5.1.2", "happy-dom": "^21.0.4" }, "dependencies": { - "@lucide/svelte": "^1.59.0", + "@lucide/svelte": "^1.84.0", "lucide-svelte": "^1.0.1" }, "overrides": { diff --git a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/App.test.ts b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/App.test.ts index 3ccd335..303f653 100644 --- a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/App.test.ts +++ b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/App.test.ts @@ -48,6 +48,7 @@ function makePayload(): SettingsDto { groupColors: {}, defaultMetricColors: {}, followWindowsTheme: true, + columns: [], row1: [], userCustomizedMetricColors: [], userCustomizedGroupColors: [], @@ -65,6 +66,7 @@ function makePayload(): SettingsDto { alertCpuPower: false, alertGpuFreq: false, alertGpuPower: false, + alertDiskTemp: false, alertNetDaily: false, alertNetMonthly: false, cpuUsageMaxPct: 90, @@ -73,6 +75,7 @@ function makePayload(): SettingsDto { gpuVramMaxMb: 8192, cpuTempMaxC: 90, gpuTempMaxC: 90, + diskTempMaxC: 70, batteryLowPct: 20, cpuFreqMinMhz: 400, cpuPowerMaxW: 100, @@ -82,6 +85,7 @@ function makePayload(): SettingsDto { netMonthlyMaxGb: 1000, showToastNotif: true, flashOverlay: true, + sustainedSecs: 3, cooldownSecs: 30, fireOncePerSession: false, }, @@ -104,6 +108,7 @@ describe('App.svelte', () => { document.body.innerHTML = ''; settings.set(null); pristineSettings.set(''); + saveStatus.set('idle'); activePage.set('alerts'); }); @@ -220,6 +225,36 @@ describe('App.svelte', () => { expect(bar!.classList.contains('visible')).toBe(false); }); + it('discard button in save bar reverts changes and hides save bar', async () => { + const payload = makePayload(); + payload.alerts.enabled = true; + settings.set(payload); + pristineSettings.set(JSON.stringify(payload)); + + component = mount(App, { target: document.body }); + await tick(); + + const bar = document.querySelector('.save-bar'); + expect(bar!.classList.contains('visible')).toBe(false); + + const toggle = document.querySelector( + 'input[aria-label="Enable Threshold Alerts"]', + ) as HTMLInputElement; + toggle.checked = false; + toggle.dispatchEvent(new Event('change')); + await tick(); + + expect(bar!.classList.contains('visible')).toBe(true); + + const discardBtn = document.querySelector('.save-bar .btn-discard') as HTMLButtonElement; + expect(discardBtn).not.toBeNull(); + discardBtn.click(); + await tick(); + + expect(bar!.classList.contains('visible')).toBe(false); + expect(get(settings)?.alerts.enabled).toBe(true); + }); + it('initializes bridge messages and handles incoming webview events', async () => { const postedMessages: any[] = []; const wv = new EventTarget(); @@ -363,6 +398,10 @@ describe('App.svelte', () => { }); it('handles modal Escape key, discard button, and invalid pristine settings', async () => { + const wv = new EventTarget() as any; + wv.postMessage = vi.fn(); + (globalThis as any).window.chrome = { webview: wv }; + const payload = makePayload(); settings.set(structuredClone(payload)); pristineSettings.set(JSON.stringify(payload)); @@ -419,6 +458,10 @@ describe('App.svelte', () => { await tick(); expect(document.querySelector('.nav-modal')).toBeNull(); + // Simulate saved event from bridge so saving state resets + wv.dispatchEvent(new MessageEvent('message', { data: { type: 'saved' } })); + await tick(); + // Navigate while dirty again and test discard & move settings.update(s => { if (s) s.monitoring.intervalMs = 7777; @@ -433,6 +476,8 @@ describe('App.svelte', () => { expect(get(activePage)).toBe('overlay'); // Test bottom bar discard with invalid JSON + const consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => { }); + const consoleDebugSpy = vi.spyOn(console, 'debug').mockImplementation(() => { }); pristineSettings.set('invalid json'); settings.update(s => { if (s) s.monitoring.intervalMs = 9999; @@ -440,10 +485,13 @@ describe('App.svelte', () => { }); await tick(); const barDiscardBtn = document.querySelector('.btn-discard') as HTMLButtonElement; - if (barDiscardBtn) { - barDiscardBtn.click(); - await tick(); - } + expect(barDiscardBtn).not.toBeNull(); + barDiscardBtn.click(); + await tick(); + consoleDebugSpy.mockRestore(); + consoleErrorSpy.mockRestore(); + + delete (globalThis as any).window.chrome; }); it('receives IPC events with null payloads gracefully', async () => { @@ -466,6 +514,30 @@ describe('App.svelte', () => { wv.dispatchEvent(new MessageEvent('message', { data: { type: 'trafficToday', payload: {} } })); wv.dispatchEvent(new MessageEvent('message', { data: { type: 'importDatResult', payload: null } })); wv.dispatchEvent(new MessageEvent('message', { data: { type: 'windowsUsageImportResult', payload: null } })); + wv.dispatchEvent(new MessageEvent('message', { data: { type: 'taskbarSlotChanged', payload: null } })); + wv.dispatchEvent(new MessageEvent('message', { data: { type: 'taskbarSlotChanged', payload: 'string-payload' } })); + wv.dispatchEvent(new MessageEvent('message', { + data: { + type: 'taskbarSlotChanged', + payload: { taskbarSpaceConstrained: true, availableSlotWidth: 260 } + } + })); + await tick(); + expect(get(settings)?.overlay.taskbarSpaceConstrained).toBe(true); + expect(get(settings)?.overlay.availableSlotWidth).toBe(260); + const saveBar = document.querySelector('.save-bar'); + expect(saveBar?.classList.contains('visible')).toBe(false); + + // When settings is null + settings.set(null as any); + wv.dispatchEvent(new MessageEvent('message', { + data: { + type: 'taskbarSlotChanged', + payload: { taskbarSpaceConstrained: false } + } + })); + await tick(); + settings.set(structuredClone(payload)); await tick(); // Dispatch trafficToday when multiple records exist for today @@ -508,7 +580,7 @@ describe('App.svelte', () => { activePage.set('unknown_page'); saveStatus.set('idle'); await tick(); - expect(document.querySelector('.content')?.children.length).toBe(0); + expect(document.querySelector('.content')?.children).toHaveLength(0); // Set saveStatus to saved when clean to cover auto-save class saveStatus.set('saved'); diff --git a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/Sidebar.test.ts b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/Sidebar.test.ts index efa1fc2..e65660f 100644 --- a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/Sidebar.test.ts +++ b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/Sidebar.test.ts @@ -1,14 +1,21 @@ import { mount, unmount, tick } from 'svelte'; -import { describe, it, expect, beforeEach, afterEach } from 'vitest'; -import { activePage } from '../../../../../../src/LocalTelemetry.App/Settings/wwwroot/src/lib/store'; +import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'; +import { activePage, systemInfo, settings } from '../../../../../../src/LocalTelemetry.App/Settings/wwwroot/src/lib/store'; +import * as bridge from '../../../../../../src/LocalTelemetry.App/Settings/wwwroot/src/lib/bridge'; import Sidebar from '../../../../../../src/LocalTelemetry.App/Settings/wwwroot/src/components/Sidebar.svelte'; describe('Sidebar.svelte', () => { let component: ReturnType | undefined; + let wv: EventTarget; beforeEach(() => { document.body.innerHTML = ''; activePage.set('general'); + wv = new EventTarget(); + (wv as any).postMessage = vi.fn(); + (globalThis as any).window.chrome = { webview: wv }; + systemInfo.set({ appVersion: '1.3.0-beta.2' } as any); + settings.set({ updates: { includePrereleases: false, checkFrequency: 'weekly' } } as any); }); afterEach(() => { @@ -16,6 +23,8 @@ describe('Sidebar.svelte', () => { unmount(component); component = undefined; } + delete (globalThis as any).window.chrome; + vi.restoreAllMocks(); }); it('renders sidebar navigation items', async () => { @@ -72,4 +81,107 @@ describe('Sidebar.svelte', () => { const activeItems = document.querySelectorAll('.nav-item.active'); expect(activeItems).toHaveLength(0); }); + + it('renders CTA footer with Star, Discord, and stable version when prereleases disabled', async () => { + const openUrlSpy = vi.spyOn(bridge, 'openUrl').mockImplementation(() => { }); + let dispatched = ''; + component = mount(Sidebar, { + target: document.body, + events: { + navigate: (e: any) => { + dispatched = e.detail; + } + } + }); + await tick(); + + const starBtn = document.querySelector('.star-btn'); + const discordBtn = document.querySelector('.discord-btn'); + const verBtn = document.querySelector('.version-btn'); + + expect(starBtn).not.toBeNull(); + expect(discordBtn).not.toBeNull(); + // Since includePrereleases is false, stable version is shown (v1.2.0) + expect(verBtn?.textContent?.trim()).toBe('v1.2.0'); + + starBtn?.click(); + expect(openUrlSpy).toHaveBeenCalledWith('https://github.com/Nicconike/LocalTelemetry'); + + discordBtn?.click(); + expect(openUrlSpy).toHaveBeenCalledWith('https://discord.gg/M2QevSgW3S'); + + verBtn?.click(); + await tick(); + expect(dispatched).toBe('about'); + }); + + it('shows latest beta version when includePrereleases is true in settings', async () => { + settings.set({ updates: { includePrereleases: true, checkFrequency: 'weekly' } } as any); + component = mount(Sidebar, { target: document.body }); + await tick(); + + const verBtn = document.querySelector('.version-btn'); + expect(verBtn?.textContent?.trim()).toBe('v1.3.0-beta.2'); + + // Simulate update check returning a newer beta + const msgEvent = new MessageEvent('message', { + data: { + type: 'updateCheckResult', + payload: { + isUpdateAvailable: true, + isPrerelease: true, + latestVersion: '1.3.0-beta.3', + currentVersion: '1.3.0-beta.2' + } + } + }); + wv.dispatchEvent(msgEvent); + await tick(); + + expect(verBtn?.textContent?.trim()).toBe('v1.3.0-beta.3'); + expect(verBtn?.classList.contains('has-update')).toBe(true); + }); + + it('shows latest stable version when updateCheckResult returns stable release with prerelease disabled', async () => { + settings.set({ updates: { includePrereleases: false, checkFrequency: 'weekly' } } as any); + component = mount(Sidebar, { target: document.body }); + await tick(); + + const msgEvent = new MessageEvent('message', { + data: { + type: 'updateCheckResult', + payload: { + isUpdateAvailable: false, + isPrerelease: false, + latestVersion: '1.2.0', + currentVersion: '1.3.0-beta.2' + } + } + }); + wv.dispatchEvent(msgEvent); + await tick(); + + const verBtn = document.querySelector('.version-btn'); + expect(verBtn?.textContent?.trim()).toBe('v1.2.0'); + }); + + it('navigates to about page on version button click', async () => { + let dispatched = ''; + component = mount(Sidebar, { + target: document.body, + events: { + navigate: (e: any) => { + dispatched = e.detail; + } + } + }); + await tick(); + + const verBtn = document.querySelector('.version-btn'); + expect(verBtn).not.toBeNull(); + + verBtn?.click(); + await tick(); + expect(dispatched).toBe('about'); + }); }); diff --git a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/AboutPage.test.ts b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/AboutPage.test.ts index b527c85..0b5682e 100644 --- a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/AboutPage.test.ts +++ b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/AboutPage.test.ts @@ -196,13 +196,19 @@ describe('AboutPage.svelte', () => { expect(document.body.textContent).toContain('08:15 AM'); unmount(component); - // 6. 1.0.0.0 version trimming to 1.0 + // 6. 1.0.0.0 version trimming to 1.0 and 1.2.3.0 trimming to 1.2.3 systemInfo.set({ version: '1.0.0.0', exeDir: '', dataDir: '', logsDir: '' } as any); component = mount(AboutPage, { target: document.body }); await tick(); expect(document.body.textContent).toContain('v1.0'); unmount(component); + systemInfo.set({ version: '1.2.3.0', exeDir: '', dataDir: '', logsDir: '' } as any); + component = mount(AboutPage, { target: document.body }); + await tick(); + expect(document.body.textContent).toContain('v1.2.3'); + unmount(component); + // 7. Missing version renders dash systemInfo.set({ version: '' } as any); component = mount(AboutPage, { target: document.body }); @@ -454,4 +460,51 @@ describe('AboutPage.svelte', () => { await tick(); expect(document.body.textContent).toContain('CustomBuildTimestamp'); }); + + it('renders Beta badge when available update is a pre-release', async () => { + component = mount(AboutPage, { target: document.body }); + await tick(); + + const msgEvent = new MessageEvent('message', { + data: { + type: 'updateCheckResult', + payload: { + isUpdateAvailable: true, + isPrerelease: true, + latestVersion: '1.2.0-beta.1', + releaseUrl: 'https://github.com/Nicconike/LocalTelemetry/releases/tag/v1.2.0-beta.1', + }, + }, + }); + wv.dispatchEvent(msgEvent); + await tick(); + + expect(document.body.textContent).toContain('v1.2.0-beta.1 Available'); + const betaBadge = document.querySelector('.update-badge.beta'); + expect(betaBadge).not.toBeNull(); + expect(betaBadge?.textContent).toBe('Beta'); + }); + + it('does not render Beta badge when available update is a stable release', async () => { + component = mount(AboutPage, { target: document.body }); + await tick(); + + const msgEvent = new MessageEvent('message', { + data: { + type: 'updateCheckResult', + payload: { + isUpdateAvailable: true, + isPrerelease: false, + latestVersion: '1.2.0', + releaseUrl: 'https://github.com/Nicconike/LocalTelemetry/releases/tag/v1.2.0', + }, + }, + }); + wv.dispatchEvent(msgEvent); + await tick(); + + expect(document.body.textContent).toContain('v1.2.0 Available'); + const betaBadge = document.querySelector('.update-badge.beta'); + expect(betaBadge).toBeNull(); + }); }); diff --git a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/AlertsPage.test.ts b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/AlertsPage.test.ts index 7902de8..734263a 100644 --- a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/AlertsPage.test.ts +++ b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/AlertsPage.test.ts @@ -1,6 +1,6 @@ import { mount, unmount, tick } from 'svelte'; import { describe, it, expect, beforeEach, afterEach } from 'vitest'; -import { settings } from '../../../../../../../src/LocalTelemetry.App/Settings/wwwroot/src/lib/store'; +import { settings, pristineSettings } from '../../../../../../../src/LocalTelemetry.App/Settings/wwwroot/src/lib/store'; import AlertsPage from '../../../../../../../src/LocalTelemetry.App/Settings/wwwroot/src/components/pages/AlertsPage.svelte'; function makeAlertPayload() { @@ -19,6 +19,7 @@ function makeAlertPayload() { alertCpuPower: false, alertGpuFreq: false, alertGpuPower: false, + alertDiskTemp: false, alertNetDaily: false, alertNetMonthly: false, cpuUsageMaxPct: 90, @@ -27,6 +28,7 @@ function makeAlertPayload() { gpuVramMaxMb: 8192, cpuTempMaxC: 90, gpuTempMaxC: 90, + diskTempMaxC: 70, batteryLowPct: 20, cpuFreqMinMhz: 400, cpuPowerMaxW: 100, @@ -36,6 +38,7 @@ function makeAlertPayload() { netMonthlyMaxGb: 1000, showToastNotif: true, flashOverlay: true, + sustainedSecs: 3, cooldownSecs: 30, fireOncePerSession: false, }, @@ -95,8 +98,9 @@ describe('AlertsPage.svelte', () => { let currentAlerts: any; settings.subscribe((s) => (currentAlerts = s?.alerts))(); expect(currentAlerts.alertCpuTemp).toBe(true); - expect(currentAlerts.alertRamUsage).toBe(true); - expect(currentAlerts.alertGpuTemp).toBe(true); + expect(currentAlerts.cpuTempMaxC).toBe(90); + expect(currentAlerts.alertRamUsage).toBe(false); + expect(currentAlerts.alertGpuTemp).toBe(false); }); it('displays battery alert controls when device has a battery', async () => { @@ -132,4 +136,51 @@ describe('AlertsPage.svelte', () => { await tick(); expect(document.querySelector('.page')).toBeNull(); }); + + it('renders sustained breach duration slider in actions section', async () => { + component = mount(AlertsPage, { target: document.body }); + await tick(); + + expect(document.body.textContent).toContain('Sustained breach duration'); + }); + + it('renders disk temperature alert controls', async () => { + const payload = makeAlertPayload(); + payload.alerts.alertDiskTemp = true; + settings.set(payload as any); + + component = mount(AlertsPage, { target: document.body }); + await tick(); + + expect(document.body.textContent).toContain('Storage'); + expect(document.body.textContent).toContain('Disk Temp'); + }); + + it('reverts to pristine alert settings when turning master toggle off after having it turned on', async () => { + const payload = makeAlertPayload(); + payload.alerts.enabled = false; + payload.alerts.alertCpuUsage = false; + payload.alerts.alertCpuTemp = false; + settings.set(payload as any); + pristineSettings.set(JSON.stringify(payload)); + + component = mount(AlertsPage, { target: document.body }); + await tick(); + + const masterToggle = document.querySelector('input[type="checkbox"]') as HTMLInputElement; + masterToggle.click(); + await tick(); + + let currentAlerts: any; + settings.subscribe((s) => (currentAlerts = s?.alerts))(); + expect(currentAlerts.enabled).toBe(true); + expect(currentAlerts.alertCpuTemp).toBe(true); + + masterToggle.click(); + await tick(); + + settings.subscribe((s) => (currentAlerts = s?.alerts))(); + expect(currentAlerts.enabled).toBe(false); + expect(currentAlerts.alertCpuTemp).toBe(false); + }); }); diff --git a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/AppearancePage.test.ts b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/AppearancePage.test.ts index 9f65460..68c6b28 100644 --- a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/AppearancePage.test.ts +++ b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/AppearancePage.test.ts @@ -57,6 +57,7 @@ function makePayload(): SettingsDto { groupColors: {}, defaultMetricColors: { ...BRAND }, followWindowsTheme: true, + columns: [], row1: [], userCustomizedMetricColors: [], userCustomizedGroupColors: [], @@ -91,6 +92,7 @@ function makePayload(): SettingsDto { netMonthlyMaxGb: 1000, showToastNotif: true, flashOverlay: true, + sustainedSecs: 0, cooldownSecs: 30, fireOncePerSession: false, }, @@ -286,17 +288,17 @@ describe('AppearancePage.svelte', () => { await tick(); expect(get(settings)!.windowTheme).not.toBe('default'); - // Test Enter key press on card - cards[0].dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', bubbles: true })); + // "Reset to Default Theme" button appears + const resetThemeBtn = Array.from(document.body.querySelectorAll('.reset-btn')).find(b => b.textContent?.includes('Reset to Default Theme')); + expect(resetThemeBtn).toBeDefined(); + resetThemeBtn!.click(); await tick(); + expect(get(settings)!.windowTheme).toBe('default'); - // If not default, "Reset to Default Theme" button appears - const resetBtn = document.body.querySelector('.reset-btn'); - if (resetBtn && resetBtn.textContent?.includes('Reset to Default Theme')) { - resetBtn.click(); - await tick(); - expect(get(settings)!.windowTheme).toBe('default'); - } + // Test Enter key press on non-default card to set theme again + cards[1].dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', bubbles: true })); + await tick(); + expect(get(settings)!.windowTheme).not.toBe('default'); }); it('toggles follow windows taskbar theme checkbox', async () => { @@ -778,6 +780,10 @@ describe('AppearancePage.svelte', () => { if (darkIdx !== -1) themes.splice(darkIdx, 1); const lightIdx = themes.indexOf(emptyLight); if (lightIdx !== -1) themes.splice(lightIdx, 1); + + expect(themes).not.toContain(emptyDark); + expect(themes).not.toContain(emptyLight); + expect(get(settings)!.overlay.userCustomizedMetricColors).toHaveLength(0); }); }); diff --git a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/GeneralPage.test.ts b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/GeneralPage.test.ts index 49395e5..a744b6f 100644 --- a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/GeneralPage.test.ts +++ b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/GeneralPage.test.ts @@ -33,6 +33,7 @@ describe('GeneralPage.svelte', () => { expect(document.body.textContent).toContain('General'); expect(document.body.textContent).toContain('Startup'); expect(document.body.textContent).toContain('Polling Interval'); + expect(document.body.textContent).not.toContain('0.5 s'); }); it('disables tray icon toggle when overlay is not visible to prevent lockout', async () => { diff --git a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/LayoutPage.test.ts b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/LayoutPage.test.ts index 0b20c7a..5fec097 100644 --- a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/LayoutPage.test.ts +++ b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/LayoutPage.test.ts @@ -95,6 +95,11 @@ describe('LayoutPage.svelte', () => { const select = document.body.querySelector('select.add-select') as HTMLSelectElement; expect(select).not.toBeNull(); + // Select empty string (-- Select --) + select.value = ''; + select.dispatchEvent(new Event('change', { bubbles: true })); + await tick(); + select.value = 'battery_pct'; select.dispatchEvent(new Event('change', { bubbles: true })); await tick(); @@ -352,4 +357,281 @@ describe('LayoutPage.svelte', () => { await tick(); } }); + + it('renders layout presets and row badges correctly', async () => { + component = mount(LayoutPage, { target: document.body }); + await tick(); + + const pills = document.body.querySelectorAll('.preset-pill') as NodeListOf; + expect(pills.length).toBeGreaterThanOrEqual(4); + expect(document.body.textContent).toContain('Default'); + expect(document.body.textContent).toContain('Gaming'); + expect(document.body.textContent).toContain('Compact'); + expect(document.body.textContent).toContain('Full Telemetry'); + + // Verify initial custom indicator exists when row1 does not match a preset + const customCard = document.body.querySelector('.custom-card'); + expect(customCard).not.toBeNull(); + expect(customCard!.textContent).toContain('Custom'); + + // Row badges check (even = Top Row, odd = Bottom Row) + const rowBadges = document.body.querySelectorAll('.row-badge'); + expect(rowBadges[0].textContent?.trim()).toBe('Top Row'); + expect(rowBadges[1].textContent?.trim()).toBe('Bottom Row'); + expect(rowBadges[2].textContent?.trim()).toBe('Top Row'); + }); + + it('switches between presets and updates active preset indicator', async () => { + component = mount(LayoutPage, { target: document.body }); + await tick(); + + const pills = Array.from(document.body.querySelectorAll('.preset-pill')) as HTMLButtonElement[]; + const gamingBtn = pills.find(p => p.textContent?.includes('Gaming')); + const compactBtn = pills.find(p => p.textContent?.includes('Compact')); + const defaultBtn = pills.find(p => p.textContent?.includes('Default')); + const fullBtn = pills.find(p => p.textContent?.includes('Full')); + + expect(gamingBtn).toBeDefined(); + expect(compactBtn).toBeDefined(); + expect(defaultBtn).toBeDefined(); + expect(fullBtn).toBeDefined(); + + // 1. Click Gaming preset: CPU top row, GPU bottom row, Total/VRAM, RAM, Network + gamingBtn!.click(); + await tick(); + + let row1 = get(settings)!.overlay.row1; + expect(row1).toEqual([ + 'cpu_pct', // Col 0 Top: CPU % + 'gpu_pct', // Col 0 Bot: GPU % + 'cpu_temp', // Col 1 Top: CPU Temp + 'gpu_temp', // Col 1 Bot: GPU Temp + 'cpu_power', // Col 2 Top: CPU Power + 'gpu_power', // Col 2 Bot: GPU Power + 'net_total', // Col 3 Top: Net Total + 'gpu_vram', // Col 3 Bot: GPU VRAM + 'ram_pct', // Col 4 Top: RAM % + 'ram_used', // Col 4 Bot: RAM Used + 'net_down', // Col 5 Top: Net Down + 'net_up', // Col 5 Bot: Net Up + ]); + expect(gamingBtn!.classList.contains('active')).toBe(true); + + // 2. Click Compact preset + compactBtn!.click(); + await tick(); + + row1 = get(settings)!.overlay.row1; + expect(row1).toEqual(['cpu_pct', 'gpu_pct', 'ram_pct', 'gpu_vram', 'net_down', 'net_up']); + expect(compactBtn!.classList.contains('active')).toBe(true); + + // 3. Click Full Telemetry preset + fullBtn!.click(); + await tick(); + + row1 = get(settings)!.overlay.row1; + expect(row1.length).toBeGreaterThan(10); + expect(fullBtn!.classList.contains('active')).toBe(true); + + // 4. Click Default preset + defaultBtn!.click(); + await tick(); + + row1 = get(settings)!.overlay.row1; + expect(row1).toContain('cpu_pct'); + expect(row1).toContain('cpu_temp'); + expect(defaultBtn!.classList.contains('active')).toBe(true); + + // 5. Test new presets: Thermals & Power, Workstation, Network & Traffic, Micro + const thermalsBtn = pills.find(p => p.textContent?.includes('Thermals')); + const workstationBtn = pills.find(p => p.textContent?.includes('Workstation')); + const networkBtn = pills.find(p => p.textContent?.includes('Network')); + const microBtn = pills.find(p => p.textContent?.includes('Micro')); + + expect(thermalsBtn).toBeDefined(); + expect(workstationBtn).toBeDefined(); + expect(networkBtn).toBeDefined(); + expect(microBtn).toBeDefined(); + + // Thermals: CPU Usage over Temp, CPU Clock over Power, GPU Usage over Temp, GPU Clock over Power + thermalsBtn!.click(); + await tick(); + row1 = get(settings)!.overlay.row1; + expect(row1).toEqual(['cpu_pct', 'cpu_temp', 'cpu_freq', 'cpu_power', 'gpu_pct', 'gpu_temp', 'gpu_freq', 'gpu_power']); + expect(thermalsBtn!.classList.contains('active')).toBe(true); + + // Workstation: CPU over Temp, RAM % over Used, Net Down over Up, Disk Read over Write + workstationBtn!.click(); + await tick(); + row1 = get(settings)!.overlay.row1; + expect(row1).toEqual(['cpu_pct', 'cpu_temp', 'ram_pct', 'ram_used', 'net_down', 'net_up', 'disk_disk0_read', 'disk_disk0_write']); + expect(workstationBtn!.classList.contains('active')).toBe(true); + + // Network: CPU % over RAM %, Net Down over Up, Net Total over RAM Used + networkBtn!.click(); + await tick(); + row1 = get(settings)!.overlay.row1; + expect(row1).toEqual(['cpu_pct', 'ram_pct', 'net_down', 'net_up', 'net_total', 'ram_used']); + expect(networkBtn!.classList.contains('active')).toBe(true); + + // Micro: CPU % over GPU %, RAM % over Net Down + microBtn!.click(); + await tick(); + row1 = get(settings)!.overlay.row1; + expect(row1).toEqual(['cpu_pct', 'gpu_pct', 'ram_pct', 'net_down']); + expect(microBtn!.classList.contains('active')).toBe(true); + + // 6. Custom edit un-highlights preset and shows 'Custom' badge + const moveDownBtns = document.body.querySelectorAll('button[title="Move down"]') as NodeListOf; + moveDownBtns[0].click(); + await tick(); + + expect(document.body.textContent).toContain('Custom'); + expect(microBtn!.classList.contains('active')).toBe(false); + }); + + it('renders live mini-taskbar preview and allows swapping columns directly when exactly 2 columns exist', async () => { + settings.set({ + monitoring: { trackCpu: true, trackGpu: true, trackRam: true, trackNet: true }, + overlay: { row1: ['cpu_pct', 'cpu_temp', 'gpu_pct', 'gpu_temp'] }, + } as any); + + component = mount(LayoutPage, { target: document.body }); + await tick(); + + // Check mini taskbar widget exists + const preview = document.body.querySelector('.mini-taskbar-widget'); + expect(preview).not.toBeNull(); + expect(preview!.textContent).toContain('CPU %'); + + // Check column cards exist + const colCards = document.body.querySelectorAll('.column-card'); + expect(colCards).toHaveLength(2); + + // Click swap button in Column 0 (swaps Column 0 and Column 1 when 2 columns exist) + const swapBtns = document.body.querySelectorAll('button.btn-swap') as NodeListOf; + expect(swapBtns).toHaveLength(2); + + swapBtns[0].click(); + await tick(); + + let row1 = get(settings)!.overlay.row1; + expect(row1[0]).toBe('gpu_pct'); + expect(row1[1]).toBe('gpu_temp'); + expect(row1[2]).toBe('cpu_pct'); + expect(row1[3]).toBe('cpu_temp'); + }); + + it('swaps any two columns via column swap buttons when more than 2 columns exist', async () => { + settings.set({ + monitoring: { trackCpu: true, trackGpu: true, trackRam: true, trackNet: true }, + overlay: { row1: ['cpu_pct', 'cpu_temp', 'gpu_pct', 'gpu_temp', 'ram_pct', 'ram_used'] }, + } as any); + + component = mount(LayoutPage, { target: document.body }); + await tick(); + + // 3 columns: Col 0 (CPU), Col 1 (GPU), Col 2 (RAM) + let swapBtns = document.body.querySelectorAll('button.btn-swap') as NodeListOf; + expect(swapBtns).toHaveLength(3); + + // Click Swap on Col 0 -> activates swap mode + swapBtns[0].click(); + await tick(); + + // Target swap button on Col 2 now says "With Col 1" + swapBtns = document.body.querySelectorAll('button.btn-swap') as NodeListOf; + expect(swapBtns[2].textContent).toContain('With Col 1'); + + // Click target on Col 2 -> Col 0 and Col 2 swap places + swapBtns[2].click(); + await tick(); + + let row1 = get(settings)!.overlay.row1; + // Col 0 is now RAM + expect(row1[0]).toBe('ram_pct'); + expect(row1[1]).toBe('ram_used'); + // Col 1 remains GPU + expect(row1[2]).toBe('gpu_pct'); + expect(row1[3]).toBe('gpu_temp'); + // Col 2 is now CPU + expect(row1[4]).toBe('cpu_pct'); + expect(row1[5]).toBe('cpu_temp'); + }); + + it('removes entire column via column remove button', async () => { + settings.set({ + monitoring: { trackCpu: true, trackGpu: true, trackRam: true, trackNet: true }, + overlay: { row1: ['cpu_pct', 'cpu_temp', 'gpu_pct', 'gpu_temp'] }, + } as any); + + component = mount(LayoutPage, { target: document.body }); + await tick(); + + const removeColBtns = document.body.querySelectorAll('button[title="Remove entire column"]') as NodeListOf; + expect(removeColBtns).toHaveLength(2); + + // Remove Col 0 + removeColBtns[0].click(); + await tick(); + + const row1 = get(settings)!.overlay.row1; + expect(row1).toEqual(['gpu_pct', 'gpu_temp']); + }); + + it('allows a column to contain only 1 metric without shifting subsequent columns', async () => { + settings.set({ + monitoring: { trackCpu: true, trackGpu: true, trackRam: true }, + overlay: { columns: [['cpu_pct', 'cpu_temp'], ['gpu_pct', 'gpu_temp']] }, + } as any); + + component = mount(LayoutPage, { target: document.body }); + await tick(); + + // 4 total remove buttons: cpu_pct, cpu_temp, gpu_pct, gpu_temp + const removeBtns = document.body.querySelectorAll('button.btn-remove') as NodeListOf; + expect(removeBtns).toHaveLength(4); + + // Remove cpu_temp (index 1, bottom of Col 0) + removeBtns[1].click(); + await tick(); + + const curCols = get(settings)!.overlay.columns; + expect(curCols).toHaveLength(2); + // Column 0 now has only 1 metric + expect(curCols[0]).toEqual(['cpu_pct']); + // Column 1 was NOT pulled up or altered + expect(curCols[1]).toEqual(['gpu_pct', 'gpu_temp']); + + // Empty bottom slot should show pair-select + const pairSelect = document.body.querySelector('select.pair-select') as HTMLSelectElement | null; + expect(pairSelect).not.toBeNull(); + + // Pair ram_pct into Column 0 + pairSelect!.value = 'ram_pct'; + pairSelect!.dispatchEvent(new Event('change', { bubbles: true })); + await tick(); + + const pairedCols = get(settings)!.overlay.columns; + expect(pairedCols[0]).toEqual(['cpu_pct', 'ram_pct']); + expect(pairedCols[1]).toEqual(['gpu_pct', 'gpu_temp']); + }); + + it('supports an overlay with only 1 single metric overall', async () => { + settings.set({ + monitoring: { trackCpu: true }, + overlay: { columns: [['cpu_pct']] }, + } as any); + + component = mount(LayoutPage, { target: document.body }); + await tick(); + + const curCols = get(settings)!.overlay.columns; + expect(curCols).toHaveLength(1); + expect(curCols[0]).toEqual(['cpu_pct']); + + const rows = document.body.querySelectorAll('.metric-name'); + expect(rows).toHaveLength(1); + expect(rows[0].textContent).toContain('CPU Usage'); + }); }); diff --git a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/OverlayPage.test.ts b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/OverlayPage.test.ts index b6ce0ec..f357e38 100644 --- a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/OverlayPage.test.ts +++ b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/OverlayPage.test.ts @@ -114,5 +114,157 @@ describe('OverlayPage.svelte', () => { expect(document.body.textContent).toContain('Taskbar space is constrained'); expect(document.body.textContent).toContain('Open Taskbar Settings'); + expect(document.body.textContent).toContain('Dismiss'); + + const openSettingsBtn = Array.from(document.querySelectorAll('.banner-btn')).find( + b => b.textContent?.includes('Open Taskbar Settings') + ); + expect(openSettingsBtn).toBeDefined(); + openSettingsBtn?.click(); + await tick(); + }); + + it('dismisses warning banner when dismiss button is clicked', async () => { + settings.set({ + showSystemTrayIcon: true, + overlay: { + visible: true, + position: 'left', + taskbarAlignment: 'center', + taskbarSpaceConstrained: true, + availableSlotWidth: 250, + doubleClickAction: 'none', + opacity: 100, + scale: 100, + fontSizePx: 18, + fontBold: false, + offsetX: 0, + }, + } as any); + + component = mount(OverlayPage, { target: document.body }); + await tick(); + + expect(document.body.textContent).toContain('Taskbar space is constrained'); + const dismissBtn = document.querySelector('.banner-btn-dismiss') as HTMLButtonElement; + expect(dismissBtn).not.toBeNull(); + dismissBtn.click(); + await tick(); + + expect(document.body.textContent).not.toContain('Taskbar space is constrained'); + }); + + it('resets dismissed state when space constraint clears and recurs', async () => { + settings.set({ + showSystemTrayIcon: true, + overlay: { + visible: true, + position: 'left', + taskbarAlignment: 'center', + taskbarSpaceConstrained: true, + availableSlotWidth: 250, + doubleClickAction: 'none', + opacity: 100, + scale: 100, + fontSizePx: 18, + fontBold: false, + offsetX: 0, + }, + } as any); + + component = mount(OverlayPage, { target: document.body }); + await tick(); + + const dismissBtn = document.querySelector('.banner-btn-dismiss') as HTMLButtonElement; + dismissBtn.click(); + await tick(); + expect(document.body.textContent).not.toContain('Taskbar space is constrained'); + + // Space clears + settings.update((s: any) => ({ + ...s, + overlay: { ...s.overlay, taskbarSpaceConstrained: false }, + })); + await tick(); + expect(document.body.textContent).not.toContain('Taskbar space is constrained'); + + // Space constrained again -> warning reappears + settings.update((s: any) => ({ + ...s, + overlay: { ...s.overlay, taskbarSpaceConstrained: true }, + })); + await tick(); + expect(document.body.textContent).toContain('Taskbar space is constrained'); + }); + + it('renders target displays section and handles display selection toggles', async () => { + settings.set({ + showSystemTrayIcon: true, + overlay: { + visible: true, + position: 'left', + displayMode: 'custom', + enabledDisplays: ['primary'], + detectedDisplays: [ + { id: 'primary', name: 'Display 1 (Primary - 2048 x 1280)', isPrimary: true, hasTaskbar: true }, + { id: 'display_2', name: 'Display 2 (1920 x 1080)', isPrimary: false, hasTaskbar: true }, + { id: 'display_3', name: 'Display 3 (2560 x 1440)', isPrimary: false, hasTaskbar: false }, + ], + doubleClickAction: 'none', + opacity: 100, + scale: 100, + fontSizePx: 18, + fontBold: false, + offsetX: 0, + }, + } as any); + + component = mount(OverlayPage, { target: document.body }); + await tick(); + + expect(document.body.textContent).toContain('Target Displays'); + expect(document.body.textContent).toContain('Display 1 (Primary - 2048 x 1280)'); + expect(document.body.textContent).toContain('Display 2 (1920 x 1080)'); + expect(document.body.textContent).toContain('(No taskbar detected)'); + + const checkboxes = document.querySelectorAll('.display-checkbox-item input[type="checkbox"]') as NodeListOf; + expect(checkboxes).toHaveLength(3); + expect(checkboxes[0].checked).toBe(true); + expect(checkboxes[1].checked).toBe(false); + + // Check Display 2 + checkboxes[1].click(); + await tick(); + + let currentSettings: any; + settings.subscribe(s => currentSettings = s)(); + expect(currentSettings.overlay.enabledDisplays).toContain('display_2'); + }); + + it('renders secondary option and shows warning note when only one display detected', async () => { + settings.set({ + showSystemTrayIcon: true, + overlay: { + visible: true, + position: 'left', + displayMode: 'secondary', + enabledDisplays: ['primary'], + detectedDisplays: [ + { id: 'primary', name: 'Display 1 (Primary - 2048 x 1280)', isPrimary: true, hasTaskbar: true }, + ], + doubleClickAction: 'none', + opacity: 100, + scale: 100, + fontSizePx: 18, + fontBold: false, + offsetX: 0, + }, + } as any); + + component = mount(OverlayPage, { target: document.body }); + await tick(); + + expect(document.body.textContent).toContain('Secondary Display Only'); + expect(document.body.textContent).toContain('No secondary display detected. The overlay will show on the primary display until another monitor is connected.'); }); }); diff --git a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/SystemPage.test.ts b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/SystemPage.test.ts index 0527728..d588b8f 100644 --- a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/SystemPage.test.ts +++ b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/SystemPage.test.ts @@ -51,16 +51,16 @@ describe('SystemPage.svelte', () => { deviceName: 'RIG-ALPHA', systemType: 'Desktop', systemModel: 'Custom Workstation', - motherboardMfr: 'ASUS', - motherboardModel: 'ROG MAXIMUS Z790', + motherboardMfr: 'TestBoardVendor', + motherboardModel: 'Test Board Model Pro', motherboardVersion: 'Rev 1.0', motherboardSerial: 'SN-12345678', bios: 'AMI 2101', biosUefi: true, - psu: 'Corsair AX1600i', - psuCapacity: '1600W Titanium', - cpu: 'Intel Core i9-14900KS', - cpuVendor: 'GenuineIntel', + psu: 'Test PSU Titanium 1000W', + psuCapacity: '1000W Titanium', + cpu: 'Test CPU 24-Core Model', + cpuVendor: 'TestCpuVendor', cpuCores: 24, cpuThreads: 32, cpuBaseSpeedMhz: 3200, @@ -69,7 +69,7 @@ describe('SystemPage.svelte', () => { cpuTdpWatts: 150, installedRamGb: 64, ramGb: 63.8, - ramMfr: 'G.Skill', + ramMfr: 'TestRamVendor', ramSpeed: '6000 MT/s', ramType: 'DDR5', ramSlots: 4, @@ -79,14 +79,14 @@ describe('SystemPage.svelte', () => { ], gpus: [ { - name: 'NVIDIA GeForce RTX 4090', + name: 'Test GPU Dedicated 24GB', dedicated: true, vramGb: 24, driver: '560.94', tdpW: 450 }, { - name: 'Intel UHD Graphics 770', + name: 'Test GPU Integrated', dedicated: false, vramGb: 0, driver: '31.0.101', @@ -95,14 +95,14 @@ describe('SystemPage.svelte', () => { ], disks: [ { - model: 'Samsung 990 PRO 2TB', + model: 'Test NVMe SSD 2TB', boot: true, formattedSize: '1.81 TB', displayType: 'NVMe SSD', busType: 'NVMe' }, { - model: 'Crucial MX500 4TB', + model: 'Test SATA SSD 4TB', boot: false, sizeGb: 4000, busType: 'SCSI' @@ -140,28 +140,28 @@ describe('SystemPage.svelte', () => { displayType: 'External SSD' } ], - nics: ['Intel I226-V 2.5GbE', 'Intel Wi-Fi 7 BE200'] + nics: ['Test Ethernet Adapter 2.5GbE', 'Test Wi-Fi Adapter'] } as any); component = mount(SystemPage, { target: document.body }); await tick(); - expect(document.body.textContent).toContain('ASUS ROG MAXIMUS Z790'); + expect(document.body.textContent).toContain('TestBoardVendor Test Board Model Pro'); expect(document.body.textContent).toContain('UEFI'); - expect(document.body.textContent).toContain('Corsair AX1600i'); + expect(document.body.textContent).toContain('Test PSU Titanium 1000W'); expect(document.body.textContent).toContain('3.2 GHz'); expect(document.body.textContent).toContain('6.2 GHz'); expect(document.body.textContent).toContain('64.0 GB'); expect(document.body.textContent).toContain('63.8 GB usable'); - expect(document.body.textContent).toContain('G.Skill'); + expect(document.body.textContent).toContain('TestRamVendor'); expect(document.body.textContent).toContain('Module 1'); - expect(document.body.textContent).toContain('NVIDIA GeForce RTX 4090'); + expect(document.body.textContent).toContain('Test GPU Dedicated 24GB'); expect(document.body.textContent).toContain('Dedicated'); expect(document.body.textContent).toContain('Integrated'); - expect(document.body.textContent).toContain('Samsung 990 PRO 2TB'); + expect(document.body.textContent).toContain('Test NVMe SSD 2TB'); expect(document.body.textContent).toContain('Boot'); expect(document.body.textContent).toContain('[NVMe SSD]'); - expect(document.body.textContent).toContain('Intel I226-V 2.5GbE'); + expect(document.body.textContent).toContain('Test Ethernet Adapter 2.5GbE'); }); it('renders laptop with battery specifications and legacy bios mode', async () => { @@ -169,12 +169,12 @@ describe('SystemPage.svelte', () => { os: 'Windows 11 Home', deviceName: 'LAPTOP-ZEN', systemType: 'Laptop', - motherboardModel: 'ZenBook UX8406', + motherboardModel: 'Test Laptop Board', biosUefi: false, - cpu: 'AMD Ryzen 9 8945HS', + cpu: 'Test Mobile CPU', ramGb: 32, - batteryManufacturer: 'SMP', - batteryDeviceName: 'UX8406-BAT', + batteryManufacturer: 'TestBatteryVendor', + batteryDeviceName: 'TEST-BATTERY-01', batteryDesignCapacity: '75000 mWh', batteryFullChargedCapacity: '73500 mWh', batteryHealthPct: 98, @@ -189,11 +189,11 @@ describe('SystemPage.svelte', () => { await tick(); expect(document.body.textContent).toContain('Laptop'); - expect(document.body.textContent).toContain('ZenBook UX8406'); + expect(document.body.textContent).toContain('Test Laptop Board'); expect(document.body.textContent).toContain('Legacy'); expect(document.body.textContent).toContain('Battery'); - expect(document.body.textContent).toContain('SMP'); - expect(document.body.textContent).toContain('UX8406-BAT'); + expect(document.body.textContent).toContain('TestBatteryVendor'); + expect(document.body.textContent).toContain('TEST-BATTERY-01'); expect(document.body.textContent).toContain('75000 mWh'); expect(document.body.textContent).toContain('98%'); expect(document.body.textContent).toContain('2%'); @@ -204,12 +204,12 @@ describe('SystemPage.svelte', () => { systemInfo.set({ os: 'Windows 11 Home', deviceName: 'MIN-PC', - cpu: 'Intel Processor N100', + cpu: 'Test Entry CPU', installedRamGb: 16, ramGb: 0, gpus: [ { - name: 'Intel UHD Graphics', + name: 'Test Basic GPU', dedicated: false, } ], @@ -246,7 +246,7 @@ describe('SystemPage.svelte', () => { systemInfo.set({ os: 'Windows 11 Pro', systemType: 'Laptop', - cpu: 'Core Ultra 7', + cpu: 'Test CPU Mobile Pro', installedRamGb: 0, ramGb: 16, ramModules: [{ sizeGb: 16, speed: '' }], @@ -297,9 +297,9 @@ describe('SystemPage.svelte', () => { systemInfo.set({ os: 'Windows 11', systemType: '', - motherboardMfr: 'MSI', + motherboardMfr: 'TestBoardMfr', motherboardModel: '', - cpu: 'AMD Ryzen 5', + cpu: 'Test CPU Model A', disks: [], gpus: [], nics: [] @@ -309,15 +309,15 @@ describe('SystemPage.svelte', () => { await tick(); expect(document.body.textContent).toContain('Desktop'); - expect(document.body.textContent).toContain('MSI'); + expect(document.body.textContent).toContain('TestBoardMfr'); // Case 2: motherboardModel only (no mfr) systemInfo.set({ os: 'Windows 11', systemType: 'Workstation', motherboardMfr: '', - motherboardModel: 'B650M-PLUS', - cpu: 'AMD Ryzen 7', + motherboardModel: 'TestModel-Plus', + cpu: 'Test CPU Model B', disks: [], gpus: [], nics: [] @@ -325,6 +325,54 @@ describe('SystemPage.svelte', () => { await tick(); expect(document.body.textContent).toContain('Workstation'); - expect(document.body.textContent).toContain('B650M-PLUS'); + expect(document.body.textContent).toContain('TestModel-Plus'); + }); + + it('renders storage health, temperature, remaining life, and reads/writes', async () => { + systemInfo.set({ + os: 'Test OS 11', + cpu: 'Generic Test CPU @ 3.00GHz', + deviceName: 'TEST-DEVICE', + disks: [ + { + model: 'NVMe Test Drive Alpha 1TB', + boot: true, + formattedSize: '1 TB', + displayType: 'NVMe SSD', + health: 'Healthy', + remainingLifePercent: 99, + temperatureC: 48, + totalWrittenTb: '16.5', + totalReadTb: '14.6', + }, + { + model: 'SATA Test Drive Beta 2TB', + boot: false, + formattedSize: '2 TB', + displayType: 'SATA SSD', + health: 'Warning', + remainingLifePercent: 91, + temperatureC: 40, + totalWrittenTb: '60.1', + totalReadTb: '71.6', + } + ], + gpus: [], + nics: [], + } as any); + + component = mount(SystemPage, { target: document.body }); + await tick(); + + expect(document.body.textContent).toContain('NVMe Test Drive Alpha 1TB'); + expect(document.body.textContent).toContain('Healthy'); + expect(document.body.textContent).toContain('99% life'); + expect(document.body.textContent).toContain('Total Writes: 16.5 TBW'); + expect(document.body.textContent).toContain('Total Reads: 14.6 TBR'); + + expect(document.body.textContent).toContain('Warning'); + expect(document.body.textContent).toContain('91% life'); + expect(document.body.textContent).toContain('Total Writes: 60.1 TBW'); + expect(document.body.textContent).toContain('Total Reads: 71.6 TBR'); }); }); diff --git a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/TrafficHistoryPage.test.ts b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/TrafficHistoryPage.test.ts index 4b35849..3f58464 100644 --- a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/TrafficHistoryPage.test.ts +++ b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/components/pages/TrafficHistoryPage.test.ts @@ -143,9 +143,17 @@ describe('TrafficHistoryPage.svelte', () => { await tick(); const presetBtns = Array.from(document.body.querySelectorAll('.preset-btn')) as HTMLButtonElement[]; + const preset7 = presetBtns.find(b => b.textContent?.includes('Last 7 Days')); + const preset14 = presetBtns.find(b => b.textContent?.includes('Last 14 Days')); const preset30 = presetBtns.find(b => b.textContent?.includes('Last 30 Days')); + expect(preset7).toBeDefined(); + expect(preset14).toBeDefined(); expect(preset30).toBeDefined(); + preset7!.click(); + await tick(); + preset14!.click(); + await tick(); preset30!.click(); await tick(); @@ -155,6 +163,18 @@ describe('TrafficHistoryPage.svelte', () => { importBtn.click(); await tick(); expect(importUsageSpy).toHaveBeenCalled(); + + // Also test import with already-formatted DD-MM-YYYY date strings (triggers toDmy non-ISO fallback) + const dateInputs = document.body.querySelectorAll('.date-picker-row input'); + if (dateInputs.length >= 2) { + dateInputs[0].value = '01-10-2026'; + dateInputs[0].dispatchEvent(new Event('input', { bubbles: true })); + dateInputs[1].value = '10-10-2026'; + dateInputs[1].dispatchEvent(new Event('input', { bubbles: true })); + await tick(); + importBtn.click(); + await tick(); + } }); it('displays windows import result status when set in store', async () => { @@ -391,6 +411,13 @@ describe('TrafficHistoryPage.svelte', () => { startDateInput.dispatchEvent(new Event('input', { bubbles: true })); await tick(); expect(document.body.textContent).toContain('Invalid date (use DD-MM-YYYY)'); + + // Valid DD-MM-YYYY date format + startDateInput.value = '15-08-2026'; + startDateInput.dispatchEvent(new Event('input', { bubbles: true })); + await tick(); + expect(document.body.textContent).not.toContain('Invalid date'); + startDateInput.type = 'date'; }); @@ -468,4 +495,52 @@ describe('TrafficHistoryPage.svelte', () => { expect(get(windowsImportResult)).toBeNull(); vi.useRealTimers(); }); + + it('handles database export to jsonl file and displays modal', async () => { + const wv = new EventTarget() as any; + wv.postMessage = vi.fn(); + (globalThis as any).window.chrome = { webview: wv }; + + const exportSpy = vi.spyOn(bridge, 'exportDatabase'); + const openFolderSpy = vi.spyOn(bridge, 'openFolder'); + + component = mount(TrafficHistoryPage, { target: document.body }); + await tick(); + + const exportBtn = Array.from(document.body.querySelectorAll('.action-btn')) + .find((b) => b.textContent?.includes('Export Database')); + expect(exportBtn).toBeDefined(); + + exportBtn?.click(); + await tick(); + + expect(exportSpy).toHaveBeenCalled(); + expect(exportSpy.mock.calls[0][1]).toContain('.jsonl'); + + wv.dispatchEvent(new MessageEvent('message', { + data: { + type: 'exportDatabaseResult', + payload: { + success: true, + filePath: 'C:\\Users\\test\\internet_usage_01-01-2026.jsonl', + fileName: 'internet_usage_01-01-2026.jsonl' + } + } + })); + await tick(); + + expect(document.body.textContent).toContain('Database Exported'); + expect(document.body.textContent).toContain('internet_usage_01-01-2026.jsonl'); + + const openFolderBtn = document.body.querySelector('.btn-open-folder'); + openFolderBtn?.click(); + expect(openFolderSpy).toHaveBeenCalledWith({ path: 'C:\\Users\\test\\internet_usage_01-01-2026.jsonl' }); + + const closeBtn = document.body.querySelector('.btn-close'); + closeBtn?.click(); + await tick(); + expect(document.body.textContent).not.toContain('Database Exported'); + + delete (globalThis as any).window.chrome; + }); }); diff --git a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/lib/themes.test.ts b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/lib/themes.test.ts index 6035fe0..7edb7de 100644 --- a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/lib/themes.test.ts +++ b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/lib/themes.test.ts @@ -27,6 +27,38 @@ describe('themes.ts', () => { expect(defaultLight?.label).toBe('Default Light'); }); + it('should include new OLED, Nord, and Cyberpunk themes', () => { + const expectedThemes = [ + { value: 'oled', label: 'OLED Black' }, + { value: 'oled-light', label: 'OLED Light' }, + { value: 'nord', label: 'Nord' }, + { value: 'nord-light', label: 'Nord Light' }, + { value: 'cyberpunk', label: 'Cyberpunk' }, + { value: 'cyberpunk-light', label: 'Cyberpunk Light' } + ]; + + for (const exp of expectedThemes) { + const found = themes.find((t) => t.value === exp.value); + expect(found).toBeDefined(); + expect(found?.label).toBe(exp.label); + expect(found?.vars['--color-bg']).toBeTruthy(); + expect(found?.vars['--color-surface']).toBeTruthy(); + expect(found?.vars['--color-primary']).toBeTruthy(); + } + + applyThemeVars('oled'); + expect(document.documentElement.style.getPropertyValue('--color-bg')).toBe('#000000'); + expect(document.documentElement.dataset.theme).toBe('dark'); + + applyThemeVars('nord'); + expect(document.documentElement.style.getPropertyValue('--color-bg')).toBe('#242933'); + expect(document.documentElement.dataset.theme).toBe('dark'); + + applyThemeVars('cyberpunk'); + expect(document.documentElement.style.getPropertyValue('--color-bg')).toBe('#09090b'); + expect(document.documentElement.dataset.theme).toBe('dark'); + }); + it('applyThemeVars should apply CSS variables to document.documentElement', () => { applyThemeVars('midnight'); const bg = document.documentElement.style.getPropertyValue('--color-bg'); @@ -63,4 +95,16 @@ describe('themes.ts', () => { expect(defaultDark?.vars['--color-primary']).toBe('#0099b8'); expect(defaultDark?.vars['--color-brand']).toBe('#0099b8'); }); + + it('every theme should have unique primary and secondary accent colors without duplicates', () => { + const primaries = themes.map((t) => t.vars['--color-primary']); + const secondaries = themes.map((t) => t.vars['--color-secondary']); + + expect(new Set(primaries).size).toBe(themes.length); + expect(new Set(secondaries).size).toBe(themes.length); + + const oled = themes.find((t) => t.value === 'oled'); + expect(oled?.vars['--color-primary']).toBe('#e11d48'); + expect(oled?.vars['--color-secondary']).toBe('#fb7185'); + }); }); diff --git a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/lib/types.test.ts b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/lib/types.test.ts index d343430..ca82ae9 100644 --- a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/lib/types.test.ts +++ b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/lib/types.test.ts @@ -45,6 +45,7 @@ describe('types.ts structure & compatibility', () => { groupColors: {}, defaultMetricColors: {}, followWindowsTheme: true, + columns: [['cpu_pct']], row1: ['cpu_pct'], userCustomizedMetricColors: [], userCustomizedGroupColors: [], @@ -79,6 +80,7 @@ describe('types.ts structure & compatibility', () => { netMonthlyMaxGb: 1000, showToastNotif: true, flashOverlay: true, + sustainedSecs: 3, cooldownSecs: 30, fireOncePerSession: false, }, diff --git a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/lib/utils.test.ts b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/lib/utils.test.ts index 5674a16..92bca8f 100644 --- a/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/lib/utils.test.ts +++ b/tests/LocalTelemetry.App.Tests/Settings/wwwroot/src/lib/utils.test.ts @@ -1,4 +1,4 @@ -import { clamp, formatBytes, formatTrafficBytes, deepClone, debounce, formatDate } from '../../../../../../src/LocalTelemetry.App/Settings/wwwroot/src/lib/utils'; +import { clamp, formatBytes, formatTrafficBytes, deepClone, debounce, formatDate, sanitizeSettingsForDirtyCheck } from '../../../../../../src/LocalTelemetry.App/Settings/wwwroot/src/lib/utils'; describe('utils.ts', () => { it('clamp should constrain numbers within range', () => { @@ -57,4 +57,24 @@ describe('utils.ts', () => { expect(formatDate('October 21, 2026')).toBe('21-10-2026'); expect(formatDate('not-a-date-value')).toBe('not-a-date-value'); }); + + it('sanitizeSettingsForDirtyCheck should strip runtime overlay properties', () => { + expect(sanitizeSettingsForDirtyCheck(null)).toBeNull(); + expect(sanitizeSettingsForDirtyCheck(undefined)).toBeUndefined(); + + const input = { + monitoring: { intervalMs: 1000 }, + overlay: { + scale: 100, + taskbarSpaceConstrained: true, + availableSlotWidth: 240, + taskbarAlignment: 'center', + }, + }; + const cleaned = sanitizeSettingsForDirtyCheck(input as any); + expect(cleaned.overlay.scale).toBe(100); + expect('taskbarSpaceConstrained' in cleaned.overlay).toBe(false); + expect('availableSlotWidth' in cleaned.overlay).toBe(false); + expect('taskbarAlignment' in cleaned.overlay).toBe(false); + }); }); diff --git a/tests/LocalTelemetry.App.Tests/Tray/TrayIconManagerTests.cs b/tests/LocalTelemetry.App.Tests/Tray/TrayIconManagerTests.cs index 159de31..2594d52 100644 --- a/tests/LocalTelemetry.App.Tests/Tray/TrayIconManagerTests.cs +++ b/tests/LocalTelemetry.App.Tests/Tray/TrayIconManagerTests.cs @@ -205,6 +205,38 @@ public void DarkTrayRenderer_And_Theme_RendersWithoutErrors() renderBgMethod.Invoke(renderer, [bgArgsDisabled]); } + [WpfFact] + public void OverlayContextMenu_RendersItemsToBitmap() + { + using var tray = new TrayIconManager(); + var field = typeof(TrayIconManager).GetField("_overlayContextMenu", BindingFlags.Instance | BindingFlags.NonPublic); + var cms = (ContextMenuStrip)field!.GetValue(tray)!; + + // Force handle creation and layout + var handle = cms.Handle; + handle.Should().NotBe(IntPtr.Zero); + + using var bmp = new Bitmap(cms.Width > 0 ? cms.Width : 200, cms.Height > 0 ? cms.Height : 200); + cms.DrawToBitmap(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height)); + + int nonBlackOrBg = 0; + for (int y = 0; y < bmp.Height; y++) + { + for (int x = 0; x < bmp.Width; x++) + { + var c = bmp.GetPixel(x, y); + // Check if text (white or light gray) is present + if (c.R > 100 && c.G > 100 && c.B > 100) + { + nonBlackOrBg++; + } + } + } + + // Output info via assertion or check + nonBlackOrBg.Should().BeGreaterThan(0, $"Expected rendered text pixels but found {nonBlackOrBg}. Size={cms.Width}x{cms.Height}"); + } + [WpfFact] public void TrayIconManager_OverlayContextMenu_StateAndVisibilityLifecycle() { @@ -444,4 +476,252 @@ public void TrayIconManager_ShowOverlayContextMenu_And_UpdateError_Coverage() TrayIconManager.SkipUiForTesting = priorSkipUi; } } + + [WpfFact] + public void MouseHookCallback_DismissesContextMenuWhenClickOutside() + { + using var tray = new TrayIconManager(); + var createMenu = typeof(TrayIconManager).GetMethod("CreateBaseContextMenu", BindingFlags.Instance | BindingFlags.NonPublic)!; + using var ctx = (ContextMenuStrip)createMenu.Invoke(tray, null)!; + + // Set active context menu + var activeMenuField = typeof(TrayIconManager).GetField("_activeContextMenu", BindingFlags.Instance | BindingFlags.NonPublic)!; + activeMenuField.SetValue(tray, ctx); + + var hookCallback = typeof(TrayIconManager).GetMethod("MouseHookCallback", BindingFlags.Instance | BindingFlags.NonPublic)!; + + // Simulate hook struct at (500, 500) + var hookStruct = new LocalTelemetry.App.Win32.NativeMethods.MsllHookStruct + { + pt = new LocalTelemetry.App.Win32.NativeMethods.Point { X = 500, Y = 500 } + }; + IntPtr ptr = System.Runtime.InteropServices.Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf(hookStruct)); + try + { + System.Runtime.InteropServices.Marshal.StructureToPtr(hookStruct, ptr, false); + + // Test non-button down msg (WM_MOUSEMOVE = 0x200) + var resMove = hookCallback.Invoke(tray, [0, (IntPtr)0x0200, ptr]); + resMove.Should().NotBeNull(); + + // Test outside click (WM_LBUTTONDOWN = 0x201) + var resClick = hookCallback.Invoke(tray, [0, (IntPtr)0x0201, ptr]); + resClick.Should().NotBeNull(); + + // Test with negative nCode + var resNegative = hookCallback.Invoke(tray, [-1, (IntPtr)0x0201, ptr]); + resNegative.Should().NotBeNull(); + } + finally + { + System.Runtime.InteropServices.Marshal.FreeHGlobal(ptr); + } + } + + [WpfFact] + public void TrayIconManager_ShowBalloonTip_ExercisesBranch() + { + using var tray = new TrayIconManager(); + // SkipUiForTesting true branch + var actSkip = () => tray.ShowBalloonTip("Title", "Message"); + actSkip.Should().NotThrow(); + + // SkipUiForTesting false branch + var priorSkip = TrayIconManager.SkipUiForTesting; + try + { + TrayIconManager.SkipUiForTesting = false; + var actShow = () => tray.ShowBalloonTip("Title", "Message"); + actShow.Should().NotThrow(); + } + finally + { + TrayIconManager.SkipUiForTesting = priorSkip; + } + } + + [WpfFact] + public void TrayIconManager_DismissHelpers_And_FormatTooltip_Coverage() + { + var isDismiss = typeof(TrayIconManager).GetMethod("IsDismissMouseButtonMessage", BindingFlags.NonPublic | BindingFlags.Static)!; + ((bool)isDismiss.Invoke(null, [0x0201])!).Should().BeTrue(); // WM_LBUTTONDOWN + ((bool)isDismiss.Invoke(null, [0x0204])!).Should().BeTrue(); // WM_RBUTTONDOWN + ((bool)isDismiss.Invoke(null, [0x0207])!).Should().BeTrue(); // WM_MBUTTONDOWN + ((bool)isDismiss.Invoke(null, [0x00A1])!).Should().BeTrue(); // WM_NCLBUTTONDOWN + ((bool)isDismiss.Invoke(null, [0x0200])!).Should().BeFalse(); // WM_MOUSEMOVE + + var formatTip = typeof(TrayIconManager).GetMethod("FormatTooltip", BindingFlags.NonPublic | BindingFlags.Static)!; + var longSnap = new LocalTelemetry.Core.Models.TelemetrySnapshot + { + CpuUsagePct = 99.9f, + RamUsagePct = 88.8f, + GpuUsagePct = 77.7f + }; + var tip = (string)formatTip.Invoke(null, [longSnap])!; + tip.Length.Should().BeLessThanOrEqualTo(63); + + using var menu = new System.Windows.Forms.ContextMenuStrip(); + menu.Items.Add("Test"); + menu.Show(new System.Drawing.Point(100, 100)); + var dismissMethod = typeof(TrayIconManager).GetMethod("DismissIfClickedOutside", BindingFlags.NonPublic | BindingFlags.Static)!; + var ptr = System.Runtime.InteropServices.Marshal.AllocHGlobal(64); + try + { + // Click far outside menu bounds + System.Runtime.InteropServices.Marshal.WriteInt32(ptr, 0, 5000); + System.Runtime.InteropServices.Marshal.WriteInt32(ptr, 4, 5000); + dismissMethod.Invoke(null, [menu, ptr]); + dismissMethod.Invoke(null, [menu, IntPtr.Zero]); // catch path + } + finally + { + System.Runtime.InteropServices.Marshal.FreeHGlobal(ptr); + menu.Close(); + } + } + + [WpfFact] + public void TrayIconManager_OverlayContextMenuBounds_And_IsPointInside_Coverage() + { + using var tray = new TrayIconManager(); + // 1. When _overlayContextMenu is null + tray.OverlayContextMenuBounds.Should().Be(Rectangle.Empty); + tray.IsPointInsideOverlayContextMenu(new LocalTelemetry.App.Win32.NativeMethods.Point { X = 10, Y = 10 }).Should().BeFalse(); + + // 2. When _overlayContextMenu is set but not visible + using var menu = new ContextMenuStrip(); + menu.Items.Add("Item"); + typeof(TrayIconManager).GetField("_overlayContextMenu", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(tray, menu); + + tray.OverlayContextMenuBounds.Should().Be(Rectangle.Empty); + tray.IsPointInsideOverlayContextMenu(new LocalTelemetry.App.Win32.NativeMethods.Point { X = 10, Y = 10 }).Should().BeFalse(); + + // 3. When visible + menu.Show(new Point(100, 100)); + tray.OverlayContextMenuBounds.Should().NotBe(Rectangle.Empty); + var bounds = tray.OverlayContextMenuBounds; + tray.IsPointInsideOverlayContextMenu(new LocalTelemetry.App.Win32.NativeMethods.Point { X = bounds.X + 2, Y = bounds.Y + 2 }).Should().BeTrue(); + tray.IsPointInsideOverlayContextMenu(new LocalTelemetry.App.Win32.NativeMethods.Point { X = bounds.X - 50, Y = bounds.Y - 50 }).Should().BeFalse(); + + menu.Close(); + } + + [WpfFact] + public void TrayIconManager_MouseHook_Tooltips_And_BalloonTip_Coverage() + { + var origSkipUi = TrayIconManager.SkipUiForTesting; + try + { + TrayIconManager.SkipUiForTesting = false; + using var tray = new TrayIconManager(); + tray.SetTrayVisible(true); + + // 1. ShowBalloonTip coverage + var actBalloon = () => tray.ShowBalloonTip("Title", "Message", ToolTipIcon.Info); + actBalloon.Should().NotThrow(); + + // 2. Update with null snapshot vs valid snapshot + tray.Update(null); + var snap = new TelemetrySnapshot { CpuUsagePct = 25.4f, RamUsagePct = 60.1f, GpuUsagePct = 80.5f }; + tray.Update(snap); + + // Test FormatTooltip private static method + var formatMethod = typeof(TrayIconManager).GetMethod("FormatTooltip", BindingFlags.Static | BindingFlags.NonPublic)!; + var tooltipText = (string)formatMethod.Invoke(null, [snap])!; + tooltipText.Should().Contain("CPU 25%"); + tooltipText.Length.Should().BeLessThanOrEqualTo(63); + + // 3. ShowOverlayContextMenu when SkipUiForTesting is false + var actShowMenu = () => + { + tray.ShowOverlayContextMenu(new Point(50, 50)); + tray.ShowOverlayContextMenu(new Point(60, 60)); // Second call to hit visible branch + tray.CloseOverlayContextMenu(); + }; + actShowMenu.Should().NotThrow(); + + // 4. MouseHookCallback + var callback = typeof(TrayIconManager).GetMethod("MouseHookCallback", BindingFlags.Instance | BindingFlags.NonPublic)!; + using var menu = new ContextMenuStrip(); + menu.Items.Add("Test"); + typeof(TrayIconManager).GetField("_activeContextMenu", BindingFlags.Instance | BindingFlags.NonPublic)!.SetValue(tray, menu); + menu.Show(new Point(100, 100)); + + var ptr = System.Runtime.InteropServices.Marshal.AllocHGlobal(16); + try + { + System.Runtime.InteropServices.Marshal.WriteInt32(ptr, 0, 500); + System.Runtime.InteropServices.Marshal.WriteInt32(ptr, 4, 500); + + // When code >= 0 and WM_LBUTTONDOWN + callback.Invoke(tray, [0, (IntPtr)0x0201 /* WM_LBUTTONDOWN */, ptr]); + + // When code < 0 + callback.Invoke(tray, [-1, (IntPtr)0x0201, ptr]); + } + finally + { + System.Runtime.InteropServices.Marshal.FreeHGlobal(ptr); + menu.Close(); + } + + // 5. CloseMenu static method + var closeMenuMethod = typeof(TrayIconManager).GetMethod("CloseMenu", BindingFlags.Static | BindingFlags.NonPublic)!; + using var dummyMenu = new ContextMenuStrip(); + dummyMenu.Show(new Point(20, 20)); + closeMenuMethod.Invoke(null, [dummyMenu]); + } + finally + { + TrayIconManager.SkipUiForTesting = origSkipUi; + } + } + + [WpfFact] + public void HiddenMenuOwnerForm_MethodsAndWndProc_Coverage() + { + using var form = new HiddenMenuOwnerForm(); + bool taskbarFired = false; + bool settingsFired = false; + form.TaskbarCreated += () => taskbarFired = true; + form.ShowSettingsRequested += () => settingsFired = true; + + form.RaiseTaskbarCreated(); + taskbarFired.Should().BeTrue(); + + form.RaiseShowSettingsRequested(); + settingsFired.Should().BeTrue(); + + var wmShowSettingsField = typeof(HiddenMenuOwnerForm).GetField("WmShowSettings", BindingFlags.Static | BindingFlags.NonPublic)!; + uint wmShowSettings = (uint)wmShowSettingsField.GetValue(null)!; + if (wmShowSettings != 0) + { + settingsFired = false; + var wndProc = typeof(HiddenMenuOwnerForm).GetMethod("WndProc", BindingFlags.Instance | BindingFlags.NonPublic)!; + var msg = Message.Create(form.Handle, (int)wmShowSettings, IntPtr.Zero, IntPtr.Zero); + object[] args = [msg]; + wndProc.Invoke(form, args); + settingsFired.Should().BeTrue(); + } + } + + [Theory] + [InlineData(0x0201, true)] // WM_LBUTTONDOWN + [InlineData(0x0204, true)] // WM_RBUTTONDOWN + [InlineData(0x0207, true)] // WM_MBUTTONDOWN + [InlineData(0x00A1, true)] // WM_NCLBUTTONDOWN + [InlineData(0x00A4, true)] // WM_NCRBUTTONDOWN + [InlineData(0x00A7, true)] // WM_NCMBUTTONDOWN + [InlineData(0x0200, false)] // WM_MOUSEMOVE + [InlineData(0x0000, false)] + public void TrayIconManager_IsDismissMouseButtonMessage_DetectsDismissButtons(int msg, bool expected) + { + var method = typeof(TrayIconManager).GetMethod( + "IsDismissMouseButtonMessage", + BindingFlags.Static | BindingFlags.NonPublic); + method.Should().NotBeNull(); + + bool result = (bool)method.Invoke(null, [msg])!; + result.Should().Be(expected); + } } diff --git a/tests/LocalTelemetry.App.Tests/Win32/DisplayInfoTests.cs b/tests/LocalTelemetry.App.Tests/Win32/DisplayInfoTests.cs new file mode 100644 index 0000000..17402cf --- /dev/null +++ b/tests/LocalTelemetry.App.Tests/Win32/DisplayInfoTests.cs @@ -0,0 +1,124 @@ +using FluentAssertions; +using LocalTelemetry.App.Win32; +using LocalTelemetry.Core.Config; +using Xunit; + +namespace LocalTelemetry.App.Tests.Win32; + +public sealed class DisplayInfoTests : IDisposable +{ + public DisplayInfoTests() + { + DisplayInfo.SkipIsWindowCheckForTesting = true; + } + + public void Dispose() + { + DisplayInfo.EnumerateDisplaysOverride = null; + DisplayInfo.SkipIsWindowCheckForTesting = false; + TaskbarEmbedder.ExplorerSecondaryTrayWndsOverride = null; + TaskbarEmbedder.ExplorerTrayWndOverride = null; + } + + [Fact] + public void DisplayInfo_EnumerateDisplays_WithMockDisplays_MapsPrimaryAndSecondary() + { + var mockDisplays = new List + { + new DisplayInfo + { + Id = "primary", + Index = 0, + DeviceName = @"\\.\DISPLAY1", + FriendlyName = "Display 1 (Primary - 2048 x 1280)", + IsPrimary = true, + Bounds = new Rectangle(0, 0, 2048, 1280), + WorkingArea = new Rectangle(0, 0, 2048, 1232), + TaskbarHwnd = new IntPtr(0x1001) + }, + new DisplayInfo + { + Id = "display_2", + Index = 1, + DeviceName = @"\\.\DISPLAY2", + FriendlyName = "Display 2 (1920 x 1080)", + IsPrimary = false, + Bounds = new Rectangle(2048, 0, 1920, 1080), + WorkingArea = new Rectangle(2048, 0, 1920, 1032), + TaskbarHwnd = new IntPtr(0x2002) + }, + new DisplayInfo + { + Id = "display_3", + Index = 2, + DeviceName = @"\\.\DISPLAY3", + FriendlyName = "Display 3 (2560 x 1440)", + IsPrimary = false, + Bounds = new Rectangle(-2560, 0, 2560, 1440), + WorkingArea = new Rectangle(-2560, 0, 2560, 1440), + TaskbarHwnd = IntPtr.Zero + } + }; + + DisplayInfo.EnumerateDisplaysOverride = () => mockDisplays; + + var result = DisplayInfo.EnumerateDisplays(); + result.Should().HaveCount(3); + result[0].IsPrimary.Should().BeTrue(); + result[0].Id.Should().Be("primary"); + result[0].TaskbarHwnd.Should().Be(new IntPtr(0x1001)); + + result[1].IsPrimary.Should().BeFalse(); + result[1].Id.Should().Be("display_2"); + result[1].TaskbarHwnd.Should().Be(new IntPtr(0x2002)); + + result[2].IsPrimary.Should().BeFalse(); + result[2].Id.Should().Be("display_3"); + result[2].HasTaskbar.Should().BeFalse(); + } + + [Fact] + public void TaskbarEmbedder_WithSecondaryDisplay_ReturnsTargetTrayWnd() + { + var cfg = new AppSettings(); + var secDisplay = new DisplayInfo + { + Id = "display_2", + Index = 1, + IsPrimary = false, + TaskbarHwnd = new IntPtr(0x5555) + }; + + var embedder = new TaskbarEmbedder(cfg, secDisplay); + embedder.TargetDisplay.Should().Be(secDisplay); + embedder.GetTargetTrayWnd().Should().Be(new IntPtr(0x5555)); + } + + [Fact] + public void DisplayInfo_HasTaskbar_WithRealIsWindowCheck_ReturnsFalseForInvalidHwnd() + { + DisplayInfo.SkipIsWindowCheckForTesting = false; + var d = new DisplayInfo { TaskbarHwnd = new IntPtr(0x123456) }; + d.HasTaskbar.Should().BeFalse(); + } + + [Fact] + public void DisplayInfo_EnumerateDisplays_LiveScreens_And_ErrorHandling() + { + DisplayInfo.EnumerateDisplaysOverride = null; + using var dummyTray = new System.Windows.Forms.Form { Bounds = new Rectangle(0, 0, 100, 40) }; + _ = dummyTray.Handle; + + TaskbarEmbedder.ExplorerTrayWndOverride = () => dummyTray.Handle; + TaskbarEmbedder.ExplorerSecondaryTrayWndsOverride = () => [dummyTray.Handle]; + + var list = DisplayInfo.EnumerateDisplays(); + list.Should().NotBeEmpty(); + list[0].IsPrimary.Should().BeTrue(); + + // Catch path when ExplorerTrayWndOverride throws + TaskbarEmbedder.ExplorerTrayWndOverride = () => throw new InvalidOperationException("Simulated display error"); + var emptyOnError = DisplayInfo.EnumerateDisplays(); + emptyOnError.Should().BeEmpty(); + } +} diff --git a/tests/LocalTelemetry.App.Tests/Win32/TaskbarEmbedderTests.cs b/tests/LocalTelemetry.App.Tests/Win32/TaskbarEmbedderTests.cs index e71e6fe..ec6d5cb 100644 --- a/tests/LocalTelemetry.App.Tests/Win32/TaskbarEmbedderTests.cs +++ b/tests/LocalTelemetry.App.Tests/Win32/TaskbarEmbedderTests.cs @@ -13,27 +13,37 @@ public class TaskbarEmbedderTests [WpfFact] public void TaskbarEmbedder_FullWin32EmbeddingLifecycle() { - var cfg = new AppSettings(); - var embedder = new TaskbarEmbedder(cfg) + using var fakeTray = new Form { Bounds = new Rectangle(0, 1000, 1920, 48) }; + TaskbarEmbedder.ExplorerTrayWndOverride = () => fakeTray.Handle; + + try { - KeyColor = Color.Magenta - }; + var cfg = new AppSettings(); + var embedder = new TaskbarEmbedder(cfg) + { + KeyColor = Color.Magenta + }; - using var form = new Form(); + using var form = new Form(); - embedder.KeyColor.Should().Be(Color.Magenta); - embedder.Embed(form.Handle, new Size(200, 30)); + embedder.KeyColor.Should().Be(Color.Magenta); + embedder.Embed(form.Handle, new Size(200, 30)); - embedder.IsEmbedded.Should().BeTrue(); - bool isChild = embedder.IsChildMode; - isChild.Should().Be(isChild); + embedder.IsEmbedded.Should().BeTrue(); + bool isChild = embedder.IsChildMode; + isChild.Should().Be(isChild); - embedder.UpdateLayeredSettings(form.Handle); - embedder.Reposition(form.Handle, new Size(220, 30)); - embedder.OnTaskbarRecreated(form.Handle, new Size(200, 30)); - embedder.Detach(form.Handle); + embedder.UpdateLayeredSettings(form.Handle); + embedder.Reposition(form.Handle, new Size(220, 30)); + embedder.OnTaskbarRecreated(form.Handle, new Size(200, 30)); + embedder.Detach(form.Handle); - form.Close(); + form.Close(); + } + finally + { + TaskbarEmbedder.ExplorerTrayWndOverride = null; + } } [Fact] @@ -49,7 +59,7 @@ public void TaskbarEmbedder_PositioningAndTaskBandReflectionCoverage() typeof(TaskbarEmbedder).GetField("_parentHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, tray); typeof(TaskbarEmbedder).GetField("_taskBandHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, tray); typeof(TaskbarEmbedder).GetField("_taskBandSaved", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, true); - typeof(TaskbarEmbedder).GetField("_taskBandOri", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, new NativeMethods.RECT { Left = 10, Top = 0, Right = 500, Bottom = 40 }); + typeof(TaskbarEmbedder).GetField("_taskBandOri", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, new NativeMethods.Rect { Left = 10, Top = 0, Right = 500, Bottom = 40 }); typeof(TaskbarEmbedder).GetField("_taskbarEdge", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, NativeMethods.ABE_BOTTOM); typeof(TaskbarEmbedder).GetField("_trayLeftEdge", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, 800); @@ -88,18 +98,8 @@ public void TaskbarEmbedder_PositioningAndTaskBandReflectionCoverage() } var restore = typeof(TaskbarEmbedder).GetMethod("RestoreTaskBand", BindingFlags.NonPublic | BindingFlags.Instance); - restore!.Invoke(embedder, null); - - var compRight = typeof(TaskbarEmbedder).GetMethod("ComputeRightFloatX", BindingFlags.NonPublic | BindingFlags.Instance); - var x = (int)compRight!.Invoke(embedder, [150])!; - x.Should().BeGreaterThan(0); - - typeof(TaskbarEmbedder).GetField("_trayLeftEdge", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, -1); - typeof(TaskbarEmbedder).GetField("_isWin11", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, true); - _ = (int)compRight.Invoke(embedder, [150])!; - - typeof(TaskbarEmbedder).GetField("_isWin11", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, false); - _ = (int)compRight.Invoke(embedder, [150])!; + var actRestore = () => restore!.Invoke(embedder, null); + actRestore.Should().NotThrow(); } [Fact] @@ -145,31 +145,9 @@ public void TaskbarEmbedder_ReflectionPrivateMethodsCoverage() typeof(TaskbarEmbedder).GetField("_isWin11", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, false); trySetParent.Invoke(embedder, [IntPtr.Zero, new Size(200, 30)]); - typeof(TaskbarEmbedder).GetProperty("IsFallback", BindingFlags.Public | BindingFlags.Instance)!.GetSetMethod(true)!.Invoke(embedder, [true]); - embedder.Reposition(IntPtr.Zero, new Size(200, 30)); - - typeof(TaskbarEmbedder).GetProperty("IsFallback", BindingFlags.Public | BindingFlags.Instance)!.GetSetMethod(true)!.Invoke(embedder, [false]); typeof(TaskbarEmbedder).GetProperty("IsEmbedded", BindingFlags.Public | BindingFlags.Instance)!.GetSetMethod(true)!.Invoke(embedder, [true]); embedder.UpdateLayeredSettings(IntPtr.Zero); embedder.Reposition(IntPtr.Zero, new Size(250, 30)); - - cfg.Overlay.FloatX = -1; - cfg.Overlay.FloatY = -1; - cfg.Overlay.Placement = "left"; - - var posFloat = typeof(TaskbarEmbedder).GetMethod("PositionFloat", BindingFlags.NonPublic | BindingFlags.Instance); - posFloat.Should().NotBeNull(); - posFloat.Invoke(embedder, [IntPtr.Zero, new Size(200, 30)]); - - cfg.Overlay.Placement = "center"; - posFloat.Invoke(embedder, [IntPtr.Zero, new Size(200, 30)]); - - cfg.Overlay.Placement = "right"; - posFloat.Invoke(embedder, [IntPtr.Zero, new Size(200, 30)]); - - cfg.Overlay.FloatX = 100; - cfg.Overlay.FloatY = 100; - posFloat.Invoke(embedder, [IntPtr.Zero, new Size(200, 30)]); } [WpfFact] @@ -319,7 +297,7 @@ public void TaskbarEmbedder_ComputeBandX_AllBranchesCoverage() var computeBandX = typeof(TaskbarEmbedder).GetMethod("ComputeBandX", BindingFlags.NonPublic | BindingFlags.Instance); computeBandX.Should().NotBeNull(); - var rect = new NativeMethods.RECT { Left = 0, Top = 0, Right = 1920, Bottom = 40 }; + var rect = new NativeMethods.Rect { Left = 0, Top = 0, Right = 1920, Bottom = 40 }; TaskbarEmbedder.IsTaskbarCenteredOverride = () => true; try @@ -351,25 +329,6 @@ public void TaskbarEmbedder_ComputeBandX_AllBranchesCoverage() } } - [Fact] - public void TaskbarEmbedder_PositionFloat_VerticalTaskbar_Coverage() - { - var cfg = new AppSettings(); - cfg.Overlay.FloatX = -1; - cfg.Overlay.FloatY = -1; - var embedder = new TaskbarEmbedder(cfg); - - // Vertical taskbar: 0u (ABE_LEFT) - typeof(TaskbarEmbedder).GetField("_taskbarEdge", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, 0u); - typeof(TaskbarEmbedder).GetField("_taskbarRect", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, new Rectangle(0, 0, 60, 1080)); - - var posFloat = typeof(TaskbarEmbedder).GetMethod("PositionFloat", BindingFlags.NonPublic | BindingFlags.Instance); - posFloat!.Invoke(embedder, [IntPtr.Zero, new Size(50, 200)]); - - cfg.Overlay.FloatX.Should().Be(-1); - embedder.LastComputedFloatX.Should().Be(4); - } - [Fact] public void TaskbarEmbedder_FindExplorerTrayWnd_RealEnumeration_ExecutesSafely() { @@ -390,7 +349,7 @@ public void TaskbarEmbedder_ShrinkTaskBand_PlacementLeftAndRight() typeof(TaskbarEmbedder).GetField("_taskBandHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, fakeBand.Handle); typeof(TaskbarEmbedder).GetField("_taskbarEdge", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, NativeMethods.ABE_BOTTOM); - typeof(TaskbarEmbedder).GetField("_taskBandOri", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, new NativeMethods.RECT { Left = 50, Top = 0, Right = 500, Bottom = 40 }); + typeof(TaskbarEmbedder).GetField("_taskBandOri", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, new NativeMethods.Rect { Left = 50, Top = 0, Right = 500, Bottom = 40 }); var shrink = typeof(TaskbarEmbedder).GetMethod("ShrinkTaskBand", BindingFlags.NonPublic | BindingFlags.Instance); cfg.Overlay.Placement = "left"; @@ -414,7 +373,7 @@ public void TaskbarEmbedder_RestoreTaskBand_HorizontalAndVertical() typeof(TaskbarEmbedder).GetField("_taskBandHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, fakeBand.Handle); typeof(TaskbarEmbedder).GetField("_taskBandSaved", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, true); - typeof(TaskbarEmbedder).GetField("_taskBandOri", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, new NativeMethods.RECT { Left = 50, Top = 10, Right = 500, Bottom = 40 }); + typeof(TaskbarEmbedder).GetField("_taskBandOri", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, new NativeMethods.Rect { Left = 50, Top = 10, Right = 500, Bottom = 40 }); var restore = typeof(TaskbarEmbedder).GetMethod("RestoreTaskBand", BindingFlags.NonPublic | BindingFlags.Instance); @@ -447,7 +406,7 @@ public void TaskbarEmbedder_ComputeBandX_Win10BandPositioning() typeof(TaskbarEmbedder).GetField("_isWin11", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, false); var computeBandX = typeof(TaskbarEmbedder).GetMethod("ComputeBandX", BindingFlags.NonPublic | BindingFlags.Instance); - var rect = new NativeMethods.RECT { Left = 0, Top = 0, Right = 1920, Bottom = 40 }; + var rect = new NativeMethods.Rect { Left = 0, Top = 0, Right = 1920, Bottom = 40 }; cfg.Overlay.Placement = "left"; var xLeft = (int)computeBandX!.Invoke(embedder, [rect, new Size(200, 30)])!; @@ -467,33 +426,61 @@ public void TaskbarEmbedder_ComputeBandX_Win10BandPositioning() } [Fact] - public void TaskbarEmbedder_ResolveParentAndTaskBand_Win11Mode_ReturnsTrue() + public void TaskbarEmbedder_ComputeBandX_Win10_PlacementOffset_And_DeskBandDetection() { var cfg = new AppSettings(); var embedder = new TaskbarEmbedder(cfg); - typeof(TaskbarEmbedder).GetField("_isWin11", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, true); - var resolve = typeof(TaskbarEmbedder).GetMethod("ResolveParentAndTaskBand", BindingFlags.NonPublic | BindingFlags.Instance); - var res = (bool)resolve!.Invoke(embedder, [new IntPtr(12345)])!; - res.Should().BeTrue(); - embedder.ParentHwnd.Should().Be(new IntPtr(12345)); + using var fakeParent = new Form { Width = 1920, Height = 40 }; + using var fakeBand = new Form { Width = 600, Height = 40 }; + using var fakeWeatherDeskBand = new Form { Width = 150, Height = 40, Left = 1500 }; + fakeParent.Show(); + fakeBand.Show(); + fakeWeatherDeskBand.Show(); + + NativeMethods.SetParent(fakeBand.Handle, fakeParent.Handle); + NativeMethods.SetParent(fakeWeatherDeskBand.Handle, fakeParent.Handle); + + NativeMethods.MoveWindow(fakeBand.Handle, 0, 0, 600, 40, true); + NativeMethods.MoveWindow(fakeWeatherDeskBand.Handle, 1500, 0, 150, 40, true); + + typeof(TaskbarEmbedder).GetField("_parentHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, fakeParent.Handle); + typeof(TaskbarEmbedder).GetField("_taskBandHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, fakeBand.Handle); + typeof(TaskbarEmbedder).GetField("_isWin11", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, false); + + var computeBandX = typeof(TaskbarEmbedder).GetMethod("ComputeBandX", BindingFlags.NonPublic | BindingFlags.Instance)!; + var rect = new NativeMethods.Rect { Left = 0, Top = 0, Right = 1920, Bottom = 40 }; + + cfg.Overlay.Placement = "right"; + cfg.Overlay.PlacementOffset = 0; + int x0 = (int)computeBandX.Invoke(embedder, [rect, new Size(200, 30)])!; + x0.Should().BeLessThanOrEqualTo(1300); + + cfg.Overlay.PlacementOffset = 50; + int x50 = (int)computeBandX.Invoke(embedder, [rect, new Size(200, 30)])!; + x50.Should().Be(x0 - 50); + + cfg.Overlay.Placement = "beside_apps"; + cfg.Overlay.PlacementOffset = 10; + int xBeside = (int)computeBandX.Invoke(embedder, [rect, new Size(200, 30)])!; + xBeside.Should().BeGreaterThan(0); + + fakeParent.Close(); + fakeBand.Close(); + fakeWeatherDeskBand.Close(); } [Fact] - public void TaskbarEmbedder_PositionFloat_InvalidTaskbarBounds_SkipsPositioning() + public void TaskbarEmbedder_ResolveParentAndTaskBand_Win11Mode_ReturnsTrue() { var cfg = new AppSettings(); - cfg.Overlay.FloatX = -1; - cfg.Overlay.FloatY = -1; var embedder = new TaskbarEmbedder(cfg); + typeof(TaskbarEmbedder).GetField("_isWin11", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, true); - typeof(TaskbarEmbedder).GetField("_taskbarRect", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, Rectangle.Empty); - - var posFloat = typeof(TaskbarEmbedder).GetMethod("PositionFloat", BindingFlags.NonPublic | BindingFlags.Instance); - posFloat!.Invoke(embedder, [IntPtr.Zero, new Size(200, 30)]); - - embedder.LastComputedFloatX.Should().Be(0); - embedder.LastComputedFloatY.Should().Be(0); + var resolve = typeof(TaskbarEmbedder).GetMethod("ResolveParentAndTaskBand", BindingFlags.NonPublic | BindingFlags.Instance); + var res = (bool)resolve!.Invoke(embedder, [new IntPtr(12345)])!; + res.Should().BeTrue(); + embedder.ParentHwnd.Should().Be(new IntPtr(12345)); } [WpfFact] @@ -534,18 +521,27 @@ public void TaskbarEmbedder_Embed_InvalidWindowHandle_SetsFailedStateAndReturnsF [WpfFact] public void TaskbarEmbedder_Embed_InvalidTaskbarGeometry_SetsFailedStateAndReturnsFalse() { + using var fakeTray = new Form { Bounds = new Rectangle(0, 1000, 1920, 48) }; using var overlayForm = new Form(); - var cfg = new AppSettings(); - var embedder = new TaskbarEmbedder(cfg); + TaskbarEmbedder.ExplorerTrayWndOverride = () => fakeTray.Handle; + TaskbarEmbedder.FailGetClientRectForTesting = true; - typeof(TaskbarEmbedder).GetField("_taskbarRect", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, Rectangle.Empty); + try + { + var cfg = new AppSettings(); + var embedder = new TaskbarEmbedder(cfg); - var posFloat = typeof(TaskbarEmbedder).GetMethod("PositionFloat", BindingFlags.NonPublic | BindingFlags.Instance); - var result = (bool)posFloat!.Invoke(embedder, [overlayForm.Handle, new Size(200, 30)])!; + var result = embedder.Embed(overlayForm.Handle, new Size(200, 30)); - result.Should().BeFalse(); - embedder.State.Should().Be(OverlayDeploymentState.Failed); - embedder.IsEmbedded.Should().BeFalse(); + result.Should().BeFalse(); + embedder.State.Should().Be(OverlayDeploymentState.Failed); + embedder.IsEmbedded.Should().BeFalse(); + } + finally + { + TaskbarEmbedder.ExplorerTrayWndOverride = null; + TaskbarEmbedder.FailGetClientRectForTesting = false; + } } [WpfFact] @@ -598,33 +594,6 @@ public void TaskbarEmbedder_IsWindows11Taskbar_WithBothBridgeAndReBar_ReturnsTru TaskbarEmbedder.FindWindowExOverride = null; } - [WpfFact] - public void TaskbarEmbedder_PositionFloat_CustomCoordinates_MovesWindow() - { - using var form = new Form(); - form.Show(); - - var cfg = new AppSettings(); - cfg.Overlay.FloatX = 120; - cfg.Overlay.FloatY = 80; - - var embedder = new TaskbarEmbedder(cfg); - var posFloat = typeof(TaskbarEmbedder).GetMethod("PositionFloat", BindingFlags.NonPublic | BindingFlags.Instance); - posFloat.Should().NotBeNull(); - - // First call sets position and flags - bool ok1 = (bool)posFloat.Invoke(embedder, [form.Handle, new Size(200, 30)])!; - ok1.Should().BeTrue(); - embedder.LastComputedFloatX.Should().Be(120); - embedder.LastComputedFloatY.Should().Be(80); - - // Second call hits cached target rect - bool ok2 = (bool)posFloat.Invoke(embedder, [form.Handle, new Size(200, 30)])!; - ok2.Should().BeTrue(); - - form.Close(); - } - [WpfFact] public void TaskbarEmbedder_RefreshTaskbarInfo_AllEdgeVariations() { @@ -682,7 +651,7 @@ public void TaskbarEmbedder_RefreshTaskbarInfo_PrimaryScreenFallback_WhenTrayWin } [WpfFact] - public void TaskbarEmbedder_Detach_FallbackMode_CleansHwndParent() + public void TaskbarEmbedder_Detach_EmbeddedMode_CleansHwndParent() { using var form = new Form(); form.Show(); @@ -690,8 +659,6 @@ public void TaskbarEmbedder_Detach_FallbackMode_CleansHwndParent() var cfg = new AppSettings(); var embedder = new TaskbarEmbedder(cfg); - // Force fallback mode - typeof(TaskbarEmbedder).GetProperty("IsFallback", BindingFlags.Public | BindingFlags.Instance)!.GetSetMethod(true)!.Invoke(embedder, [true]); typeof(TaskbarEmbedder).GetProperty("IsEmbedded", BindingFlags.Public | BindingFlags.Instance)!.GetSetMethod(true)!.Invoke(embedder, [true]); embedder.Detach(form.Handle); @@ -702,68 +669,6 @@ public void TaskbarEmbedder_Detach_FallbackMode_CleansHwndParent() form.Close(); } - [Fact] - public void TaskbarEmbedder_PositionFloat_ClampingAndEdgeCases_Coverage() - { - TaskbarEmbedder.LeftWidgetRightEdgeOverride = () => -1; - TaskbarEmbedder.RightWidgetLeftEdgeOverride = () => -1; - TaskbarEmbedder.AppListLeftEdgeOverride = () => 600; - TaskbarEmbedder.AppListRightEdgeOverride = () => 1200; - TaskbarEmbedder.ExplorerTrayWndOverride = () => IntPtr.Zero; - TaskbarEmbedder.IsTaskbarCenteredOverride = () => true; - - try - { - var cfg = new AppSettings(); - var embedder = new TaskbarEmbedder(cfg); - - var posFloatMethod = typeof(TaskbarEmbedder).GetMethod("PositionFloat", BindingFlags.NonPublic | BindingFlags.Instance); - posFloatMethod.Should().NotBeNull(); - - var rectField = typeof(TaskbarEmbedder).GetField("_taskbarRect", BindingFlags.NonPublic | BindingFlags.Instance); - var edgeField = typeof(TaskbarEmbedder).GetField("_taskbarEdge", BindingFlags.NonPublic | BindingFlags.Instance); - - // 1. Invalid taskbar bounds (lines 705-710) - rectField!.SetValue(embedder, Rectangle.Empty); - bool failRes = (bool)posFloatMethod.Invoke(embedder, [IntPtr.Zero, new Size(200, 30)])!; - failRes.Should().BeFalse(); - embedder.State.Should().Be(OverlayDeploymentState.Failed); - - // 2. Horizontal clamping: left overflow (lines 724-727) - rectField.SetValue(embedder, new Rectangle(0, 1000, 1920, 48)); - edgeField!.SetValue(embedder, NativeMethods.ABE_BOTTOM); - cfg.Overlay.Placement = "left"; - cfg.Overlay.PlacementOffset = -500; - bool clampLeft = (bool)posFloatMethod.Invoke(embedder, [IntPtr.Zero, new Size(200, 30)])!; - clampLeft.Should().BeFalse(); // IntPtr.Zero HWND returns false on SetWindowPos but executes calculation - embedder.LastComputedFloatX.Should().Be(0); - - // 3. Horizontal clamping: right overflow (lines 724-727) - cfg.Overlay.Placement = "left"; - cfg.Overlay.PlacementOffset = 5000; - posFloatMethod.Invoke(embedder, [IntPtr.Zero, new Size(200, 30)]); - embedder.LastComputedFloatX.Should().Be(1920 - 200); - - // 4. Vertical taskbar placement (line 720) - edgeField.SetValue(embedder, NativeMethods.ABE_LEFT); - posFloatMethod.Invoke(embedder, [IntPtr.Zero, new Size(200, 30)]); - embedder.LastComputedFloatX.Should().Be(4); - - edgeField.SetValue(embedder, NativeMethods.ABE_RIGHT); - posFloatMethod.Invoke(embedder, [IntPtr.Zero, new Size(200, 30)]); - embedder.LastComputedFloatX.Should().Be(4); - } - finally - { - TaskbarEmbedder.LeftWidgetRightEdgeOverride = null; - TaskbarEmbedder.RightWidgetLeftEdgeOverride = null; - TaskbarEmbedder.AppListLeftEdgeOverride = null; - TaskbarEmbedder.AppListRightEdgeOverride = null; - TaskbarEmbedder.ExplorerTrayWndOverride = null; - TaskbarEmbedder.IsTaskbarCenteredOverride = null; - } - } - [Fact] public void TaskbarEmbedder_ComputeBandX_And_PositionInBand_Overflow_Coverage() { @@ -785,7 +690,7 @@ public void TaskbarEmbedder_ComputeBandX_And_PositionInBand_Overflow_Coverage() cfg.Overlay.Placement = "right"; cfg.Overlay.PlacementOffset = 10; - var parentRect = new NativeMethods.RECT { Left = 0, Top = 0, Right = 1920, Bottom = 48 }; + var parentRect = new NativeMethods.Rect { Left = 0, Top = 0, Right = 1920, Bottom = 48 }; int x = (int)computeBandX.Invoke(embedder, [parentRect, new Size(200, 30)])!; x.Should().BeGreaterThan(0); @@ -865,46 +770,42 @@ public void TaskbarEmbedder_Centered_And_TrayStructure_Coverage() [Fact] public void TaskbarEmbedder_LeftWidgetPositioning_BandAndFloat() { + using var fakeTray = new Form { Bounds = new Rectangle(0, 0, 1920, 48) }; var cfg = new AppSettings(); var embedder = new TaskbarEmbedder(cfg); - IntPtr tray = TaskbarEmbedder.FindExplorerTrayWnd(); - if (tray == IntPtr.Zero) - tray = NativeMethods.FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Progman", null); - - typeof(TaskbarEmbedder).GetField("_parentHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, tray); + typeof(TaskbarEmbedder).GetField("_parentHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, fakeTray.Handle); typeof(TaskbarEmbedder).GetField("_isWin11", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, true); - typeof(TaskbarEmbedder).GetField("_taskbarRect", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, new Rectangle(0, 1000, 1920, 48)); + typeof(TaskbarEmbedder).GetField("_taskbarRect", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, new Rectangle(0, 0, 1920, 48)); cfg.Overlay.Placement = "left"; cfg.Overlay.PlacementOffset = 10; TaskbarEmbedder.IsTaskbarCenteredOverride = () => true; + TaskbarEmbedder.AppListLeftEdgeOverride = () => 600; + TaskbarEmbedder.LeftWidgetRightEdgeOverride = () => -1; try { var computeBandX = typeof(TaskbarEmbedder).GetMethod("ComputeBandX", BindingFlags.NonPublic | BindingFlags.Instance); - var computeLeftFloat = typeof(TaskbarEmbedder).GetMethod("ComputeLeftFloatX", BindingFlags.NonPublic | BindingFlags.Instance); - var parentRect = new NativeMethods.RECT { Left = 0, Top = 0, Right = 1920, Bottom = 48 }; + var parentRect = new NativeMethods.Rect { Left = 0, Top = 0, Right = 1920, Bottom = 48 }; // 1. When widget is present on left at X=180 + TaskbarEmbedder.LeftWidgetRightEdgeOverride = () => 180; typeof(TaskbarEmbedder).GetField("_leftWidgetRightEdge", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, 180); - int floatXWithWidget = (int)computeLeftFloat!.Invoke(embedder, null)!; - floatXWithWidget.Should().Be(180 + 10); // 180 + Offset (10) = 190 - int bandXWithWidget = (int)computeBandX!.Invoke(embedder, [parentRect, new Size(200, 30)])!; bandXWithWidget.Should().BeGreaterThan(0); // 2. When no widget is present (_leftWidgetRightEdge = -1) + TaskbarEmbedder.LeftWidgetRightEdgeOverride = () => -1; typeof(TaskbarEmbedder).GetField("_leftWidgetRightEdge", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, -1); - int floatXNoWidget = (int)computeLeftFloat.Invoke(embedder, null)!; - floatXNoWidget.Should().Be(0 + 10); // _taskbarRect.Left (0) + Offset (10) = 10 - int bandXNoWidget = (int)computeBandX.Invoke(embedder, [parentRect, new Size(200, 30)])!; bandXNoWidget.Should().Be(10); } finally { TaskbarEmbedder.IsTaskbarCenteredOverride = null; + TaskbarEmbedder.AppListLeftEdgeOverride = null; + TaskbarEmbedder.LeftWidgetRightEdgeOverride = null; } } @@ -1012,14 +913,8 @@ public void TaskbarEmbedder_ResolveFromTrayWindow_And_ScreenWorkingArea_Coverage } [Fact] - public void TaskbarEmbedder_PositionFloat_Modes_And_EdgeCases() + public void TaskbarEmbedder_EdgeCaches_And_TrayInspection_Coverage() { - var cfg = new AppSettings(); - var embedder = new TaskbarEmbedder(cfg); - using var form = new Form(); - - var posFloatMethod = typeof(TaskbarEmbedder).GetMethod("PositionFloat", BindingFlags.NonPublic | BindingFlags.Instance)!; - var compLeftFloatMethod = typeof(TaskbarEmbedder).GetMethod("ComputeLeftFloatX", BindingFlags.NonPublic | BindingFlags.Instance)!; var estTrayWidthMethod = typeof(TaskbarEmbedder).GetMethod("EstimateTrayWidth", BindingFlags.NonPublic | BindingFlags.Static)!; var logTrayEdgeMethod = typeof(TaskbarEmbedder).GetMethod("LogTrayEdgeChange", BindingFlags.NonPublic | BindingFlags.Static)!; var logWidgetEdgeMethod = typeof(TaskbarEmbedder).GetMethod("LogWidgetEdgeChange", BindingFlags.NonPublic | BindingFlags.Static)!; @@ -1044,71 +939,6 @@ public void TaskbarEmbedder_PositionFloat_Modes_And_EdgeCases() // 3. EstimateTrayWidth int trayWidth = (int)estTrayWidthMethod.Invoke(null, null)!; trayWidth.Should().BeGreaterThan(0); - - // 4. PositionFloat with invalid bounds -> returns false - typeof(TaskbarEmbedder).GetField("_taskbarRect", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, Rectangle.Empty); - bool failRes = (bool)posFloatMethod.Invoke(embedder, [form.Handle, new Size(200, 30)])!; - failRes.Should().BeFalse(); - embedder.State.Should().Be(OverlayDeploymentState.Failed); - - // 5. PositionCustomFloat when FloatX and FloatY >= 0 - cfg.Overlay.FloatX = 150; - cfg.Overlay.FloatY = 250; - bool customRes = (bool)posFloatMethod.Invoke(embedder, [form.Handle, new Size(200, 30)])!; - customRes.Should().BeTrue(); - embedder.LastComputedFloatX.Should().Be(150); - embedder.LastComputedFloatY.Should().Be(250); - - // Repeated call to verify _lastFloatRect == targetRect early return - bool repeatCustomRes = (bool)posFloatMethod.Invoke(embedder, [form.Handle, new Size(200, 30)])!; - repeatCustomRes.Should().BeTrue(); - - // 6. PositionTaskbarFloat with horizontal taskbar (bottom and top) - cfg.Overlay.FloatX = -1; - cfg.Overlay.FloatY = -1; - typeof(TaskbarEmbedder).GetField("_taskbarRect", BindingFlags.NonPublic | BindingFlags.Instance)! - .SetValue(embedder, new Rectangle(0, 1000, 1920, 48)); - typeof(TaskbarEmbedder).GetField("_taskbarEdge", BindingFlags.NonPublic | BindingFlags.Instance)! - .SetValue(embedder, NativeMethods.ABE_BOTTOM); - - // Placement = "left" - cfg.Overlay.Placement = "left"; - typeof(TaskbarEmbedder).GetField("_leftWidgetRightEdge", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, 120); - int leftXWithWidget = (int)compLeftFloatMethod.Invoke(embedder, null)!; - leftXWithWidget.Should().BeGreaterThan(0); - - typeof(TaskbarEmbedder).GetField("_leftWidgetRightEdge", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, -1); - int leftXNoWidget = (int)compLeftFloatMethod.Invoke(embedder, null)!; - leftXNoWidget.Should().Be(cfg.Overlay.PlacementOffset); - - bool leftFloatRes = (bool)posFloatMethod.Invoke(embedder, [form.Handle, new Size(200, 30)])!; - leftFloatRes.Should().BeTrue(); - - // Placement = "center" - cfg.Overlay.Placement = "center"; - bool centerFloatRes = (bool)posFloatMethod.Invoke(embedder, [form.Handle, new Size(200, 30)])!; - centerFloatRes.Should().BeTrue(); - - // Placement = "right" with clamping condition (e.g. huge offset or edge outside) - cfg.Overlay.Placement = "right"; - cfg.Overlay.PlacementOffset = 5000; // triggers out-of-range clamping - bool clampedRes = (bool)posFloatMethod.Invoke(embedder, [form.Handle, new Size(200, 30)])!; - clampedRes.Should().BeTrue(); - - // 7. Vertical taskbar float (ABE_LEFT and ABE_RIGHT) - typeof(TaskbarEmbedder).GetField("_taskbarEdge", BindingFlags.NonPublic | BindingFlags.Instance)! - .SetValue(embedder, NativeMethods.ABE_LEFT); - bool vertLeftRes = (bool)posFloatMethod.Invoke(embedder, [form.Handle, new Size(200, 30)])!; - vertLeftRes.Should().BeTrue(); - - typeof(TaskbarEmbedder).GetField("_taskbarEdge", BindingFlags.NonPublic | BindingFlags.Instance)! - .SetValue(embedder, NativeMethods.ABE_RIGHT); - bool vertRightRes = (bool)posFloatMethod.Invoke(embedder, [form.Handle, new Size(200, 30)])!; - vertRightRes.Should().BeTrue(); - - // 8. RestoreLayeredStyles static invocation - var restoreLayered = typeof(TaskbarEmbedder).GetMethod("RestoreLayeredStyles", BindingFlags.NonPublic | BindingFlags.Static)!; - restoreLayered.Invoke(null, [form.Handle]); } [Fact] @@ -1181,10 +1011,8 @@ public void TaskbarEmbedder_LeftAlignedTaskbar_PositionsWithoutCollisions() try { var compBandX = typeof(TaskbarEmbedder).GetMethod("ComputeBandX", BindingFlags.NonPublic | BindingFlags.Instance)!; - var compLeftFloat = typeof(TaskbarEmbedder).GetMethod("ComputeLeftFloatX", BindingFlags.NonPublic | BindingFlags.Instance)!; - var compRightFloat = typeof(TaskbarEmbedder).GetMethod("ComputeRightFloatX", BindingFlags.NonPublic | BindingFlags.Instance)!; - var parentRect = new NativeMethods.RECT { Left = 0, Top = 0, Right = 1920, Bottom = 48 }; + var parentRect = new NativeMethods.Rect { Left = 0, Top = 0, Right = 1920, Bottom = 48 }; var overlaySize = new Size(300, 40); // 1. Placement = "left" on left-aligned taskbar @@ -1195,9 +1023,6 @@ public void TaskbarEmbedder_LeftAlignedTaskbar_PositionsWithoutCollisions() // Band left position must start at or after app list (500 + 10 = 510) bandLeftX.Should().BeGreaterThanOrEqualTo(510); - int floatLeftX = (int)compLeftFloat.Invoke(embedder, null)!; - floatLeftX.Should().Be(510); - // 2. Placement = "right" on left-aligned taskbar cfg.Overlay.Placement = "right"; cfg.Overlay.PlacementOffset = 10; @@ -1206,9 +1031,6 @@ public void TaskbarEmbedder_LeftAlignedTaskbar_PositionsWithoutCollisions() // Band right position must stay before tray left (1600 - 300 - 10 = 1290) bandRightX.Should().BeLessThanOrEqualTo(1290); bandRightX.Should().BeGreaterThanOrEqualTo(500); - - int floatRightX = (int)compRightFloat.Invoke(embedder, [overlaySize.Width])!; - floatRightX.Should().Be(1290); } finally { @@ -1243,9 +1065,8 @@ public void TaskbarEmbedder_LeftAlignedTaskbar_WithRightWeatherWidget_AvoidsWeat try { var compBandX = typeof(TaskbarEmbedder).GetMethod("ComputeBandX", BindingFlags.NonPublic | BindingFlags.Instance)!; - var compRightFloat = typeof(TaskbarEmbedder).GetMethod("ComputeRightFloatX", BindingFlags.NonPublic | BindingFlags.Instance)!; - var parentRect = new NativeMethods.RECT { Left = 0, Top = 0, Right = 1920, Bottom = 48 }; + var parentRect = new NativeMethods.Rect { Left = 0, Top = 0, Right = 1920, Bottom = 48 }; var overlaySize = new Size(300, 40); cfg.Overlay.Placement = "right"; @@ -1255,9 +1076,6 @@ public void TaskbarEmbedder_LeftAlignedTaskbar_WithRightWeatherWidget_AvoidsWeat // Expected placement: 1450 - 300 - 10 = 1140 (safely left of weather widget!) int bandRightX = (int)compBandX.Invoke(embedder, [parentRect, overlaySize])!; bandRightX.Should().Be(1140); - - int floatRightX = (int)compRightFloat.Invoke(embedder, [overlaySize.Width])!; - floatRightX.Should().Be(1140); } finally { @@ -1324,7 +1142,7 @@ public void TaskbarEmbedder_FindExplorerTrayWnd_And_CenteredRegistry_Coverage() // 4. FindRightmostChildTrayLeft var findChild = typeof(TaskbarEmbedder).GetMethod("FindRightmostChildTrayLeft", BindingFlags.NonPublic | BindingFlags.Static); findChild.Should().NotBeNull(); - var dummyRect = new NativeMethods.RECT { Left = 0, Top = 1000, Right = 1920, Bottom = 1048 }; + var dummyRect = new NativeMethods.Rect { Left = 0, Top = 1000, Right = 1920, Bottom = 1048 }; int childLeft = (int)findChild.Invoke(null, [form.Handle, dummyRect])!; childLeft.Should().Be(int.MaxValue); } @@ -1421,68 +1239,6 @@ public void TaskbarEmbedder_WidgetsAndAppListEdges_ComprehensiveBranches() actReset.Should().NotThrow(); } - [Fact] - public void TaskbarEmbedder_TaskbarFloatPositioning_And_ClampingBranches() - { - var cfg = new AppSettings(); - var embedder = new TaskbarEmbedder(cfg); - - using var form = new Form(); - typeof(TaskbarEmbedder).GetField("_taskbarRect", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, new Rectangle(0, 1032, 1920, 48)); - typeof(TaskbarEmbedder).GetField("_taskbarEdge", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, NativeMethods.ABE_BOTTOM); - typeof(TaskbarEmbedder).GetField("_isWin11", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, true); - - var compFloatX = typeof(TaskbarEmbedder).GetMethod("ComputeHorizontalTaskbarFloatX", BindingFlags.NonPublic | BindingFlags.Instance); - compFloatX.Should().NotBeNull(); - - // 1. Win11 Left Aligned branches - TaskbarEmbedder.IsTaskbarCenteredOverride = () => false; - TaskbarEmbedder.AppListRightEdgeOverride = () => 400; - cfg.Overlay.Placement = "left"; - cfg.Overlay.PlacementOffset = 5; - int xLeft = (int)compFloatX.Invoke(embedder, [200])!; - xLeft.Should().Be(405); - - cfg.Overlay.Placement = "beside_apps"; - int xBeside = (int)compFloatX.Invoke(embedder, [200])!; - xBeside.Should().Be(405); - - cfg.Overlay.Placement = "right"; - TaskbarEmbedder.RightWidgetLeftEdgeOverride = () => 1600; - int xRight = (int)compFloatX.Invoke(embedder, [200])!; - xRight.Should().Be(1395); - - // Clamping branch: force out of range to trigger Math.Clamp and warning log - cfg.Overlay.PlacementOffset = -1000; - int xClamped = (int)compFloatX.Invoke(embedder, [200])!; - xClamped.Should().BeGreaterThanOrEqualTo(400); - - // 2. Win11 Centered branches - TaskbarEmbedder.IsTaskbarCenteredOverride = () => true; - cfg.Overlay.PlacementOffset = 0; - cfg.Overlay.Placement = "center"; - int xCenter = (int)compFloatX.Invoke(embedder, [200])!; - xCenter.Should().Be(860); - - cfg.Overlay.Placement = "left"; - TaskbarEmbedder.LeftWidgetRightEdgeOverride = () => 180; - int xCenterLeft = (int)compFloatX.Invoke(embedder, [200])!; - xCenterLeft.Should().Be(180); - - TaskbarEmbedder.LeftWidgetRightEdgeOverride = null; - TaskbarEmbedder.RightWidgetLeftEdgeOverride = null; - TaskbarEmbedder.AppListRightEdgeOverride = null; - TaskbarEmbedder.IsTaskbarCenteredOverride = null; - - // 3. PositionFloat invalid bounds branch - typeof(TaskbarEmbedder).GetField("_taskbarRect", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, new Rectangle(0, 0, 0, 0)); - var posFloat = typeof(TaskbarEmbedder).GetMethod("PositionFloat", BindingFlags.NonPublic | BindingFlags.Instance); - posFloat.Should().NotBeNull(); - bool floatRes = (bool)posFloat.Invoke(embedder, [form.Handle, new Size(200, 30)])!; - floatRes.Should().BeFalse(); - embedder.State.Should().Be(OverlayDeploymentState.Failed); - } - [Fact] public void TaskbarEmbedder_ChildEmbedding_FailurePaths_And_BandResolution() { @@ -1584,8 +1340,10 @@ public void TaskbarEmbedder_EdgeCalculations_And_Diagnostics_Coverage() var queryAppList = typeof(TaskbarEmbedder).GetMethod("QueryAppListRightEdgeFromAutomation", BindingFlags.NonPublic | BindingFlags.Static)!; var origExplorerTray = TaskbarEmbedder.ExplorerTrayWndOverride; + var lastWidgetQueryTicksField = typeof(TaskbarEmbedder).GetField("_lastWidgetQueryTicks", BindingFlags.NonPublic | BindingFlags.Static); try { + lastWidgetQueryTicksField?.SetValue(null, 0L); TaskbarEmbedder.ExplorerTrayWndOverride = () => IntPtr.Zero; var wRes = queryWidgets.Invoke(null, [IntPtr.Zero, 1920]); wRes.Should().Be((-1, -1)); @@ -1770,7 +1528,6 @@ public void TaskbarEmbedder_RemainingEdgeBranches_And_TestingSeams_Coverage() try { TaskbarEmbedder.ThrowInAttachChildForTesting = true; - TaskbarEmbedder.FailPositionFloatForTesting = true; bool embedded = embedder.Embed(overlayForm.Handle, new Size(200, 30)); embedded.Should().BeFalse(); @@ -1779,7 +1536,6 @@ public void TaskbarEmbedder_RemainingEdgeBranches_And_TestingSeams_Coverage() finally { TaskbarEmbedder.ThrowInAttachChildForTesting = false; - TaskbarEmbedder.FailPositionFloatForTesting = false; } // 9. FindRightmostChildTrayLeft @@ -1788,7 +1544,7 @@ public void TaskbarEmbedder_RemainingEdgeBranches_And_TestingSeams_Coverage() fakeChild.Visible = true; NativeMethods.GetWindowRect(fakeChild.Handle, out var actualChildRect); var findRight = typeof(TaskbarEmbedder).GetMethod("FindRightmostChildTrayLeft", BindingFlags.NonPublic | BindingFlags.Static); - var trayRect = new NativeMethods.RECT { Left = 0, Top = actualChildRect.Top - 5, Right = actualChildRect.Right + 10, Bottom = actualChildRect.Bottom + 5 }; + var trayRect = new NativeMethods.Rect { Left = 0, Top = actualChildRect.Top - 5, Right = actualChildRect.Right + 10, Bottom = actualChildRect.Bottom + 5 }; TaskbarEmbedder.FindWindowExOverride = (p, c, cls, name) => c == IntPtr.Zero ? fakeChild.Handle : IntPtr.Zero; try { @@ -1818,13 +1574,22 @@ public void TaskbarEmbedder_RemainingEdgeBranches_And_TestingSeams_Coverage() TaskbarEmbedder.FindWindowExOverride = null; } - // 11. GetAppListRightEdge with _taskBandHwnd set - typeof(TaskbarEmbedder).GetField("_taskBandHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, fakeTray.Handle); + // 11. GetAppListRightEdge with _taskBandHwnd set (with and without child buttons) + using var fakeBand = new Form { Bounds = new Rectangle(0, 1000, 1920, 48), FormBorderStyle = FormBorderStyle.None }; + typeof(TaskbarEmbedder).GetField("_taskBandHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, fakeBand.Handle); typeof(TaskbarEmbedder).GetField("_cachedAppListRightEdge", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, -1); typeof(TaskbarEmbedder).GetField("_lastAppListQueryTicks", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, 0L); var queryAppBand = typeof(TaskbarEmbedder).GetMethod("GetAppListRightEdge", BindingFlags.NonPublic | BindingFlags.Instance); var bandRight = (int)queryAppBand?.Invoke(embedder, null)!; - bandRight.Should().Be(fakeTray.Right); + NativeMethods.GetWindowRect(fakeBand.Handle, out var fakeBandRect); + bandRight.Should().Be(fakeBandRect.Right); + + // Taskband with buttons returns button edge + typeof(TaskbarEmbedder).GetField("_taskBandHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, fakeTray.Handle); + typeof(TaskbarEmbedder).GetField("_cachedAppListRightEdge", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, -1); + typeof(TaskbarEmbedder).GetField("_lastAppListQueryTicks", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, 0L); + var buttonBandRight = (int)queryAppBand?.Invoke(embedder, null)!; + buttonBandRight.Should().BeGreaterThan(0); // 12. UpdateWidgetsEdges branches (tray null vs tray valid) TaskbarEmbedder.LeftWidgetRightEdgeOverride = null; @@ -1836,54 +1601,59 @@ public void TaskbarEmbedder_RemainingEdgeBranches_And_TestingSeams_Coverage() updateWidgetsMethod?.Invoke(embedder, null); // Tray is valid, with ThrowInQueryWidgetsButtonEdgeForTesting - TaskbarEmbedder.ExplorerTrayWndOverride = () => fakeTray.Handle; - TaskbarEmbedder.ThrowInQueryWidgetsButtonEdgeForTesting = true; - typeof(TaskbarEmbedder).GetField("_cachedLeftWidgetRightEdge", BindingFlags.NonPublic | BindingFlags.Static)!.SetValue(null, -1); - typeof(TaskbarEmbedder).GetField("_cachedRightWidgetLeftEdge", BindingFlags.NonPublic | BindingFlags.Static)!.SetValue(null, -1); - updateWidgetsMethod?.Invoke(embedder, null); - TaskbarEmbedder.ThrowInQueryWidgetsButtonEdgeForTesting = false; + try + { + TaskbarEmbedder.ExplorerTrayWndOverride = () => fakeTray.Handle; + TaskbarEmbedder.ThrowInQueryWidgetsButtonEdgeForTesting = true; + typeof(TaskbarEmbedder).GetField("_cachedLeftWidgetRightEdge", BindingFlags.NonPublic | BindingFlags.Static)!.SetValue(null, -1); + typeof(TaskbarEmbedder).GetField("_cachedRightWidgetLeftEdge", BindingFlags.NonPublic | BindingFlags.Static)!.SetValue(null, -1); + updateWidgetsMethod?.Invoke(embedder, null); + TaskbarEmbedder.ThrowInQueryWidgetsButtonEdgeForTesting = false; - // QueryWidgetsButtonEdge cache hit - typeof(TaskbarEmbedder).GetField("_cachedLeftWidgetRightEdge", BindingFlags.NonPublic | BindingFlags.Static)!.SetValue(null, 150); - typeof(TaskbarEmbedder).GetField("_cachedRightWidgetLeftEdge", BindingFlags.NonPublic | BindingFlags.Static)!.SetValue(null, 1200); - typeof(TaskbarEmbedder).GetField("_lastWidgetQueryTicks", BindingFlags.NonPublic | BindingFlags.Static)!.SetValue(null, System.Diagnostics.Stopwatch.GetTimestamp()); - var queryWidgets = typeof(TaskbarEmbedder).GetMethod("QueryWidgetsButtonEdge", BindingFlags.NonPublic | BindingFlags.Static); - var cachedRes = ((int, int))queryWidgets?.Invoke(null, [fakeTray.Handle, 1920])!; - cachedRes.Item1.Should().Be(150); - cachedRes.Item2.Should().Be(1200); - - // Controls inside fakeTray for UIAutomation queries - var containerBtn = new Button { Name = "TaskbarItemsContainer", Bounds = new Rectangle(100, 0, 400, 40) }; - var childBtn = new Button { Name = "AppButton1", Bounds = new Rectangle(10, 5, 50, 30) }; - containerBtn.Controls.Add(childBtn); - fakeTray.Controls.Add(containerBtn); - - var widgetsBtn = new Button { Name = "WidgetsButton", Bounds = new Rectangle(50, 5, 100, 30) }; - fakeTray.Controls.Add(widgetsBtn); - fakeTray.Show(); - - // UIAutomation find WidgetsButton - typeof(TaskbarEmbedder).GetField("_cachedLeftWidgetRightEdge", BindingFlags.NonPublic | BindingFlags.Static)!.SetValue(null, -1); - typeof(TaskbarEmbedder).GetField("_cachedRightWidgetLeftEdge", BindingFlags.NonPublic | BindingFlags.Static)!.SetValue(null, -1); - var autoWidgetRes = ((int, int))queryWidgets?.Invoke(null, [fakeTray.Handle, 1920])!; - autoWidgetRes.Should().NotBe((-1, -1)); - - // 13. QueryAppListRightEdgeFromAutomation error path, null tray path, and UIAutomation find - var queryAppAutomation = typeof(TaskbarEmbedder).GetMethod("QueryAppListRightEdgeFromAutomation", BindingFlags.NonPublic | BindingFlags.Static); - TaskbarEmbedder.ExplorerTrayWndOverride = () => IntPtr.Zero; - var resNullTray = (int)queryAppAutomation?.Invoke(null, [1920])!; - resNullTray.Should().Be(-1); + // QueryWidgetsButtonEdge cache hit + typeof(TaskbarEmbedder).GetField("_cachedLeftWidgetRightEdge", BindingFlags.NonPublic | BindingFlags.Static)!.SetValue(null, 150); + typeof(TaskbarEmbedder).GetField("_cachedRightWidgetLeftEdge", BindingFlags.NonPublic | BindingFlags.Static)!.SetValue(null, 1200); + typeof(TaskbarEmbedder).GetField("_lastWidgetQueryTicks", BindingFlags.NonPublic | BindingFlags.Static)!.SetValue(null, System.Diagnostics.Stopwatch.GetTimestamp()); + var queryWidgets = typeof(TaskbarEmbedder).GetMethod("QueryWidgetsButtonEdge", BindingFlags.NonPublic | BindingFlags.Static); + var cachedRes = ((int, int))queryWidgets?.Invoke(null, [fakeTray.Handle, 1920])!; + cachedRes.Item1.Should().Be(150); + cachedRes.Item2.Should().Be(1200); + + // Controls inside fakeTray for UIAutomation queries + var containerBtn = new Button { Name = "TaskbarItemsContainer", Bounds = new Rectangle(100, 0, 400, 40) }; + var childBtn = new Button { Name = "AppButton1", Bounds = new Rectangle(10, 5, 50, 30) }; + containerBtn.Controls.Add(childBtn); + fakeTray.Controls.Add(containerBtn); + + var widgetsBtn = new Button { Name = "WidgetsButton", Bounds = new Rectangle(50, 5, 100, 30) }; + fakeTray.Controls.Add(widgetsBtn); + fakeTray.Show(); + + // UIAutomation find WidgetsButton + TaskbarEmbedder.InvalidateCaches(); + var autoWidgetRes = ((int, int))queryWidgets?.Invoke(null, [fakeTray.Handle, 1920])!; + autoWidgetRes.Should().NotBe((-1, -1)); + + // 13. QueryAppListRightEdgeFromAutomation error path, null tray path, and UIAutomation find + var queryAppAutomation = typeof(TaskbarEmbedder).GetMethod("QueryAppListRightEdgeFromAutomation", BindingFlags.NonPublic | BindingFlags.Static); + TaskbarEmbedder.ExplorerTrayWndOverride = () => IntPtr.Zero; + var resNullTray = (int)queryAppAutomation?.Invoke(null, [1920])!; + resNullTray.Should().Be(-1); - TaskbarEmbedder.ExplorerTrayWndOverride = () => fakeTray.Handle; - var autoAppRight = (int)queryAppAutomation?.Invoke(null, [1920])!; - autoAppRight.Should().BeGreaterThan(0); + TaskbarEmbedder.ExplorerTrayWndOverride = () => fakeTray.Handle; + var autoAppRight = (int)queryAppAutomation?.Invoke(null, [1920])!; + autoAppRight.Should().BeGreaterThan(0); - TaskbarEmbedder.ThrowInQueryAppListRightEdgeFromAutomationForTesting = true; - typeof(TaskbarEmbedder).GetField("_cachedAppListRightEdge", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, -1); - typeof(TaskbarEmbedder).GetField("_taskBandHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, IntPtr.Zero); - queryAppBand?.Invoke(embedder, null); - TaskbarEmbedder.ThrowInQueryAppListRightEdgeFromAutomationForTesting = false; - TaskbarEmbedder.ExplorerTrayWndOverride = null; + TaskbarEmbedder.ThrowInQueryAppListRightEdgeFromAutomationForTesting = true; + typeof(TaskbarEmbedder).GetField("_cachedAppListRightEdge", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, -1); + typeof(TaskbarEmbedder).GetField("_taskBandHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, IntPtr.Zero); + queryAppBand?.Invoke(embedder, null); + TaskbarEmbedder.ThrowInQueryAppListRightEdgeFromAutomationForTesting = false; + } + finally + { + TaskbarEmbedder.ExplorerTrayWndOverride = null; + } // 14. ThrowInIsTaskbarCenteredForTesting TaskbarEmbedder.IsTaskbarCenteredOverride = null; @@ -1972,21 +1742,21 @@ public void TaskbarEmbedder_ButtonCalculations_WorkingArea_And_BandPositioning_C TaskbarEmbedder.CalculateMaxButtonRight([new System.Windows.Rect(150, 0, 50, 20), new System.Windows.Rect(100, 0, 40, 20)]).Should().Be(200); // 3. CalculateFromWorkingArea edge tests - var bounds = new System.Drawing.Rectangle(0, 0, 1920, 1080); + var bounds = new Rectangle(0, 0, 1920, 1080); // Bottom - var (bRect, bEdge) = TaskbarEmbedder.CalculateFromWorkingArea(bounds, new System.Drawing.Rectangle(0, 0, 1920, 1032)); + var (bRect, bEdge) = TaskbarEmbedder.CalculateFromWorkingArea(bounds, new Rectangle(0, 0, 1920, 1032)); bEdge.Should().Be(NativeMethods.ABE_BOTTOM); bRect.Height.Should().Be(48); // Top - var (tRect, tEdge) = TaskbarEmbedder.CalculateFromWorkingArea(bounds, new System.Drawing.Rectangle(0, 48, 1920, 1032)); + var (tRect, tEdge) = TaskbarEmbedder.CalculateFromWorkingArea(bounds, new Rectangle(0, 48, 1920, 1032)); tEdge.Should().Be(NativeMethods.ABE_TOP); tRect.Height.Should().Be(48); // Right - var (rRect, rEdge) = TaskbarEmbedder.CalculateFromWorkingArea(bounds, new System.Drawing.Rectangle(0, 0, 1872, 1080)); + var (rRect, rEdge) = TaskbarEmbedder.CalculateFromWorkingArea(bounds, new Rectangle(0, 0, 1872, 1080)); rEdge.Should().Be(NativeMethods.ABE_RIGHT); rRect.Width.Should().Be(48); // Left - var (lRect, lEdge) = TaskbarEmbedder.CalculateFromWorkingArea(bounds, new System.Drawing.Rectangle(48, 0, 1872, 1080)); + var (lRect, lEdge) = TaskbarEmbedder.CalculateFromWorkingArea(bounds, new Rectangle(48, 0, 1872, 1080)); lEdge.Should().Be(NativeMethods.ABE_LEFT); lRect.Width.Should().Be(48); // Fallback (identical bounds) @@ -1995,7 +1765,7 @@ public void TaskbarEmbedder_ButtonCalculations_WorkingArea_And_BandPositioning_C fRect.Height.Should().Be(48); // 4. Band positioning failure and clamping paths - using var fakeForm = new System.Windows.Forms.Form(); + using var fakeForm = new Form(); fakeForm.SetBounds(0, 0, 800, 48); fakeForm.Show(); @@ -2004,7 +1774,7 @@ public void TaskbarEmbedder_ButtonCalculations_WorkingArea_And_BandPositioning_C var embedder = new TaskbarEmbedder(cfg); typeof(TaskbarEmbedder).GetField("_parentHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, fakeForm.Handle); - using var fakeOverlay = new System.Windows.Forms.Form(); + using var fakeOverlay = new Form(); fakeOverlay.SetBounds(0, 0, 100, 30); fakeOverlay.Show(); @@ -2012,11 +1782,11 @@ public void TaskbarEmbedder_ButtonCalculations_WorkingArea_And_BandPositioning_C // Clamping branch when size width > parent width cfg.Overlay.Placement = "TaskbarLeft"; - var resClamp = positionBand?.Invoke(embedder, [fakeOverlay.Handle, new System.Drawing.Size(1000, 40)]); + var resClamp = positionBand?.Invoke(embedder, [fakeOverlay.Handle, new Size(1000, 40)]); resClamp.Should().Be(true); // Invalid overlay handle - var resInvalid = positionBand?.Invoke(embedder, [(IntPtr)0xDEAD, new System.Drawing.Size(100, 40)]); + var resInvalid = positionBand?.Invoke(embedder, [(IntPtr)0xDEAD, new Size(100, 40)]); resInvalid.Should().Be(false); // 5. GetAppListLeftEdge testing seams @@ -2116,7 +1886,7 @@ public void TaskbarEmbedder_ButtonCalculations_WorkingArea_And_BandPositioning_C try { TaskbarEmbedder.FailGetClientRectForTesting = true; - var resFail = positionBand?.Invoke(embedder, [fakeOverlay.Handle, new System.Drawing.Size(100, 40)]); + var resFail = positionBand?.Invoke(embedder, [fakeOverlay.Handle, new Size(100, 40)]); resFail.Should().Be(false); embedder.State.Should().Be(OverlayDeploymentState.Failed); } @@ -2132,7 +1902,7 @@ public void TaskbarEmbedder_ButtonCalculations_WorkingArea_And_BandPositioning_C cfg.Overlay.Placement = "TaskbarLeft"; cfg.Overlay.PlacementOffset = 50; TaskbarEmbedder.AppListLeftEdgeOverride = () => 0; - var resX = (int)computeX?.Invoke(embedder, [new NativeMethods.RECT { Left = 0, Top = 0, Right = 800, Bottom = 48 }, new System.Drawing.Size(100, 40)])!; + var resX = (int)computeX?.Invoke(embedder, [new NativeMethods.Rect { Left = 0, Top = 0, Right = 800, Bottom = 48 }, new Size(100, 40)])!; resX.Should().BeGreaterThan(0); } finally @@ -2141,7 +1911,7 @@ public void TaskbarEmbedder_ButtonCalculations_WorkingArea_And_BandPositioning_C } // 13. UI Automation queries without button children (bounding rect fallback) - var panel = new System.Windows.Forms.Panel { Name = "TaskbarItemsContainer" }; + var panel = new Panel { Name = "TaskbarItemsContainer" }; panel.SetBounds(100, 0, 300, 48); fakeForm.Controls.Add(panel); @@ -2163,4 +1933,724 @@ public void TaskbarEmbedder_ButtonCalculations_WorkingArea_And_BandPositioning_C fakeOverlay.Close(); fakeForm.Close(); } + + [Fact] + public void TaskbarEmbedder_CalculateTrayLeft_VariousBoundingBoxes() + { + // 1. Empty rects list + int resEmpty = TaskbarEmbedder.CalculateTrayLeft([], 1920); + resEmpty.Should().Be(-1); + + // 2. Rectangles with empty or zero size + var invalidRects = new List + { + System.Windows.Rect.Empty, + new(1000, 0, 0, 48), + new(1000, 0, 50, 0) + }; + int resInvalid = TaskbarEmbedder.CalculateTrayLeft(invalidRects, 1920); + resInvalid.Should().Be(-1); + + // 3. Rectangles on the left side of taskbar (Left < midX where midX = 960) + var leftSideRects = new List + { + new(100, 0, 200, 48), + new(500, 0, 100, 48) + }; + int resLeftSide = TaskbarEmbedder.CalculateTrayLeft(leftSideRects, 1920); + resLeftSide.Should().Be(-1); + + // 4. Valid tray rectangles on the right side + var trayRects = new List + { + new(1720, 0, 24, 48), // e.g. NotificationChevron + new(1750, 0, 60, 48), // e.g. SystemPromotedNotificationArea + new(1820, 0, 80, 48) // e.g. ControlCenter / Clock + }; + int resTray = TaskbarEmbedder.CalculateTrayLeft(trayRects, 1920); + resTray.Should().Be(1720); + + // 5. Zero taskbar width defaults midX to 0 + int resZeroWidth = TaskbarEmbedder.CalculateTrayLeft([new(50, 0, 100, 48)], 0); + resZeroWidth.Should().Be(50); + } + + [WpfFact] + public void TaskbarEmbedder_TrayLeftEdgeAutomation_Tests() + { + // Reset static caches + var resetStaticCaches = typeof(TaskbarEmbedder).GetMethod("ResetStaticEdgeCaches", BindingFlags.NonPublic | BindingFlags.Static)!; + resetStaticCaches.Invoke(null, null); + + using var fakeTray = new Form { Bounds = new Rectangle(0, 1000, 1920, 48) }; + TaskbarEmbedder.ExplorerTrayWndOverride = () => fakeTray.Handle; + + try + { + // 1. Test TrayLeftEdgeAutomationOverride hook in GetTrayLeftEdge + TaskbarEmbedder.TrayLeftEdgeAutomationOverride = width => 1650; + var getTrayLeft = typeof(TaskbarEmbedder).GetMethod("GetTrayLeftEdge", BindingFlags.NonPublic | BindingFlags.Static)!; + int trayLeft = (int)getTrayLeft.Invoke(null, null)!; + trayLeft.Should().Be(1650); + + // 2. ThrowInTrayLeftEdgeAutomationForTesting hook in QueryTrayLeftEdgeFromAutomation + TaskbarEmbedder.TrayLeftEdgeAutomationOverride = null; + TaskbarEmbedder.ThrowInTrayLeftEdgeAutomationForTesting = true; + var queryTrayAuto = typeof(TaskbarEmbedder).GetMethod("QueryTrayLeftEdgeFromAutomation", BindingFlags.NonPublic | BindingFlags.Static)!; + var actThrow = () => queryTrayAuto.Invoke(null, [fakeTray.Handle, 1920]); + actThrow.Should().Throw() + .WithInnerException() + .WithMessage("Simulated tray left edge automation error"); + TaskbarEmbedder.ThrowInTrayLeftEdgeAutomationForTesting = false; + + // 3. Automation query on fake tray without matching elements returns -1 + int queryNone = (int)queryTrayAuto.Invoke(null, [fakeTray.Handle, 1920])!; + queryNone.Should().Be(-1); + + // 4. Fallback EstimateTrayWidth + var estWidthMethod = typeof(TaskbarEmbedder).GetMethod("EstimateTrayWidth", BindingFlags.NonPublic | BindingFlags.Static)!; + int estWidth = (int)estWidthMethod.Invoke(null, null)!; + estWidth.Should().BeGreaterThanOrEqualTo(200); + } + finally + { + TaskbarEmbedder.ExplorerTrayWndOverride = null; + TaskbarEmbedder.TrayLeftEdgeAutomationOverride = null; + TaskbarEmbedder.ThrowInTrayLeftEdgeAutomationForTesting = false; + resetStaticCaches.Invoke(null, null); + fakeTray.Close(); + } + } + + [Fact] + public void TaskbarEmbedder_CalculateTrayLeft_NegativeCoordinates() + { + // Monitor positioned to the left of primary: bounds -2560 to -512 (width 2048) + var rects = new List + { + new(-700, 0, 80, 48), // Clock on right side of secondary monitor + new(-2400, 0, 60, 48) // Start button on left side of secondary monitor + }; + + int trayLeft = TaskbarEmbedder.CalculateTrayLeft(rects, 2048); + trayLeft.Should().Be(-700); + } + + [WpfFact] + public void TaskbarEmbedder_SecondaryTaskbar_EstimateTrayWidth() + { + using var fakeSecondaryTray = new Form { Bounds = new Rectangle(-2560, 0, 2048, 48) }; + try + { + TaskbarEmbedder.CurrentTargetTrayWnd = fakeSecondaryTray.Handle; + TaskbarEmbedder.IsSecondaryTrayWindowOverride = _ => true; + var estWidthMethod = typeof(TaskbarEmbedder).GetMethod("EstimateTrayWidth", BindingFlags.NonPublic | BindingFlags.Static)!; + int estWidth = (int)estWidthMethod.Invoke(null, null)!; + estWidth.Should().Be(LocalTelemetry.App.Win32.WindowHelpers.Scale(80, 1f)); + } + finally + { + TaskbarEmbedder.CurrentTargetTrayWnd = null; + TaskbarEmbedder.IsSecondaryTrayWindowOverride = null; + } + } + + [Fact] + public void TaskbarEmbedder_IsRightDockedId_IdentifiesKnownTrayElements() + { + TaskbarEmbedder.IsRightDockedId("NotificationChevron").Should().BeTrue(); + TaskbarEmbedder.IsRightDockedId("SystemPromotedNotificationArea").Should().BeTrue(); + TaskbarEmbedder.IsRightDockedId("ClockButton").Should().BeTrue(); + TaskbarEmbedder.IsRightDockedId("TimeWidget").Should().BeTrue(); + TaskbarEmbedder.IsRightDockedId("NotificationCenterButton").Should().BeTrue(); + TaskbarEmbedder.IsRightDockedId("Clock").Should().BeTrue(); + TaskbarEmbedder.IsRightDockedId("RandomAppButton").Should().BeFalse(); + TaskbarEmbedder.IsRightDockedId(string.Empty).Should().BeFalse(); + } + + [Fact] + public void TaskbarEmbedder_ScanTaskbar_HandlesZeroHwndAndTestingFlags() + { + var zeroRes = TaskbarEmbedder.ScanTaskbar(IntPtr.Zero, 1920, 0); + zeroRes.AppsLeft.Should().Be(-1); + zeroRes.AppsRight.Should().Be(-1); + zeroRes.TrayLeft.Should().Be(-1); + + try + { + TaskbarEmbedder.ThrowInScanTaskbarForTesting = true; + var act = () => TaskbarEmbedder.ScanTaskbar((IntPtr)12345, 1920, 0); + act.Should().Throw(); + } + finally + { + TaskbarEmbedder.ThrowInScanTaskbarForTesting = false; + } + } + + [Fact] + public void TaskbarEmbedder_ScanTaskbar_CachesResultsAndClearsOnReset() + { + var testHandle = (IntPtr)0x12345; + var fakeResult = new TaskbarEmbedder.TaskbarScanResult(800, 100, 1600, Stopwatch.GetTimestamp()); + var cache = (System.Collections.Concurrent.ConcurrentDictionary) + typeof(TaskbarEmbedder).GetField("_taskbarScanCache", BindingFlags.NonPublic | BindingFlags.Static)!.GetValue(null)!; + + cache[testHandle] = fakeResult; + + try + { + var res = TaskbarEmbedder.ScanTaskbar(testHandle, 1920, 0); + res.Should().Be(fakeResult); + + TaskbarEmbedder.InvalidateCaches(); + + var resAfterReset = TaskbarEmbedder.ScanTaskbar(testHandle, 1920, 0); + resAfterReset.Should().NotBe(fakeResult); + } + finally + { + TaskbarEmbedder.InvalidateCaches(); + } + } + + [WpfFact] + public void TaskbarEmbedder_IsAdjacentTrayChild_And_ClusterLeft_Coverage() + { + var isAdjacentMethod = typeof(TaskbarEmbedder).GetMethod("IsAdjacentTrayChild", BindingFlags.NonPublic | BindingFlags.Static); + isAdjacentMethod.Should().NotBeNull(); + + using var trayForm = new Form { StartPosition = FormStartPosition.Manual, Bounds = new Rectangle(0, 0, 1920, 50) }; + trayForm.Show(); + using var childForm = new Form { StartPosition = FormStartPosition.Manual, Bounds = new Rectangle(1200, 0, 80, 50) }; + childForm.Show(); + + NativeMethods.GetWindowRect(childForm.Handle, out var actualCr); + var trayRect = new NativeMethods.Rect { Left = 0, Top = 0, Right = actualCr.Right + 500, Bottom = 50 }; + int clusterLeft = actualCr.Right + 10; + + // Valid adjacent child + object[] args = [childForm.Handle, trayRect, clusterLeft, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, 0]; + bool res = (bool)isAdjacentMethod.Invoke(null, args)!; + res.Should().BeTrue(); + ((int)args[6]).Should().Be(actualCr.Left); + + // App overlay window handle or title -> false (must not self-detect) + TaskbarEmbedder.ActiveOverlayHwnds.TryAdd(childForm.Handle, 0); + args = [childForm.Handle, trayRect, clusterLeft, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, 0]; + ((bool)isAdjacentMethod.Invoke(null, args)!).Should().BeFalse(); + TaskbarEmbedder.ActiveOverlayHwnds.TryRemove(childForm.Handle, out _); + + childForm.Text = "LocalTelemetry_Overlay"; + args = [childForm.Handle, trayRect, clusterLeft, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, 0]; + ((bool)isAdjacentMethod.Invoke(null, args)!).Should().BeFalse(); + childForm.Text = "MockChild"; + + // Same as rebar or trayNotify or clock -> false + args = [childForm.Handle, trayRect, clusterLeft, childForm.Handle, IntPtr.Zero, IntPtr.Zero, 0]; + ((bool)isAdjacentMethod.Invoke(null, args)!).Should().BeFalse(); + + args = [childForm.Handle, trayRect, clusterLeft, IntPtr.Zero, childForm.Handle, IntPtr.Zero, 0]; + ((bool)isAdjacentMethod.Invoke(null, args)!).Should().BeFalse(); + + args = [childForm.Handle, trayRect, clusterLeft, IntPtr.Zero, IntPtr.Zero, childForm.Handle, 0]; + ((bool)isAdjacentMethod.Invoke(null, args)!).Should().BeFalse(); + + // Hidden window -> false + childForm.Visible = false; + args = [childForm.Handle, trayRect, clusterLeft, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, 0]; + ((bool)isAdjacentMethod.Invoke(null, args)!).Should().BeFalse(); + childForm.Visible = true; + + // Horizontally not adjacent (too far left: actualCr.Right < clusterLeft - 20) + int farClusterLeft = actualCr.Right + 50; + args = [childForm.Handle, trayRect, farClusterLeft, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, 0]; + ((bool)isAdjacentMethod.Invoke(null, args)!).Should().BeFalse(); + + // Not reasonable bounds (tray width too small so child exceeds 45% of width) + var narrowTrayRect = new NativeMethods.Rect { Left = 0, Top = actualCr.Top, Right = actualCr.Width + 10, Bottom = actualCr.Bottom }; + args = [childForm.Handle, narrowTrayRect, clusterLeft, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, 0]; + ((bool)isAdjacentMethod.Invoke(null, args)!).Should().BeFalse(); + + // Zero/negative width window handle (IntPtr.Zero) -> false + args = [IntPtr.Zero, trayRect, clusterLeft, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, 0]; + ((bool)isAdjacentMethod.Invoke(null, args)!).Should().BeFalse(); + + // FindAdjacentClusterLeft with childForm as a child of trayForm + NativeMethods.SetParent(childForm.Handle, trayForm.Handle); + var findClusterMethod = typeof(TaskbarEmbedder).GetMethod("FindAdjacentClusterLeft", BindingFlags.NonPublic | BindingFlags.Static); + findClusterMethod.Should().NotBeNull(); + int finalCluster = (int)findClusterMethod.Invoke(null, [trayForm.Handle, trayRect, clusterLeft, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero])!; + finalCluster.Should().BeLessThanOrEqualTo(clusterLeft); + + trayForm.Close(); + childForm.Close(); + } + + [WpfFact] + public void TaskbarEmbedder_RefactoredMethods_CompleteBranchCoverage() + { + var cfg = new AppSettings(); + var embedder = new TaskbarEmbedder(cfg); + + using var parentForm = new Form { Bounds = new Rectangle(0, 0, 1920, 48) }; + using var bandForm = new Form { Bounds = new Rectangle(100, 0, 400, 48) }; + parentForm.Show(); + bandForm.Show(); + + typeof(TaskbarEmbedder).GetField("_parentHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, parentForm.Handle); + typeof(TaskbarEmbedder).GetField("_taskBandHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, bandForm.Handle); + + // 1. QueryLegacyTaskBandRightEdge and LeftEdge with valid window + var queryRight = typeof(TaskbarEmbedder).GetMethod("QueryLegacyTaskBandRightEdge", BindingFlags.NonPublic | BindingFlags.Instance)!; + var queryLeft = typeof(TaskbarEmbedder).GetMethod("QueryLegacyTaskBandLeftEdge", BindingFlags.NonPublic | BindingFlags.Instance)!; + ((int)queryRight.Invoke(embedder, null)!).Should().BeGreaterThan(0); + ((int)queryLeft.Invoke(embedder, null)!).Should().BeGreaterThanOrEqualTo(0); + + // When taskband is IntPtr.Zero + typeof(TaskbarEmbedder).GetField("_taskBandHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, IntPtr.Zero); + ((int)queryRight.Invoke(embedder, null)!).Should().Be(-1); + ((int)queryLeft.Invoke(embedder, null)!).Should().Be(-1); + + // 2. ResolveDynamicAppListRightEdge and LeftEdge automation overrides + var resolveRight = typeof(TaskbarEmbedder).GetMethod("ResolveDynamicAppListRightEdge", BindingFlags.NonPublic | BindingFlags.Instance)!; + var resolveLeft = typeof(TaskbarEmbedder).GetMethod("ResolveDynamicAppListLeftEdge", BindingFlags.NonPublic | BindingFlags.Instance)!; + + try + { + TaskbarEmbedder.AppListRightEdgeAutomationOverride = _ => 999; + TaskbarEmbedder.AppListLeftEdgeAutomationOverride = _ => 111; + ((int)resolveRight.Invoke(embedder, null)!).Should().Be(999); + ((int)resolveLeft.Invoke(embedder, null)!).Should().Be(111); + } + finally + { + TaskbarEmbedder.AppListRightEdgeAutomationOverride = null; + TaskbarEmbedder.AppListLeftEdgeAutomationOverride = null; + } + + // When overrides are null, scan taskbar fallback + int dynRight = (int)resolveRight.Invoke(embedder, null)!; + int dynLeft = (int)resolveLeft.Invoke(embedder, null)!; + dynRight.Should().BeInRange(-1, 1920); + dynLeft.Should().BeInRange(-1, 1920); + + // 3. ResolveClientRightBoundary with valid boundary vs invalid (-1) + var resolveClientRight = typeof(TaskbarEmbedder).GetMethod("ResolveClientRightBoundary", BindingFlags.NonPublic | BindingFlags.Instance)!; + var parentRect = new NativeMethods.Rect { Left = 0, Top = 0, Right = 1920, Bottom = 48 }; + + typeof(TaskbarEmbedder).GetField("_trayLeftEdge", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, 1600); + var expectedPt = new NativeMethods.Point { X = 1600, Y = 0 }; + NativeMethods.ScreenToClient(parentForm.Handle, ref expectedPt); + int clientRight = (int)resolveClientRight.Invoke(embedder, [parentRect])!; + clientRight.Should().Be(expectedPt.X); + + typeof(TaskbarEmbedder).GetField("_trayLeftEdge", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, -1); + int fallbackRight = (int)resolveClientRight.Invoke(embedder, [parentRect])!; + fallbackRight.Should().BeGreaterThan(0); + + // 4. FindRebarDeskBandRightBound with _trayLeftEdge == -1 vs valid + var findDeskBandBound = typeof(TaskbarEmbedder).GetMethod("FindRebarDeskBandRightBound", BindingFlags.NonPublic | BindingFlags.Instance)!; + typeof(TaskbarEmbedder).GetField("_trayLeftEdge", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, -1); + int bound1 = (int)findDeskBandBound.Invoke(embedder, [500, 1920])!; + bound1.Should().Be(1920); + + typeof(TaskbarEmbedder).GetField("_trayLeftEdge", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, 1500); + var expectedTrayPt = new NativeMethods.Point { X = 1500, Y = 0 }; + NativeMethods.ScreenToClient(parentForm.Handle, ref expectedTrayPt); + int bound2 = (int)findDeskBandBound.Invoke(embedder, [500, 1920])!; + bound2.Should().Be(expectedTrayPt.X); + + parentForm.Close(); + bandForm.Close(); + } + + [WpfFact] + public void TaskbarEmbedder_ComputeBandLeftAlignedX_PlacementRight_NeverOverlapsAppButtonsWhenConstrained() + { + using var parentForm = new Form { Bounds = new Rectangle(0, 0, 1000, 48) }; + var cfg = new AppSettings(); + cfg.Overlay.Placement = "right"; + cfg.Overlay.PlacementOffset = 5; + + var embedder = new TaskbarEmbedder(cfg); + typeof(TaskbarEmbedder).GetField("_parentHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, parentForm.Handle); + + try + { + TaskbarEmbedder.AppListRightEdgeOverride = () => 600; + + var compute = typeof(TaskbarEmbedder).GetMethod("ComputeBandLeftAlignedX", BindingFlags.NonPublic | BindingFlags.Instance)!; + // clientRightBoundary = 500, overlay width = 400. + // Available slot = 500 - 600 - 10 = 0px. Overlay is 400px. + int x = (int)compute.Invoke(embedder, [new Size(400, 30), 500])!; + + var expectedPt = new NativeMethods.Point { X = 600, Y = 0 }; + NativeMethods.ScreenToClient(parentForm.Handle, ref expectedPt); + int expectedX = Math.Max(0, expectedPt.X) + cfg.Overlay.PlacementOffset; + + // Overlay must be clamped so it begins at or after appRight + offset, never overlapping app icons + x.Should().Be(expectedX); + embedder.IsTaskbarSpaceConstrained.Should().BeTrue(); + embedder.AvailableSlotWidth.Should().Be(Math.Max(0, 500 - Math.Max(0, expectedPt.X) - (2 * cfg.Overlay.PlacementOffset))); + } + finally + { + TaskbarEmbedder.AppListRightEdgeOverride = null; + } + } + + [WpfFact] + public void TaskbarEmbedder_ComputeBandWin10X_SpaceConstrained_ClampsWithoutOverlappingApps() + { + using var parentForm = new Form + { + StartPosition = FormStartPosition.Manual, + FormBorderStyle = FormBorderStyle.None, + Bounds = new Rectangle(0, 0, 1000, 40) + }; + using var bandForm = new Form { Bounds = new Rectangle(0, 0, 800, 40) }; + parentForm.Show(); + bandForm.Show(); + NativeMethods.SetParent(bandForm.Handle, parentForm.Handle); + + var cfg = new AppSettings(); + cfg.Overlay.Placement = "right"; + cfg.Overlay.PlacementOffset = 5; + + var embedder = new TaskbarEmbedder(cfg); + typeof(TaskbarEmbedder).GetField("_parentHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, parentForm.Handle); + typeof(TaskbarEmbedder).GetField("_taskBandHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, bandForm.Handle); + typeof(TaskbarEmbedder).GetField("_isWin11", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, false); + + try + { + TaskbarEmbedder.AppListRightEdgeOverride = () => 700; + var compute = typeof(TaskbarEmbedder).GetMethod("ComputeBandWin10X", BindingFlags.NonPublic | BindingFlags.Instance)!; + + // Slot is parent width (800) - appRight (approx 536) - 2*offset (10) = 254px. + // Overlay width is 400px > 254px available. + var parentRect = new NativeMethods.Rect { Left = 0, Top = 0, Right = 800, Bottom = 40 }; + int x = (int)compute.Invoke(embedder, [parentRect, new Size(400, 30)])!; + + // Overlay must not overlap appRight; must be clamped to minRightX. + var pt = new NativeMethods.Point { X = 700, Y = 0 }; + NativeMethods.ScreenToClient(parentForm.Handle, ref pt); + int expectedMinX = Math.Max(0, pt.X) + cfg.Overlay.PlacementOffset; + + x.Should().Be(expectedMinX); + embedder.IsTaskbarSpaceConstrained.Should().BeTrue(); + embedder.AvailableSlotWidth.Should().Be(Math.Max(0, 800 - Math.Max(0, pt.X) - (2 * cfg.Overlay.PlacementOffset))); + } + finally + { + TaskbarEmbedder.AppListRightEdgeOverride = null; + parentForm.Close(); + bandForm.Close(); + } + } + + [WpfFact] + public void TaskbarEmbedder_CalculateAvailableSlotWidth_Win10Mode_ComputesExpectedWidth() + { + using var parentForm = new Form { Bounds = new Rectangle(0, 0, 1000, 40) }; + using var bandForm = new Form { Bounds = new Rectangle(0, 0, 600, 40) }; + parentForm.Show(); + bandForm.Show(); + NativeMethods.SetParent(bandForm.Handle, parentForm.Handle); + + var cfg = new AppSettings(); + cfg.Overlay.Placement = "right"; + cfg.Overlay.PlacementOffset = 5; + + var embedder = new TaskbarEmbedder(cfg); + typeof(TaskbarEmbedder).GetField("_parentHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, parentForm.Handle); + typeof(TaskbarEmbedder).GetField("_taskBandHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, bandForm.Handle); + typeof(TaskbarEmbedder).GetField("_isWin11", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, false); + + try + { + TaskbarEmbedder.AppListRightEdgeOverride = () => 600; + + NativeMethods.GetClientRect(parentForm.Handle, out var parentRect); + int slotWidth = embedder.CalculateAvailableSlotWidth(); + var pt = new NativeMethods.Point { X = 600, Y = 0 }; + NativeMethods.ScreenToClient(parentForm.Handle, ref pt); + int expected = Math.Max(0, parentRect.Width - Math.Max(0, pt.X) - (2 * cfg.Overlay.PlacementOffset)); + + slotWidth.Should().Be(expected); + } + finally + { + TaskbarEmbedder.AppListRightEdgeOverride = null; + parentForm.Close(); + bandForm.Close(); + } + } + + [WpfFact] + public void TaskbarEmbedder_SecondaryTray_And_RightSlotWidth_Coverage() + { + var origFind = TaskbarEmbedder.FindWindowExOverride; + var origThrow = TaskbarEmbedder.ThrowInExplorerLookupForTesting; + try + { + using var f = new Form { Bounds = new Rectangle(0, 0, 100, 40) }; + _ = f.Handle; + int call = 0; + TaskbarEmbedder.FindWindowExOverride = (_, _, cls, _) => + { + if (cls == "Shell_SecondaryTrayWnd" && call++ == 0) return f.Handle; + return IntPtr.Zero; + }; + TaskbarEmbedder.ThrowInExplorerLookupForTesting = true; + var res = TaskbarEmbedder.FindExplorerSecondaryTrayWnds(); + res.Should().BeEmpty(); + } + finally + { + TaskbarEmbedder.FindWindowExOverride = origFind; + TaskbarEmbedder.ThrowInExplorerLookupForTesting = origThrow; + } + + // ResolveSecondaryTrayLeftEdge fallback to trayRect.Right when no clock/elements exist + var resolveSec = typeof(TaskbarEmbedder).GetMethod("ResolveSecondaryTrayLeftEdge", BindingFlags.NonPublic | BindingFlags.Static)!; + var rect = new NativeMethods.Rect { Left = 0, Top = 1040, Right = 1920, Bottom = 1080 }; + var secEdge = (int)resolveSec.Invoke(null, [IntPtr.Zero, rect])!; + secEdge.Should().Be(1920); + + // CalculateRightSlotWidth with both valid and -1 rightBoundary + using var parentForm = new Form { Bounds = new Rectangle(0, 0, 1000, 40) }; + _ = parentForm.Handle; + var cfg = new AppSettings(); + var embedder = new TaskbarEmbedder(cfg); + typeof(TaskbarEmbedder).GetField("_parentHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, parentForm.Handle); + var calcRight = typeof(TaskbarEmbedder).GetMethod("CalculateRightSlotWidth", BindingFlags.NonPublic | BindingFlags.Instance)!; + + try + { + TaskbarEmbedder.RightWidgetLeftEdgeOverride = () => 800; + TaskbarEmbedder.AppListRightEdgeOverride = () => 400; + int w1 = (int)calcRight.Invoke(embedder, [new NativeMethods.Rect { Left = 0, Top = 0, Right = 1000, Bottom = 40 }, 5])!; + w1.Should().BeGreaterThanOrEqualTo(0); + + TaskbarEmbedder.RightWidgetLeftEdgeOverride = () => -1; + int w2 = (int)calcRight.Invoke(embedder, [new NativeMethods.Rect { Left = 0, Top = 0, Right = 1000, Bottom = 40 }, 5])!; + w2.Should().BeGreaterThanOrEqualTo(0); + } + finally + { + TaskbarEmbedder.RightWidgetLeftEdgeOverride = null; + TaskbarEmbedder.AppListRightEdgeOverride = null; + } + } + + [Fact] + public void TaskbarEmbedder_CalculationsAndSlotWidth_Coverage() + { + // 1. IsRightDockedId + TaskbarEmbedder.IsRightDockedId("NotificationChevron").Should().BeTrue(); + TaskbarEmbedder.IsRightDockedId("ClockButton").Should().BeTrue(); + TaskbarEmbedder.IsRightDockedId("SystemTrayIcons").Should().BeTrue(); + TaskbarEmbedder.IsRightDockedId("RandomButton").Should().BeFalse(); + + // 2. CalculateTrayLeft + var emptyRects = new List(); + TaskbarEmbedder.CalculateTrayLeft(emptyRects, 1920).Should().Be(-1); + + var validRects = new List + { + new System.Windows.Rect(1600, 0, 50, 40), + new System.Windows.Rect(1700, 0, 100, 40) + }; + TaskbarEmbedder.CalculateTrayLeft(validRects, 1920, 0).Should().Be(1600); + + // 3. CalculateAvailableSlotWidth + var cfg = new AppSettings(); + var embedder = new TaskbarEmbedder(cfg); + + // Parent HWND zero -> 0 + embedder.CalculateAvailableSlotWidth().Should().Be(0); + + // Parent HWND set + using var parentForm = new Form { Bounds = new Rectangle(0, 0, 1920, 40) }; + _ = parentForm.Handle; + typeof(TaskbarEmbedder).GetField("_parentHwnd", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(embedder, parentForm.Handle); + + // Placement = "left" + cfg.Overlay.Placement = "left"; + var actLeft = () => embedder.CalculateAvailableSlotWidth(); + actLeft.Should().NotThrow(); + + // Placement = "right" + cfg.Overlay.Placement = "right"; + var actRight = () => embedder.CalculateAvailableSlotWidth(); + actRight.Should().NotThrow(); + + // 4. ResolveSecondaryTrayLeftEdge & ResolvePrimaryTrayLeftEdge + var secResolve = typeof(TaskbarEmbedder).GetMethod("ResolveSecondaryTrayLeftEdge", BindingFlags.NonPublic | BindingFlags.Static)!; + int secResult = (int)secResolve.Invoke(null, [parentForm.Handle, new NativeMethods.Rect { Left = 0, Top = 0, Right = 1920, Bottom = 40 }])!; + secResult.Should().Be(1920); + + var primResolve = typeof(TaskbarEmbedder).GetMethod("ResolvePrimaryTrayLeftEdge", BindingFlags.NonPublic | BindingFlags.Static)!; + int primResult = (int)primResolve.Invoke(null, [parentForm.Handle, new NativeMethods.Rect { Left = 0, Top = 0, Right = 1920, Bottom = 40 }, false])!; + primResult.Should().Be(1920); + + // 5. QueryWidgetsButtonEdge with simulated throw + var priorThrow = TaskbarEmbedder.ThrowInQueryWidgetsButtonEdgeForTesting; + try + { + TaskbarEmbedder.ThrowInQueryWidgetsButtonEdgeForTesting = true; + var queryWidgets = typeof(TaskbarEmbedder).GetMethod("QueryWidgetsButtonEdge", BindingFlags.NonPublic | BindingFlags.Static)!; + var actWidgets = () => queryWidgets.Invoke(null, [parentForm.Handle, 1920]); + actWidgets.Should().NotThrow(); + } + finally + { + TaskbarEmbedder.ThrowInQueryWidgetsButtonEdgeForTesting = priorThrow; + } + } + + [Fact] + public void TaskbarEmbedder_ResolveTrayLeftEdge_EdgeCases_Coverage() + { + var rect = new NativeMethods.Rect { Left = 0, Top = 0, Right = 1920, Bottom = 40 }; + + // 1. ThrowInTrayLeftEdgeForTesting + var priorThrow = TaskbarEmbedder.ThrowInTrayLeftEdgeForTesting; + try + { + TaskbarEmbedder.ThrowInTrayLeftEdgeForTesting = true; + TaskbarEmbedder.ResolveTrayLeftEdge(IntPtr.Zero, false).Should().Be(-1); + TaskbarEmbedder.ResolveTrayLeftEdge(IntPtr.Zero, true).Should().Be(-1); + } + finally + { + TaskbarEmbedder.ThrowInTrayLeftEdgeForTesting = priorThrow; + } + + // 2. TrayLeftEdgeAutomationOverride + var priorOverride = TaskbarEmbedder.TrayLeftEdgeAutomationOverride; + try + { + TaskbarEmbedder.TrayLeftEdgeAutomationOverride = _ => 1550; + var primResolve = typeof(TaskbarEmbedder).GetMethod("ResolvePrimaryTrayLeftEdge", BindingFlags.NonPublic | BindingFlags.Static)!; + int res = (int)primResolve.Invoke(null, [IntPtr.Zero, rect, false])!; + res.Should().Be(1550); + + TaskbarEmbedder.TrayLeftEdgeAutomationOverride = _ => -1; + int fallback = (int)primResolve.Invoke(null, [IntPtr.Zero, rect, false])!; + fallback.Should().BeGreaterThan(0); + } + finally + { + TaskbarEmbedder.TrayLeftEdgeAutomationOverride = priorOverride; + } + } + + [Theory] + [InlineData("NotificationChevron", true)] + [InlineData("SystemPromotedNotificationArea", true)] + [InlineData("NotificationArea", true)] + [InlineData("SystemTrayFrameGrid", true)] + [InlineData("SystemTrayIcons", true)] + [InlineData("ControlCenterButton", true)] + [InlineData("ClockButton", true)] + [InlineData("NotificationCenterButton", true)] + [InlineData("TimeButton", true)] + [InlineData("TimeWidget", true)] + [InlineData("Clock", true)] + [InlineData("TaskbarApp", false)] + [InlineData("", false)] + public void TaskbarEmbedder_IsRightDockedId_MatchesExpected(string id, bool expected) + { + TaskbarEmbedder.IsRightDockedId(id).Should().Be(expected); + } + + [Fact] + public void TaskbarEmbedder_IsClockButtonCandidate_And_InvalidateCaches() + { + TaskbarEmbedder.InvalidateCaches(); + + var isCandidateMethod = typeof(TaskbarEmbedder).GetMethod( + "IsClockButtonCandidate", + BindingFlags.NonPublic | BindingFlags.Static); + isCandidateMethod.Should().NotBeNull(); + + // Valid candidate: width in (20, 250), Right > maxRight, Left >= midX + var validRect = new System.Windows.Rect(1000, 0, 80, 40); + bool valid = (bool)isCandidateMethod.Invoke(null, [validRect, 900, 500.0])!; + valid.Should().BeTrue(); + + // Empty rect: invalid + bool empty = (bool)isCandidateMethod.Invoke(null, [System.Windows.Rect.Empty, 900, 500.0])!; + empty.Should().BeFalse(); + + // Width too small (<= 20) + var smallRect = new System.Windows.Rect(1000, 0, 15, 40); + bool small = (bool)isCandidateMethod.Invoke(null, [smallRect, 900, 500.0])!; + small.Should().BeFalse(); + + // Left < midX + var leftRect = new System.Windows.Rect(800, 0, 80, 40); + bool leftTooFar = (bool)isCandidateMethod.Invoke(null, [leftRect, 900, 500.0])!; + leftTooFar.Should().BeFalse(); + + // LogTrayEdgeChange + var logMethod = typeof(TaskbarEmbedder).GetMethod( + "LogTrayEdgeChange", + BindingFlags.NonPublic | BindingFlags.Static); + logMethod.Should().NotBeNull(); + logMethod.Invoke(null, [1200, "unit test"]); + logMethod.Invoke(null, [1210, "unit test suppressed change"]); + logMethod.Invoke(null, [1300, "unit test significant change"]); + } + + [Fact] + public void TaskbarEmbedder_CurrentTargetTrayWnd_And_LookupFailureTesting() + { + var dummyHandle = new IntPtr(0x5555); + try + { + TaskbarEmbedder.CurrentTargetTrayWnd = dummyHandle; + TaskbarEmbedder.FindExplorerTrayWnd().Should().Be(dummyHandle); + + TaskbarEmbedder.CurrentTargetTrayWnd = null; + TaskbarEmbedder.ThrowInExplorerLookupForTesting = true; + + var actPrimary = () => TaskbarEmbedder.FindExplorerTrayWnd(); + actPrimary.Should().NotThrow(); + + var actSecondary = () => TaskbarEmbedder.FindExplorerSecondaryTrayWnds(); + actSecondary.Should().NotThrow(); + } + finally + { + TaskbarEmbedder.CurrentTargetTrayWnd = null; + TaskbarEmbedder.ThrowInExplorerLookupForTesting = false; + } + } + + [Fact] + public void TaskbarEmbedder_RefreshTaskbarInfo_SecondaryTargetDisplay() + { + using var dummySecondaryTray = new Form { Bounds = new Rectangle(1920, 1000, 1920, 48) }; + var secDisplay = new DisplayInfo + { + Id = "display_2", + IsPrimary = false, + TaskbarHwnd = dummySecondaryTray.Handle + }; + + var cfg = new AppSettings(); + var embedder = new TaskbarEmbedder(cfg, secDisplay); + + var refreshMethod = typeof(TaskbarEmbedder).GetMethod( + "RefreshTaskbarInfo", + BindingFlags.NonPublic | BindingFlags.Instance); + refreshMethod.Should().NotBeNull(); + + var act = () => refreshMethod.Invoke(embedder, null); + act.Should().NotThrow(); + } } diff --git a/tests/LocalTelemetry.App.Tests/Win32/WindowHelpersTests.cs b/tests/LocalTelemetry.App.Tests/Win32/WindowHelpersTests.cs index 5524832..51887f5 100644 --- a/tests/LocalTelemetry.App.Tests/Win32/WindowHelpersTests.cs +++ b/tests/LocalTelemetry.App.Tests/Win32/WindowHelpersTests.cs @@ -419,4 +419,32 @@ public void SetStartupEnabled_And_LegacyRegistry_Coverage() WindowHelpers.RunKeyQuery = null; } } + + [Fact] + public void WindowHelpers_CheckSchtasksFallback_And_RegistryStartup_Coverage() + { + var checkFallback = typeof(WindowHelpers).GetMethod("CheckSchtasksFallback", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static)!; + var actFallback = () => checkFallback.Invoke(null, null); + actFallback.Should().NotThrow(); + + var isReg = typeof(WindowHelpers).GetMethod("IsRegistryStartupEnabled", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static)!; + var actReg = () => isReg.Invoke(null, null); + actReg.Should().NotThrow(); + + var prevFactory = WindowHelpers.TaskSchedulerFactory; + var prevExitCode = WindowHelpers.StartupQueryExitCode; + try + { + WindowHelpers.StartupQueryExitCode = null; + WindowHelpers.TaskSchedulerFactory = () => throw new InvalidOperationException("Simulated COM failure"); + var isTs = typeof(WindowHelpers).GetMethod("IsScheduledTaskStartupEnabled", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static)!; + var actTs = () => isTs.Invoke(null, null); + actTs.Should().NotThrow(); + } + finally + { + WindowHelpers.TaskSchedulerFactory = prevFactory; + WindowHelpers.StartupQueryExitCode = prevExitCode; + } + } } diff --git a/tests/LocalTelemetry.App.Tests/coverlet.runsettings b/tests/LocalTelemetry.App.Tests/coverlet.runsettings deleted file mode 100644 index ef87ca9..0000000 --- a/tests/LocalTelemetry.App.Tests/coverlet.runsettings +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - cobertura - [LocalTelemetry]* - [LocalTelemetry.Core]* - - - - - diff --git a/tests/LocalTelemetry.Core.Tests/Config/AppSettingsTests.cs b/tests/LocalTelemetry.Core.Tests/Config/AppSettingsTests.cs index e0460dc..fdc5a25 100644 --- a/tests/LocalTelemetry.Core.Tests/Config/AppSettingsTests.cs +++ b/tests/LocalTelemetry.Core.Tests/Config/AppSettingsTests.cs @@ -72,7 +72,7 @@ public void Load_ValidJsonFile_DeserializesCorrectly() ShowSystemTrayIcon = false, EnableFileLogging = false, WindowTheme = "dark", - Monitoring = new MonitoringConfig { PollIntervalMs = 500 }, + Monitoring = new MonitoringConfig { PollIntervalMs = 2000 }, Overlay = new OverlayConfig { Visible = true } }; custom.Save(); @@ -83,7 +83,7 @@ public void Load_ValidJsonFile_DeserializesCorrectly() reloaded.ShowSystemTrayIcon.Should().BeFalse(); reloaded.EnableFileLogging.Should().BeFalse(); reloaded.WindowTheme.Should().Be("dark"); - reloaded.Monitoring.PollIntervalMs.Should().Be(500); + reloaded.Monitoring.PollIntervalMs.Should().Be(2000); reloaded.Overlay.Visible.Should().BeTrue(); } @@ -275,8 +275,6 @@ public void ConfigSubModels_AllPropertiesCoverage() Visible = true, Placement = "right", PlacementOffset = 10, - FloatX = 100, - FloatY = 200, DoubleClickAction = "taskmanager", Opacity = 80, ScalePct = 120, @@ -291,14 +289,12 @@ public void ConfigSubModels_AllPropertiesCoverage() FollowWindowsTheme = false, UserCustomizedMetricColors = ["cpu_pct"], UserCustomizedGroupColors = ["cpu"], - Row1 = ["cpu_pct", "gpu_pct"] + Columns = [["cpu_pct", "gpu_pct"]] }; overlay.Visible.Should().BeTrue(); overlay.Placement.Should().Be("right"); overlay.PlacementOffset.Should().Be(10); - overlay.FloatX.Should().Be(100); - overlay.FloatY.Should().Be(200); overlay.DoubleClickAction.Should().Be("taskmanager"); overlay.Opacity.Should().Be(80); overlay.ScalePct.Should().Be(120); @@ -313,7 +309,8 @@ public void ConfigSubModels_AllPropertiesCoverage() overlay.FollowWindowsTheme.Should().BeFalse(); overlay.UserCustomizedMetricColors.Should().Contain("cpu_pct"); overlay.UserCustomizedGroupColors.Should().Contain("cpu"); - overlay.Row1.Should().HaveCount(2); + overlay.Columns.Should().HaveCount(1); + overlay.Columns[0].Should().HaveCount(2); appSettings.Overlay = overlay; appSettings.Overlay.Should().BeSameAs(overlay); @@ -397,4 +394,121 @@ public void InitPaths_LogsDirBlockedByFile_CatchesExceptionAndFallsBack() AppSettings.LastDirectoryError.Should().NotBeNull(); AppSettings.LogsDir.Should().Be(subDir); } + + [Fact] + public void UpdateConfig_DefaultIncludePrereleases_RespectsVersionAndExplicitOverrides() + { + bool originalDefault = UpdateConfig.DefaultIncludePrereleases; + try + { + // Test beta mode default + UpdateConfig.DefaultIncludePrereleases = true; + var betaCfg = new UpdateConfig(); + betaCfg.IncludePrereleases.Should().BeTrue(); + betaCfg.UserExplicitlySetIncludePrereleases.Should().BeFalse(); + + // Explicit user toggle + betaCfg.IncludePrereleases = false; + betaCfg.UserExplicitlySetIncludePrereleases = true; + betaCfg.IncludePrereleases.Should().BeFalse(); + + // Test stable mode default + UpdateConfig.DefaultIncludePrereleases = false; + var stableCfg = new UpdateConfig(); + stableCfg.IncludePrereleases.Should().BeFalse(); + + // Test config migration when running beta build + UpdateConfig.DefaultIncludePrereleases = true; + var appSettings = new AppSettings(); + appSettings.Updates.IncludePrereleases = false; + appSettings.Updates.UserExplicitlySetIncludePrereleases = false; + appSettings.Save(); + + var loaded = AppSettings.Load(); + loaded.Updates.IncludePrereleases.Should().BeTrue(); + + // Test config migration respects explicit user setting + loaded.Updates.IncludePrereleases = false; + loaded.Updates.UserExplicitlySetIncludePrereleases = true; + loaded.Save(); + + var loadedExplicit = AppSettings.Load(); + loadedExplicit.Updates.IncludePrereleases.Should().BeFalse(); + } + finally + { + UpdateConfig.DefaultIncludePrereleases = originalDefault; + } + } + + [Fact] + public void OverlayConfig_MultiDisplay_DefaultsAndSerialization() + { + var cfg = new OverlayConfig(); + cfg.DisplayMode.Should().Be("primary"); + cfg.EnabledDisplays.Should().ContainSingle().Which.Should().Be("primary"); + + var settings = new AppSettings(); + settings.Overlay.DisplayMode = "custom"; + settings.Overlay.EnabledDisplays = ["primary", "display_2", "display_3"]; + settings.Save(); + + var loaded = AppSettings.Load(); + loaded.Overlay.DisplayMode.Should().Be("custom"); + loaded.Overlay.EnabledDisplays.Should().BeEquivalentTo("primary", "display_2", "display_3"); + } + + [Fact] + public void MigrateConfig_ClampsSubSecondPollIntervalTo1000() + { + var settings = new AppSettings(); + settings.Monitoring.PollIntervalMs = 500; + var method = typeof(AppSettings).GetMethod("MigrateConfig", BindingFlags.NonPublic | BindingFlags.Static)!; + method.Invoke(null, [settings]); + + settings.Monitoring.PollIntervalMs.Should().Be(1000); + } + + [Fact] + public void AppSettings_CopyFrom_CopiesAllPropertiesCorrectly() + { + var source = new AppSettings + { + RunAtStartup = true, + StartMinimized = true, + MinimizeToTrayOnClose = false, + ShowSystemTrayIcon = false, + EnableFileLogging = false, + SystemLogLevel = "Debug", + WindowTheme = "light" + }; + var target = new AppSettings(); + + target.CopyFrom(source); + + target.RunAtStartup.Should().BeTrue(); + target.StartMinimized.Should().BeTrue(); + target.MinimizeToTrayOnClose.Should().BeFalse(); + target.ShowSystemTrayIcon.Should().BeFalse(); + target.EnableFileLogging.Should().BeFalse(); + target.SystemLogLevel.Should().Be("Debug"); + target.WindowTheme.Should().Be("light"); + } + + [Fact] + public void UpdateConfig_Properties_ReadWriteAndDefaults() + { + var cfg = new UpdateConfig + { + CheckFrequency = "daily", + IncludePrereleases = true, + UserExplicitlySetIncludePrereleases = true, + LastCheckUtc = new DateTime(2026, 12, 1, 0, 0, 0, DateTimeKind.Utc) + }; + + cfg.CheckFrequency.Should().Be("daily"); + cfg.IncludePrereleases.Should().BeTrue(); + cfg.UserExplicitlySetIncludePrereleases.Should().BeTrue(); + cfg.LastCheckUtc.Should().Be(new DateTime(2026, 12, 1, 0, 0, 0, DateTimeKind.Utc)); + } } diff --git a/tests/LocalTelemetry.Core.Tests/Diagnostics/LogTests.cs b/tests/LocalTelemetry.Core.Tests/Diagnostics/LogTests.cs index 573ac7e..1c5288d 100644 --- a/tests/LocalTelemetry.Core.Tests/Diagnostics/LogTests.cs +++ b/tests/LocalTelemetry.Core.Tests/Diagnostics/LogTests.cs @@ -210,10 +210,11 @@ public void SessionStartAndEnd_WritesBanners_StartsAtLine1_AndDeduplicatesTermin string content = File.ReadAllText(dedicatedSysLog); // Verify starts on line 1 without leading blank line - content.StartsWith('-').Should().BeTrue(); + content.StartsWith("--------------------------------------------------------------------------------").Should().BeTrue(); content.Should().Contain("LocalTelemetry v1.0.0-test Started"); - content.Should().Contain("OS: Windows 11 Pro (build 26200)"); - content.Should().Contain("LocalTelemetry Terminated | Reason: Windows System Shutdown"); + content.Should().Contain("Admin: Yes"); + content.Should().Contain("Mode: Standard"); + content.Should().Contain("LocalTelemetry Terminated | Reason: Windows System Shutdown | Timestamp: "); content.Should().NotContain("Application Quit"); // deduplicated content.Should().Contain("Session Uptime: 5m 0s"); } @@ -274,7 +275,7 @@ public void RedundantPrefixes_AreStrippedFromMessage() } [Fact] - public void SessionStart_WithNullOsName_UsesFallbackOsDescription() + public void SessionStart_WritesSingleLineSessionHeader() { string dedicatedSysLog = Path.Combine(_tempDir, "sys_osfallback_" + Guid.NewGuid().ToString("N") + ".log"); string dedicatedMetricLog = Path.Combine(_tempDir, "metric_osfallback_" + Guid.NewGuid().ToString("N") + ".log"); @@ -284,9 +285,25 @@ public void SessionStart_WithNullOsName_UsesFallbackOsDescription() Log.Shutdown(); string content = File.ReadAllText(dedicatedSysLog); + content.Should().Contain("--------------------------------------------------------------------------------"); content.Should().Contain("LocalTelemetry v1.2.3 Started"); - content.Should().Contain("OS:"); content.Should().Contain("Admin: No"); + content.Should().Contain("Mode: Floating"); + } + + [Fact] + public void SessionEnd_WritesSingleLineSessionFooter() + { + string dedicatedSysLog = Path.Combine(_tempDir, "sys_footer_" + Guid.NewGuid().ToString("N") + ".log"); + string dedicatedMetricLog = Path.Combine(_tempDir, "metric_footer_" + Guid.NewGuid().ToString("N") + ".log"); + Log.Init(dedicatedSysLog, dedicatedMetricLog, enableMetrics: false); + + Log.SessionEnd("Application Quit", TimeSpan.FromMinutes(12)); + Log.Shutdown(); + + string content = File.ReadAllText(dedicatedSysLog); + content.Should().Contain("LocalTelemetry Terminated | Reason: Application Quit | Timestamp: "); + content.Should().Contain(" | Session Uptime: 12m 0s"); } [Fact] @@ -305,6 +322,42 @@ public void SessionEnd_WithUptimeOverOneHour_FormatsHoursCorrectly() content.Should().Contain("Reason: User Logout"); } + [Fact] + public void ConsecutiveSessions_HaveSingleSeparatorLineBetweenOldAndNewSessions_WithoutDoubleDividers() + { + string dedicatedSysLog = Path.Combine(_tempDir, "sys_consecutive_" + Guid.NewGuid().ToString("N") + ".log"); + string dedicatedMetricLog = Path.Combine(_tempDir, "metric_consecutive_" + Guid.NewGuid().ToString("N") + ".log"); + + // Session 1 + Log.Init(dedicatedSysLog, dedicatedMetricLog, enableMetrics: false); + Log.SessionStart("1.0.0", isAdmin: true, configPath: "test.json", mode: "Standard"); + Log.Info("Session 1 running"); + Log.SessionEnd("Application Quit", TimeSpan.FromMinutes(10)); + Log.Shutdown(); + + // Session 2 in the same log file + Log.Init(dedicatedSysLog, dedicatedMetricLog, enableMetrics: false); + Log.SessionStart("1.0.0", isAdmin: true, configPath: "test.json", mode: "Standard"); + Log.Info("Session 2 running"); + Log.Shutdown(); + + string content = File.ReadAllText(dedicatedSysLog); + string doubleDividerLf = "--------------------------------------------------------------------------------\n--------------------------------------------------------------------------------"; + string doubleDividerCrlf = "--------------------------------------------------------------------------------\r\n--------------------------------------------------------------------------------"; + + content.Should().NotContain(doubleDividerLf); + content.Should().NotContain(doubleDividerCrlf); + + // Verify transition has exactly one separator between Terminated and Started + string[] lines = content.Split(["\r\n", "\n"], StringSplitOptions.None); + int terminatedIndex = Array.FindIndex(lines, l => l.Contains("LocalTelemetry Terminated")); + int startedIndex = Array.FindIndex(lines, terminatedIndex + 1, l => l.Contains("LocalTelemetry v1.0.0 Started")); + + terminatedIndex.Should().BeGreaterThan(-1); + startedIndex.Should().Be(terminatedIndex + 2); // Exactly 1 line between: Terminated, divider, Started + lines[terminatedIndex + 1].Should().Be(new string('-', 80)); + } + [Fact] public void RotateSystemLog_CascadesAllExistingArchives() { diff --git a/tests/LocalTelemetry.Core.Tests/Hardware/DiskQueryTests.cs b/tests/LocalTelemetry.Core.Tests/Hardware/DiskQueryTests.cs index 1dc4005..89ec40b 100644 --- a/tests/LocalTelemetry.Core.Tests/Hardware/DiskQueryTests.cs +++ b/tests/LocalTelemetry.Core.Tests/Hardware/DiskQueryTests.cs @@ -567,7 +567,7 @@ public void DiskQuery_DeviceIoControlOverride_Coverage() return true; }; - var busRes = (string)queryBusMethod.Invoke(null, [101])!; + var busRes = (string)queryBusMethod.Invoke(null, [10101])!; busRes.Should().Be("NVMe"); // Case 2: BusType = 0 (Unknown) @@ -576,7 +576,7 @@ public void DiskQuery_DeviceIoControlOverride_Coverage() Array.Clear(outBuf, 0, outBuf.Length); return true; }; - busRes = (string)queryBusMethod.Invoke(null, [102])!; + busRes = (string)queryBusMethod.Invoke(null, [10102])!; busRes.Should().BeEmpty(); // Case 3: BusType = 99 (> 32 garbage) @@ -588,7 +588,7 @@ public void DiskQuery_DeviceIoControlOverride_Coverage() } return true; }; - busRes = (string)queryBusMethod.Invoke(null, [103])!; + busRes = (string)queryBusMethod.Invoke(null, [10103])!; busRes.Should().BeEmpty(); // Case 4: Exception during parsing @@ -596,7 +596,7 @@ public void DiskQuery_DeviceIoControlOverride_Coverage() { throw new InvalidOperationException("Simulated IOCTL error"); }; - busRes = (string)queryBusMethod.Invoke(null, [104])!; + busRes = (string)queryBusMethod.Invoke(null, [10104])!; busRes.Should().BeEmpty(); // Case 5: Boot drive extents via IOCTL @@ -624,6 +624,197 @@ public void DiskQuery_DeviceIoControlOverride_Coverage() DiskQuery.DeviceIoControlOverride = null; } } + + [Fact] + public void DiskQuery_ParseMsftHealthStatus_ParsesCorrectly() + { + DiskQuery.ParseMsftHealthStatus(0).Should().Be("Healthy"); + DiskQuery.ParseMsftHealthStatus(1).Should().Be("Warning"); + DiskQuery.ParseMsftHealthStatus(2).Should().Be("Unhealthy"); + DiskQuery.ParseMsftHealthStatus((ushort)0).Should().Be("Healthy"); + DiskQuery.ParseMsftHealthStatus((byte)1).Should().Be("Warning"); + DiskQuery.ParseMsftHealthStatus("unknown").Should().Be("Healthy"); + DiskQuery.ParseMsftHealthStatus(null).Should().Be("Healthy"); + } + + [Fact] + public void DiskQuery_QueryNvmeSmart_ParsesTelemetryCorrectly() + { + try + { + DiskQuery.CreateFileOverride = path => new Microsoft.Win32.SafeHandles.SafeFileHandle(new IntPtr(100), true); + DiskQuery.DeviceIoControlOverride = (handle, ioctl, inBuf, outBuf) => + { + if (outBuf.Length >= 560) + { + int payload = 48; + outBuf[payload] = 0; // critWarn = 0 (Healthy) + BitConverter.GetBytes((ushort)323).CopyTo(outBuf, payload + 1); // 323 K = 50 C + outBuf[payload + 5] = 1; // 1% used = 99% life + BitConverter.GetBytes(28515625UL).CopyTo(outBuf, payload + 32); // Total read + BitConverter.GetBytes(32226562UL).CopyTo(outBuf, payload + 48); // Total written + return true; + } + return false; + }; + + var smart = DiskQuery.QuerySmartTelemetry(0, "Healthy"); + smart.HealthStatus.Should().Be("Healthy"); + smart.TemperatureC.Should().Be(50); + smart.RemainingLifePercent.Should().Be(99); + smart.TotalWrittenTb.Should().BeApproximately(15.4, 0.5); + smart.TotalReadTb.Should().BeApproximately(13.6, 0.5); + } + finally + { + DiskQuery.CreateFileOverride = null; + DiskQuery.DeviceIoControlOverride = null; + } + } + + [Fact] + public void DiskQuery_QueryAtaSmart_ParsesTelemetryCorrectly() + { + try + { + DiskQuery.CreateFileOverride = path => new Microsoft.Win32.SafeHandles.SafeFileHandle(new IntPtr(101), true); + DiskQuery.DeviceIoControlOverride = (handle, ioctl, inBuf, outBuf) => + { + // NVMe query is checked first; let NVMe fail to allow ATA check + uint protoType = BitConverter.ToUInt32(inBuf, 8); + if (protoType == 3) return false; + + if (protoType == 1 && outBuf.Length >= 560) + { + int payload = 48; + // Attribute 194 at payload + 2: Temp = 36C + outBuf[payload + 2] = 194; + outBuf[payload + 2 + 3] = 100; + outBuf[payload + 2 + 5] = 36; + + // Attribute 231 at payload + 14: Life = 98% + outBuf[payload + 14] = 231; + outBuf[payload + 14 + 3] = 98; + + // Attribute 241 at payload + 26: Total LBAs written = 20,000,000,000 (~9.3 TB) + outBuf[payload + 26] = 241; + ulong lbas = 20000000000UL; + for (int b = 0; b < 6; b++) + { + outBuf[payload + 26 + 5 + b] = (byte)((lbas >> (b * 8)) & 0xFF); + } + + return true; + } + return false; + }; + + var smart = DiskQuery.QuerySmartTelemetry(1, "Healthy"); + smart.HealthStatus.Should().Be("Healthy"); + smart.TemperatureC.Should().Be(36); + smart.RemainingLifePercent.Should().Be(98); + smart.TotalWrittenTb.Should().BeApproximately(9.3, 0.1); + } + finally + { + DiskQuery.CreateFileOverride = null; + DiskQuery.DeviceIoControlOverride = null; + } + } + + [Fact] + public void DiskQuery_QuerySmartTelemetry_ReturnsDefaultHealthWhenHandleInvalid() + { + try + { + DiskQuery.CreateFileOverride = path => new Microsoft.Win32.SafeHandles.SafeFileHandle(IntPtr.Zero, true); + var smart = DiskQuery.QuerySmartTelemetry(99, "Warning"); + smart.HealthStatus.Should().Be("Warning"); + smart.TemperatureC.Should().BeNull(); + smart.RemainingLifePercent.Should().BeNull(); + smart.TotalWrittenTb.Should().BeNull(); + smart.TotalReadTb.Should().BeNull(); + } + finally + { + DiskQuery.CreateFileOverride = null; + } + } + + [Theory] + [InlineData(0, "Healthy")] + [InlineData(1, "Warning")] + [InlineData(2, "Unhealthy")] + [InlineData(99, "Healthy")] + [InlineData(null, "Healthy")] + public void DiskQuery_ParseMsftHealthStatus_ReturnsExpectedStatus(object? raw, string expected) + { + DiskQuery.ParseMsftHealthStatus(raw).Should().Be(expected); + if (raw is int i) + { + DiskQuery.ParseMsftHealthStatus((ushort)i).Should().Be(expected); + DiskQuery.ParseMsftHealthStatus((byte)i).Should().Be(expected); + } + } + + [Theory] + [InlineData(3, "HDD")] + [InlineData(4, "SSD")] + [InlineData(5, "SCM")] + [InlineData(0, "")] + [InlineData(99, "")] + [InlineData(null, "")] + public void DiskQuery_ParseMsftMediaType_ReturnsExpectedType(object? raw, string expected) + { + DiskQuery.ParseMsftMediaType(raw).Should().Be(expected); + if (raw is int i) + { + DiskQuery.ParseMsftMediaType((ushort)i).Should().Be(expected); + } + } + + [Fact] + public void DiskQuery_QuerySmartTelemetry_AtaAttribute242AndAttribute5Warning() + { + try + { + DiskQuery.CreateFileOverride = path => new Microsoft.Win32.SafeHandles.SafeFileHandle(new IntPtr(102), true); + DiskQuery.DeviceIoControlOverride = (handle, ioctl, inBuf, outBuf) => + { + uint protoType = BitConverter.ToUInt32(inBuf, 8); + if (protoType == 3) return false; + + if (protoType == 1 && outBuf.Length >= 560) + { + int payload = 48; + // Attribute 5 (Reallocated Sectors Count) at payload + 2: raw = 25 > 10, sets Warning + outBuf[payload + 2] = 5; + outBuf[payload + 2 + 3] = 90; + outBuf[payload + 2 + 5] = 25; + + // Attribute 242 (Total LBAs Read) at payload + 14 + outBuf[payload + 14] = 242; + ulong readLbas = 10000000000UL; + for (int b = 0; b < 6; b++) + { + outBuf[payload + 14 + 5 + b] = (byte)((readLbas >> (b * 8)) & 0xFF); + } + + return true; + } + return false; + }; + + var smart = DiskQuery.QuerySmartTelemetry(2, "Healthy"); + smart.HealthStatus.Should().Be("Warning"); + smart.TotalReadTb.Should().BeApproximately(4.7, 0.1); + } + finally + { + DiskQuery.CreateFileOverride = null; + DiskQuery.DeviceIoControlOverride = null; + } + } } diff --git a/tests/LocalTelemetry.Core.Tests/Hardware/EseNetworkUsageReaderTests.cs b/tests/LocalTelemetry.Core.Tests/Hardware/EseNetworkUsageReaderTests.cs index 8801685..54f2bc7 100644 --- a/tests/LocalTelemetry.Core.Tests/Hardware/EseNetworkUsageReaderTests.cs +++ b/tests/LocalTelemetry.Core.Tests/Hardware/EseNetworkUsageReaderTests.cs @@ -9,7 +9,7 @@ namespace LocalTelemetry.Core.Tests.Hardware; [Collection("TrafficHistory")] public class EseNetworkUsageReaderTests { - private static readonly object SyncLock = new(); + private static readonly Lock SyncLock = new(); [Fact] public void EseNetworkUsageReader_GetInterfaceName_MapsIanaTypesCorrectly() @@ -32,7 +32,7 @@ public void EseNetworkUsageReader_GetInterfaceName_MapsIanaTypesCorrectly() public async Task EseNetworkUsageReader_ReadUsageInternalAsync_WithMockDatabase_ReadsRecords() { string tempSrum = Path.Combine(Path.GetTempPath(), $"SRUDB_Mock_{Guid.NewGuid():N}.dat"); - await File.WriteAllTextAsync(tempSrum, "mock esent database content"); + await File.WriteAllTextAsync(tempSrum, "mock esent database content", TestContext.Current.CancellationToken); try { @@ -42,11 +42,7 @@ public async Task EseNetworkUsageReader_ReadUsageInternalAsync_WithMockDatabase_ new() { Date = "01-08-2026", InterfaceType = "Ethernet", DownBytes = 1048576, UpBytes = 524288 } }; - var records = await EseNetworkUsageReader.ReadUsageInternalAsync( - now.AddDays(-7), now, tempSrum, - (exe, src, dst, flag, token) => Task.FromResult(true), - (exe, db) => true, - (dbPath, start, end) => mockRecords); + var records = await EseNetworkUsageReader.ReadUsageInternalAsync(now.AddDays(-7), now, tempSrum, (exe, src, dst, flag, token) => Task.FromResult(true), (exe, db) => true, (dbPath, start, end) => mockRecords, TestContext.Current.CancellationToken); records.Should().HaveCount(1); records[0].InterfaceType.Should().Be("Ethernet"); @@ -115,7 +111,7 @@ public async Task EseNetworkUsageReader_RunEsentutlCopy_WithProcessRunner_TestsB method.Should().NotBeNull(); string tempDest = Path.Combine(Path.GetTempPath(), $"SRUDB_Copy_{Guid.NewGuid():N}.dat"); - await File.WriteAllTextAsync(tempDest, "mock"); + await File.WriteAllTextAsync(tempDest, "mock", TestContext.Current.CancellationToken); try { @@ -156,11 +152,7 @@ public async Task EseNetworkUsageReader_ReadUsageInternalAsync_MissingSrumDataba { string missing = Path.Combine(Path.GetTempPath(), $"SRUDB_Missing_{Guid.NewGuid():N}.dat"); - var records = await EseNetworkUsageReader.ReadUsageInternalAsync( - DateTime.UtcNow.AddDays(-7), DateTime.UtcNow, missing, - (exe, src, dst, flag, token) => Task.FromResult(true), - (exe, db) => true, - (dbPath, start, end) => [new WindowsNetworkUsageRecord()]); + var records = await EseNetworkUsageReader.ReadUsageInternalAsync(DateTime.UtcNow.AddDays(-7), DateTime.UtcNow, missing, (exe, src, dst, flag, token) => Task.FromResult(true), (exe, db) => true, (dbPath, start, end) => [new WindowsNetworkUsageRecord()], TestContext.Current.CancellationToken); records.Should().BeEmpty(); } @@ -169,14 +161,10 @@ public async Task EseNetworkUsageReader_ReadUsageInternalAsync_MissingSrumDataba public async Task EseNetworkUsageReader_ReadUsageInternalAsync_AllCopyMethodsFail_ReturnsEmpty() { string tempSrum = Path.Combine(Path.GetTempPath(), $"SRUDB_CopyFail_{Guid.NewGuid():N}.dat"); - await File.WriteAllTextAsync(tempSrum, "mock esent database content"); + await File.WriteAllTextAsync(tempSrum, "mock esent database content", TestContext.Current.CancellationToken); try { - var records = await EseNetworkUsageReader.ReadUsageInternalAsync( - DateTime.UtcNow.AddDays(-7), DateTime.UtcNow, tempSrum, - (exe, src, dst, flag, token) => Task.FromResult(false), - (exe, db) => true, - (dbPath, start, end) => [new WindowsNetworkUsageRecord()]); + var records = await EseNetworkUsageReader.ReadUsageInternalAsync(DateTime.UtcNow.AddDays(-7), DateTime.UtcNow, tempSrum, (exe, src, dst, flag, token) => Task.FromResult(false), (exe, db) => true, (dbPath, start, end) => [new WindowsNetworkUsageRecord()], TestContext.Current.CancellationToken); records.Should().BeEmpty(); } @@ -190,14 +178,10 @@ public async Task EseNetworkUsageReader_ReadUsageInternalAsync_AllCopyMethodsFai public async Task EseNetworkUsageReader_ReadUsageInternalAsync_RepairFails_ReturnsEmpty() { string tempSrum = Path.Combine(Path.GetTempPath(), $"SRUDB_RepairFail_{Guid.NewGuid():N}.dat"); - await File.WriteAllTextAsync(tempSrum, "mock esent database content"); + await File.WriteAllTextAsync(tempSrum, "mock esent database content", TestContext.Current.CancellationToken); try { - var records = await EseNetworkUsageReader.ReadUsageInternalAsync( - DateTime.UtcNow.AddDays(-7), DateTime.UtcNow, tempSrum, - (exe, src, dst, flag, token) => Task.FromResult(true), - (exe, db) => false, - (dbPath, start, end) => [new WindowsNetworkUsageRecord()]); + var records = await EseNetworkUsageReader.ReadUsageInternalAsync(DateTime.UtcNow.AddDays(-7), DateTime.UtcNow, tempSrum, (exe, src, dst, flag, token) => Task.FromResult(true), (exe, db) => false, (dbPath, start, end) => [new WindowsNetworkUsageRecord()], TestContext.Current.CancellationToken); records.Should().BeEmpty(); } @@ -211,28 +195,24 @@ public async Task EseNetworkUsageReader_ReadUsageInternalAsync_RepairFails_Retur public async Task EseNetworkUsageReader_ReadUsageInternalAsync_FallsBackToSecondCopy_NormalizesDatesAndCleansUp() { string tempSrum = Path.Combine(Path.GetTempPath(), $"SRUDB_Fallback_{Guid.NewGuid():N}.dat"); - await File.WriteAllTextAsync(tempSrum, "mock esent database content"); + await File.WriteAllTextAsync(tempSrum, "mock esent database content", TestContext.Current.CancellationToken); var flags = new List(); DateTime? receivedStart = null; DateTime? receivedEnd = null; string? receivedDest = null; try { - var records = await EseNetworkUsageReader.ReadUsageInternalAsync( - new DateTime(2026, 8, 1, 12, 34, 56, DateTimeKind.Utc), new DateTime(2026, 8, 7, 23, 59, 59, DateTimeKind.Utc), tempSrum, - (exe, src, dst, flag, token) => + var records = await EseNetworkUsageReader.ReadUsageInternalAsync(new DateTime(2026, 8, 1, 12, 34, 56, DateTimeKind.Utc), new DateTime(2026, 8, 7, 23, 59, 59, DateTimeKind.Utc), tempSrum, (exe, src, dst, flag, token) => { flags.Add(flag); return Task.FromResult(flag != "/vss"); - }, - (exe, db) => true, - (dbPath, start, end) => + }, (exe, db) => true, (dbPath, start, end) => { receivedDest = dbPath; receivedStart = start; receivedEnd = end; return [new WindowsNetworkUsageRecord { Date = "01-08-2026", InterfaceType = "Ethernet", DownBytes = 1, UpBytes = 2 }]; - }); + }, TestContext.Current.CancellationToken); records.Should().HaveCount(1); records[0].InterfaceType.Should().Be("Ethernet"); @@ -284,15 +264,11 @@ public async Task EseNetworkUsageReader_ReadRecords_RealDatabase_ReadsAndAggrega new SrumRow(default, 1234, 5678, SrumLuid(6), RawOleTs: double.NaN), // non-finite -> skipped ]); - var records = await EseNetworkUsageReader.ReadUsageInternalAsync( - new DateTime(2026, 8, 1, 0, 0, 0, DateTimeKind.Utc), new DateTime(2026, 8, 7, 0, 0, 0, DateTimeKind.Utc), dbPath, - (exe, src, dst, flag, token) => + var records = await EseNetworkUsageReader.ReadUsageInternalAsync(new DateTime(2026, 8, 1, 0, 0, 0, DateTimeKind.Utc), new DateTime(2026, 8, 7, 0, 0, 0, DateTimeKind.Utc), dbPath, (exe, src, dst, flag, token) => { File.Copy(src, dst, true); return Task.FromResult(true); - }, - (exe, db) => true, - null); + }, (exe, db) => true, null, TestContext.Current.CancellationToken); records.Should().HaveCount(2); records.Should().Contain(r => r.Date == "01-08-2026" && r.InterfaceType == "Ethernet" && r.DownBytes == 2200 && r.UpBytes == 1100); @@ -315,15 +291,11 @@ public async Task EseNetworkUsageReader_ReadRecords_TableNotFound_ReturnsEmpty() ColTimeStamp, ColBytesSent, ColBytesRecvd, ColInterfaceLuid ], null); - var records = await EseNetworkUsageReader.ReadUsageInternalAsync( - new DateTime(2026, 8, 1, 0, 0, 0, DateTimeKind.Utc), new DateTime(2026, 8, 7, 0, 0, 0, DateTimeKind.Utc), dbPath, - (exe, src, dst, flag, token) => + var records = await EseNetworkUsageReader.ReadUsageInternalAsync(new DateTime(2026, 8, 1, 0, 0, 0, DateTimeKind.Utc), new DateTime(2026, 8, 7, 0, 0, 0, DateTimeKind.Utc), dbPath, (exe, src, dst, flag, token) => { File.Copy(src, dst, true); return Task.FromResult(true); - }, - (exe, db) => true, - null); + }, (exe, db) => true, null, TestContext.Current.CancellationToken); records.Should().BeEmpty(); } @@ -496,7 +468,7 @@ public async Task EseNetworkUsageReader_RunEsentutlCopy_DeletesRawFiles() string tempDir = Path.Combine(Path.GetTempPath(), $"temp_ese_{Guid.NewGuid():N}"); Directory.CreateDirectory(tempDir); string dummyRaw = Path.Combine(tempDir, $"test_{Guid.NewGuid():N}.INTEG.RAW"); - await File.WriteAllTextAsync(dummyRaw, "dummy raw content"); + await File.WriteAllTextAsync(dummyRaw, "dummy raw content", TestContext.Current.CancellationToken); var copyMethod = typeof(EseNetworkUsageReader).GetMethod("RunEsentutlCopy", BindingFlags.NonPublic | BindingFlags.Static)!; try @@ -520,13 +492,12 @@ public async Task EseNetworkUsageReader_RunEsentutlCopy_DeletesRawFiles() public async Task EseNetworkUsageReader_MissingEsentutl_ReturnsEmpty() { string dummyDb = Path.Combine(Path.GetTempPath(), $"DummySrum_{Guid.NewGuid():N}.dat"); - await File.WriteAllBytesAsync(dummyDb, [1, 2, 3]); + await File.WriteAllBytesAsync(dummyDb, [1, 2, 3], TestContext.Current.CancellationToken); try { EseNetworkUsageReader.EsentUtlPathOverride = @"C:\NonExistent_Esentutl.exe"; - var records = await EseNetworkUsageReader.ReadUsageInternalAsync( - DateTime.Today.AddDays(-1), DateTime.Today, dummyDb, null, null, null); + var records = await EseNetworkUsageReader.ReadUsageInternalAsync(DateTime.Today.AddDays(-1), DateTime.Today, dummyDb, null, null, null, TestContext.Current.CancellationToken); records.Should().BeEmpty(); } finally diff --git a/tests/LocalTelemetry.Core.Tests/Hardware/HardwareInventoryTests.cs b/tests/LocalTelemetry.Core.Tests/Hardware/HardwareInventoryTests.cs index c2ce65f..4c85191 100644 --- a/tests/LocalTelemetry.Core.Tests/Hardware/HardwareInventoryTests.cs +++ b/tests/LocalTelemetry.Core.Tests/Hardware/HardwareInventoryTests.cs @@ -143,6 +143,31 @@ public void LogHardwareConfiguration_HardwareChanged_GeneratesNewFingerprintAndU state2.Processor.Should().Contain("Intel Core i9-10900K"); } + [Fact] + public void LogHardwareConfiguration_DiscreteGpuAsleep_PreservesDiscreteGpuFromPreviousState() + { + // First run: laptop with both Intel integrated and NVIDIA dedicated GPUs detected + var sysInfo1 = CreateMockSysInfo(); + sysInfo1.GetGpus().Returns([ + (Name: "Intel(R) UHD Graphics", Vendor: "Intel", IsDedicated: false, VramBytes: null, DriverVersion: "32.0.101.7088"), + (Name: "NVIDIA GeForce RTX 2060", Vendor: "NVIDIA", IsDedicated: true, VramBytes: 6442450944, DriverVersion: "550.00") + ]); + var state1 = HardwareInventory.LogHardwareConfiguration(sysInfo1, _stateFilePath); + state1.Graphics.Should().HaveCount(2); + + // Second run: NVIDIA dGPU enters D3cold sleep, only Intel UHD returned by active enumeration + var sysInfo2 = CreateMockSysInfo(); + sysInfo2.GetGpus().Returns([ + (Name: "Intel(R) UHD Graphics", Vendor: "Intel", IsDedicated: false, VramBytes: null, DriverVersion: "32.0.101.7088") + ]); + var state2 = HardwareInventory.LogHardwareConfiguration(sysInfo2, _stateFilePath); + + // Fingerprint must stay identical and dedicated GPU must be preserved + state2.Fingerprint.Should().Be(state1.Fingerprint); + state2.Graphics.Should().HaveCount(2); + state2.Graphics.Should().Contain(g => g.Contains("NVIDIA GeForce RTX 2060") && g.Contains("Dedicated")); + } + [Fact] public void LogHardwareConfiguration_BatteryFullChargedCapacityChanged_KeepsSameFingerprint() { @@ -195,4 +220,41 @@ public void LogHardwareConfiguration_SaveStateError_CatchesException() var act = () => HardwareInventory.LogHardwareConfiguration(sysInfo, invalidPath); act.Should().NotThrow(); } + + [Fact] + public void HardwareInventory_LogChangedHardware_LogsAllDifferentFields() + { + var prev = new HardwareState + { + SystemModel = "Model A", + OsVersion = "Win 10", + FormFactor = "Desktop", + Motherboard = "Mobo A", + Processor = "CPU A", + Graphics = ["GPU A"], + Storage = ["Disk A"], + Memory = "16 GB", + Battery = "Battery A" + }; + var curr = new HardwareState + { + SystemModel = "Model B", + OsVersion = "Win 11", + FormFactor = "Laptop", + Motherboard = "Mobo B", + Processor = "CPU B", + Graphics = ["GPU B1", "GPU B2"], + Storage = ["Disk B1", "Disk B2"], + Memory = "32 GB", + Battery = "Battery B" + }; + + var method = typeof(HardwareInventory).GetMethod( + "LogHardwareDelta", + System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static); + method.Should().NotBeNull(); + + var act = () => method.Invoke(null, [prev, curr, "NVMe", 2]); + act.Should().NotThrow(); + } } diff --git a/tests/LocalTelemetry.Core.Tests/Hardware/HardwareLifecycleManagerTests.cs b/tests/LocalTelemetry.Core.Tests/Hardware/HardwareLifecycleManagerTests.cs index 5ffc4d9..5ebc274 100644 --- a/tests/LocalTelemetry.Core.Tests/Hardware/HardwareLifecycleManagerTests.cs +++ b/tests/LocalTelemetry.Core.Tests/Hardware/HardwareLifecycleManagerTests.cs @@ -293,4 +293,27 @@ public void HardwareLifecycleManager_SubscriptionHooks_CoverCatchBlocks() HardwareLifecycleManager.UnsubscribeNetworkChangeHook = null; } } + + [Fact] + public void HardwareLifecycleManager_SessionUnlock_FiresSessionLockStateChanged() + { + using var manager = new HardwareLifecycleManager(); + bool? lockedState = null; + manager.SessionLockStateChanged += state => lockedState = state; + + var onSessionSwitch = typeof(HardwareLifecycleManager).GetMethod( + "OnSessionSwitch", + System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static); + onSessionSwitch.Should().NotBeNull(); + + var eUnlock = new Microsoft.Win32.SessionSwitchEventArgs(Microsoft.Win32.SessionSwitchReason.SessionUnlock); + onSessionSwitch.Invoke(null, [null, eUnlock]); + + lockedState.Should().BeFalse(); + + var eLock = new Microsoft.Win32.SessionSwitchEventArgs(Microsoft.Win32.SessionSwitchReason.SessionLock); + onSessionSwitch.Invoke(null, [null, eLock]); + + lockedState.Should().BeTrue(); + } } diff --git a/tests/LocalTelemetry.Core.Tests/Hardware/HardwareMonitorTests.cs b/tests/LocalTelemetry.Core.Tests/Hardware/HardwareMonitorTests.cs index de561ee..f953c66 100644 --- a/tests/LocalTelemetry.Core.Tests/Hardware/HardwareMonitorTests.cs +++ b/tests/LocalTelemetry.Core.Tests/Hardware/HardwareMonitorTests.cs @@ -110,8 +110,8 @@ public async Task HardwareMonitor_SnapshotReadyEvent_FiresOnPolling() var pollMethod = typeof(HardwareMonitor).GetMethod("Poll", BindingFlags.NonPublic | BindingFlags.Instance); pollMethod?.Invoke(monitor, null); - var completedTask = await Task.WhenAny(tcs.Task, Task.Delay(10000)); - completedTask.Should().BeSameAs(tcs.Task); + var completedSnapshot = await tcs.Task.WaitAsync(TimeSpan.FromSeconds(10), TestContext.Current.CancellationToken); + completedSnapshot.Should().NotBeNull(); received.Should().NotBeNull(); } @@ -491,7 +491,10 @@ public void ReadGpu_MethodsWithNoSource_ReturnZero() using var m = CreateMonitor(BasicCfg()); SetField(m, "_nvGpu", null); SetField(m, "_amdGpu", null); + SetField(m, "_intelGpu", null); SetField(m, "_wddmGpu", null); + SetField(m, "_gpuVendor", string.Empty); + SetField(m, "_hasDedicatedGpu", false); InvokeFloat(m, "ReadGpuPct", (NvGpuMonitor.NvGpuData?)null).Should().Be(0f); InvokeFloat(m, "ReadGpuTemp", (NvGpuMonitor.NvGpuData?)null).Should().Be(0f); InvokeFloat(m, "ReadGpuVramUsedMb", (NvGpuMonitor.NvGpuData?)null).Should().Be(0f); @@ -499,6 +502,69 @@ public void ReadGpu_MethodsWithNoSource_ReturnZero() InvokeFloat(m, "ReadGpuPowerW", (NvGpuMonitor.NvGpuData?)null).Should().Be(0f); } + [Fact] + public void ReadGpu_IntegratedGpuFallbacks_UsedOnlyWhenNoDedicatedGpu() + { + using var m = CreateMonitor(BasicCfg()); + SetField(m, "_nvGpu", null); + SetField(m, "_amdGpu", null); + SetField(m, "_intelGpu", null); + SetField(m, "_wddmGpu", null); + SetField(m, "_cpuVendor", "Intel"); + SetField(m, "_gpuVendor", "Intel"); + + // 1. When dedicated GPU is present, fallbacks are NOT used + SetField(m, "_hasDedicatedGpu", true); + InvokeFloat(m, "ReadGpuTemp", (NvGpuMonitor.NvGpuData?)null).Should().Be(0f); + InvokeFloat(m, "ReadGpuVramUsedMb", (NvGpuMonitor.NvGpuData?)null).Should().Be(0f); + InvokeFloat(m, "ReadGpuPowerW", (NvGpuMonitor.NvGpuData?)null).Should().Be(0f); + + // 2. When integrated GPU only (no dedicated GPU), fallbacks are active + SetField(m, "_hasDedicatedGpu", false); + m.HasDedicatedGpu.Should().BeFalse(); + } + + [Fact] + public void FormatActiveGpuAdapterLog_FormatsDedicatedAndIntegrated() + { + var method = typeof(HardwareMonitor).GetMethod("FormatActiveGpuAdapterLog", BindingFlags.NonPublic | BindingFlags.Static); + method.Should().NotBeNull(); + + string dResult = (string)method.Invoke(null, ["NVIDIA GeForce RTX 4090", "NVIDIA", true])!; + dResult.Should().Be("NVIDIA GeForce RTX 4090 (Dedicated, NVIDIA)"); + + string iResult = (string)method.Invoke(null, ["Intel(R) Iris(R) Xe Graphics", "Intel", false])!; + iResult.Should().Be("Intel(R) Iris(R) Xe Graphics (Integrated, Intel)"); + + string emptyResult = (string)method.Invoke(null, ["", "Intel", false])!; + emptyResult.Should().Be("Intel (Integrated)"); + + string noneResult = (string)method.Invoke(null, ["", "", false])!; + noneResult.Should().Be("None"); + } + + [Theory] + [InlineData("Intel(R) UHD Graphics 770", "Intel", true)] + [InlineData("Intel(R) UHD Graphics 730", "Intel", true)] + [InlineData("Intel(R) Iris(R) Xe Graphics", "Intel", true)] + [InlineData("Intel(R) HD Graphics 630", "Intel", true)] + [InlineData("Intel(R) Arc(TM) A770 Graphics", "Intel", false)] + [InlineData("Intel(R) Arc(TM) A380 Graphics", "Intel", false)] + [InlineData("Intel(R) Iris(R) Xe MAX Graphics (DG1)", "Intel", false)] + [InlineData("AMD Radeon(TM) Graphics", "AMD", true)] + [InlineData("AMD Radeon Graphics", "AMD", true)] + [InlineData("AMD Radeon 780M", "AMD", true)] + [InlineData("AMD Radeon 680M", "AMD", true)] + [InlineData("AMD Radeon(TM) Vega 8 Graphics", "AMD", true)] + [InlineData("AMD Radeon RX 7900 XTX", "AMD", false)] + [InlineData("AMD Radeon RX 6700 XT", "AMD", false)] + [InlineData("AMD Radeon PRO W7900", "AMD", false)] + [InlineData("NVIDIA GeForce RTX 4090", "NVIDIA", false)] + public void IsKnownIntegratedGpu_IdentifiesDesktopAndMobileIntegratedAdapters(string name, string vendor, bool expected) + { + HardwareMonitor.IsKnownIntegratedGpu(name, vendor).Should().Be(expected); + } + [Fact] public void ReadGpu_WithNvmlMonitor_IfAvailable() { @@ -672,7 +738,7 @@ public void ShouldLogTick_UnknownCategory_UsesDefaultLevel() public void CollectCpuMetrics_Disabled_ReturnsZeros() { using var m = CreateMonitor(BasicCfg()); - var mc = new LocalTelemetry.Core.Config.MonitoringConfig { EnableCpu = false }; + var mc = new MonitoringConfig { EnableCpu = false }; var (cpuPct, cpuTemp, cpuFreq, cpuPower) = ((float, float, float, float))Invoke(m, "CollectCpuMetrics", mc)!; cpuPct.Should().Be(0f); cpuTemp.Should().Be(0f); @@ -1884,9 +1950,10 @@ public void HardwareMonitor_StaticHelpers_CompleteBranchCoverage() { // FormatActiveGpuAdapterLog var formatGpu = typeof(HardwareMonitor).GetMethod("FormatActiveGpuAdapterLog", BindingFlags.NonPublic | BindingFlags.Static)!; - ((string)formatGpu.Invoke(null, ["GeForce RTX 4090", "NVIDIA"])!).Should().Be("GeForce RTX 4090 (NVIDIA)"); - ((string)formatGpu.Invoke(null, ["", "AMD"])!).Should().Be("AMD"); - ((string)formatGpu.Invoke(null, ["", ""])!).Should().Be("None"); + ((string)formatGpu.Invoke(null, ["GeForce RTX 4090", "NVIDIA", true])!).Should().Be("GeForce RTX 4090 (Dedicated, NVIDIA)"); + ((string)formatGpu.Invoke(null, ["Intel(R) Iris(R) Xe Graphics", "Intel", false])!).Should().Be("Intel(R) Iris(R) Xe Graphics (Integrated, Intel)"); + ((string)formatGpu.Invoke(null, ["", "AMD", true])!).Should().Be("AMD (Dedicated)"); + ((string)formatGpu.Invoke(null, ["", "", false])!).Should().Be("None"); // DetectGpuVendor var detectGpu = typeof(HardwareMonitor).GetMethod("DetectGpuVendor", BindingFlags.NonPublic | BindingFlags.Static)!; @@ -2092,7 +2159,7 @@ public void HardwareMonitor_PowerAndLifecycle_Events_Coverage() [Fact] public void HardwareMonitor_IsVirtualAdapter_ComprehensiveBranches() { - void AssertVirtual(string name, string desc, bool expected) + static void AssertVirtual(string name, string desc, bool expected) { var nic = Substitute.For(); nic.Name.Returns(name); @@ -2242,7 +2309,7 @@ public async Task HardwareMonitor_PowerResume_OfflineNic_And_BatteryRate_Coverag HardwareMonitor.PowerResumeWarmUpDelayMs = 10; var onResumed = typeof(HardwareMonitor).GetMethod("OnPowerResumed", BindingFlags.NonPublic | BindingFlags.Instance)!; onResumed.Invoke(monitor, null); - await Task.Delay(50); + await Task.Delay(50, TestContext.Current.CancellationToken); } finally { @@ -2489,7 +2556,7 @@ public void HardwareMonitor_PowerAndNicOverrides_FullBranchCoverage() resNull.Item2.Should().BeFalse(); // 1b. Returns BatteryFlag = 128 (no battery) - HardwareMonitor.SystemPowerStatusOverride = () => new LocalTelemetry.Core.Hardware.NativeMethods.SystemPowerStatus + HardwareMonitor.SystemPowerStatusOverride = () => new NativeMethods.SystemPowerStatus { BatteryFlag = 128 }; @@ -2497,7 +2564,7 @@ public void HardwareMonitor_PowerAndNicOverrides_FullBranchCoverage() resNoBat.Item1.Should().Be(0f); // 1c. Returns active battery: 85%, charging, AC online - HardwareMonitor.SystemPowerStatusOverride = () => new LocalTelemetry.Core.Hardware.NativeMethods.SystemPowerStatus + HardwareMonitor.SystemPowerStatusOverride = () => new NativeMethods.SystemPowerStatus { BatteryFlag = 8, BatteryLifePercent = 85, @@ -2690,7 +2757,7 @@ public async Task HardwareMonitor_TestingSeams_And_ErrorBranches_Coverage() HardwareMonitor.ThrowInPowerResumeWarmUpForTesting = true; var onResumed = typeof(HardwareMonitor).GetMethod("OnPowerResumed", BindingFlags.NonPublic | BindingFlags.Instance); onResumed?.Invoke(monitor, null); - await Task.Delay(50); + await Task.Delay(50, TestContext.Current.CancellationToken); } finally { @@ -2699,8 +2766,8 @@ public async Task HardwareMonitor_TestingSeams_And_ErrorBranches_Coverage() } // 6. PawnIO installation retry branches - var pawnIoMock1 = Substitute.For(); - var transportMock = Substitute.For(); + var pawnIoMock1 = Substitute.For(); + var transportMock = Substitute.For(); transportMock.Execute(Arg.Any(), Arg.Any(), Arg.Any()).Returns([]); int createCalls = 0; pawnIoMock1.TryCreate().Returns(_ => @@ -2717,8 +2784,8 @@ public async Task HardwareMonitor_TestingSeams_And_ErrorBranches_Coverage() initPawn?.Invoke(monitorRetry1, null); } - var pawnIoMock2 = Substitute.For(); - pawnIoMock2.TryCreate().Returns((LocalTelemetry.Core.Hardware.PawnIo.IPawnIoTransport?)null); + var pawnIoMock2 = Substitute.For(); + pawnIoMock2.TryCreate().Returns((IPawnIoTransport?)null); pawnIoMock2.TryInstall().Returns(true); pawnIoMock2.StartDriverService().Returns(true); @@ -2766,4 +2833,235 @@ public async Task HardwareMonitor_TestingSeams_And_ErrorBranches_Coverage() var actWddmUsage = () => (float)mReadGpuPct.Invoke(monitor, [null])!; actWddmUsage.Should().NotThrow(); } + + [Fact] + public void HardwareMonitor_OnSessionLockStateChanged_PausesAndResumesPolling() + { + var cfg = new AppSettings(); + var sysInfoMock = Substitute.For(); + using var monitor = new HardwareMonitor(cfg, sysInfoMock, null); + + var onLockChanged = typeof(HardwareMonitor).GetMethod("OnSessionLockStateChanged", BindingFlags.NonPublic | BindingFlags.Instance); + onLockChanged.Should().NotBeNull(); + + // Lock session + onLockChanged.Invoke(monitor, [true]); + var isLocked = (bool)typeof(HardwareMonitor).GetField("_isSessionLocked", BindingFlags.NonPublic | BindingFlags.Instance)!.GetValue(monitor)!; + var isSuspended = (bool)typeof(HardwareMonitor).GetField("_isSuspended", BindingFlags.NonPublic | BindingFlags.Instance)!.GetValue(monitor)!; + isLocked.Should().BeTrue(); + isSuspended.Should().BeTrue(); + + // Unlock session + onLockChanged.Invoke(monitor, [false]); + isLocked = (bool)typeof(HardwareMonitor).GetField("_isSessionLocked", BindingFlags.NonPublic | BindingFlags.Instance)!.GetValue(monitor)!; + isSuspended = (bool)typeof(HardwareMonitor).GetField("_isSuspended", BindingFlags.NonPublic | BindingFlags.Instance)!.GetValue(monitor)!; + isLocked.Should().BeFalse(); + isSuspended.Should().BeFalse(); + } + + [Fact] + public async Task HardwareMonitor_OnPowerResumed_WhenLocked_DefersWarmUpUntilUnlock() + { + var cfg = new AppSettings(); + var sysInfoMock = Substitute.For(); + using var monitor = new HardwareMonitor(cfg, sysInfoMock, null); + + var prevDelay = HardwareMonitor.PowerResumeWarmUpDelayMs; + HardwareMonitor.PowerResumeWarmUpDelayMs = 10; + try + { + var onLockChanged = typeof(HardwareMonitor).GetMethod("OnSessionLockStateChanged", BindingFlags.NonPublic | BindingFlags.Instance)!; + var onResumed = typeof(HardwareMonitor).GetMethod("OnPowerResumed", BindingFlags.NonPublic | BindingFlags.Instance)!; + + // Session is locked before wake + onLockChanged.Invoke(monitor, [true]); + + onResumed.Invoke(monitor, null); + await Task.Delay(50, TestContext.Current.CancellationToken); + + var needsWarmUp = (bool)typeof(HardwareMonitor).GetField("_needsPowerResumeWarmUp", BindingFlags.NonPublic | BindingFlags.Instance)!.GetValue(monitor)!; + needsWarmUp.Should().BeTrue(); + + // When unlocked, deferred warm-up triggers and clears flag + onLockChanged.Invoke(monitor, [false]); + needsWarmUp = (bool)typeof(HardwareMonitor).GetField("_needsPowerResumeWarmUp", BindingFlags.NonPublic | BindingFlags.Instance)!.GetValue(monitor)!; + needsWarmUp.Should().BeFalse(); + } + finally + { + HardwareMonitor.PowerResumeWarmUpDelayMs = prevDelay; + } + } + + [Fact] + public void CollectDiskMetrics_CachesTemperatures_BetweenSensorIntervals() + { + var cfg = BasicCfg(); + cfg.Monitoring.EnableDisk = true; + cfg.Monitoring.PollIntervalMs = 1000; + using var m = CreateMonitor(cfg); + + var fakeList = new List<(PerformanceCounter read, PerformanceCounter write)> { (null!, null!) }; + SetField(m, "_perDiskCounters", fakeList); + + var cachedTemps = (Dictionary)typeof(HardwareMonitor).GetField("_cachedDiskTemps", BindingFlags.NonPublic | BindingFlags.Instance)!.GetValue(m)!; + cachedTemps[0] = 48; + typeof(HardwareMonitor).GetField("_lastDiskTempQuery", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(m, DateTime.UtcNow); + + var (_, _, disks) = m.CollectDiskMetrics(cfg.Monitoring); + disks.Should().HaveCount(1); + disks[0].TemperatureC.Should().Be(48); + + var onPnP = typeof(HardwareMonitor).GetMethod("OnDevicePnPChanged", BindingFlags.NonPublic | BindingFlags.Instance)!; + onPnP.Invoke(m, null); + cachedTemps.Should().BeEmpty(); + } + + [Fact] + public void HardwareMonitor_DiskArchitecture_And_ComputeMetricDemands_Coverage() + { + HardwareMonitor.ExtractDiskArchitecture(null, null).Should().Be("Disk"); + HardwareMonitor.ExtractDiskArchitecture("NVMe PCIe 4.0", null).Should().Be("NVMe"); + HardwareMonitor.ExtractDiskArchitecture(null, "SATA").Should().Be("SATA"); + HardwareMonitor.ExtractDiskArchitecture(null, "SCSI").Should().Be("SCSI"); + HardwareMonitor.ExtractDiskArchitecture(null, "USB").Should().Be("USB"); + HardwareMonitor.ExtractDiskArchitecture("SSD", null).Should().Be("SSD"); + HardwareMonitor.ExtractDiskArchitecture("HDD", null).Should().Be("HDD"); + HardwareMonitor.ExtractDiskArchitecture("BusTypeUnknown", null).Should().Be("Disk"); + HardwareMonitor.ExtractDiskArchitecture("BusTypeRAID", null).Should().Be("RAID"); + + var labels = HardwareMonitor.ComputeDiskArchitectureLabels([("NVMe", null), ("NVMe", null), (null, null)]); + labels.Should().Equal("NVMe 1", "NVMe 2", "Disk 3"); + + var compute = typeof(HardwareMonitor).GetMethod("ComputeMetricDemands", BindingFlags.NonPublic | BindingFlags.Static)!; + var row = new HashSet + { + "cpu_temp", "cpu_freq", "cpu_power", "ram_pct", "gpu_temp", "gpu_vram", "gpu_freq", "gpu_power", + "net_down", "disk_read", "battery_pct" + }; + var demands = compute.Invoke(null, [row, new LocalTelemetry.Core.Config.AlertConfig()])!; + demands.Should().NotBeNull(); + + var emptyDemands = compute.Invoke(null, [null, null])!; + emptyDemands.Should().NotBeNull(); + } + + [Fact] + public void HardwareMonitor_ResolveMetricDemands_WithoutFileLogging_EvaluatesAllBranches() + { + var cfg = new AppSettings(); + cfg.EnableFileLogging = false; + cfg.Overlay.Columns = [["cpu_temp", "ram_used", "net_up", "battery_rate", "disk_read", "gpu_power"]]; + cfg.Alerts.Enabled = true; + cfg.Alerts.AlertCpuTemp = true; + cfg.Alerts.AlertCpuFreq = true; + cfg.Alerts.AlertCpuPower = true; + cfg.Alerts.AlertRamUsage = true; + cfg.Alerts.AlertGpuTemp = true; + cfg.Alerts.AlertGpuVram = true; + cfg.Alerts.AlertGpuFreq = true; + cfg.Alerts.AlertGpuPower = true; + cfg.Alerts.AlertNetDaily = true; + cfg.Alerts.AlertNetMonthly = true; + cfg.Alerts.AlertDiskTemp = true; + cfg.Alerts.AlertBatteryLow = true; + + using var monitor = CreateMonitor(cfg); + var resolveMethod = typeof(HardwareMonitor).GetMethod( + "GetMetricDemands", + BindingFlags.NonPublic | BindingFlags.Instance); + resolveMethod.Should().NotBeNull(); + + var demands = resolveMethod.Invoke(monitor, null); + demands.Should().NotBeNull(); + + // Also test with null overlay columns and disabled alerts + cfg.Overlay.Columns = null!; + cfg.Alerts.Enabled = false; + var demandsDefault = resolveMethod.Invoke(monitor, null); + demandsDefault.Should().NotBeNull(); + } + + [Fact] + public void HardwareMonitor_ReadWmiCpuTemp_ResetWmiCpuTempForTesting_ExecutesSafely() + { + try + { + HardwareMonitor.ResetWmiCpuTempForTesting = true; + var readMethod = typeof(HardwareMonitor).GetMethod( + "ReadWmiCpuTemp", + BindingFlags.NonPublic | BindingFlags.Static); + readMethod.Should().NotBeNull(); + + var temp = (float)readMethod.Invoke(null, null)!; + temp.Should().BeGreaterThanOrEqualTo(0f); + } + finally + { + HardwareMonitor.ResetWmiCpuTempForTesting = false; + } + } + + private static readonly System.Text.Json.JsonSerializerOptions CamelCaseJsonOpts = new() + { + PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase + }; + + [Fact] + public void HardwareMonitor_OfflineNetwork_LogsAndCleansState() + { + try + { + HardwareMonitor.SelectActiveNicOverride = () => (null, false); + var cfg = new AppSettings(); + cfg.Monitoring.EnableNet = true; + + using var monitor = CreateMonitor(cfg); + var ensureNic = typeof(HardwareMonitor).GetMethod("EnsureNicCounters", BindingFlags.NonPublic | BindingFlags.Instance); + ensureNic.Should().NotBeNull(); + ensureNic.Invoke(monitor, null); + } + finally + { + HardwareMonitor.SelectActiveNicOverride = null; + } + } + + [Fact] + public void HardwareMonitor_DedicatedGpuFallback_FromPreviousState() + { + string tempDir = Path.Combine(Path.GetTempPath(), "HwMonPrevState_" + Guid.NewGuid().ToString("N")); + Directory.CreateDirectory(tempDir); + + try + { + AppSettings.InitPaths(tempDir); + var state = new HardwareState + { + Graphics = ["NVIDIA GeForce RTX 4070 (Dedicated)"] + }; + string json = System.Text.Json.JsonSerializer.Serialize(state, CamelCaseJsonOpts); + File.WriteAllText(AppSettings.HardwareStatePath, json); + + var cfg = new AppSettings(); + cfg.Monitoring.EnableGpu = true; + + var sysInfoMock = Substitute.For(); + sysInfoMock.GetCpuName().Returns("Mock CPU"); + sysInfoMock.GetCpuVendor().Returns("Intel"); + sysInfoMock.GetGpus().Returns([(Name: "Intel UHD Graphics", Vendor: "Intel", IsDedicated: false, VramBytes: null, DriverVersion: null)]); + + var pawnIoMock = Substitute.For(); + using var monitor = new HardwareMonitor(cfg, sysInfoMock, pawnIoMock); + + var hasGpuField = typeof(HardwareMonitor).GetField("_hasDedicatedGpu", BindingFlags.NonPublic | BindingFlags.Instance); + hasGpuField.Should().NotBeNull(); + bool hasGpu = (bool)hasGpuField.GetValue(monitor)!; + hasGpu.Should().BeTrue(); + } + finally + { + try { if (Directory.Exists(tempDir)) Directory.Delete(tempDir, true); } catch (IOException ex) { System.Diagnostics.Trace.WriteLine(ex.Message); } + } + } } diff --git a/tests/LocalTelemetry.Core.Tests/Hardware/JsonlTrafficImporterTests.cs b/tests/LocalTelemetry.Core.Tests/Hardware/JsonlTrafficImporterTests.cs index 445223e..fcc98b6 100644 --- a/tests/LocalTelemetry.Core.Tests/Hardware/JsonlTrafficImporterTests.cs +++ b/tests/LocalTelemetry.Core.Tests/Hardware/JsonlTrafficImporterTests.cs @@ -100,4 +100,104 @@ public void JsonlTrafficImporter_Import_HandlesInvalidFormatsAndDateBoundaries() try { if (File.Exists(tempFile)) File.Delete(tempFile); } catch (IOException ex) { System.Diagnostics.Trace.WriteLine(ex.Message); } } } + + [Fact] + public void JsonlTrafficImporter_Import_SupportsJsonArrayAndBomAndIsoTimestamps() + { + string tempFile = Path.Combine(Path.GetTempPath(), $"JsonlImporter_{Guid.NewGuid():N}.jsonl"); + try + { + var history = new TrafficHistoryFile(tempFile); + TrafficHistoryStore.Initialize(history); + + string arrayContent = "\uFEFF[\n" + + " {\"date\":\"2026-07-21T14:30:00Z\",\"download_bytes\":\"2789279764\",\"upload_bytes\":\"28800094\",\"interface\":\"Ethernet\"},\n" + + " {\"date\":\"19/07/2026 09:00:00\",\"rx_bytes\":17557919323,\"tx_bytes\":317861156,\"interface\":\"Wi-Fi\"},\n" + + " {\"date\":\"2026/07/15\",\"bytes_in\":5455971232,\"bytes_out\":240485610}\n" + + "]"; + + int imported = JsonlTrafficImporter.Import(arrayContent); + imported.Should().Be(3); + + var julyRecords = TrafficHistoryStore.GetMonth(2026, 7); + julyRecords.Should().HaveCount(3); + + var rec21 = julyRecords.FirstOrDefault(r => r.Day == 21); + rec21.DownBytes.Should().Be(2789279764); + rec21.UpBytes.Should().Be(28800094); + rec21.Interface.Should().Be("Ethernet"); + + var rec19 = julyRecords.FirstOrDefault(r => r.Day == 19); + rec19.DownBytes.Should().Be(17557919323); + rec19.UpBytes.Should().Be(317861156); + rec19.Interface.Should().Be("Wi-Fi"); + + var rec15 = julyRecords.FirstOrDefault(r => r.Day == 15); + rec15.DownBytes.Should().Be(5455971232); + rec15.UpBytes.Should().Be(240485610); + rec15.Interface.Should().Be("Backup"); + } + finally + { + try { if (File.Exists(tempFile)) File.Delete(tempFile); } catch (IOException ex) { System.Diagnostics.Trace.WriteLine(ex.Message); } + } + } + + [Fact] + public void JsonlTrafficImporter_Import_ParsesExactCodebaseFileContent() + { + string tempFile = Path.Combine(Path.GetTempPath(), $"JsonlImporter_{Guid.NewGuid():N}.jsonl"); + try + { + var history = new TrafficHistoryFile(tempFile); + TrafficHistoryStore.Initialize(history); + + string fileContent = """ + {"date":"21-07-2026","download_bytes":2789279764,"upload_bytes":28800094,"total_bytes":2818079858,"interface":"Ethernet","source":"imported"} + {"date":"19-07-2026","download_bytes":17557919323,"upload_bytes":317861156,"total_bytes":17875780479,"interface":"Ethernet","source":"imported"} + {"date":"15-07-2026","download_bytes":5455971232,"upload_bytes":240485610,"total_bytes":5696456842,"interface":"Ethernet","source":"imported"} + """; + + int imported = JsonlTrafficImporter.Import(fileContent); + imported.Should().Be(3); + + var julyRecords = TrafficHistoryStore.GetMonth(2026, 7); + julyRecords.Should().HaveCount(3); + } + finally + { + try { if (File.Exists(tempFile)) File.Delete(tempFile); } catch (IOException ex) { System.Diagnostics.Trace.WriteLine(ex.Message); } + } + } + + [Fact] + public void JsonlTrafficImporter_Import_RejectsNegativeBytesAndSanitizesStrings() + { + string tempFile = Path.Combine(Path.GetTempPath(), $"JsonlImporter_{Guid.NewGuid():N}.jsonl"); + try + { + var history = new TrafficHistoryFile(tempFile); + TrafficHistoryStore.Initialize(history); + + string content = """ + {"date":"10-08-2026","download_bytes":-500,"upload_bytes":1000} + {"date":"11-08-2026","download_bytes":1000,"upload_bytes":"-200"} + {"date":"12-08-2026","download_bytes":5000,"upload_bytes":2000,"interface":"Ethernet\r\nInjected","source":"Custom\nSource"} + """; + + int imported = JsonlTrafficImporter.Import(content); + imported.Should().Be(1); + + var monthRecords = TrafficHistoryStore.GetMonth(2026, 8); + monthRecords.Should().ContainSingle(r => r.Day == 12); + + var rec12 = monthRecords.First(r => r.Day == 12); + rec12.Interface.Should().Be("Ethernet Injected"); + rec12.Source.Should().Be("Custom Source"); + } + finally + { + try { if (File.Exists(tempFile)) File.Delete(tempFile); } catch (IOException ex) { System.Diagnostics.Trace.WriteLine(ex.Message); } + } + } } diff --git a/tests/LocalTelemetry.Core.Tests/Hardware/NetUsageLoggerTests.cs b/tests/LocalTelemetry.Core.Tests/Hardware/NetUsageLoggerTests.cs index f92d3a9..e52d38b 100644 --- a/tests/LocalTelemetry.Core.Tests/Hardware/NetUsageLoggerTests.cs +++ b/tests/LocalTelemetry.Core.Tests/Hardware/NetUsageLoggerTests.cs @@ -246,4 +246,80 @@ public void NetUsageLogger_GetTodayTotalGb_And_GetMonthTotalGb() try { if (File.Exists(tempPath)) File.Delete(tempPath); } catch (IOException ex) { System.Diagnostics.Trace.WriteLine(ex.Message); } } } + + [Fact] + public void NetUsageLogger_Record_WithLargeTimeGap_ClampsDelta_ToAvoidSleepSpikes() + { + var cfg = new AppSettings(); + cfg.NetUsage.Enabled = true; + cfg.Monitoring.PollIntervalMs = 1000; + + string tempPath = Path.Combine(Path.GetTempPath(), $"TrafficClamp_{Guid.NewGuid():N}.dat"); + var historyFile = new TrafficHistoryFile(tempPath); + + try + { + using var logger = new NetUsageLogger(cfg, historyFile); + + var snap1 = new TelemetrySnapshot + { + Timestamp = DateTime.Now, + NetInterfaceName = "Ethernet", + NetDownBps = 1_000_000, + NetUpBps = 500_000 + }; + logger.Record(snap1); + + // Simulate resuming from sleep 3600 seconds later + var snap2 = new TelemetrySnapshot + { + Timestamp = snap1.Timestamp.AddSeconds(3600), + NetInterfaceName = "Ethernet", + NetDownBps = 1_000_000, + NetUpBps = 500_000 + }; + logger.Record(snap2); + + // Delta should have been clamped to 1.0s rather than 3600s + // Snap 1 ~ 1MB down, Snap 2 ~ 1MB down => ~2MB down total + var (down, up) = historyFile.GetToday(); + down.Should().BeLessThan(5_000_000); + up.Should().BeLessThan(2_500_000); + } + finally + { + try { if (File.Exists(tempPath)) File.Delete(tempPath); } catch (IOException ex) { System.Diagnostics.Trace.WriteLine(ex.Message); } + } + } + + [Fact] + public void NetUsageLogger_Record_WithNegativeOrNaN_IsIgnored() + { + var cfg = new AppSettings(); + cfg.NetUsage.Enabled = true; + + string tempPath = Path.Combine(Path.GetTempPath(), $"TrafficNaN_{Guid.NewGuid():N}.dat"); + var historyFile = new TrafficHistoryFile(tempPath); + + try + { + using var logger = new NetUsageLogger(cfg, historyFile); + + logger.Record(new TelemetrySnapshot + { + Timestamp = DateTime.Now, + NetInterfaceName = "Ethernet", + NetDownBps = double.NaN, + NetUpBps = -1000 + }); + + var (down, up) = historyFile.GetToday(); + down.Should().Be(0); + up.Should().Be(0); + } + finally + { + try { if (File.Exists(tempPath)) File.Delete(tempPath); } catch (IOException ex) { System.Diagnostics.Trace.WriteLine(ex.Message); } + } + } } diff --git a/tests/LocalTelemetry.Core.Tests/Hardware/NvGpuMonitorTests.cs b/tests/LocalTelemetry.Core.Tests/Hardware/NvGpuMonitorTests.cs index eee14d7..f608c84 100644 --- a/tests/LocalTelemetry.Core.Tests/Hardware/NvGpuMonitorTests.cs +++ b/tests/LocalTelemetry.Core.Tests/Hardware/NvGpuMonitorTests.cs @@ -261,6 +261,8 @@ public void NvGpuMonitor_Query_ConsecutiveUnknownFailures_TriggersDeviceLost() monitor.Query().Should().BeNull(); monitor.IsAvailable.Should().BeFalse(); nativeMock.Received(1).Shutdown(); + nativeMock.DidNotReceive().GetClockInfo(Arg.Any(), Arg.Any(), out Arg.Any()); + nativeMock.DidNotReceive().GetPowerUsage(Arg.Any(), out Arg.Any()); } [Fact] diff --git a/tests/LocalTelemetry.Core.Tests/Hardware/PawnIo/PawnIoDeviceTests.cs b/tests/LocalTelemetry.Core.Tests/Hardware/PawnIo/PawnIoDeviceTests.cs index 8425165..5715749 100644 --- a/tests/LocalTelemetry.Core.Tests/Hardware/PawnIo/PawnIoDeviceTests.cs +++ b/tests/LocalTelemetry.Core.Tests/Hardware/PawnIo/PawnIoDeviceTests.cs @@ -1,5 +1,4 @@ using System.Diagnostics; -using System.Net.Http; using System.Reflection; using System.Runtime.InteropServices; using FluentAssertions; @@ -446,7 +445,7 @@ public void PawnIoDevice_RunInstaller_And_StartDriver_NonElevated_Coverage() try { var runInstaller = typeof(PawnIoDevice).GetMethod("RunInstaller", BindingFlags.NonPublic | BindingFlags.Static)!; - int code = (int)runInstaller.Invoke(null, [new System.Diagnostics.ProcessStartInfo("cmd.exe")])!; + int code = (int)runInstaller.Invoke(null, [new ProcessStartInfo("cmd.exe")])!; code.Should().Be(-1); bool started = PawnIoDevice.StartDriverService(); @@ -514,7 +513,7 @@ public void PawnIoDevice_GetDefaultInstallerUri_And_InstallerBranches_Coverage() } // 5. Execute with non-null input array - using var invalidHandle = new Microsoft.Win32.SafeHandles.SafeFileHandle(new IntPtr(-1), false); + using var invalidHandle = new SafeFileHandle(new IntPtr(-1), false); var device = new PawnIoDevice(invalidHandle); var res = device.Execute("test_fn", [12345UL], 1); res.Should().BeEmpty(); @@ -526,7 +525,7 @@ public void PawnIoDevice_OverridesAndExecute_Coverage() try { // 1. TryCreate with CreateFileOverride - PawnIoDevice.CreateFileOverride = _ => new Microsoft.Win32.SafeHandles.SafeFileHandle(new IntPtr(1234), false); + PawnIoDevice.CreateFileOverride = _ => new SafeFileHandle(new IntPtr(1234), false); var dev = PawnIoDevice.TryCreate(); dev.Should().NotBeNull(); @@ -629,7 +628,7 @@ public void PawnIoDevice_ProcessLauncher_And_PrivilegeException_And_HttpClientFa var downloadMethod = typeof(PawnIoDevice).GetMethod("DownloadInstallerBytes", BindingFlags.NonPublic | BindingFlags.Static); var downloaded = (byte[])downloadMethod?.Invoke(null, null)!; - downloaded.Should().Equal([0x4D, 0x5A, 0x90, 0x00]); + downloaded.Should().Equal(0x4D, 0x5A, 0x90, 0x00); // Test RunInstaller using ProcessLauncher var runInstaller = typeof(PawnIoDevice).GetMethod("RunInstaller", BindingFlags.NonPublic | BindingFlags.Static); @@ -647,6 +646,26 @@ public void PawnIoDevice_ProcessLauncher_And_PrivilegeException_And_HttpClientFa } } + [Fact] + public void PawnIoDevice_DeletePawnIoTempFiles_RemovesMatchingTempFilesAndDirectories() + { + string tempDir = Path.GetTempPath(); + string dummyFile = Path.Combine(tempDir, $"PawnIO_test_{Guid.NewGuid():N}.tmp"); + string dummyDir = Path.Combine(tempDir, $"PawnIO_dir_{Guid.NewGuid():N}.tmp"); + + File.WriteAllText(dummyFile, "test"); + Directory.CreateDirectory(dummyDir); + File.WriteAllText(Path.Combine(dummyDir, "test.sys"), "test"); + + File.Exists(dummyFile).Should().BeTrue(); + Directory.Exists(dummyDir).Should().BeTrue(); + + PawnIoDevice.DeletePawnIoTempFiles(); + + File.Exists(dummyFile).Should().BeFalse(); + Directory.Exists(dummyDir).Should().BeFalse(); + } + private sealed class FakeHttpMessageHandler(HttpResponseMessage response) : HttpMessageHandler { protected override Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) diff --git a/tests/LocalTelemetry.Core.Tests/Hardware/SystemInfoTests.cs b/tests/LocalTelemetry.Core.Tests/Hardware/SystemInfoTests.cs index 161edc5..7726e62 100644 --- a/tests/LocalTelemetry.Core.Tests/Hardware/SystemInfoTests.cs +++ b/tests/LocalTelemetry.Core.Tests/Hardware/SystemInfoTests.cs @@ -1,12 +1,13 @@ using System.Reflection; using System.Text; using FluentAssertions; +using LocalTelemetry.Core.Config; using LocalTelemetry.Core.Hardware; using LocalTelemetry.Core.Hardware.PawnIo; using NSubstitute; using Xunit; -[assembly: CollectionBehavior(DisableTestParallelization = true)] +[assembly: Xunit.v3.Parallelization(Mode = Xunit.Sdk.ParallelMode.None)] namespace LocalTelemetry.Core.Tests.Hardware; @@ -690,12 +691,16 @@ public void SystemInfo_InternalCpuMethods_And_BatteryFlows_Coverage() var batNameField = typeof(SystemInfo).GetField("_batteryDeviceNameCache", BindingFlags.NonPublic | BindingFlags.Static); var batCapField = typeof(SystemInfo).GetField("_batteryDesignCapacityCache", BindingFlags.NonPublic | BindingFlags.Static); var batFccField = typeof(SystemInfo).GetField("_batteryFullChargeCapacityCache", BindingFlags.NonPublic | BindingFlags.Static); + var batCapMwhField = typeof(SystemInfo).GetField("_batteryDesignCapacityMwhCache", BindingFlags.NonPublic | BindingFlags.Static); + var batFccMwhField = typeof(SystemInfo).GetField("_batteryFullChargeCapacityMwhCache", BindingFlags.NonPublic | BindingFlags.Static); object? origHasBat = hasBatField!.GetValue(null); object? origMfr = batMfrField!.GetValue(null); object? origName = batNameField!.GetValue(null); object? origCap = batCapField!.GetValue(null); object? origFcc = batFccField!.GetValue(null); + object? origCapMwh = batCapMwhField!.GetValue(null); + object? origFccMwh = batFccMwhField!.GetValue(null); try { @@ -704,6 +709,8 @@ public void SystemInfo_InternalCpuMethods_And_BatteryFlows_Coverage() batNameField.SetValue(null, null); batCapField.SetValue(null, null); batFccField.SetValue(null, null); + batCapMwhField.SetValue(null, null); + batFccMwhField.SetValue(null, null); SystemInfo.GetBatteryManufacturer().Should().NotBeNullOrEmpty(); SystemInfo.GetBatteryDeviceName().Should().NotBeNullOrEmpty(); @@ -721,6 +728,8 @@ public void SystemInfo_InternalCpuMethods_And_BatteryFlows_Coverage() batNameField.SetValue(null, origName); batCapField.SetValue(null, origCap); batFccField.SetValue(null, origFcc); + batCapMwhField.SetValue(null, origCapMwh); + batFccMwhField.SetValue(null, origFccMwh); } }); } @@ -2596,7 +2605,7 @@ public void SystemInfo_BatteryAndGpuFallbacks_FullBranchCoverage() if (isDiscreteMethod is not null) { // Intel Arc - var devInfo = new LocalTelemetry.Core.Hardware.NativeMethods.SpDevinfoData(); + var devInfo = new NativeMethods.SpDevinfoData(); ((bool)isDiscreteMethod.Invoke(null, ["Intel(R) Arc(TM) A770", "Intel", IntPtr.Zero, devInfo])!).Should().BeTrue(); // AMD RX ((bool)isDiscreteMethod.Invoke(null, ["AMD Radeon RX 6700 XT", "AMD", IntPtr.Zero, devInfo])!).Should().BeTrue(); @@ -2798,6 +2807,79 @@ public void SystemInfo_ComprehensiveEdgeCases_Coverage() } } + [Fact] + public void SystemInfo_ResolveBatteryVendorToken_HandlesPatternsCodesAndBoundaries() + { + SystemInfo.ResolveBatteryVendorToken("").Should().BeEmpty(); + SystemInfo.ResolveBatteryVendorToken(" ").Should().BeEmpty(); + SystemInfo.ResolveBatteryVendorToken("Sunwoda Electronics").Should().Be("Sunwoda"); + SystemInfo.ResolveBatteryVendorToken("SWD").Should().Be("Sunwoda"); + SystemInfo.ResolveBatteryVendorToken("123-SWD-456").Should().Be("Sunwoda"); + SystemInfo.ResolveBatteryVendorToken("XSWDX").Should().BeEmpty(); + SystemInfo.ResolveBatteryVendorToken("UnknownBrandXYZ").Should().BeEmpty(); + } + + private static readonly System.Text.Json.JsonSerializerOptions CamelCaseJsonOpts = new() + { + PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase + }; + + [Fact] + public void SystemInfo_GetGpuBrandColorAndVendor_FallbackToPreviousState() + { + string tempDir = Path.Combine(Path.GetTempPath(), "SysInfoPrevState_" + Guid.NewGuid().ToString("N")); + Directory.CreateDirectory(tempDir); + + try + { + AppSettings.InitPaths(tempDir); + var state = new HardwareState + { + Graphics = ["NVIDIA GeForce RTX 4080 (Dedicated)"] + }; + string json = System.Text.Json.JsonSerializer.Serialize(state, CamelCaseJsonOpts); + File.WriteAllText(AppSettings.HardwareStatePath, json); + + // Set _gpusCache via reflection to only integrated or empty + var cacheField = typeof(SystemInfo).GetField("_gpusCache", BindingFlags.NonPublic | BindingFlags.Static); + cacheField?.SetValue(null, Array.Empty<(string Name, string Vendor, bool IsDedicated, long? VramBytes, string? DriverVersion)>()); + + string color = SystemInfo.GetGpuColor(); + color.Should().Be("#76B900"); // NVIDIA Brand color + + string vendor = SystemInfo.GetGpuVendor(); + vendor.Should().Be("NVIDIA"); + + // Repeat with AMD + state.Graphics = ["AMD Radeon RX 7900 XTX (Dedicated)"]; + File.WriteAllText(AppSettings.HardwareStatePath, System.Text.Json.JsonSerializer.Serialize(state, CamelCaseJsonOpts)); + cacheField?.SetValue(null, Array.Empty<(string Name, string Vendor, bool IsDedicated, long? VramBytes, string? DriverVersion)>()); + + SystemInfo.GetGpuColor().Should().Be("#ED1C24"); // AMD Brand color + SystemInfo.GetGpuVendor().Should().Be("AMD"); + } + finally + { + SystemInfo.ResetCaches(); + try { if (Directory.Exists(tempDir)) Directory.Delete(tempDir, true); } catch (IOException ex) { System.Diagnostics.Trace.WriteLine(ex.Message); } + } + } + + [Fact] + public void SystemInfo_ThrowInWin32BatteryGenericException_CatchesGracefully() + { + try + { + SystemInfo.ThrowInWin32BatteryGenericExceptionForTesting = true; + string mfr = SystemInfo.GetBatteryManufacturer(); + mfr.Should().NotBeNull(); + } + finally + { + SystemInfo.ThrowInWin32BatteryGenericExceptionForTesting = false; + } + } + private sealed class MockPawnIoSpeedTransport(ulong[] returnValues) : IPawnIoTransport { public ulong[] Execute(string name, ulong[]? input, int outLength) => returnValues; diff --git a/tests/LocalTelemetry.Core.Tests/Hardware/TrafficHistoryStoreTests.cs b/tests/LocalTelemetry.Core.Tests/Hardware/TrafficHistoryStoreTests.cs index 6ac958a..2e00c03 100644 --- a/tests/LocalTelemetry.Core.Tests/Hardware/TrafficHistoryStoreTests.cs +++ b/tests/LocalTelemetry.Core.Tests/Hardware/TrafficHistoryStoreTests.cs @@ -7,7 +7,7 @@ namespace LocalTelemetry.Core.Tests.Hardware; [Collection("TrafficHistory")] public class TrafficHistoryStoreTests { - private static readonly object SyncLock = new(); + private static readonly Lock SyncLock = new(); [Fact] public void TrafficHistoryStore_InitializeAndDelegates() diff --git a/tests/LocalTelemetry.Core.Tests/Hardware/WddmGpuMonitorTests.cs b/tests/LocalTelemetry.Core.Tests/Hardware/WddmGpuMonitorTests.cs index ab50a9c..32a687f 100644 --- a/tests/LocalTelemetry.Core.Tests/Hardware/WddmGpuMonitorTests.cs +++ b/tests/LocalTelemetry.Core.Tests/Hardware/WddmGpuMonitorTests.cs @@ -318,5 +318,54 @@ public void WddmGpuMonitor_NativeHooks_FailurePaths_Coverage() WddmGpuMonitor.ResetHooks(); } } -} + [Fact] + public void WddmGpuMonitor_GetSharedMemoryUsedMb_Behaviors() + { + var monitor = new WddmGpuMonitor(); + if (monitor.IsAvailable) + { + float sharedMb = monitor.GetSharedMemoryUsedMb(); + sharedMb.Should().BeGreaterThanOrEqualTo(0f); + } + + monitor.Dispose(); + monitor.GetSharedMemoryUsedMb().Should().Be(0f); + } + + [Fact] + public void WddmGpuMonitor_AdapterMemoryCountersFailure_LeavesIsAvailableTrue() + { + try + { + var originalAddCounter = WddmGpuMonitor.PdhAddEnglishCounterFunc; + WddmGpuMonitor.PdhAddEnglishCounterFunc = (IntPtr q, string path, IntPtr ud, out IntPtr c) => + { + if (path.Contains("GPU Adapter Memory")) + { + c = IntPtr.Zero; + return -1; // Status error + } + return originalAddCounter(q, path, ud, out c); + }; + + using var monitor = new WddmGpuMonitor(); + if (monitor.IsAvailable) + { + monitor.GetSharedMemoryUsedMb().Should().Be(0f); + } + } + finally + { + WddmGpuMonitor.ResetHooks(); + } + } + + [Fact] + public void WddmGpuMonitor_GetAdapterLuid_WithMismatchedGpuName_FallsBackGracefully() + { + string? luid = WddmGpuMonitor.GetAdapterLuid("NonExistentGpu_9999"); + // Should either resolve first hardware adapter or return null gracefully + luid.Should().Be(luid); + } +} diff --git a/tests/LocalTelemetry.Core.Tests/Hardware/WindowsNetworkUsageProviderTests.cs b/tests/LocalTelemetry.Core.Tests/Hardware/WindowsNetworkUsageProviderTests.cs index cf3cef1..6be866b 100644 --- a/tests/LocalTelemetry.Core.Tests/Hardware/WindowsNetworkUsageProviderTests.cs +++ b/tests/LocalTelemetry.Core.Tests/Hardware/WindowsNetworkUsageProviderTests.cs @@ -62,7 +62,7 @@ public async Task WindowsNetworkUsageProvider_ImportDateRangeAsync_And_MergeHist DateTime tenDaysAgo = DateTime.Today.AddDays(-10); // 1. Inverted date range -> returns failure - var invertedResult = await WindowsNetworkUsageProvider.ImportDateRangeAsync(historyFile, yesterday, tenDaysAgo); + var invertedResult = await WindowsNetworkUsageProvider.ImportDateRangeAsync(historyFile, yesterday, tenDaysAgo, TestContext.Current.CancellationToken); invertedResult.Success.Should().BeFalse(); invertedResult.ErrorMessage.Should().Contain("Start date must be before or equal to End date"); @@ -104,7 +104,7 @@ public async Task WindowsNetworkUsageProvider_Logging_InstallDate_And_ImportFlow historyFile.SetDay(yesterday.Year, yesterday.Month, yesterday.Day, 1000, 2000, "Ethernet", "Test"); // Up-to-date run - await WindowsNetworkUsageProvider.ImportAndSaveHistoryAsync(historyFile); + await WindowsNetworkUsageProvider.ImportAndSaveHistoryAsync(historyFile, TestContext.Current.CancellationToken); // ImportTodayBaselineAsync via reflection with empty vs existing var importToday = typeof(WindowsNetworkUsageProvider).GetMethod("ImportTodayBaselineAsync", BindingFlags.NonPublic | BindingFlags.Static); @@ -154,7 +154,7 @@ public async Task WindowsNetworkUsageProvider_ImportDateRangeAsync_ClampsFutureE DateTime startDate = DateTime.Today.AddDays(-2); DateTime futureDate = DateTime.Today.AddDays(10); - var result = await WindowsNetworkUsageProvider.ImportDateRangeAsync(historyFile, startDate, futureDate); + var result = await WindowsNetworkUsageProvider.ImportDateRangeAsync(historyFile, startDate, futureDate, TestContext.Current.CancellationToken); result.Should().NotBeNull(); } finally @@ -212,11 +212,11 @@ public async Task WindowsNetworkUsageProvider_ImportHistoricalRecordsAsync_Execu public async Task WindowsNetworkUsageProvider_GetUsageAsync_SingleDay_And_HistoricalRange_Coverage() { // 1. Single day (start == end) - var singleDay = await WindowsNetworkUsageProvider.GetUsageAsync(DateTime.Today, DateTime.Today); + var singleDay = await WindowsNetworkUsageProvider.GetUsageAsync(DateTime.Today, DateTime.Today, TestContext.Current.CancellationToken); singleDay.Should().NotBeNull(); // 2. Historical chunk range (different dates) - var multiDay = await WindowsNetworkUsageProvider.GetUsageAsync(DateTime.Today.AddDays(-3), DateTime.Today.AddDays(-1)); + var multiDay = await WindowsNetworkUsageProvider.GetUsageAsync(DateTime.Today.AddDays(-3), DateTime.Today.AddDays(-1), TestContext.Current.CancellationToken); multiDay.Should().NotBeNull(); // 3. With cancelled token @@ -460,12 +460,12 @@ public async Task WindowsNetworkUsageProvider_ImportDateRangeAsync_DetailedOutco DateTime endDate = DateTime.Today.AddDays(-1); // Import past range - var result = await WindowsNetworkUsageProvider.ImportDateRangeAsync(historyFile, startDate, endDate); + var result = await WindowsNetworkUsageProvider.ImportDateRangeAsync(historyFile, startDate, endDate, TestContext.Current.CancellationToken); result.Success.Should().BeTrue(); result.DaysImported.Should().BeGreaterThanOrEqualTo(0); // Re-import same range -> days imported should be 0 and message indicates up-to-date or no activity - var reimport = await WindowsNetworkUsageProvider.ImportDateRangeAsync(historyFile, startDate, endDate); + var reimport = await WindowsNetworkUsageProvider.ImportDateRangeAsync(historyFile, startDate, endDate, TestContext.Current.CancellationToken); reimport.Success.Should().BeTrue(); reimport.Message.Should().NotBeNullOrEmpty(); } @@ -655,27 +655,27 @@ public async Task WindowsNetworkUsageProvider_AdapterFactory_FullCoverage() { // 1. Null adapter WindowsNetworkUsageProvider.AdapterFactory = () => null; - var nullRes = await WindowsNetworkUsageProvider.GetUsageAsync(DateTime.Today, DateTime.Today); + var nullRes = await WindowsNetworkUsageProvider.GetUsageAsync(DateTime.Today, DateTime.Today, TestContext.Current.CancellationToken); nullRes.Should().BeEmpty(); // 2. Non-physical IANA type WindowsNetworkUsageProvider.AdapterFactory = () => new MockTestNetworkAdapter("MockNonPhysical", "guid-nonphys", 99u, (_, _, _) => Task.FromResult>([])); - var nonPhysRes = await WindowsNetworkUsageProvider.GetUsageAsync(DateTime.Today, DateTime.Today); + var nonPhysRes = await WindowsNetworkUsageProvider.GetUsageAsync(DateTime.Today, DateTime.Today, TestContext.Current.CancellationToken); nonPhysRes.Should().BeEmpty(); // 3. Single day query success WindowsNetworkUsageProvider.AdapterFactory = () => new MockTestNetworkAdapter("MockEthernet", "guid-eth", 6u, (_, _, _) => Task.FromResult>([(1000UL, 500UL), (200UL, 100UL)])); - var singleRes = await WindowsNetworkUsageProvider.GetUsageAsync(DateTime.Today, DateTime.Today); + var singleRes = await WindowsNetworkUsageProvider.GetUsageAsync(DateTime.Today, DateTime.Today, TestContext.Current.CancellationToken); singleRes.Should().ContainSingle(r => r.DownBytes == 1200 && r.UpBytes == 600); // 4. Single day query throws exception WindowsNetworkUsageProvider.AdapterFactory = () => new MockTestNetworkAdapter("MockThrow", "guid-throw", 6u, (_, _, _) => throw new InvalidOperationException("API failure")); - var throwRes = await WindowsNetworkUsageProvider.GetUsageAsync(DateTime.Today, DateTime.Today); + var throwRes = await WindowsNetworkUsageProvider.GetUsageAsync(DateTime.Today, DateTime.Today, TestContext.Current.CancellationToken); throwRes.Should().BeEmpty(); // 5. Multi-day 35-day query success WindowsNetworkUsageProvider.AdapterFactory = () => new MockTestNetworkAdapter("MockMulti", "guid-multi", 71u, (_, _, _) => Task.FromResult>([(500UL, 250UL)])); - var multiRes = await WindowsNetworkUsageProvider.GetUsageAsync(DateTime.Today.AddDays(-35), DateTime.Today); + var multiRes = await WindowsNetworkUsageProvider.GetUsageAsync(DateTime.Today.AddDays(-35), DateTime.Today, TestContext.Current.CancellationToken); multiRes.Should().NotBeEmpty(); // 6. Multi-day query with 30-day failure falling back to 7-day slices @@ -686,12 +686,12 @@ public async Task WindowsNetworkUsageProvider_AdapterFactory_FullCoverage() if (callCount == 1) throw new InvalidOperationException("30-day query failed"); return Task.FromResult>([(300UL, 150UL)]); }); - var fallbackRes = await WindowsNetworkUsageProvider.GetUsageAsync(DateTime.Today.AddDays(-14), DateTime.Today); + var fallbackRes = await WindowsNetworkUsageProvider.GetUsageAsync(DateTime.Today.AddDays(-14), DateTime.Today, TestContext.Current.CancellationToken); fallbackRes.Should().NotBeEmpty(); // 7. Multi-day slice query throwing on all attempts WindowsNetworkUsageProvider.AdapterFactory = () => new MockTestNetworkAdapter("MockSliceThrow", "guid-fail", 6u, (_, _, _) => throw new InvalidOperationException("Slice failure")); - var allFailRes = await WindowsNetworkUsageProvider.GetUsageAsync(DateTime.Today.AddDays(-5), DateTime.Today); + var allFailRes = await WindowsNetworkUsageProvider.GetUsageAsync(DateTime.Today.AddDays(-5), DateTime.Today, TestContext.Current.CancellationToken); allFailRes.Should().BeEmpty(); } finally @@ -717,7 +717,7 @@ public async Task WindowsNetworkUsageProvider_TodayBaseline_And_CatchPaths_Cover updated.Should().BeTrue(); // 2. RefreshTodayUsageAsync normal flow - await WindowsNetworkUsageProvider.RefreshTodayUsageAsync(historyFile); + await WindowsNetworkUsageProvider.RefreshTodayUsageAsync(historyFile, TestContext.Current.CancellationToken); // 3. Catch path in RefreshTodayUsageAsync var actRefreshThrow = async () => await WindowsNetworkUsageProvider.RefreshTodayUsageAsync(null!); @@ -728,7 +728,7 @@ public async Task WindowsNetworkUsageProvider_TodayBaseline_And_CatchPaths_Cover await actImportSaveThrow.Should().NotThrowAsync(); // 5. Catch path in ImportDateRangeAsync - var resultRange = await WindowsNetworkUsageProvider.ImportDateRangeAsync(null!, DateTime.Today.AddDays(-2), DateTime.Today); + var resultRange = await WindowsNetworkUsageProvider.ImportDateRangeAsync(null!, DateTime.Today.AddDays(-2), DateTime.Today, TestContext.Current.CancellationToken); resultRange.Success.Should().BeFalse(); // 6. ImportHistoricalRecordsAsync when history is already up to date @@ -851,7 +851,7 @@ public async Task WindowsNetworkUsageProvider_ImportHistoricalZero_Coverage() WindowsNetworkUsageProvider.AdapterFactory = () => new MockTestNetworkAdapter( "MockEth", Guid.NewGuid().ToString("D"), 6u, (_, _, _) => Task.FromResult>([])); - var res = await WindowsNetworkUsageProvider.ImportDateRangeAsync(historyFile, start, end); + var res = await WindowsNetworkUsageProvider.ImportDateRangeAsync(historyFile, start, end, TestContext.Current.CancellationToken); res.Success.Should().BeTrue(); res.DaysImported.Should().Be(0); } @@ -871,7 +871,7 @@ public async Task WindowsNetworkUsageProvider_ErrorPaths_And_TodayBaselineInitia // Test ThrowInGetDefaultAdapterForTesting WindowsNetworkUsageProvider.ThrowInGetDefaultAdapterForTesting = true; WindowsNetworkUsageProvider.AdapterFactory = null; - var usage = await WindowsNetworkUsageProvider.GetUsageAsync(DateTime.Today, DateTime.Today); + var usage = await WindowsNetworkUsageProvider.GetUsageAsync(DateTime.Today, DateTime.Today, TestContext.Current.CancellationToken); usage.Should().BeEmpty(); } finally @@ -915,7 +915,7 @@ public async Task WindowsNetworkUsageProvider_ErrorPaths_And_TodayBaselineInitia 6u, (_, _, _) => Task.FromResult>([(5000UL, 3000UL)])); - await WindowsNetworkUsageProvider.RefreshTodayUsageAsync(historyFile); + await WindowsNetworkUsageProvider.RefreshTodayUsageAsync(historyFile, TestContext.Current.CancellationToken); var today = DateTime.Today; var entry = historyFile.Find(today.Year, today.Month, today.Day, "Ethernet"); entry.HasValue.Should().BeTrue(); diff --git a/tests/LocalTelemetry.Core.Tests/LocalTelemetry.Core.Tests.csproj b/tests/LocalTelemetry.Core.Tests/LocalTelemetry.Core.Tests.csproj index 58b0529..e24b1eb 100644 --- a/tests/LocalTelemetry.Core.Tests/LocalTelemetry.Core.Tests.csproj +++ b/tests/LocalTelemetry.Core.Tests/LocalTelemetry.Core.Tests.csproj @@ -1,7 +1,10 @@ - net10.0-windows10.0.19041.0 + net11.0-windows10.0.19041.0 + Exe + true + true enable enable false @@ -12,24 +15,10 @@ - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - + + - diff --git a/tests/LocalTelemetry.Core.Tests/Models/MetricsTests.cs b/tests/LocalTelemetry.Core.Tests/Models/MetricsTests.cs index 64d3221..790194e 100644 --- a/tests/LocalTelemetry.Core.Tests/Models/MetricsTests.cs +++ b/tests/LocalTelemetry.Core.Tests/Models/MetricsTests.cs @@ -13,6 +13,7 @@ public void Metrics_RegisterDisk_AddsDescriptorsAndMapEntry() Metrics.AllMetricsById.Should().ContainKey("disk_testdisk_read"); Metrics.AllMetricsById.Should().ContainKey("disk_testdisk_write"); + Metrics.AllMetricsById.Should().ContainKey("disk_testdisk_temp"); // Duplicate registration should be no-op Metrics.RegisterDisk("testdisk", "DISK_TEST"); @@ -146,6 +147,7 @@ public void Metrics_Format_DiskMetrics() Id = "disk0", ReadMBps = 1500.0f, WriteMBps = 2.5f, + TemperatureC = 48, }; var s = new TelemetrySnapshot @@ -155,6 +157,12 @@ public void Metrics_Format_DiskMetrics() Metrics.Format("disk_disk0_read", s, false, false).Should().Be("1.5GB/s"); Metrics.Format("disk_disk0_write", s, false, false).Should().Be("2.5MB/s"); + Metrics.Format("disk_disk0_temp", s, false, false).Should().Be("48°C"); + Metrics.Format("disk_disk0_temp", s, false, true).Should().Be("118°F"); + + var diskNoTemp = disk with { TemperatureC = null }; + var sNoTemp = s with { Disks = [diskNoTemp] }; + Metrics.Format("disk_disk0_temp", sNoTemp, false, false).Should().Be("--"); var diskKb = disk with { WriteMBps = 0.5f }; var sKb = s with { Disks = [diskKb] }; @@ -180,6 +188,8 @@ public void Metrics_WidestValueString_ReturnsMaximumWidths() Metrics.WidestValueString(Metrics.NetTotal, false, false).Should().Be("999.99TB"); Metrics.WidestValueString(Metrics.BatteryRate, false, false).Should().Be("+999.9W"); Metrics.WidestValueString("disk_disk0_read", false, false).Should().Be("999.9GB/s"); + Metrics.WidestValueString("disk_disk0_temp", false, false).Should().Be("100°C"); + Metrics.WidestValueString("disk_disk0_temp", false, true).Should().Be("212°F"); Metrics.WidestValueString("unknown_metric", false, false).Should().Be("9999"); } } diff --git a/tests/LocalTelemetry.Notifier.Tests/LocalTelemetry.Notifier.Tests.csproj b/tests/LocalTelemetry.Notifier.Tests/LocalTelemetry.Notifier.Tests.csproj index 6b3b7b1..a5c487d 100644 --- a/tests/LocalTelemetry.Notifier.Tests/LocalTelemetry.Notifier.Tests.csproj +++ b/tests/LocalTelemetry.Notifier.Tests/LocalTelemetry.Notifier.Tests.csproj @@ -1,10 +1,12 @@ - net10.0-windows10.0.19041.0 + net11.0-windows10.0.19041.0 + Exe + true + true enable enable - true true false true @@ -14,20 +16,11 @@ - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - + + - - + diff --git a/tests/LocalTelemetry.Notifier.Tests/NotifierLogTests.cs b/tests/LocalTelemetry.Notifier.Tests/NotifierLogTests.cs index 93613e0..2e5ef89 100644 --- a/tests/LocalTelemetry.Notifier.Tests/NotifierLogTests.cs +++ b/tests/LocalTelemetry.Notifier.Tests/NotifierLogTests.cs @@ -1,4 +1,3 @@ -using System.IO; using System.Reflection; using FluentAssertions; using Xunit; @@ -75,7 +74,7 @@ public void NotifierLog_Shutdown_WhenWriterFlushThrows_CatchesGracefully() var throwingStream = new ThrowingTestStream(); var sw = new StreamWriter(throwingStream); - field!.SetValue(null, sw); + field.SetValue(null, sw); var act = () => NotifierLog.Shutdown(); act.Should().NotThrow(); @@ -145,7 +144,7 @@ public void NotifierLog_Write_WhenWriteLineThrows_CapturesLastError() var throwingStream = new ThrowOnWriteOnlyStream(); var sw = new StreamWriter(throwingStream) { AutoFlush = true }; - field!.SetValue(null, sw); + field.SetValue(null, sw); try { diff --git a/tests/LocalTelemetry.Notifier.Tests/ProgramTests.cs b/tests/LocalTelemetry.Notifier.Tests/ProgramTests.cs index 0a58bc4..1268a5b 100644 --- a/tests/LocalTelemetry.Notifier.Tests/ProgramTests.cs +++ b/tests/LocalTelemetry.Notifier.Tests/ProgramTests.cs @@ -1,5 +1,4 @@ using System.Diagnostics; -using System.IO; using System.IO.Pipes; using System.Reflection; using System.Text; @@ -196,7 +195,7 @@ public void NamedPipeServerStreamWrapper_ExercisesAllStreamMembers() var wrapperType = typeof(Program).GetNestedType("NamedPipeServerStreamWrapper", BindingFlags.NonPublic); wrapperType.Should().NotBeNull(); - using var pipe = new System.IO.Pipes.NamedPipeServerStream("TestPipeNotifierWrapper", PipeDirection.In, 1, PipeTransmissionMode.Message, PipeOptions.Asynchronous); + using var pipe = new NamedPipeServerStream("TestPipeNotifierWrapper", PipeDirection.In, 1, PipeTransmissionMode.Message, PipeOptions.Asynchronous); var wrapper = (Program.INotifierPipeServer)Activator.CreateInstance(wrapperType, [pipe])!; wrapper.Stream.Should().NotBeNull(); @@ -528,7 +527,7 @@ public async Task SetupParentMonitoring_NonExistentPid_Coverage() using var waitToken = new CancellationTokenSource(2000); while (!cts.IsCancellationRequested && !waitToken.IsCancellationRequested) { - await Task.Delay(10); + await Task.Delay(10, TestContext.Current.CancellationToken); } cts.IsCancellationRequested.Should().BeTrue(); @@ -553,7 +552,7 @@ public async Task SetupParentMonitoring_RealExitingProcess_Coverage() using var waitToken = new CancellationTokenSource(3000); while (!cts.IsCancellationRequested && !waitToken.IsCancellationRequested) { - await Task.Delay(20); + await Task.Delay(20, TestContext.Current.CancellationToken); } cts.IsCancellationRequested.Should().BeTrue(); @@ -562,18 +561,10 @@ public async Task SetupParentMonitoring_RealExitingProcess_Coverage() [Fact] public void Program_UnhandledExceptionHandler_Coverage() { - var cType = typeof(Program).GetNestedType("<>c", BindingFlags.NonPublic); - cType.Should().NotBeNull(); - var method = cType.GetMethod("
b__16_0", BindingFlags.NonPublic | BindingFlags.Instance); - method.Should().NotBeNull(); - - var singletonField = cType.GetField("<>9", BindingFlags.NonPublic | BindingFlags.Static); - var instance = singletonField?.GetValue(null) ?? Activator.CreateInstance(cType, nonPublic: true); - - var actEx = () => method.Invoke(instance, [null, new UnhandledExceptionEventArgs(new InvalidOperationException("Test crash"), false)]); + var actEx = () => Program.OnUnhandledException(null, new UnhandledExceptionEventArgs(new InvalidOperationException("Test crash"), false)); actEx.Should().NotThrow(); - var actNonEx = () => method.Invoke(instance, [null, new UnhandledExceptionEventArgs("Not an exception", false)]); + var actNonEx = () => Program.OnUnhandledException(null, new UnhandledExceptionEventArgs("Not an exception", false)); actNonEx.Should().NotThrow(); } diff --git a/tests/LocalTelemetry.Release.Tests/changelog-domains.test.ts b/tests/LocalTelemetry.Release.Tests/changelog-domains.test.ts new file mode 100644 index 0000000..baf828c --- /dev/null +++ b/tests/LocalTelemetry.Release.Tests/changelog-domains.test.ts @@ -0,0 +1,401 @@ +import { describe, it } from 'node:test'; +import assert from 'node:assert/strict'; +import { + CHANGE_SECTIONS, + cleanRepoUrl, + cleanSubject, + DOMAINS, + formatReleaseDate, + generateGitHubReleaseNotes, + parseCommitEntries, + parseOwnerAndRepo, + resolveChangeCategory, + resolveDomain, + resolveDomainLabel, +} from '../../.github/release/changelog-domains.js'; + +describe('changelog-domains', () => { + describe('cleanRepoUrl', () => { + it('normalizes SSH git URLs to HTTPS', () => { + assert.equal( + cleanRepoUrl('git@github.com:Nicconike/LocalTelemetry.git'), + 'https://github.com/Nicconike/LocalTelemetry', + ); + }); + + it('normalizes HTTPS git URLs with .git suffix', () => { + assert.equal( + cleanRepoUrl('https://github.com/Nicconike/LocalTelemetry.git'), + 'https://github.com/Nicconike/LocalTelemetry', + ); + }); + + it('falls back to default URL when null or empty', () => { + assert.equal(cleanRepoUrl(''), 'https://github.com/Nicconike/LocalTelemetry'); + assert.equal(cleanRepoUrl(undefined), 'https://github.com/Nicconike/LocalTelemetry'); + }); + }); + + describe('parseOwnerAndRepo', () => { + it('parses owner and repo from standard HTTPS URL', () => { + const res = parseOwnerAndRepo('https://github.com/Nicconike/LocalTelemetry'); + assert.deepEqual(res, { owner: 'Nicconike', repo: 'LocalTelemetry' }); + }); + + it('parses owner and repo from SSH URL', () => { + const res = parseOwnerAndRepo('git@github.com:Nicconike/LocalTelemetry.git'); + assert.deepEqual(res, { owner: 'Nicconike', repo: 'LocalTelemetry' }); + }); + + it('returns null for non-github or invalid URL', () => { + assert.equal(parseOwnerAndRepo('invalid-url-without-slash'), null); + }); + }); + + describe('resolveDomain', () => { + it('resolves taskbar overlay domain from scope and keywords', () => { + assert.equal(resolveDomain('feat', 'overlay', 'embed child window'), DOMAINS.OVERLAY); + assert.equal(resolveDomain('fix', 'taskbar', 'reposition band'), DOMAINS.OVERLAY); + assert.equal(resolveDomain('refactor', 'embedder', 'cleanup interop'), DOMAINS.OVERLAY); + }); + + it('resolves layout presets domain', () => { + assert.equal(resolveDomain('feat', 'layout', 'add preset tiles'), DOMAINS.LAYOUT); + assert.equal(resolveDomain('fix', 'metrics', 'fix row calculation'), DOMAINS.LAYOUT); + }); + + it('resolves hardware telemetry domain', () => { + assert.equal(resolveDomain('feat', 'hardware', 'query NVMe temperature'), DOMAINS.HARDWARE); + assert.equal(resolveDomain('fix', 'gpu', 'handle driver absence'), DOMAINS.HARDWARE); + assert.equal(resolveDomain('refactor', 'pawnio', 'sandbox MSR calls'), DOMAINS.HARDWARE); + }); + + it('resolves traffic and network domain', () => { + assert.equal(resolveDomain('feat', 'traffic', 'import JSONL usage history'), DOMAINS.TRAFFIC); + assert.equal(resolveDomain('fix', 'network', 'filter inactive adapters'), DOMAINS.TRAFFIC); + }); + + it('resolves alerts and notifications domain', () => { + assert.equal(resolveDomain('feat', 'alerts', 'add hysteresis threshold'), DOMAINS.ALERTS); + assert.equal(resolveDomain('fix', 'notifier', 'pipe reconnection'), DOMAINS.ALERTS); + }); + + it('resolves appearance and themes domain', () => { + assert.equal(resolveDomain('feat', 'theme', 'add laser crimson palette'), DOMAINS.THEME); + assert.equal(resolveDomain('style', 'appearance', 'contrast borders'), DOMAINS.THEME); + }); + + it('resolves lifecycle and app domain', () => { + assert.equal(resolveDomain('feat', 'app', 'single instance mutex'), DOMAINS.LIFECYCLE); + assert.equal(resolveDomain('refactor', 'bridge', 'dispatch IPC messages'), DOMAINS.LIFECYCLE); + assert.equal(resolveDomain('feat', 'settings', 'portable directory path'), DOMAINS.LIFECYCLE); + }); + + it('resolves packaging and installer domain', () => { + assert.equal(resolveDomain('feat', 'installer', 'compile Inno Setup 7'), DOMAINS.INSTALLER); + assert.equal(resolveDomain('chore', 'winget', 'bump manifest'), DOMAINS.INSTALLER); + }); + + it('resolves build system & dependencies domain distinctly from CI', () => { + assert.equal(resolveDomain('build', 'deps', 'bump Microsoft.Web.WebView2'), DOMAINS.BUILD); + assert.equal(resolveDomain('build', '', 'update global.json'), DOMAINS.BUILD); + }); + + it('resolves CI & workflows domain distinctly from build and tests', () => { + assert.equal(resolveDomain('ci', 'workflows', 'restrict token permissions'), DOMAINS.CI); + assert.equal(resolveDomain('ci', 'sonar', 'configure coverage feeder'), DOMAINS.CI); + assert.equal(resolveDomain('ci', 'release', 'prevent duplicate trailing newlines and expand test coverage'), DOMAINS.CI); + }); + + it('resolves tests & test coverage domain distinctly from CI', () => { + assert.equal(resolveDomain('test', 'coverage', 'assert embedder seams'), DOMAINS.TESTS); + assert.equal(resolveDomain('test', '', 'unit test runner setup'), DOMAINS.TESTS); + }); + + it('resolves documentation domain', () => { + assert.equal(resolveDomain('docs', 'guides', 'update developer architecture'), DOMAINS.DOCS); + assert.equal(resolveDomain('docs', 'readme', 'refresh badges'), DOMAINS.DOCS); + }); + + it('excludes routine chores without feature scopes', () => { + assert.equal(resolveDomain('chore', '', '1.3.0-beta.3 [skip ci]'), null); + assert.equal(resolveDomain('chore', 'release', '1.3.0-beta.3 [skip ci]'), null); + assert.equal(resolveDomain('style', '', 'format whitespace'), null); + }); + }); + + describe('resolveChangeCategory', () => { + it('resolves breaking changes first', () => { + const cat = resolveChangeCategory('feat', true, 'overlay', 'breaking api change'); + assert.equal(cat?.id, 'breaking'); + }); + + it('resolves conventional commit categories', () => { + assert.equal(resolveChangeCategory('feat')?.id, 'feat'); + assert.equal(resolveChangeCategory('fix')?.id, 'fix'); + assert.equal(resolveChangeCategory('perf')?.id, 'perf'); + assert.equal(resolveChangeCategory('refactor')?.id, 'refactor'); + assert.equal(resolveChangeCategory('build')?.id, 'build'); + assert.equal(resolveChangeCategory('ci')?.id, 'ci'); + assert.equal(resolveChangeCategory('test')?.id, 'test'); + assert.equal(resolveChangeCategory('docs')?.id, 'docs'); + }); + + it('maps dependency chores to build', () => { + const cat = resolveChangeCategory('chore', false, 'deps', 'bump svelte'); + assert.equal(cat?.id, 'build'); + }); + + it('omits release chores and generic styles', () => { + assert.equal(resolveChangeCategory('chore', false, 'release', '1.3.0-beta.4'), null); + assert.equal(resolveChangeCategory('style', false, '', 'format code'), null); + }); + }); + + describe('resolveDomainLabel', () => { + it('resolves clean domain labels from scopes', () => { + assert.equal(resolveDomainLabel('feat', 'layout', ''), 'Layout Presets'); + assert.equal(resolveDomainLabel('feat', 'overlay', ''), 'Taskbar Overlay'); + assert.equal(resolveDomainLabel('feat', 'traffic', ''), 'Network Traffic'); + assert.equal(resolveDomainLabel('feat', 'theme', ''), 'Appearance & Themes'); + assert.equal(resolveDomainLabel('build', 'deps', ''), 'Dependencies'); + assert.equal(resolveDomainLabel('ci', 'sync', ''), 'PR Synchronization'); + assert.equal(resolveDomainLabel('ci', 'release', ''), 'Release Pipeline'); + assert.equal(resolveDomainLabel('test', 'coverage', ''), 'Tests & Coverage'); + assert.equal(resolveDomainLabel('docs', 'guides', ''), 'Documentation'); + }); + }); + + describe('cleanSubject', () => { + it('strips redundant leading scope prefixes', () => { + assert.equal(cleanSubject('overlay: embed window'), 'Embed window'); + assert.equal(cleanSubject('layout: add presets'), 'Add presets'); + assert.equal(cleanSubject('hardware: detect sensors'), 'Detect sensors'); + assert.equal(cleanSubject('bridge: dispatch messages'), 'Dispatch messages'); + }); + + it('capitalizes the first character and strips trailing period', () => { + assert.equal(cleanSubject('update taskbar placement.'), 'Update taskbar placement'); + }); + + it('standardizes dependabot group bump descriptions', () => { + assert.equal( + cleanSubject('bump the dotnet-deps group across 3 directories with 4 updates'), + 'Bump dotnet dependencies', + ); + }); + }); + + describe('formatReleaseDate', () => { + it('formats ISO strings into DD-MM-YYYY', () => { + assert.equal(formatReleaseDate('2026-11-14T22:56:05Z'), '14-11-2026'); + }); + + it('preserves existing DD-MM-YYYY formatted dates', () => { + assert.equal(formatReleaseDate('14-11-2026'), '14-11-2026'); + }); + }); + + describe('parseCommitEntries', () => { + it('expands multiline body sub-bullets into distinct domain entries', () => { + const commit = { + hash: '20507fdd629ed5a2e5205b7bfaf871bfd0ad98a6', + shortHash: '20507fd', + message: [ + 'feat(layout,traffic,overlay): add layout presets, traffic import, and themes', + '', + '- feat(layout): add layout preset customization and sorting', + '- feat(traffic): add JSONL historical network traffic import', + '- feat(theme): introduce Laser Crimson Cyberpunk theme', + '- feat(overlay): enhance Win32 taskbar embedder positioning', + '- test(coverage): add unit tests for layout presets and themes', + '- docs(guides): update architecture specification', + ].join('\n'), + }; + + const entries = parseCommitEntries(commit); + + assert.equal(entries.length, 6); + assert.deepEqual(entries[0], { + category: CHANGE_SECTIONS.FEAT, + domain: 'Layout Presets', + subject: 'Add layout preset customization and sorting', + hash: commit.hash, + shortHash: commit.shortHash, + }); + assert.deepEqual(entries[1], { + category: CHANGE_SECTIONS.FEAT, + domain: 'Network Traffic', + subject: 'Add JSONL historical network traffic import', + hash: commit.hash, + shortHash: commit.shortHash, + }); + assert.deepEqual(entries[2], { + category: CHANGE_SECTIONS.FEAT, + domain: 'Appearance & Themes', + subject: 'Introduce Laser Crimson Cyberpunk theme', + hash: commit.hash, + shortHash: commit.shortHash, + }); + assert.deepEqual(entries[3], { + category: CHANGE_SECTIONS.FEAT, + domain: 'Taskbar Overlay', + subject: 'Enhance Win32 taskbar embedder positioning', + hash: commit.hash, + shortHash: commit.shortHash, + }); + assert.deepEqual(entries[4], { + category: CHANGE_SECTIONS.TEST, + domain: 'Tests & Coverage', + subject: 'Add unit tests for layout presets and themes', + hash: commit.hash, + shortHash: commit.shortHash, + }); + assert.deepEqual(entries[5], { + category: CHANGE_SECTIONS.DOCS, + domain: 'Documentation', + subject: 'Update architecture specification', + hash: commit.hash, + shortHash: commit.shortHash, + }); + }); + + it('correctly categorizes keyword sub-bullets containing tests and fixes', () => { + const commit = { + hash: 'ec1b5d15b96b785f49bdf0f57c38a070e8117b64', + shortHash: 'ec1b5d1', + message: [ + 'fix(overlay): apply placement offset and avoid ExplorerPatcher weather overlap on Win10', + '', + '- Detect adjacent weather widgets and ReBar deskbands to eliminate overlay overlap.', + '- Add unit tests for Windows 10 deskband clipping and placement offset calculations.', + '- Update documentation for Windows 10 deskbands and uninstaller options.', + ].join('\n'), + }; + + const entries = parseCommitEntries(commit); + assert.equal(entries.length, 3); + assert.equal(entries[0].category, CHANGE_SECTIONS.FIX); + assert.equal(entries[0].subject, 'Detect adjacent weather widgets and ReBar deskbands to eliminate overlay overlap'); + assert.equal(entries[1].category, CHANGE_SECTIONS.TEST); + assert.equal(entries[1].subject, 'Add unit tests for Windows 10 deskband clipping and placement offset calculations'); + assert.equal(entries[2].category, CHANGE_SECTIONS.DOCS); + assert.equal(entries[2].subject, 'Update documentation for Windows 10 deskbands and uninstaller options'); + }); + + it('falls back to header scope when no body sub-bullets exist', () => { + const commit = { + hash: 'bb672c28fde60aa5c785f12a76f671ce43199162', + shortHash: 'bb672c2', + message: 'fix(overlay): dismiss context menu on outside click', + }; + + const entries = parseCommitEntries(commit); + assert.equal(entries.length, 1); + assert.deepEqual(entries[0], { + category: CHANGE_SECTIONS.FIX, + domain: 'Taskbar Overlay', + subject: 'Dismiss context menu on outside click', + hash: commit.hash, + shortHash: commit.shortHash, + }); + }); + + it('omits routine chore release commits', () => { + const commit = { + hash: 'daff7864c04bcf400e619e8d89f09531ab419e24', + shortHash: 'daff786', + message: 'chore(release): 1.3.0-beta.3 [skip ci]', + }; + + const entries = parseCommitEntries(commit); + assert.equal(entries.length, 0); + }); + }); + + describe('generateGitHubReleaseNotes', () => { + it('assembles sorted markdown release notes grouped by type with distinct SemVer sections', () => { + const commits = [ + { + hash: '1111111111111111111111111111111111111111', + shortHash: '1111111', + message: 'feat(overlay): embed child window into taskbar', + }, + { + hash: '2222222222222222222222222222222222222222', + shortHash: '2222222', + message: 'fix(layout): fix custom preset tile calculation', + }, + { + hash: '3333333333333333333333333333333333333333', + shortHash: '3333333', + message: 'ci(workflows): enforce app token attribution', + }, + { + hash: '4444444444444444444444444444444444444444', + shortHash: '4444444', + message: 'test(taskbar): assert simulated automation exception', + }, + ]; + + const notes = generateGitHubReleaseNotes({ + fromTag: 'v1.0.0', + toRef: 'v1.1.0', + version: '1.1.0', + date: '14-11-2026', + repositoryUrl: 'https://github.com/Nicconike/LocalTelemetry', + commits, + }); + + assert.ok(notes.includes('## [1.1.0](https://github.com/Nicconike/LocalTelemetry/compare/v1.0.0...v1.1.0) (14-11-2026)')); + assert.ok(notes.includes('### 🚀 Features\n\n* **Taskbar Overlay**: Embed child window into taskbar ([1111111](https://github.com/Nicconike/LocalTelemetry/commit/1111111111111111111111111111111111111111))')); + assert.ok(notes.includes('### 🐛 Bug Fixes\n\n* **Layout Presets**: Fix custom preset tile calculation ([2222222](https://github.com/Nicconike/LocalTelemetry/commit/2222222222222222222222222222222222222222))')); + assert.ok(notes.includes('### 🤖 Continuous Integration & Workflows\n\n* **CI Workflows**: Enforce app token attribution ([3333333](https://github.com/Nicconike/LocalTelemetry/commit/3333333333333333333333333333333333333333))')); + assert.ok(notes.includes('### 🧪 Tests & Test Coverage\n\n* **Taskbar Overlay**: Assert simulated automation exception ([4444444](https://github.com/Nicconike/LocalTelemetry/commit/4444444444444444444444444444444444444444))')); + + // Verify priority ordering: Features (90) -> Bug Fixes (80) -> CI (30) -> Tests (20) + const featIdx = notes.indexOf('### 🚀 Features'); + const fixIdx = notes.indexOf('### 🐛 Bug Fixes'); + const ciIdx = notes.indexOf('### 🤖 Continuous Integration & Workflows'); + const testIdx = notes.indexOf('### 🧪 Tests & Test Coverage'); + + assert.ok(featIdx < fixIdx); + assert.ok(fixIdx < ciIdx); + assert.ok(ciIdx < testIdx); + }); + + it('groups multiple items under the same domain as nested sub-bullets', () => { + const commits = [ + { + hash: 'aaaaaaa111111111111111111111111111111111', + shortHash: 'aaaaaaa', + message: 'build(deps): bump dompurify to 3.4.17', + }, + { + hash: 'bbbbbbb222222222222222222222222222222222', + shortHash: 'bbbbbbb', + message: 'build(deps): bump svelte to 5.57.2', + }, + { + hash: 'ccccccc333333333333333333333333333333333', + shortHash: 'ccccccc', + message: 'build: update global.json SDK', + }, + ]; + + const notes = generateGitHubReleaseNotes({ + fromTag: 'v1.0.0', + toRef: 'v1.1.0', + version: '1.1.0', + date: '14-11-2026', + repositoryUrl: 'https://github.com/Nicconike/LocalTelemetry', + commits, + }); + + // Dependencies has 2 items -> nested sub-bullets + assert.ok(notes.includes('* **Dependencies**\n * Bump dompurify to 3.4.17 ([aaaaaaa](https://github.com/Nicconike/LocalTelemetry/commit/aaaaaaa111111111111111111111111111111111))\n * Bump svelte to 5.57.2 ([bbbbbbb](https://github.com/Nicconike/LocalTelemetry/commit/bbbbbbb222222222222222222222222222222222))')); + // Build System has 1 item -> single line with colon + assert.ok(notes.includes('* **Build System**: Update global.json SDK ([ccccccc](https://github.com/Nicconike/LocalTelemetry/commit/ccccccc333333333333333333333333333333333))')); + }); + }); +});