[Repo Assist] feat(device): enhance device.status with os/cpu/memory/disk sections and sections filter - #242
Conversation
Add structured os, cpu, memory, and disk.drives sections to device.status response, a collectedAt timestamp, and a sections[] filter parameter so callers can request only the data they need. - os: version, architecture, machineName, uptimeSeconds - cpu: name, logicalProcessors, usagePercent (null until platform provider injected) - memory: totalBytes, availableBytes, usagePercent (via GCMemoryInfo) - disk.drives[]: name, label, totalBytes, freeBytes, usagePercent, format - sections filter: if provided, only named sections are populated; unknown names return an error - collectedAt: ISO-8601 UTC timestamp for cache freshness All legacy response fields (battery, thermal, storage, network, uptimeSeconds) are preserved unchanged for backward compatibility. Closes #240 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🤖 Repo Assist note: This PR is superseded by community PR #249 ("feat(device): enhance device.status with rich system health sections...") by
|
|
Closing per repo-assist triage: this is superseded by the broader provider-based device status work in #249, and this draft leaves important semantics/provider gaps unresolved. |
🤖 This is an automated PR from Repo Assist.
Implements the structured sections proposed in #240, adding
os,cpu,memory, anddisk.drivesfields todevice.statusplus asections[]filter argument. All legacy fields are preserved for backward compatibility.Changes
src/OpenClaw.Shared/Capabilities/DeviceCapability.cscollectedAtDateTime.UtcNowos.versionEnvironment.OSVersion.Version"10.0.26100"os.architectureRuntimeInformation.OSArchitecture"X64","Arm64"os.machineNameEnvironment.MachineNameos.uptimeSecondsEnvironment.TickCount64 / 1000cpu.namePROCESSOR_IDENTIFIERenv var / arch fallbackGetModelIdentifier()cpu.logicalProcessorsEnvironment.ProcessorCountcpu.usagePercentnullPerformanceCounter)memory.totalBytesGC.GetGCMemoryInfo().TotalAvailableMemoryBytesmemory.availableBytestotal - loadmemory.usagePercentdisk.drives[]DriveInfo.GetDrives()name,label,totalBytes,freeBytes,usagePercent,formatsectionsparameter: if omitted, all sections are populated (backward-compatible). If provided (e.g.{"sections":["os","cpu"]}), only named sections are included and non-named sections are returned asnull. Unknown section names return an error listing valid values.Legacy fields (
battery,thermal,storage,network,uptimeSeconds) remain unchanged.tests/OpenClaw.Shared.Tests/CapabilityTests.csThree new tests added to
DeviceCapabilityTests:DeviceStatus_ReturnsEnhancedSections— assertscollectedAt,os,cpu,memory,disk.drivesare present and well-formedDeviceStatus_SectionsFilter_ReturnsOnlyRequestedSections— asserts non-requested sections are nullDeviceStatus_SectionsFilter_RejectsUnknownSections— asserts error response for unknown section namesTest Status
OpenClaw.Shared.Tests(new DeviceCapability tests)OpenClaw.Shared.Tests(full suite)McpHttpServerTestsfailures unrelated to this change (see PR #238)OpenClaw.Tray.Tests