and seeder/kernel parity. Booter / ctx (1.44.0) - bareOsReadPearRuntimeSnapshotJson; hrpc stock routes documented (kernel.*, vfs.readText, bare_os.echo, bare_os.disk_os_hints). - Peer admission: BARE_OS_DHT_ADDRESS_CLASS_ALLOWLIST + meta.dhtAddressClass; shouldAttemptPeer(peerKey, meta). - Optional BARE_OS_VFS_WARM_CACHE_INVALIDATE_ON_APPEND on system drive cores. - maybeMergeBareFromDrive: path dedupe + early exit when manifest keys satisfied. - identity-account: zero UTF-8 passphrase buffer after PBKDF2 (string path). Shell / utilities - BARE_OS_SHELL_ERREXIT and set -e / set +e; tests in bare-os-booter/test.js. - expand: comma-separated POSIX-style tab stops; man page + coreutils tests. Tooling / docs - kernel-microbench vfs: warmReplicationPathClassify sketch. - holepunch-drift-repos suggestedCriticalRepos; sync-holepunch-clones report. - scripts/README: pretest maintainer runbook; handbook/12 P2P vs POSIX. - KERNEL_CONTRACT, environment appendix, PLACEHOLDER_BASELINE (multisig gate), compatibility matrix, posix artifacts, syscalls.example.json, seeder sync. Requires: npm run pretest && npm test (already green in session).
51 lines
1.6 KiB
JavaScript
51 lines
1.6 KiB
JavaScript
/**
|
|
* 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.'
|
|
}
|
|
}
|