React console, StifleR sign-in, runs with bulk logs, Windows PE, shell choices and agent auto-upgrade #18

Merged
gsadmin merged 72 commits from dev into main 2026-10-23 23:31:56 +00:00
Owner

React console, StifleR-style sign-in, runs with bulk log downloads, Windows PE and remote shell choices.

Console

  • The console moves to React 19 + MUI 9 on the Mantis Pro shell. SvelteKit is removed.
  • Screen text: short signposts on the page, explanations on hover, Title Case labels.
  • Monaco editor: VS Code-grade scripting and Functions experience.
  • Remote shell pops out into its own window and back.

Runs and jobs

  • Run Script dialog: one tabbed dialog from Devices (check devices, pick a script) or from Scripts (pick a script, then devices and groups).
  • Run page: every run gets a progress bar and counters for Targets, Online, Succeeded, Failed, Running, Pending and Skipped. Each counter filters the device list, and each device opens its output.
  • Downloads:
    • One job: COMPUTERNAME.JobID.yyyy.MM.dd.HHmmss.log.
    • A whole run: ScriptName.RunID.….log.
    • New: check devices on a run and Download Logs. You get ScriptName.RunID.….zip with one COMPUTERNAME.JobID.….log per device. The endpoint is POST /api/executions/{runId}/output/archive.
  • Group runs: run now on any mix of devices and groups as one execution.
  • Groups: nested groups and folders.
  • Schedules: a workspace to edit and preview them.

Sign-in and access (as in StifleR)

  • Methods: Built-In, Local Windows Accounts, LDAP (LDAPS, StartTLS or Kerberos; auto-configured on domain-joined servers; with a breaker) and OIDC (PKCE, end-session).
  • Access: role bindings join groups (built-in, Windows SID, directory DN, OIDC claim=value) to ExecuteR's own roles, device scopes included.
  • Sessions: stored in the database, with CSRF protection.
  • Safeguards: sign-in throttling, step-up before changing methods, test-before-disable, a break-glass account, auth-reset and AUTH_FORCE_LOCAL.
  • Upgrade: users' roles become built-in groups bound to those roles, and the old OIDC settings and claim mappings carry over. This was tested on a copy of a real database.

Windows PE

  • Phase: the agent detects WinPE and reports the OS as Windows PE; the console shows a WinPE chip.
  • Identity: unchanged and taken from the firmware, so the installed OS re-enrolls into the same device row and the name and OS update.
  • Device History tab: lists Enrolled, Renamed and OS Changed events (GET /api/devices/{clientId}/history).
  • Install: Windows one-liners work in WinPE. They take the portable ZIP and register the service through the agent's initialize, which uses the Service Control Manager APIs.
  • Foreground: foreground still works from startnet.cmd.

Remote shell

  • Shell picker for Windows devices: Automatic, PowerShell 7, Windows PowerShell, Built-In PowerShell (the agent's own host, no install needed) and Command Prompt.
  • Automatic tries pwsh, then powershell, then the built-in host, then cmd.

Agent upgrades and the watchdog

  • Starting upgrades: Upgrade Agent… and Roll Back Agent… on devices, selections, groups and folders (nested groups included), with a version picker that defaults to Newest for Each Device. Offline devices are queued until they return.
  • Automatic Upgrades (Settings › Agent Upgrades):
    • Keeps devices on the newest version, except Never Upgrade groups.
    • Never downgrades, and never retries a version that already failed on a device.
  • Pacing: batches go out every 15 s, sized so every queued online device starts within Start Within (Minutes) (default 3, at least 10 per batch). Each agent adds 0–15 s of jitter, and the package route isn't throttled per IP.
  • Version catalog: every agent version the server ships is kept, for rollbacks. The newest version and rollback targets are protected; Keep Versions prunes the rest.
  • Watchdog:
    • A separate small service (ExecuteRWatchdog, about 12 MB) that restarts a dead or stalled agent.
    • It applies upgrades as a journalled in-place swap and keeps the new version only if it reports healthy and connected within the health deadline. Otherwise it rolls back by itself, then replaces its own binary last.
    • It is in every package and the MSI. Existing agents install it during their first upgrade.
  • Tracking: Device History and a per-device Agent Upgrades tab show upgraded, rolled back and failed, with the reason and log tail.

Breaking changes

  • chore!: the license changes to proprietary (Grace Solutions).
  • feat(webui)!: the React console replaces SvelteKit.
  • Sign-in: /login → /sign-in. Access comes from group bindings; the old default role has no equivalent.

Testing

  • Automated: 167 backend, 125 agent, 33 watchdog and 89 shared tests pass, and the console typecheck and lint are clean.
  • Checked in the browser:
    • Sign-in, password change, step-up, bindings, the People tab, the bulk zip download, group pictures, the shell picker, and the WinPE then installed-OS enrollment with its history.
  • Watchdog end-to-end on Windows: run against a stub agent: upgrade, self-replacement, rollback on health deadline, and recovery after a kill. The upgrade screens were checked in the browser.
  • Not tested:
    • The MSI with the watchdog, which CI builds.
    • A real agent upgrade over NATS.
    • The watchdog on Linux/macOS.
    • A real WinPE image.
    • Live LDAP/AD or an OIDC provider; OIDC was covered only by tests against a fake provider.
    • Remote shell sessions over NATS.

🤖 Generated with Claude Code

React console, StifleR-style sign-in, runs with bulk log downloads, Windows PE and remote shell choices. ## Console - The console moves to React 19 + MUI 9 on the Mantis Pro shell. SvelteKit is removed. - **Screen text:** short signposts on the page, explanations on hover, Title Case labels. - **Monaco editor:** VS Code-grade scripting and Functions experience. - **Remote shell** pops out into its own window and back. ## Runs and jobs - **Run Script dialog:** one tabbed dialog from Devices (check devices, pick a script) or from Scripts (pick a script, then devices and groups). - **Run page:** every run gets a progress bar and counters for Targets, Online, Succeeded, Failed, Running, Pending and Skipped. Each counter filters the device list, and each device opens its output. - **Downloads:** - One job: `COMPUTERNAME.JobID.yyyy.MM.dd.HHmmss.log`. - A whole run: `ScriptName.RunID.….log`. - **New:** check devices on a run and **Download Logs**. You get `ScriptName.RunID.….zip` with one `COMPUTERNAME.JobID.….log` per device. The endpoint is `POST /api/executions/{runId}/output/archive`. - **Group runs:** run now on any mix of devices and groups as one execution. - **Groups:** nested groups and folders. - **Schedules:** a workspace to edit and preview them. ## Sign-in and access (as in StifleR) - **Methods:** Built-In, Local Windows Accounts, LDAP (LDAPS, StartTLS or Kerberos; auto-configured on domain-joined servers; with a breaker) and OIDC (PKCE, end-session). - **Access:** role bindings join groups (built-in, Windows SID, directory DN, OIDC `claim=value`) to ExecuteR's own roles, device scopes included. - **Sessions:** stored in the database, with CSRF protection. - **Safeguards:** sign-in throttling, step-up before changing methods, test-before-disable, a break-glass account, `auth-reset` and `AUTH_FORCE_LOCAL`. - **Upgrade:** users' roles become built-in groups bound to those roles, and the old OIDC settings and claim mappings carry over. This was tested on a copy of a real database. ## Windows PE - **Phase:** the agent detects WinPE and reports the OS as **Windows PE**; the console shows a WinPE chip. - **Identity:** unchanged and taken from the firmware, so the installed OS re-enrolls into the same device row and the name and OS update. - **Device History tab:** lists Enrolled, Renamed and OS Changed events (`GET /api/devices/{clientId}/history`). - **Install:** Windows one-liners work in WinPE. They take the portable ZIP and register the service through the agent's `initialize`, which uses the Service Control Manager APIs. - **Foreground:** `foreground` still works from `startnet.cmd`. ## Remote shell - **Shell picker** for Windows devices: Automatic, PowerShell 7, Windows PowerShell, Built-In PowerShell (the agent's own host, no install needed) and Command Prompt. - **Automatic** tries pwsh, then powershell, then the built-in host, then cmd. ## Agent upgrades and the watchdog - **Starting upgrades:** **Upgrade Agent…** and **Roll Back Agent…** on devices, selections, groups and folders (nested groups included), with a version picker that defaults to Newest for Each Device. Offline devices are queued until they return. - **Automatic Upgrades** (Settings › Agent Upgrades): - Keeps devices on the newest version, except **Never Upgrade** groups. - Never downgrades, and never retries a version that already failed on a device. - **Pacing:** batches go out every 15 s, sized so every queued online device starts within **Start Within (Minutes)** (default 3, at least 10 per batch). Each agent adds 0–15 s of jitter, and the package route isn't throttled per IP. - **Version catalog:** every agent version the server ships is kept, for rollbacks. The newest version and rollback targets are protected; Keep Versions prunes the rest. - **Watchdog:** - A separate small service (`ExecuteRWatchdog`, about 12 MB) that restarts a dead or stalled agent. - It applies upgrades as a journalled in-place swap and keeps the new version only if it reports healthy and connected within the health deadline. Otherwise it rolls back by itself, then replaces its own binary last. - It is in every package and the MSI. Existing agents install it during their first upgrade. - **Tracking:** Device History and a per-device Agent Upgrades tab show upgraded, rolled back and failed, with the reason and log tail. ## Breaking changes - `chore!`: the license changes to proprietary (Grace Solutions). - `feat(webui)!`: the React console replaces SvelteKit. - Sign-in: `/login` → `/sign-in`. Access comes from group bindings; the old default role has no equivalent. ## Testing - **Automated:** 167 backend, 125 agent, 33 watchdog and 89 shared tests pass, and the console typecheck and lint are clean. - **Checked in the browser:** - Sign-in, password change, step-up, bindings, the People tab, the bulk zip download, group pictures, the shell picker, and the WinPE then installed-OS enrollment with its history. - **Watchdog end-to-end on Windows:** run against a stub agent: upgrade, self-replacement, rollback on health deadline, and recovery after a kill. The upgrade screens were checked in the browser. - **Not tested:** - The MSI with the watchdog, which CI builds. - A real agent upgrade over NATS. - The watchdog on Linux/macOS. - A real WinPE image. - Live LDAP/AD or an OIDC provider; OIDC was covered only by tests against a fake provider. - Remote shell sessions over NATS. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
gsadmin added 50 commits 2026-10-23 16:30:53 +00:00
New advisories against the transitive 9.0.4/10.0.10 crypto packages turned
the NuGet audit into a hard build failure under TreatWarningsAsErrors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- PUT /api/triggers/{id} edits a trigger in place (script, target, cadence,
  arguments, name) instead of delete-and-recreate.
- POST /api/triggers/{id}/run fires a trigger now against its current
  target as one execution, leaving its cadence and enabled state alone.
- POST /api/triggers/preview returns the next N fire times, evaluated
  server-side in the schedule's time zone (DST-aware).
- Triggers carry an optional Name and the LastRunId of their last firing
  so the UI can drill straight into that execution.
- Validation: bad time zones are reported as such (not as a cron error),
  enabled one-shots in the past are refused, never-firing crons rejected.
- Device-scoped roles can only aim triggers inside their scope (a visible
  device or a group whose members they can all see; never "all devices").
- Event triggers now pass their captured arguments (they were dropped).
- The sweep and run-now share TriggerExecutor; trigger changes are audited
  under a new "automation" category; deleting a trigger drops its
  once-per-device run records.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
POST /api/jobs takes ClientIds alongside ClientId/GroupId/GroupIds; the
targets are deduplicated, scope-filtered and dispatched under one RunId,
which the response now returns. OnlineOnly skips devices that are not
online (reported in SkippedOffline) instead of queueing for their return.
A lone ClientId keeps its original contract (201 + JobDto, 404/409).

Fixes:
- A GroupIds-only request was rejected ("Target exactly one of clientId
  or groupId"), so multi-group runs from the script page never started.
- Execution summaries left Dispatched jobs out of every tally; they now
  count as pending.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Groups now form a tree (ParentId, at most 8 levels) and gain a Folder kind
that holds no devices of its own. A group's effective membership includes
every group nested under it, so running, scheduling or scoping a role on a
parent reaches its whole subtree.

- POST /api/groups/{id}/move re-parents a group; moves into itself or its
  own subtree, or past the depth limit, are refused.
- GroupMembership evaluates every group once per request (one read of
  groups, static members, devices and, only when needed, inventory)
  instead of re-reading the fleet per group on the list endpoint.
- Group DTOs carry ParentId, DirectMemberCount and OnlineCount; device rows
  carry their direct GroupIds so the console can draw the tree and filter
  by node; a device's groups mark ancestors as Inherited.
- Deleting a group lifts its children to its parent and disables triggers
  that targeted it (with the reason recorded). A group that scopes a role
  is refused: dropping it would silently widen the role to all devices.
- Switching a static group to another kind drops its member rows; folders
  and dynamic groups refuse explicit members; member edits are batched,
  ignore unknown devices and are audited, as are updates and deletes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replaces the SvelteKit app with a Vite/React 19 console built on the Mantis
Pro 4.2.0 seed (MUI 9.0.1): its theme system, component overrides, drawer
and header, restyled to the slate surfaces and blue accent of the house
consoles, with light/dark/system modes on CSS variables.

This commit is the shell; pages move over in the commits that follow
(routes show a placeholder until then).

- Session context with can(permission); navigation entries the session
  cannot use stay visible, disabled, and say why on hover.
- One API module (cookie auth + CSRF double-submit; a 401 returns to
  sign-in with a safe returnUrl) and SWR for cached, shared reads.
- The browser NATS client is unchanged apart from exposing its connection
  state to React; the header shows it as Live/Connecting/Offline.
- Shared building blocks: PageHeader, DataTable (sort, paging, row
  selection, toolbar slot), TreeList (keyboard, context menu, drag and
  drop), ActionMenu (menus as data, greyed entries explain themselves),
  ConfirmDialog, Sheet, GatedButton, StatusChip and time/format helpers.
- Sign-in keeps local, OIDC, auto-redirect, ?local=1 and the forced
  first-password change.

Build/deploy: `vite build` writes dist/. The webui image now serves it
with a dependency-free server.mjs (SPA fallback, immutable asset caching,
traversal-safe) on the same port 3000, so compose/k8s/swarm and their
health checks are unchanged; Package-Server embeds dist/ instead of the
adapter-static output. `npm run check` is now typecheck + ESLint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The Mantis Alert override read ownerState.color, which MUI 9 leaves unset
  when only `severity` is given, so any standard Alert threw while styling
  (the Settings page went to the router error boundary). Fall back to the
  severity.
- The selected drawer entry used primary.900 in dark mode; generated dark
  ramps run darkest-first, so that was a light pill under white text. The
  subtle `lighter` tint with `main` text works in both schemes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ports the remaining SvelteKit pages feature-for-feature onto the new shell:

- Dashboard: KPI tiles, the 14-day execution timeline, outcome/platform/
  engine/exit-code/target/script charts (dependency-free SVG on the theme's
  chart colors, with tooltips and screen-reader tables), recent runs, the
  live activity feed and deploy tracker.
- Jobs: filters by device, script, state and execution (?runId= shows one
  run's targets until they finish); JobOutputDrawer is the shared output
  viewer (stored + live output, progress, stream filters, search, copy,
  download, polling fallback).
- Functions: Monaco editing via a shared CodeEditor (lazy Monaco, PowerShell
  completions, follows light/dark), clone, deep links, unsaved prompts.
- Access: users and roles in sheets; role device scopes pick groups by
  their nested path; system roles read-only with clone.
- Settings: authentication (all sign-in modes), enrollment tokens, secrets
  providers, S3 and agent package, appearance; the Add Device dialog keeps
  the per-OS install commands and adds the MSI/portable ZIP choice the
  install endpoint already supported.
- Remote shell: the same NATS shell protocol in xterm, sized to the page,
  with reconnect; output bytes go straight to xterm so split multi-byte
  characters no longer garble.

Devices, groups, scripts and schedules follow in their own commits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Windows clones (core.autocrlf=true) check out CRLF, and endOfLine: lf
turned every line into a lint warning there. Linux CI is unaffected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Run now
- One Run Script dialog (AutomationProvider/useAutomation) opened from the
  device row and bulk menus, the group tree, device and group pages and the
  script editor. Targets are any mix of devices and groups, picked by name,
  address or nested group path.
- Before running it shows the reach: devices (nested groups included),
  how many are online, and orphaned ones that will be skipped. "Only
  Devices Online Now" skips the rest instead of queueing for their return.
- Typed parameter inputs now start from each parameter's default and are
  validated (required, numbers, unique hashtable keys) before sending.
- The result reads "Queued on N devices; M offline skipped" with a View Run
  link to the execution.

Schedules
- A Schedules page for every schedule and event trigger: search, kind and
  paused filters, next run, last result linking to the run it created.
- One editor (sheet) to create, edit or duplicate: optional name, script,
  When (on a schedule / on enrollment / on agent ready), target (device,
  group with its nested groups, or all devices) and typed arguments,
  which the old UI could not set at all.
- A friendly cadence builder (every N minutes/hours, daily, weekly,
  monthly, once, or raw cron) that reopens saved crons in friendly form,
  defaults to the browser's time zone and previews the next runs computed
  by the server for that zone.
- Row menu: Edit, Run Now, Duplicate, Enable/Disable, Delete; entries the
  session cannot use stay visible and say why.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Devices
- A group tree beside the device grid: All Devices, the nested groups with
  device counts (nested included; online on hover), and Ungrouped. The
  selection, search, status/platform filters and "Include Nested Groups"
  live in the URL; a group's header offers Run on Group, Schedule and its
  menu.
- Every row has a "…" menu, and choosing rows brings up a bulk bar whose
  Actions menu is the same menu: Run Script, Schedule Script, Open Shell,
  Add to Group (or a new static group from the selection), Remove from the
  current static group, Edit/Add Tags, Refresh Inventory, Details, Job
  History, Copy Client ID. The menu is data (utils/deviceActions), and an
  unavailable entry says why: permission, one device at a time, orphaned,
  not online.
- Device detail: run, schedule, shell and the same menu in the header;
  overview, hardware, network, execution history (output in the shared
  drawer), the schedules that reach the device (directly, through any of
  its groups, or all devices), and file delivery.

Groups
- Folders, static and dynamic groups nest; drag a group onto another (or
  onto All Devices for the top level) and confirm the move. Right-click,
  Shift+F10 or long-press opens the group menu: Run, Schedule, View
  Devices, New Group Here, Edit, Duplicate, Move to Top Level, Delete
  (stating which nested groups move up and which schedules get disabled).
- The group editor (sheet) picks the parent by path, switches kind with a
  warning when listed devices would be dropped, previews rule matches live
  and lists static members by name, ID or address. The rule builder only
  offers operators that fit the field.
- The Groups page summarizes every group (nested and own counts, online,
  schedules) and, per group, its rules in plain words, listed devices,
  nested groups and schedules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- List: search, engine, parameters, last change; each row's "…" menu
  offers Open, Run, Schedule, Duplicate and Delete, gated by permission.
- Editor: details and engine notes, then tabs for Code (Monaco with script-
  aware completions and pop-out), Parameters, Functions (attach and order),
  Secrets (browse provider folders and names, or type them), Files,
  Executions (runs -> targets -> output drawer, polling while running) and
  Schedules. Ctrl+S saves; leaving with unsaved changes asks first; Run and
  Schedule save first and open the shared dialogs, so a script can run on
  any devices and groups, not only on groups as before.
- Validation names the first problem and jumps to its tab (parameter names,
  clashes with $Secrets/$Files, binding names).

Every page is now on the new console; the placeholder route is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- README: the WebUI is the React/MUI console; "Device groups and script
  triggers" covers folders, nesting (membership includes nested groups),
  the tree, moves and the safe-delete rules; "Group runs and schedules"
  covers run now on any devices/groups (reach preview, online-only, one
  execution) and the Schedules workspace (edit in place, run now, server
  preview, validation, scope rules). Node 22+ for the WebUI.
- Screenshots regenerated from the new console (dev seed, dark, 1440x900
  @2x, light dashboard); four that nothing referenced are removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A device-scoped role could enable, delete or (via edit) retarget a
  trigger aimed outside its scope; enabling a disabled "all devices"
  schedule then ran it fleet-wide. Enable/disable, delete and edit now
  check the trigger's stored target the same way create and run-now check
  a new one (edit checks both ends).
- Re-enabling a one-shot whose time has passed is refused, as saving one
  already was; it used to fire on the next sweep.
- A lone ClientId with OnlineOnly on an offline device answers 409 instead
  of switching to the multi-target response shape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
decodeURIComponent threw on a bad escape (GET /%) inside the async
handler, and the unhandled rejection exited Node. Requests are now
guarded (400 for bad escapes, 500 otherwise) and file streams have an
error handler.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Group editor: static members seeded once per opening; a device-list
  refresh (live presence, focus, the 60 s poll) used to reset the picker
  and silently drop unsaved additions. A retry after a failed member
  update updates the group just created instead of creating a second one.
- Schedule editor: a disabled one-shot may keep a past time, so a fired
  one-shot can still be renamed or retargeted (the server agrees).
- Run Script: arguments reset to the parameter defaults on every opening
  instead of keeping the previous run's values.
- Job output: polling resumes after the last gap-free record, so lines
  lost from the live stream are fetched, and stored output pages past the
  server's 10,000-record cap instead of truncating long logs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Triggers carry a ConcurrencyStamp, renewed on every save by AppDbContext,
so a write based on a stale read fails instead of silently winning.

- The sweep and Run Now save through TriggerExecutor.SaveFiringAsync: if
  the trigger was edited, toggled or retargeted while firing, that change
  stands (the sweep's cadence advance is dropped) and only the firing's
  outcome and run id are recorded onto it; if it was deleted it stays
  deleted. Previously the sweep overwrote the edit with a NextRunUtc
  computed from the old cron, and a concurrent delete aborted the sweep.
- Editing, enabling/disabling or deleting a trigger that a firing just
  changed answers 409 with a reload hint; so does deleting a group whose
  schedule fired mid-delete.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The project is not open source, so the AGPL text no longer describes it.

- LICENSE: the Grace Solutions proprietary licence used by the other house
  products, including the clause for the commercially licensed Mantis Pro
  template the console is built on.
- THIRD-PARTY-NOTICES.md: the commercial template, the bundled nats-server
  and the open-source server, agent, console and build components with
  their licences.
- Assemblies carry the copyright; the WebUI package is UNLICENSED; both
  container images are labelled LicenseRef-GraceSolutions-Proprietary.
- Server and agent zips ship LICENSE and THIRD-PARTY-NOTICES.md; the README
  gains a Licence section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The MVP design spec (read by coding agents as guidance) now describes
  the React/MUI console on the Mantis Pro shell: stack, folder layout,
  live-update path, UI conventions, image build (Vite dist/ served by
  server.mjs), CI step and architecture diagram, so later work does not
  drift back to Svelte.
- .editorconfig covers .tsx/.mjs instead of .svelte; Test.ps1 help names
  the WebUI typecheck + lint.
- Initialize-Repository.ps1 refuses Node older than 22 up front (the NATS
  browser client needs it; npm's engines check already enforced it later).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Windows environment names are case-insensitive, so assigning "ApiKey"
over an inherited "APIKEY" kept the old spelling; bash is case-sensitive
and saw $ApiKey as empty. On any Windows device with a same-named variable
in different case, that parameter or secret silently arrived blank. The
inherited entry is now removed first so the script's name wins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A random port in 20000-60000 occasionally collided with one in use and
HttpListener.Start() threw, failing a delivery test now and then.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Output objects were sent as PSObject.ToString(), so anything that was not
already a string came back as a type name or a terse dump:
"System.Collections.Hashtable", "System.Diagnostics.Process (svchost)",
"@{Name=widget; Size=42}".

Both PowerShell engines now pipe the script's output through
`Out-String -Stream -Width 4096`, PowerShell's own formatter: objects
arrive as their table or list view (a hashtable's Name/Value rows,
properties as columns), still streamed line by line as they are produced,
wide enough that tables are not cut short with "…" at 80/120 columns.
Strings pass through unchanged; trailing padding is trimmed; the exit
code is unaffected. Bash output was already text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Job reads never applied the role's device scope: a scoped role could list
every job, open any job and read its output (which holds whatever the
script printed) and see every target of an execution. The job list,
job, output, a script's executions and an execution's targets are now
limited to devices inside the scope (others read as not found).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- GET /api/jobs/{jobId}/output/download: one job's complete stored output
  as .txt with a header (device, state, exit code, times).
- GET /api/executions/{runId}/output/download: every target of a run in
  one file, a section per device with its state and exit code.
- Both stream straight from the database (no size cap, nothing buffered),
  tag non-output streams ("[ERROR] …"), take ?timestamps=true, name the
  file script_device-or-run_time.txt, and respect device scope.
- Console: the output drawer's download now fetches the full log from the
  server (it used to save only the lines currently loaded and filtered);
  runs get Download Output on the Jobs page and on a script's Executions
  tab. README documents downloads and the new output rendering.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Client ids are deterministic (SHA-256 over normalized hardware ids) and
re-enrollment was already idempotent per device — history, tags, groups
and schedules carry over and the new key is bound. But every bootstrap
spent a token use, so re-running the same install command (single-device
tokens: one use, 24 h) failed on the second redeploy.

Devices now record the token that last enrolled them. That token
re-enrolls the same device without spending a use, even once its uses are
gone, as long as it is not expired or revoked; any other device still
needs a use left. Repeat enrollments are marked in the audit trail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Redeploying over an enrolled agent used to delete its credentials before
re-bootstrapping, so a spent token or an unreachable server stranded the
device. Credentials are now replaced only when the new enrollment
succeeds: a rejected token is dropped and the agent carries on, and an
unreachable server keeps both for the next start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A job downloads as COMPUTERNAME.JobID.yyyy.MM.dd.HHmmss.log and a run as
ScriptName.RunID.yyyy.MM.dd.HHmmss.log (creation time, UTC, 24-hour).
Dots only separate fields; other characters in the name become dashes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A shell is now a controller that outlives its page: Pop Out moves the live
xterm element into a new window (xterm adopts the window), so the session,
scrollback and running commands carry over and the console stays usable.
Return to Console / Bring Back docks the same terminal; closing the window
docks it when the shell page shows and ends the session otherwise, and
signing out or leaving the console ends every shell.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- PowerShell grammar scoped like VS Code's (cmdlets, -Parameters, word
  operators, types/attributes, string interpolation, here-strings) with
  Dark/Light Modern colours on the console's slate surfaces.
- Context-aware IntelliSense from one token-based analysis per document
  version: the command's parameters after '-', declared variables after '$',
  $Secrets./$Files./$env:/[type] members, attached module functions,
  snippets; hover cards with syntax and comment-based synopsis.
- Outline (Ctrl+Shift+O, sticky scroll), go to definition, references,
  highlights and F2 rename for variables and functions.
- Problems for unbalanced brackets and unbound secret/file names.
- Gutter change bars and Compare with Saved (Ctrl+K D) against the saved text.
- VS Code-style status bar: position, problems, current function,
  indentation and LF/CRLF menus, word wrap/sticky scroll/minimap toggles.
- Fix: a render lagging a keystroke behind no longer writes the stale value
  back into the editor (lost characters and a jumping cursor when typing fast).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Runs record now holds what started a run (manual, schedule or trigger),
what it targeted and the devices it skipped (orphaned, or offline with
Only Devices Online Now), which previously existed only in the POST
response. Executions answer with RunCounts (targets, pending, running,
succeeded, failed, cancelled, skipped, online now), per-target online state
and failure summary, and the skipped list (narrowed to a scoped role's
devices). GET /api/executions lists recent runs across scripts. Schedules
count orphaned members as skipped instead of dropping them silently.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Run Script is a tabbed modal (Script, Devices, Groups, Parameters,
  Review) with the same mechanics from a script (script fixed, opens on
  Devices) and from devices (selection preselected, opens on Script).
  Devices are searchable and multi-select with Choose Results.
- Starting a run opens /runs/{runId}: one segmented progress bar, counters
  for Targets, Online, Pending, Running, Succeeded, Failed and Skipped that
  filter the target list, skipped devices listed, rows drilling into output,
  Run Again and Download Output.
- Jobs opens on Runs (recent runs across scripts with progress and source);
  the script Executions tab uses the same progress view.
- Buttons keep their authored Title Case (no forced capitalize), as StifleR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Applies the standing UI text rule (as StifleR's): descriptions, captions,
empty states and dialog intros are a few words to one line; anything longer
moves into a HoverHelp or tooltip beside the label it explains. Subheaders
and helper paragraphs become title or label help icons, explanatory info
alerts become one line plus hover, and a few labels are put in Title Case.
Behaviour and control labels are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Four sign-in methods, configured in the database and switched per tab:
Built-In accounts (PBKDF2-SHA512, 12+ characters, forced change, older
hashes rehashed), Local Windows Accounts (LogonUser against this server's
SAM, bound by SID and local group SIDs), LDAP/Active Directory
(System.DirectoryServices.Protocols: LDAPS, StartTLS, Kerberos sign and
seal; user/group filters, nested groups; automatic setup on a
domain-joined server with a breaker) and OIDC (code + PKCE, state/nonce/
verifier in the database, ID token validation, group claims, end session).

- Sessions are database rows behind __Host-session (revocable at once,
  idle + absolute expiry) with a session-bound CSRF token; failed sign-ins
  back off per account and address; step-up guards switching methods.
- People get access only through groups: role bindings name a built-in
  group, a Windows SID, an LDAP DN or an OIDC claim=value and bind it to an
  ExecuteR role, so permissions and device scope compose across roles.
- Settings › Authentication endpoints per method with If-Match, test
  sign-ins, and the guard that keeps a way in; users, built-in groups and
  bindings under /api/admin; the break-glass account (INITIAL_ADMIN_* or a
  one-time password in the log) and auth-reset recovery.
- Upgrade: users' roles move onto built-in groups, the old OIDC settings
  (database or OIDC_* env) and claim mappings onto documents and bindings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign-in page for Built-In, Local Windows Accounts, LDAP and OIDC with
redirect mode, forced password change and break-glass display; step-up
dialog; Settings > Authentication tabs (methods, sessions, accounts,
built-in groups, role bindings, tests, LDAP breaker); Access page with
Roles bound by groups and a People tab. Settings tabs follow the
permissions their endpoints need. README describes the new model and
the upgrade.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
POST /api/executions/{runId}/output/archive streams
ScriptName.RunID.yyyy.MM.dd.HHmmss.zip with one
COMPUTERNAME.JobID.yyyy.MM.dd.HHmmss.log per chosen job (every job when
none are chosen), scoped like the other downloads. The run table gains
checkboxes (skipped targets have no log) and Download Logs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ShellOpenCommandPayload and CreateShellRequest carry an optional ShellKinds
value (auto, pwsh, powershell, cmd, builtin; null = automatic) and
ShellStatePayload reports the shell the agent started. The backend
validates the choice (400 on unknown), passes it to the agent and records
it in the shell audit detail. Old agents ignore the new field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The agent resolves the requested shell: PowerShell 7 (Program Files or
PATH), Windows PowerShell, cmd.exe (%ComSpec%) or its own built-in
PowerShell console; automatic takes the first of those that exists. A
missing explicit choice fails the open with a clear message.

The built-in shell is the hidden `shell-host` verb: the SDK console host
(ConsoleShell.Start) on the embedded engine with the bundled modules on
PSModulePath, so a shell works in Windows PE without WinPE-PowerShell. It
starts no agent workers and touches no config or credentials.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The remote shell page gets a Shell picker (Automatic, PowerShell 7,
Windows PowerShell, Command Prompt, Built-In PowerShell) on Windows
devices; picking one opens a new session with it and the choice is
remembered per browser. The picker, page title and pop-out window show
the shell the agent started (Automatic resolves to the actual shell).
Explanations live in hover tooltips on each option.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Provider tests share the database and leave OIDC configured, so the
summary test failed depending on run order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Detect Windows PE via the HKLM\SYSTEM\CurrentControlSet\Control\MiniNT key
(injectable WindowsPhase probe) and report the OS as "Windows PE" with the
real build version in inventory and at enrollment. Enrollment now sends the
same OS reading inventory does, so the device row no longer flips between
"Microsoft Windows NT ..." and "Windows 11". WMI failures beyond
ManagementException (no WinPE-WMI) are caught with a clear log message.
Hardware identity is unchanged, so a device keeps its client id from WinPE
into the installed OS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The default (MSI) script detects Windows PE via the MiniNT key and takes the
portable path there, since Windows Installer does not run in WinPE. The
portable path unzips with System.IO.Compression instead of Expand-Archive,
stops a running agent before replacing its files, and registers and starts
the Windows service through the agent's own `initialize` (SCM APIs), now
failing loudly on a non-zero exit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When a device's hostname or OS caption changes — at enrollment, presence or
inventory — record a "device" audit event on its client id
(device-renamed "MINWINPC-ABC → LAB-PC-01", device-os-changed
"Windows PE 10.0.26100 → Windows 11 10.0.26100.4351"), only when the value
actually changes. Every (re)enrollment records device-enrolled with the name
and OS it enrolled as, and the bootstrap-succeeded row now carries the OS.
GET /api/devices/{clientId}/history returns the trail newest first
(devices.view, device scope honored). No schema change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The device page gains a Device History tab listing enrollments, renames and
OS changes newest first (Enrolled / Renamed / OS Changed, the detail, and
the relative time). Devices reporting "Windows PE" show a WinPE chip in the
device list and the device header, explained on hover.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When a device re-enrolls with a different OS (Windows PE → its installed
OS), the inventory on file still describes Windows PE, and group rules
prefer it over the enrollment-reported OS — so an on-enrollment trigger
scoped to "not Windows PE" never fired for the installed OS. Drop the stale
snapshot on such an enrollment; fresh inventory follows within seconds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Windows PE runs from a small RAM drive; a first install extracts straight
into Program Files instead of a temporary copy. Re-runs still unpack aside,
stop the agent and copy over it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeps the existing one-argument construction (integration tests) working.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs: Windows PE names the remote shell choices
CI / build-test (push) Successful in 19m6s
CI / images (push) Successful in 4m35s
CI / build-test (pull_request) Successful in 6m2s
CI / images (pull_request) Has been skipped
4a007ce544
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gsadmin added 22 commits 2026-10-23 21:50:28 +00:00
The upgrade command and its progress events, upgrade states and reasons,
package types per runtime, one version comparison, the files the agent and
the watchdog share under <data>/upgrade, the console API, and the agent's
runtime on presence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upgrades start in batches every 15 seconds, sized so every queued online device starts within StartWithinMinutes (at least 10 a batch); each agent adds a random start jitter before downloading.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GET /api/agent-packages/{sha256} serves one catalog package by content
hash (what an upgrade command's DownloadUrl points at). A queued upgrade
whose device never came back is cancelled with reason "expired".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Catalog: every node imports the upgradable packages it can see (version
  from the VERSION marker) into <data>/agent-packages/<version>/, offloads
  them to S3 when agent offload is on, and prunes to KeepVersions, never
  the newest, an open upgrade's target or a device's rollback target.
  GET/DELETE /api/agent-versions.
- GET /api/agent-packages/{sha256}: anonymous, ranges, no per-address
  limit; falls back to the install package or the S3 copy.
- POST /api/agent-upgrades (devices and nested groups, scope applied) and
  /rollback queue rows with skip reasons; cancel while queued; list.
- Scheduler (with the schedules, SCHEDULE_WORKER): every 15 s it sends the
  next batch of queued online devices, sized so each starts within
  StartWithinMinutes (at least 10 a batch, 15 s agent jitter); no-report
  deadlines, presence-confirmed success, 7-day queue expiry, automatic
  upgrades (never a downgrade, never a failed target again).
- Agent upgrade events on the agent event subject update rows, write
  Device History (agent-upgraded, agent-rolled-back, agent-upgrade-failed)
  and tell consoles. Presence records the agent runtime.
- Settings › Agent Upgrades (GET/PUT /api/settings/agent-upgrades).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each fixture gets its own data root for catalog copies; catalog syncs are
driven by the tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Types and calls for the version catalog, upgrade attempts, rollback,
cancel and Settings › Agent Upgrades; one module of state, reason, source
and platform labels with their hover text; the version order the server
uses; and the state chip and version marker the lists share.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Device rows, bulk Actions and the device page get Upgrade Agent… and
Roll Back Agent…; the group and folder menu gets the same for every
device under it. The upgrade dialog picks a version (newest for each
device by default); the result snackbar counts devices left out and shows
why.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The agent version (sorted by version), marked when a newer version holds a
package for the device's platform, and a state chip while an upgrade is
open, from one read of the open upgrades for the page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Agent card shows the version with its available-upgrade marker, the
open upgrade (state and target) and the last finished one. A new Agent
Upgrades tab lists every attempt: From → To, source, state, reason with
its detail on hover, last log lines, and Cancel while queued. Device
History names the agent-upgraded, agent-rolled-back and
agent-upgrade-failed events.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Automatic Upgrades (on/off, Start Within, Health Deadline, Never Upgrade
groups with their folder paths, Keep Versions), the Agent Versions catalog
(newest, platforms, devices, imported, Remove with the server's reason
when blocked) and Recent Upgrades across devices with an Open Only filter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A second, small process (ExecuteR-Watchdog / executer-watchdog: self-contained,
single file, trimmed, referencing only Shared.Contracts) that polls every 2 s:

- applies a hand-over: staging checked (location, safe paths, size + SHA-256),
  journalled phases (stopping, swapping, verifying, committed / rolling-back),
  files copied into .next/<id> and checked again, current files to
  .previous/<id>, a move retried only while in use (10 x 500 ms), the new
  version kept only when its beacon reports the version, connected, after the
  start, within the deadline; three exits end the wait (crashed); a rollback
  puts .previous back, starts the old agent and writes the outcome with the
  last log lines; failures before any move are tried three times
- recovers a run cut short from its journal at start, and never applies an
  upgrade that has a journal or an outcome again
- replaces its own binary last, when the package brings a newer one that runs
- supervises the agent without fighting an admin: only an automatic-start
  service that hangs (stale beacon) or stopped with a failure is restarted
- registers itself through the SCM APIs (ExecuteRWatchdog), systemd
  (executer-watchdog) or launchd (info.executer.watchdog)

The meeting files are read and written through a source-generated context
and one atomic file store in Shared.Contracts, shared with the agent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- command.agent.upgrade: acknowledged, recorded per UpgradeId (a redelivery is
  skipped), run in the background. Refused as unsupported when not the
  installed service or for another platform's package type, busy while a
  hand-over, swap or unreported outcome is pending; succeeded/already on the
  running version. Otherwise waits the random start jitter first, downloads
  (a "/" path resolved against the configured server URL, an absolute URL as
  is; OS trust or TlsSkipVerify, the configured proxy) to
  upgrade/downloads/<sha>.zip with progress events, checks size and SHA-256,
  unpacks into staging/<version>-<id>/, makes sure the watchdog is installed
  and running (copied from the package for installs that predate it), writes
  handover.json and reports installing; a hand-over not picked up in time
  fails with reason watchdog.
- health.json every 5 s on its own timer (installed service only): version,
  PID, connected = command consumer bound and NATS open.
- the outcome the watchdog left is published once connected, then deleted;
  old downloads and staging are tidied (the newest kept).
- presence carries the build's RID; install/initialize register and start the
  watchdog beside the agent, remove takes it out first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Package-Agent.ps1 publishes the watchdog (trimmed single file) for every RID
and puts it beside the agent (ExecuteR-Watchdog.exe; executer-watchdog on
linux/macOS), so the zips CI stages into the backend image carry it. The MSI
installs it as its own component with the ExecuteRWatchdog service
(LocalSystem, automatic, restart on failure, `run`), started on install and
removed on uninstall; MajorUpgrade is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs: the two agent upgrade sections link each other and are in the contents
CI / build-test (push) Successful in 21m40s
CI / images (push) Successful in 3m17s
CI / build-test (pull_request) Successful in 5m56s
CI / images (pull_request) Has been skipped
c12c7d571c
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gsadmin changed title from React console, StifleR sign-in, runs with bulk logs, Windows PE and shell choices to React console, StifleR sign-in, runs with bulk logs, Windows PE, shell choices and agent auto-upgrade 2026-10-23 21:50:54 +00:00
gsadmin merged commit e0780cd865 into main 2026-10-23 23:31:56 +00:00
Sign in to join this conversation.