/** * Live Hyperdrive / core length hints for `/proc/bare_os/replication` and * `metrics_live.replicationLive` (non-secret progress; not full per-peer throughput). * * @param {{ drive?: unknown, personalDrive?: unknown } | null | undefined} disk * @param {number} peerCount */ export function buildBareOsReplicationLiveSketch(disk, peerCount) { let systemCoreLength = null let personalCoreLength = null try { const c = disk && disk.drive && /** @type {{ core?: { length?: number } }} */ (disk.drive).core if (c && typeof c.length === 'number') systemCoreLength = c.length } catch { systemCoreLength = null } try { const c = disk && disk.personalDrive && /** @type {{ core?: { length?: number } }} */ (disk.personalDrive).core if (c && typeof c.length === 'number') personalCoreLength = c.length } catch { personalCoreLength = null } let auxiliaryDriveCount = 0 try { if (disk && Array.isArray(disk.auxiliaryDrives)) auxiliaryDriveCount = disk.auxiliaryDrives.length } catch { auxiliaryDriveCount = 0 } const stallHint = peerCount === 0 ? 'no_peers' : systemCoreLength == null ? 'length_unavailable' : 'ok' return { schema: 2, systemCoreLength, personalCoreLength, auxiliaryDriveCount, stallHint, note: 'Schema 2 adds auxiliaryDriveCount (read-only mirror Hyperdrives under /mirror/aux*). Append-only core lengths are non-secret progress hints; aligns with corestore-snapshot / multi-drive replication operator workflows — not a full telemetry plane.' } }