Import the wilm endpoint telemetry, PC Detail rework and backup overlay

Ports 37 of Benjamin Baker's commits from the wilm branch, mirrored from the
corporate GitHub at 7905917c. wilm rides the publication lineage and shares no
ancestor with wj, so this is a filtered tree patch rather than a merge:
94 files, and every path the publication export strips (docs/, tools/, mcp/,
CLAUDE.md, start-*.sh, .gitea/, the three excluded tests) is held back, because
a raw diff would delete each of them from this tree.

What comes across:

* Endpoint telemetry, phase 2. Physical disk health from two sources, NIC link
  state, boot type, Defender health, processor/memory/chassis inventory, the
  listening TCP set, mapped network drives and Windows Update history. Five
  additive migrations, 0012 through 0016, off the 0011 head.
* Mapped drives are collected by a probe running in the interactive user's
  session, because they do not exist in the agent's session 0. Two Windows
  sources can disagree about one drive and the worse status wins, so a
  half-broken share is never rendered as healthy.
* Windows events are reported once each, keyed on the channel's own record id,
  instead of being re-sent whenever a report overlapped the last one.
* PC Detail rework: Details cards flow, the hand-written Network card gives way
  to a full address history, Storage and disk health merge into one card with
  two sections, Operator Reports and Corporate Tools get their own tabs.
* An opt-in restic backup overlay with a third container, restore gated on the
  dump's own data revision rather than the code head, and backup/restore history.
* The agent's version is read from the binary's PE version rather than trusted
  from the csproj, and the Fleet view gains an Agent Version column.
* The enqueue route now asks caller_holds instead of the owner's permissions,
  which closes the scoped-token elevation on run_script, update_app and
  system_restart.

Held back deliberately:

* agent/installer/install-shopdbagent.ps1 stays deleted, as upstream deleted it.
  The installer that reaches a bay is generated by _install_script() in
  plugins/endpoints/api/siteagent.py; the standalone script had stopped being
  shipped and was collecting fixes no endpoint ever ran.
* The .gitignore hunk adding docs/*.md. Correct on the publication lineage,
  where docs/ becomes the wiki and its absence is how the gates detect a
  published checkout. Here it would silently ignore every new doc.
* Their deletions of docs/DEV-BUILD-TEST.md and docs/PLUGIN-HOOKS.md. Upstream
  those were stubs; here PLUGIN-HOOKS.md is the 31KB document CLAUDE.md points
  readers at.
* Five zero-byte files committed by an accidental `git add -A`, a run log from
  the author's own machine, and docs/notes/, which is working scratch that says
  so in its own header and belongs in devnotes/ on this side.

Carried with the import so it lands green: the 17 new routes are described in
docs/api-inventory.json with the spec and project map regenerated, and two new
frontend specs read fixtures through fileURLToPath(URL) which node rejects under
jsdom's own URL global.

Suite 2591 passed / 9 skipped; frontend 391 passed; naming, style and doc gates
clean.

Scope: product
This commit is contained in:
cproudlock
2026-09-06 16:47:24 -04:00
parent 9947a477b8
commit 6e36df841e
96 changed files with 12395 additions and 761 deletions

View File

@@ -4034,6 +4034,70 @@
"params": "query: search (hostname substring)",
"purpose": "List endpoint states. Registered both with and without the trailing slash, so both forms are described here",
"example": "curl -H \"Authorization: Bearer $TOKEN\" http://localhost:5001/api/endpoints"
},
{
"method": "GET",
"path": "/api/endpoints/asset/<asset_id>/hardware",
"auth": "endpoints.view",
"params": "path: asset_id",
"purpose": "Asset-detail panel: processor, memory and chassis inventory. Agent 1.7.0 and later only; an older agent leaves the columns null and the panel hides itself rather than rendering blanks",
"example": "curl -H \"Authorization: Bearer $TOKEN\" http://localhost:5001/api/endpoints/asset/1/hardware"
},
{
"method": "GET",
"path": "/api/endpoints/asset/<asset_id>/osinfo",
"auth": "endpoints.view",
"params": "path: asset_id",
"purpose": "Asset-detail panel: operating system, firmware and domain membership as one card (both answer \"what is this box running\")",
"example": "curl -H \"Authorization: Bearer $TOKEN\" http://localhost:5001/api/endpoints/asset/1/osinfo"
},
{
"method": "GET",
"path": "/api/endpoints/asset/<asset_id>/storage",
"auth": "endpoints.view",
"params": "path: asset_id",
"purpose": "Asset-detail panel: volume capacity and physical drive health as two sections. They share no key (volumes vs physical devices) and are never reconciled across sections",
"example": "curl -H \"Authorization: Bearer $TOKEN\" http://localhost:5001/api/endpoints/asset/1/storage"
},
{
"method": "GET",
"path": "/api/endpoints/asset/<asset_id>/diskhealth",
"auth": "endpoints.view",
"params": "path: asset_id",
"purpose": "Physical drive health rows, anything predicting failure sorted first. No longer backs a panel of its own (Storage renders it as a section) but kept as a stable read for callers outside the panel renderer",
"example": "curl -H \"Authorization: Bearer $TOKEN\" http://localhost:5001/api/endpoints/asset/1/diskhealth"
},
{
"method": "GET",
"path": "/api/endpoints/asset/<asset_id>/listeners",
"auth": "endpoints.view",
"params": "path: asset_id",
"purpose": "Asset-detail panel: TCP sockets in LISTEN with the owning process, sorted by port. The full connection table is an on-demand command, not standard telemetry",
"example": "curl -H \"Authorization: Bearer $TOKEN\" http://localhost:5001/api/endpoints/asset/1/listeners"
},
{
"method": "GET",
"path": "/api/endpoints/asset/<asset_id>/mappeddrives",
"auth": "endpoints.view",
"params": "path: asset_id",
"purpose": "Asset-detail panel: mapped network drives with a health badge each. Session-scoped, so an empty list when nobody is signed in is a valid state, not a failure",
"example": "curl -H \"Authorization: Bearer $TOKEN\" http://localhost:5001/api/endpoints/asset/1/mappeddrives"
},
{
"method": "GET",
"path": "/api/endpoints/asset/<asset_id>/usercontext",
"auth": "endpoints.view",
"params": "path: asset_id",
"purpose": "Asset-detail panel: session-scoped data from the interactive user probe. Mapped drives arrive from two sources that can disagree and the worse status wins, so a half-broken share is never shown healthy",
"example": "curl -H \"Authorization: Bearer $TOKEN\" http://localhost:5001/api/endpoints/asset/1/usercontext"
},
{
"method": "GET",
"path": "/api/endpoints/asset/<asset_id>/iphistory",
"auth": "endpoints.view",
"params": "path: asset_id",
"purpose": "Asset-detail panel: every address this asset has held, newest change first. \"Last changed\" is when a field on the row moved, NOT when the address was last seen",
"example": "curl -H \"Authorization: Bearer $TOKEN\" http://localhost:5001/api/endpoints/asset/1/iphistory"
}
]
},
@@ -4214,5 +4278,82 @@
"example": "curl -X PUT http://localhost:5001/api/endpoints/siteagent/binaries/agent/current -H \"Authorization: Bearer $TOK\" -H 'Content-Type: application/json' -d '{\"version\":\"1.6.2\"}'"
}
]
},
{
"surface": "core-shopdbbackups",
"endpoints": [
{
"method": "GET",
"path": "/api/shopdbbackups",
"auth": "admin",
"params": "none",
"purpose": "List every retained backup set, newest first, each with a compatibility flag saying whether it restores onto this build",
"example": "curl -H \"Authorization: Bearer $TOKEN\" http://localhost:5001/api/shopdbbackups"
},
{
"method": "POST",
"path": "/api/shopdbbackups",
"auth": "admin",
"params": "none",
"purpose": "Kick off an on-demand backup run. Requires the backup overlay: without a configured backups root there is nothing behind it",
"example": "curl -X POST -H \"Authorization: Bearer $TOKEN\" http://localhost:5001/api/shopdbbackups"
},
{
"method": "GET",
"path": "/api/shopdbbackups/<snapshotid>",
"auth": "admin",
"params": "path: snapshotid",
"purpose": "Return one set's full manifest plus a resolved compatibility verdict",
"example": "curl -H \"Authorization: Bearer $TOKEN\" http://localhost:5001/api/shopdbbackups/2026-09-06T120000Z"
},
{
"method": "POST",
"path": "/api/shopdbbackups/<snapshotid>/restore",
"auth": "admin",
"params": "path: snapshotid",
"purpose": "Queue a restore of a set, gated on schema compatibility. DESTRUCTIVE: the load drops and replaces every table",
"example": "curl -X POST -H \"Authorization: Bearer $TOKEN\" http://localhost:5001/api/shopdbbackups/2026-09-06T120000Z/restore"
},
{
"method": "POST",
"path": "/api/shopdbbackups/finalize-restore",
"auth": "admin",
"params": "none",
"purpose": "Run the post-restore schema upgrade against the just-loaded database. A restore that loaded an older set is NOT complete until this succeeds",
"example": "curl -X POST -H \"Authorization: Bearer $TOKEN\" http://localhost:5001/api/shopdbbackups/finalize-restore"
},
{
"method": "GET",
"path": "/api/shopdbbackups/status",
"auth": "admin",
"params": "none",
"purpose": "Live status of the most recent backup and restore runs, or idle when neither is moving",
"example": "curl -H \"Authorization: Bearer $TOKEN\" http://localhost:5001/api/shopdbbackups/status"
},
{
"method": "GET",
"path": "/api/shopdbbackups/history",
"auth": "admin",
"params": "none",
"purpose": "Recorded backup and restore run history, newest first",
"example": "curl -H \"Authorization: Bearer $TOKEN\" http://localhost:5001/api/shopdbbackups/history"
},
{
"method": "GET",
"path": "/api/shopdbbackups/settings",
"auth": "admin",
"params": "none",
"purpose": "Read the backup settings, with secret values masked",
"example": "curl -H \"Authorization: Bearer $TOKEN\" http://localhost:5001/api/shopdbbackups/settings"
},
{
"method": "PUT",
"path": "/api/shopdbbackups/settings",
"auth": "admin",
"params": "body: backup settings keys",
"purpose": "Update the backup settings. A masked secret submitted unchanged leaves the stored value alone",
"example": "curl -X PUT -H \"Authorization: Bearer $TOKEN\" -H 'Content-Type: application/json' -d '{\"backup_schedule\":\"0 2 * * *\"}' http://localhost:5001/api/shopdbbackups/settings"
}
]
}
]
]