3 Commits

Author SHA256 Message Date
Alphaeus Mote 408a960f42 feat(sequences): server-orchestrated script sequences that continue across restarts [skip ci]
A sequence is an ordered list of steps, each an existing script with its own
arguments, extra Functions, own S3 files, condition (previous outcome,
platform, full OS / Windows PE, groups), Restart On Completion (one
RestartSettings value over the script's own), Continue On Error and
Success/Warning/Failure exit-code lists (codes, ranges, hex, *; defaults
0 / 3010, 1641 / *; validated server side, no overlaps).

A start records the sequence run, one ordinary run per step with that
step's sealed snapshot, and each device's run with its first step's job.
Every step is a normal job sent by the JobDispatcher, so history, output,
run pages, dashboards and audit are unchanged. A SequenceWorker (on the
SCHEDULE_WORKER node, every 2 s) classifies a finished step, waits while its
restart is under way (Restarted, or a newer inventory boot time, which also
covers Windows PE), checks the next step's condition and queues it, with one
update conditioned on the device run's version and the next job in the same
transaction: duplicate or concurrent advances move a device once. The
batched job-state writer is untouched.

Sequences run from Run Now (POST /api/jobs with sequenceId), schedules and
event triggers (sequenceId on /api/triggers), and On Demand with the device
CLI, which returns at once for a sequence. Runs can be cancelled
(POST /api/sequence-runs/{id}/cancel); steps not yet sent are cancelled.
Jobs, runs and summaries carry a sequence step reference. Migrations for
SQLite, PostgreSQL and SQL Server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 09:54:26 -05:00
Alphaeus Mote bb707b9b33 test: hold on the CI runner (SYSTEM account, path case, presign second)
CI / build-test (push) Failing after 9m36s
CI / images (push) Has been skipped
Release / release (push) Failing after 1m25s
Release / images (push) Has been skipped
The runner runs the suite as SYSTEM: a pipe it owns is trusted by design,
and its temp path's case varies. A presigned link signed a moment after its
expiry was set reads one second shorter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 22:26:39 -05:00
Alphaeus Mote 44a4c3aaec feat(agent): logon events, device-clock start times, trigger context and run CLI
One process-wide session watcher: the Windows service lifetime now takes
SERVICE_CONTROL_SESSIONCHANGE and forwards it; a foreground run polls
WTSEnumerateSessions. Remote View sweeps at once on console and logon
changes. Logons (WTSINFO LogonTime and DOMAIN\user on Windows, loginctl
on linux; none on macOS or in Windows PE) are caught up at start, deduped
in logons.json and reported as "logon" agent events, queued while the
agent is offline.

Script jobs wait on the device clock until NotBeforeUtc before they run,
see what started them ($Trigger, EXECUTER_TRIGGER_* for external engines)
and feed a local observer keyed by the request id.

`ExecuteR-Agent run <name|id> [-p Name=Value] [--wait] [--timeout s]` and
`run --list` reach the running agent over a named pipe (Administrators and
SYSTEM only, elevated callers, owner-checked) or a root-only Unix socket,
which asks the backend with an agent.run.request. Bare `run` is still the
service entry point.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 14:59:47 -05:00