Commit Graph
57 Commits
Author SHA1 Message Date
jaredandClaude Opus 5.5 5d1cdf9da0 Quick Command remembers the mode and workers (#31)
CI / Lint (eslint) (pull_request) Successful in 23s
CI / Test (jest) (pull_request) Successful in 23s
CI / Security (npm audit) (pull_request) Successful in 10s
CI / Integration (api) (pull_request) Successful in 2m40s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 1m51s
CI / UI (playwright) (pull_request) Successful in 4m32s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 4m43s
The mode (single or multi), the single worker and the multi-worker
selection are saved in localStorage (pulse_qc_prefs): the mode when it
changes, the workers when a command is sent. A reload starts from that
choice instead of the first worker; a Re-run from Executions still
overrides it. The Ctrl+Enter hint and shortcut already existed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:19:02 -05:00
jaredandClaude Opus 5.5 d1ef6297ec Empty states say what to do next (#33)
CI / Lint (eslint) (pull_request) Successful in 24s
CI / Test (jest) (pull_request) Successful in 22s
CI / Security (npm audit) (pull_request) Successful in 10s
CI / Integration (api) (pull_request) Successful in 2m39s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 2m7s
CI / UI (playwright) (pull_request) Successful in 2m25s
CI / Deploy (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 2m23s
CI / Notify (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
- Workers: what a worker is, the four settings it needs, and a link to
  the README's worker setup.
- Scheduler: what a schedule does, a + New Schedule button, and a
  pointer to try the command in Quick Command first.
- Workflows: links to the step reference and to Quick Command, under the
  existing Create button.
- The "No workers available" pickers in Quick Command and the schedule
  form link to the Workers page.
- UI test with stubbed empty lists checks each hint and action.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:08:30 -05:00
jaredandClaude Opus 5.5 d7d1381259 Long commands: narrower box, 500-character hover text
CI / Lint (eslint) (pull_request) Successful in 39s
CI / Test (jest) (pull_request) Successful in 36s
CI / Security (npm audit) (pull_request) Successful in 27s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 2m2s
CI / Integration (api) (pull_request) Successful in 2m50s
CI / UI (playwright) (pull_request) Successful in 2m31s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 2m24s
The command box stops at min(24rem, 100%) so a long command ends in an
ellipsis well short of the next column, and the list returns up to 500
characters so the hover text shows the whole command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 13:29:52 -05:00
jaredandClaude Opus 5.5 eda319e16a Executions list: show what a command ran and on which worker (#15)
CI / Test (jest) (pull_request) Successful in 27s
CI / Lint (eslint) (pull_request) Successful in 31s
CI / Security (npm audit) (pull_request) Successful in 11s
CI / Integration (api) (pull_request) Canceled after 1m56s
CI / Scan (secrets, workflows, shell) (pull_request) Canceled after 1m48s
CI / UI (playwright) (pull_request) Canceled after 0s
CI / UI screenshots (before/after) (pull_request) Canceled after 0s
CI / Deploy (pull_request) Canceled after 0s
CI / Deploy worker (pull_request) Canceled after 0s
CI / Notify (pull_request) Canceled after 0s
Every command execution was listed as "[Quick Command]". The list API now
returns, for command executions, the first command (up to 120 characters)
and the worker's name (from the first log entry, joined to workers), and
the row shows them as `command @ worker`. Workflows keep their name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 13:27:12 -05:00
jared a945cd80d3 Merge pull request 'Run multi-target commands in parallel' (#75) from parallel-targets into main
CI / UI screenshots (before/after) (push) Skipped
CI / Test (jest) (push) Successful in 20s
CI / Lint (eslint) (push) Successful in 29s
CI / Security (npm audit) (push) Successful in 15s
CI / Scan (secrets, workflows, shell) (push) Successful in 2m1s
CI / Integration (api) (push) Successful in 2m50s
CI / UI (playwright) (push) Successful in 1m56s
CI / Deploy (push) Successful in 14s
CI / Deploy worker (push) Successful in 8s
CI / Notify (push) Successful in 3s
2026-11-23 13:15:17 -05:00
jaredandClaude Opus 5.5 abb4b9326f Run multi-target commands in parallel (#26)
CI / Lint (eslint) (pull_request) Successful in 27s
CI / Test (jest) (pull_request) Successful in 19s
CI / Security (npm audit) (pull_request) Successful in 12s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 1m58s
CI / Integration (api) (pull_request) Successful in 2m49s
CI / UI (playwright) (pull_request) Successful in 2m15s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 2m6s
- Workflow execute steps send to all targets at once and wait for every
  result (Promise.all), so one slow or hung worker no longer holds up the
  rest; any failed target fails the step. parallel: false keeps the old
  one-at-a-time order, stopping at the first failure, for rolling changes.
  (Log appends are atomic in SQL, so concurrent targets can't lose
  entries.)
- Quick Command's multi-worker mode sends to every selected worker at once.
- Integration tests: 3 workers x 2 s finish in about 2 s; parallel: false
  takes 6 s or more; one failing target fails the step after all report.
- README: the parallel field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 13:07:26 -05:00
jaredandClaude Opus 5.5 4cf3c084a9 Executions: Re-run Workflow, and search that finds commands (#18, #16)
CI / Test (jest) (pull_request) Successful in 23s
CI / Lint (eslint) (pull_request) Successful in 26s
CI / Security (npm audit) (pull_request) Successful in 15s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 1m42s
CI / Integration (api) (pull_request) Successful in 2m37s
CI / UI (playwright) (pull_request) Successful in 2m45s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 2m41s
- #18: a workflow execution's detail now offers Re-run Workflow, which
  starts the same workflow with the parameters from its params log entry
  (after a confirm listing them) and opens the new run. Quick commands
  keep Re-run Command.
- #16: search runs on the server: workflow name, who started it, the id,
  or any command the execution ran (JSON_SEARCH over the logs). The page
  sends it as you type (debounced 300 ms, from the first page); the
  status filter stays local.
- Regression tests for #12 (Create Workflow starts with the example) and
  #13 (dry run works for workflows without parameters), which the UI
  rewrite had already fixed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 13:03:42 -05:00
jaredandClaude Opus 5.5 789e5651c8 Worker memory: report available memory, not free memory (#30)
CI / Test (jest) (pull_request) Successful in 19s
CI / Lint (eslint) (pull_request) Successful in 21s
CI / Security (npm audit) (pull_request) Successful in 11s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 1m54s
CI / Integration (api) (pull_request) Successful in 2m36s
CI / UI (playwright) (pull_request) Successful in 2m15s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 2m29s
os.freemem() leaves out the page cache, so a healthy Linux box looks full:
the production worker (CT 153, 512 MB) has 4 MB free but 449 MB
available, and showed as 99% used instead of about 12%.

- worker: heartbeat metadata adds availableMem from MemAvailable in
  /proc/meminfo (falls back to os.freemem()); freeMem stays for old
  servers.
- Workers tab and dashboard compute used memory from availableMem when
  present, from freeMem for workers that predate it.
- Unit tests for the meminfo parsing and the fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:55:25 -05:00
jaredandClaude Opus 5.5 39d28fb9e7 Executions: show runs waiting on a prompt; Automated tab filters on the server (#3, #4)
CI / Lint (eslint) (pull_request) Successful in 29s
CI / Test (jest) (pull_request) Successful in 24s
CI / Security (npm audit) (pull_request) Successful in 12s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 1m48s
CI / Integration (api) (pull_request) Successful in 2m32s
CI / UI (playwright) (pull_request) Successful in 2m6s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 2m28s
- #3: the list response includes waiting_for_input for each execution
  (a running execution blocked on a prompt). The row shows it as
  'waiting' (the design system's purple status) and the Waiting status
  filter, which could never match, now finds it.
- #4: new only_internal=true filter (Gandalf and scheduler runs), used by
  the Automated tab, so it pages and counts on the server like the Manual
  tab; the client-side filter over one shared page is gone.
- Tests: integration for waiting_for_input and both server filters; UI
  for the waiting status and the filter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:38:22 -05:00
jaredandClaude Opus 5.5 6ffe230c34 Rate limits per user, and coalesce live-event reloads (#10)
CI / Lint (eslint) (pull_request) Successful in 23s
CI / Test (jest) (pull_request) Successful in 23s
CI / Security (npm audit) (pull_request) Successful in 1m17s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 1m42s
CI / Integration (api) (pull_request) Successful in 4m23s
CI / UI (playwright) (pull_request) Successful in 2m35s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 2m13s
Production refused 1,052 of the UI's requests with 429 in one day: every
user arrives through the reverse proxy, so the per-IP limiter put the
whole team in one bucket, and each open page reloaded its whole list on
every live event (about two per Gandalf command).

- lib/ratelimit.js keys both limiters: a trusted SSO identity gets
  user:<name>, a request with the valid Gandalf key gets 'gandalf' (an
  invalid key falls back to the IP, so nobody can drain Gandalf's bucket),
  everything else the IP. The API default goes from 300 to 1000 per
  15 min per bucket.
- Pulse.util.throttle: live-event reloads on Executions, Dashboard and
  Workers run at most once per 2 s (at once when idle, then once at the end
  of the window). User actions still reload immediately.
- Unit tests for the keys. No visual change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:26:06 -05:00
jaredandClaude Opus 5.5 c890d5c078 Workers tab: show the commit each worker runs (#40)
CI / UI screenshots (before/after) (push) Skipped
CI / Lint (eslint) (push) Successful in 16s
CI / Test (jest) (push) Successful in 17s
CI / Security (npm audit) (push) Successful in 18s
CI / Scan (secrets, workflows, shell) (push) Successful in 2m1s
CI / Integration (api) (push) Successful in 2m34s
CI / Lint (eslint) (pull_request) Successful in 22s
CI / Test (jest) (pull_request) Successful in 22s
CI / Security (npm audit) (pull_request) Successful in 18s
CI / UI (playwright) (push) Successful in 2m14s
CI / Deploy (push) Skipped
CI / Deploy worker (push) Skipped
CI / Notify (push) Skipped
CI / Integration (api) (pull_request) Successful in 2m23s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 1m33s
CI / UI (playwright) (pull_request) Successful in 2m28s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 2m43s
A Version row on each worker card: the short sha linked to the commit in
Gitea, or 'unknown' for a worker that doesn't report one. Updated live
with the rest of the card. Playwright checks all three test workers show
the checkout's HEAD.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:23:56 -05:00
jaredandClaude Opus 5.5 599a62f010 Resync the vendored design system (dash-free upstream) and check it too
CI / Lint (eslint) (push) Failing after 44s
CI / Test (jest) (push) Successful in 24s
CI / Security (npm audit) (push) Successful in 7s
CI / Integration (api) (push) Successful in 1m13s
CI / Scan (secrets, workflows, shell) (push) Successful in 2m21s
CI / Lint (eslint) (pull_request) Failing after 18s
CI / UI (playwright) (push) Successful in 2m9s
CI / Deploy (push) Skipped
CI / Deploy worker (push) Skipped
CI / Notify (push) Skipped
CI / Test (jest) (pull_request) Successful in 18s
CI / Security (npm audit) (pull_request) Successful in 29s
CI / Integration (api) (pull_request) Successful in 2m23s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 2m19s
CI / UI (playwright) (pull_request) Successful in 1m34s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
public/web_template is now web_template 8286bb2, which removed every em
and en dash (web_template#3, approved with screenshots). Pulse's copy was
byte-identical to the previous upstream bbec859, so the only changes are
upstream's: hyphens in comments, '-' for empty values in lt.fmt, and
'ALL SYSTEMS NOMINAL: PULSE' / offline banner and toast rewording.

- The CI dash check no longer excludes public/web_template.
- UI tests: no page renders an em or en dash; the boot screen reads
  'ALL SYSTEMS NOMINAL: PULSE'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:23:12 -05:00
jaredandClaude Opus 5.5 027dce7fd5 Remove em and en dashes from UI text
Security / JS Security (npm audit) (push) Failing after 23s
Lint / JS (eslint) (push) Successful in 26s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Security / JS Security (npm audit) (pull_request) Failing after 38s
Lint / JS (eslint) (pull_request) Successful in 42s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Test / JS Tests (jest) (pull_request) Successful in 28s
Test / JS Tests (jest) (push) Successful in 31s
Replace the remaining dashes users can see:
- error page titles and headings, and the browser tab title: "|" or ":";
- the footer: "PULSE | TDS v1.2";
- the 401 message and two toasts: sentence breaks or a comma;
- the quick-command history and success line: "|";
- empty table cells: "-";
- the compare hint: "2 to 5".

No layout or behaviour changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:55:26 -05:00
jaredandClaude Opus 5.5 66d5240be0 Remove em and en dashes from comments, logs, docs and CI
Security / JS Security (npm audit) (push) Failing after 15s
Lint / JS (eslint) (push) Successful in 16s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Lint / JS (eslint) (pull_request) Successful in 13s
Lint / Notify on failure (pull_request) Skipped
Test / JS Tests (jest) (push) Successful in 15s
Lint / Deploy (pull_request) Skipped
Test / JS Tests (jest) (pull_request) Successful in 17s
Security / JS Security (npm audit) (pull_request) Failing after 20s
Replace every em dash and en dash outside user-visible UI text with a
colon, comma, hyphen or "to". The UI strings and the vendored
web_template are handled separately.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:50:37 -05:00
jaredandClaude Fable 5.1 eca5cb45b1 feat(ui): TDS migration stage 3 — integration fixes, legacy removal, docs
Lint / JS (eslint) (pull_request) Successful in 10s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / JS Security (npm audit) (pull_request) Failing after 10s
Test / JS Tests (jest) (pull_request) Successful in 14s
Lint / JS (eslint) (push) Successful in 11s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Security / JS Security (npm audit) (push) Failing after 11s
Test / JS Tests (jest) (push) Successful in 10s
- Fix design-system class names that do not exist in base.css (.lt-alert--error,
  .lt-form-hint); add shared .lt-modal-lg, .lt-field-error and .is-invalid rules
- Remove public/index.html and the public/base.js symlink
- package.json: start script, correct main
- README: vendored design system, Web UI section, new env vars, read-only dev mode

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HamVMDrA8RqhyxmUHgiqRp
2026-09-08 22:17:15 -04:00
jaredandClaude Fable 5.1 68d0a906a6 feat(ui): TDS migration stage 2 — six page views and page modules
- Dashboard, Workers, Workflows, Executions, Quick Command, Scheduler pages on the
  shared layout, all behaviour via Pulse delegated actions (no inline handlers)
- Executions: server-driven Manual/Automated views, compare mode, detail modal with all
  log types, ?open= deep link, cross-page re-run via sessionStorage
- Workflows: run modal (dry-run available for every workflow), create modal pre-filled
  with the example definition
- Fix EJS comment in page-header partial that broke rendering

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HamVMDrA8RqhyxmUHgiqRp
2026-09-08 21:57:33 -04:00
jaredandClaude Fable 5.1 cbb91a306d feat(ui): TDS migration stage 1 — EJS layout, CSP, vendored design system, shared runtime
- Vendor web_template base.css/base.js (v1.2 bbec859) under public/web_template with sync script
- Add views/layout.ejs (fixed upstream EJS comment delimiters, mobile drawer, cmd palette,
  keys help, WS status, theme toggle) and lib/render.js two-step renderer
- Add page routes for /, /workers, /workflows, /executions, /quick, /scheduler (stub views)
- helmet with strict nonce CSP (script-src-attr 'none'), /csp-report, report-only toggle
- lib/pageauth.js: shared users upsert + HTML 401/403 for page routes
- PULSE_DEV_READONLY guard disabling background writers for local testing
- public/assets/app.js shared runtime (Pulse namespace, delegated actions, WS singleton,
  themed confirm modal) and app.css
- eslint globals for browser files; ignore vendored assets

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HamVMDrA8RqhyxmUHgiqRp
2026-09-08 21:46:24 -04:00
jaredandClaude Sonnet 4.6 d523b6d02a ci: add ESLint lint workflow with per-directory configs
Lint / JS (eslint) (push) Failing after 8s
Node.js env for server.js/worker/, browser env for public/.
All errors downgraded to warnings (empty blocks, inner declarations,
loose equality, useless escape, constant condition) for practical CI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 23:46:46 -04:00
jaredandClaude Sonnet 4.6 0990e5b807 Add parse/route step types, wider modal, automated link troubleshooter
- Add 'parse' step type: reads KEY=VALUE lines from last command output into execution state
- Add 'route' step type: evaluates JS conditions list, auto-jumps to first match with no user input
- Support condition field on parse steps (skip when conditional execute was also skipped)
- Widen execution detail modal to min(1100px, 96vw) to eliminate horizontal scrolling
- Show last command output in prompt boxes so user has context before clicking
- Add formatLogEntry support for parse_complete and route_taken log actions
- Apply applyParams() substitution to prompt messages ({{server_name}}, {{iface}}, etc.)
- Fix prompt button onclick using data-opt attribute to avoid JSON double-quote breakage

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 19:29:28 -04:00
jaredandClaude Sonnet 4.6 2290d52f8b Fix prompt buttons, add command output to prompt steps, add worker to repo
- Fix onclick buttons broken by JSON.stringify double-quotes inside HTML
  attributes — use data-opt attribute + this.dataset.opt instead
- Track last command stdout in execution state when command_result arrives
- executePromptStep: include last command output in log entry and broadcast
  so users can review results alongside the question in the same view
- GET /api/executions/🆔 propagate output field to pending prompt response
- Add .prompt-output CSS class for scrollable terminal-style output block
- Fix MariaDB CAST(? AS JSON) → JSON_EXTRACT(?, '$') (MariaDB 10.11 compat)
- Add worker/worker.js to repo (deployed on pulse-worker-01 / LXC 153)
  Fix: worker was not echoing command_id back in result — resolvers always
  got undefined, causing every workflow step to timeout and fail

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 19:06:02 -04:00
jaredandClaude Sonnet 4.6 3f6e04d1ab Apply LotusGuild design system convergence (aesthetic_diff.md)
- §5: Section headers now ╠═══ TITLE ═══╣ (was ═══ TITLE ═══)
- §8+§18: Replace inline-style showTerminalNotification() with lt.toast.*
  delegate wrapper; load base.js from /base.js
- §12: Fix --text-muted #008822→#00bb33 (WCAG AA contrast)

base.js symlinked from web_template into public/ so lt.* is available.
showTerminalNotification() is kept as a thin wrapper so all existing
call sites continue to work unchanged.

README: Remove completed pending items (toast, text-muted, position)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 21:40:36 -04:00
jaredandClaude Sonnet 4.6 18a6b642d1 Fix all-workers-offline silent success bug, noisy logging, UX polish
server.js:
- Fix bug: when all targeted workers disconnect before step runs, results[] was empty
  and results.every() returned true vacuously (silent false success). Now tracks sentCount
  and fails with 'no_workers' log if nothing was actually dispatched
- Remove per-message console.log on every WebSocket message (high noise)
- Only log a warning for failed commands (not every success)

index.html:
- loadSchedules() catch now shows error message in scheduleList (was silent)
- abortExecution() shows server's error message from JSON body instead of generic string
  (e.g. "Execution is not running" instead of "Failed to abort execution")

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 13:48:35 -04:00
jaredandClaude Sonnet 4.6 8ff3700601 Fix XSS, add per-step timeout/retry to workflow engine
index.html:
- Escape started_by in execution list, execution cards, and execution detail modal
- Escape schedule name in schedules list

server.js:
- Per-step timeout: step.timeout (seconds) overrides global COMMAND_TIMEOUT_MS (5s-600s range)
- Per-step retry: step.retries (max 5) with step.retryDelayMs (max 30s) re-sends command on failure
  with command_retry log entries showing attempt/max_retries progress

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 17:36:35 -04:00
jaredandClaude Sonnet 4.6 ba5ba6f899 Security and reliability fixes: XSS, race conditions, logging
- Fix XSS in workflow list: escape name/description/created_by with escapeHtml()
- Fix broadcast() race: snapshot browserClients Set before iterating
- Fix waitForCommandResult: use position-based matching (worker omits command_id in result)
- Fix scheduler duplicate-run race: atomic UPDATE with affectedRows check
- Suppress toast alerts for automated executions (gandalf:/scheduler: prefix)
- Add waiting_for_input + prompt fields to GET /executions/:id
- Add GET /api/workflows/:id endpoint
- Add interactive prompt UI: respondToPrompt(), WebSocket execution_prompt handler
- Add workflow editor modal (admin-only)
- Remove sensitive console.log calls (WS payload, command output)
- Show error messages in list containers on load failure
- evalCondition: log warning instead of silently swallowing errors
- Worker reconnect: clean up stale entries for same dbWorkerId
- Null-check execState before continuing workflow steps

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 17:30:32 -04:00
jaredandClaude Sonnet 4.6 a596c6075c Fix ESC handler, form reset, and scheduler next-run countdown
- Fix ESC key handler to use .modal.show class selector instead of style.display check
- Reset create workflow form fields when opening the create modal
- Show relative countdown (e.g. "in 5m") alongside next run timestamp in scheduler list

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 11:26:48 -04:00
jaredandClaude Sonnet 4.6 95f6554cc2 Frontend improvements: safety, UX, and WebSocket handling
- Guard all new Date().toLocaleString() calls with safeDate() to prevent 'Invalid Date'
- Guard escapeHtml() for null/undefined input
- Guard getTimeAgo() for null/NaN dates; add safeDate() and formatElapsed() helpers
- Show elapsed time for running executions in the execution list
- Add status-running CSS pulse animation class to running execution items
- Add explicit executions_bulk_deleted WebSocket handler
- clearCompletedExecutions() uses new bulk DELETE endpoint instead of N individual requests
- switchTab() persists active tab to localStorage; init restores it on load
- refreshData() updates lastRefreshed timestamp in header
- Add Ctrl+Enter shortcut for quick command form
- Wrap rerunCommand worker_id with escapeHtml() to prevent XSS

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 11:24:34 -04:00
jaredandClaude Sonnet 4.6 658caa9f7e Fix bracket wrapping to new lines via inline-flex on buttons
The CSS ::before/::after pseudo-elements for [ ] brackets were rendering
on separate lines because button HTML had multiline whitespace (newlines +
indentation) inside the tag, causing:
  [
    Button Text
  ]

Fix: set button display to inline-flex with align-items:center so
pseudo-elements become flex children that stay on the same line
as button content regardless of internal whitespace. Also add
white-space:nowrap and flex-shrink:0 on pseudo-elements.

Also fix compareBtn.style.display to use inline-flex to avoid
reverting to block-level display that would re-introduce wrapping.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 23:27:00 -04:00
jaredandClaude Sonnet 4.6 af63fbb1de Fix remaining [[ ]] double-bracket bugs on Templates, History, and sub-tab buttons
- Remove manual [ ] from sub-tab buttons (Manual Runs, Automated)
- Add CSS to suppress button::before/after pseudo-elements on .tab
  buttons and border:none inline-styled buttons so they don't get
  double-bracketed
- Prevents [[ text ]] from appearing on Templates/History/sub-tabs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 23:23:58 -04:00
jaredandClaude Sonnet 4.6 d7b26c2b70 Fix [[ ]] visual bug and add missing log type handlers
Root cause: CSS button::before/after adds [ ] universally, but many
buttons had hardcoded [ text ] content, producing [[ text ]].

- Strip manual [ ] wrappers from all button text in HTML and JS
- Fix JS textContent assignments for compare mode buttons
- Fix dynamic button HTML strings in execution details panel
- Add formatLogEntry handlers for previously unhandled action types:
  dry_run_skipped, execution_timeout, goto_error, step_error,
  workflow_result, params, server_restart_recovery
- Unknown log actions now show action name instead of raw JSON
- Add cron schedule type display in schedules list

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 23:18:18 -04:00
jaredandClaude Sonnet 4.6 2d6a0f1054 Add rate limiting, cron scheduling, webhooks, dry-run, execution filtering, and UX improvements
- Rate limiting: 300 req/15min general, 20 req/min on POST /api/executions
- Cron schedule type support using cron-parser for full cron expressions
- Webhook notifications: POST to workflow webhook_url on execution complete/failed
- Dry-run mode: simulate workflow execution without running any commands
- Global execution timeout via EXECUTION_MAX_MINUTES env var (default 60min)
- Execution filtering: status, workflow_id, started_by, after, before, search
- Event-driven command result delivery (replaces 500ms DB polling)
- Atomic log appends via JSON_ARRAY_APPEND (no read-modify-write race)
- Separate browserClients/workerClients sets (workers no longer receive broadcasts)
- Stale execution cleanup on startup (mark running→failed after crash)
- Scheduler overlap prevention (skip if same workflow already running)
- Frontend: webhook_url field in create/edit workflow modals
- Frontend: dry-run checkbox in workflow param modal
- Frontend: ESC closes modals, ws.onerror handler added
- Frontend: selectedExecutions changed from Array to Set (O(1) ops)
- Frontend: XSS fixes via escapeHtml() on all user-controlled innerHTML
- Frontend: param modal keydown listener deduplication fix
- Remove unused npm packages (bcryptjs, body-parser, cors, js-yaml, jsonwebtoken)
- Add express-rate-limit and cron-parser dependencies

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 23:06:09 -04:00
jaredandClaude Sonnet 4.6 58c172e131 Security hardening, bug fixes, and performance improvements
Security fixes:
- Replace new Function() condition eval with vm.runInNewContext() (RCE fix)
- Add admin checks to DELETE executions, all scheduled-commands endpoints
- Remove api_key from GET /api/workers response (was exposed to all employees)
- Separate browserClients/workerClients sets; broadcast() now sends to browsers only
- Add worker WebSocket auth: reject if api_key provided but invalid
- Fix XSS: escapeHtml() on step_name, duration, worker_id, user info, execution_id

Bug fixes:
- Replace DB-polling waitForCommandResult with event-driven _commandResolvers Map
- Replace non-atomic addExecutionLog with JSON_ARRAY_APPEND (fixes concurrent write race)
- Add stale execution recovery on startup: running→failed with log entry
- Fix calculateNextRun returning null for unknown types (now throws)
- Fix scheduler overlap: skip if previous execution still running
- Fix JSON double-parse on worker_ids column
- Fix switchTab() bare event.target reference
- Fix selectedExecutions Array→Set (O(1) lookups, fixes performance regression)
- Fix param modal event listener leak (delegated handler, removes before re-adding)
- Add ws.onerror handler (was silently swallowing WebSocket errors)
- Move misplaced routes to before server.listen()

Performance/cleanup:
- DB connection pool 10→50
- EXECUTION_RETENTION_DAYS default 1→30 (matches docs)
- Remove unused packages: bcryptjs, body-parser, cors, js-yaml, jsonwebtoken
- Remove generateUUID() wrapper, use crypto.randomUUID() directly
- Remove dead example workflow constants
- Add ESC key handler to close modals
- Fix clearCompletedExecutions limit 1000→9999
- Add security notice to README.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 22:53:25 -04:00
jaredandClaude Sonnet 4.6 0fee118d1d Suppress toast notifications for automated executions
Automated executions (started_by gandalf: or scheduler:) no longer
trigger success/failure toast alerts for connected browser users.
Server now includes is_automated flag in command_result broadcasts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 16:26:18 -05:00
jaredandClaude Sonnet 4.6 bf9b14bc96 Add interactive workflow system with prompt steps, workflow editor
- executeWorkflowSteps: rewritten with step-id/goto branching support
- executePromptStep: async pause via _executionPrompts Map, 60min timeout
- POST /api/executions/:id/respond: resolves pending prompt from browser
- PUT /api/workflows/🆔 admin-only workflow editing, broadcasts workflow_updated
- GET /api/workflows/🆔 fetch single workflow for edit modal
- GET /api/executions/🆔 now includes waiting_for_input + prompt fields
- index.html: prompt/prompt_response/step_skipped log entry rendering
- index.html: execution_prompt WebSocket handler refreshes open modal
- index.html: workflow_updated WebSocket handler reloads workflow list
- index.html: Edit button + modal for in-browser workflow editing
- index.html: respondToPrompt keeps modal open, refreshes execution view
- Interactive Link Troubleshooter v2 workflow: 45-step wizard with
  copper/fiber branches, clean/swap/reseat actions, re-test loops,
  CRC error path, performance diagnostics, SUCCESS/ESCALATE terminals

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 16:55:02 -05:00
jaredandClaude Sonnet 4.6 033237482d feat: workflow param substitution + link troubleshooter support
Adds {{param_name}} template substitution to the workflow execution engine
so workflows can accept user-supplied inputs at run time.

server.js:
- applyParams() helper — substitutes {{name}} in command strings with
  validated values (alphanumeric + safe punctuation only); unsafe values
  throw and fail the execution cleanly
- executeCommandStep() / executeWorkflowSteps() — accept params={} and
  apply substitution before dispatching commands to workers
- POST /api/executions — accepts params:{} from client; validates required
  params against definition.params[]; logs params in initial execution log

index.html:
- loadWorkflows() caches definition in _workflowRegistry keyed by id;
  shows "[N params]" badge on parameterised workflows
- executeWorkflow() checks for definition.params; if present, shows
  param input modal instead of plain confirm()
- showParamModal() — builds labelled input form from param definitions,
  marks required fields, focuses first input, Enter submits
- submitParamForm() — validates required fields, calls startExecution()
- startExecution() — POSTs {workflow_id, params} and switches to executions tab
- Param input modal — terminal-aesthetic overlay, no external dependencies

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 16:20:05 -05:00
jaredandClaude Sonnet 4.6 6d945a1913 feat: Gandalf M2M API, manual/automated execution sub-tabs, cleanup tuning
- server.js: add authenticateGandalf middleware (X-Gandalf-API-Key header)
  and two internal endpoints used by Gandalf link diagnostics:
    POST /api/internal/command  — submit SSH command to a worker, returns execution_id
    GET  /api/internal/executions/:id — poll execution status/logs
  Also tag automated executions as started_by 'gandalf:*' / 'scheduler:*';
  add hide_internal query param to GET /api/executions; change cleanup
  from daily/30d to hourly/1d to keep execution history lean
- index.html: add Manual / Automated sub-tabs on Execution History tab so
  Gandalf diagnostic runs don't clutter the manual run view; persists
  selected tab to localStorage; dashboard recent-run strip filters to
  manual runs only; sub-tabs show live counts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 16:04:22 -05:00
jared e7707d7edb Add abort execution feature for stuck/running processes 2026-01-08 22:11:59 -05:00
jaredandClaude Sonnet 4.5 9b31b7619f Add WebSocket error handling with stack traces
Wrapped ws.onmessage in try-catch to capture full stack trace
when errors occur during message handling. This will help identify
where the 'Cannot read properties of undefined' error is coming from.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-07 23:33:07 -05:00
jaredandClaude Sonnet 4.5 aaeb59a8e2 Improve error handling in workflow creation and data loading
- Separated JSON validation from API call error handling
- Changed refreshData() to async with individual try-catch blocks
- Better error messages: "Invalid JSON" vs "Error creating workflow"
- Console.error logging for each data loading function
- Changed success alert to terminal notification
- This will help identify which specific function is failing

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-07 23:27:54 -05:00
jaredandClaude Sonnet 4.5 018752813a Implement Complete Workflow Execution Engine
Added full workflow execution engine that actually runs workflow steps:

Server-Side (server.js):
- executeWorkflowSteps() - Main workflow orchestration function
- executeCommandStep() - Executes commands on target workers
- waitForCommandResult() - Polls for command completion
- Support for step types: execute, wait, prompt (prompt skipped for now)
- Sequential step execution with failure handling
- Worker targeting: "all" or specific worker IDs/names
- Automatic status updates (running -> completed/failed)
- Real-time WebSocket broadcasts for step progress
- Command result tracking with command_id for workflows
- Only updates status for non-workflow quick commands

Client-Side (index.html):
- Enhanced formatLogEntry() with workflow-specific log types
- step_started - Shows step number and name with amber color
- step_completed - Shows completion with green checkmark
- waiting - Displays wait duration
- no_workers - Error when no workers available
- worker_offline - Warning for offline workers
- workflow_error - Critical workflow errors
- Better visual feedback for workflow progress

Workflow Definition Format:
{
  "steps": [
    {
      "name": "Step Name",
      "type": "execute",
      "targets": ["all"] or ["worker-name"],
      "command": "your command here"
    },
    {
      "type": "wait",
      "duration": 5
    }
  ]
}

Features:
- Executes steps sequentially
- Stops on first failure
- Supports multiple workers per step
- Real-time progress updates
- Comprehensive logging
- Terminal-themed workflow logs

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-07 23:19:12 -05:00
jaredandClaude Sonnet 4.5 4511fac486 Phase 10: Command Scheduler
Added comprehensive command scheduling system:

Backend:
- New scheduled_commands database table
- Scheduler processor runs every minute
- Support for three schedule types: interval, hourly, daily
- calculateNextRun() function for intelligent scheduling
- API endpoints: GET, POST, PUT (toggle), DELETE
- Executions automatically created and tracked
- Enable/disable schedules without deleting

Frontend:
- New Scheduler tab in navigation
- Create Schedule modal with worker selection
- Dynamic schedule input based on type
- Schedule list showing status, next/last run times
- Enable/Disable toggle for each schedule
- Delete schedule functionality
- Terminal-themed scheduler UI
- Integration with existing worker and execution systems

Schedule Types:
- Interval: Every X minutes (e.g., 30 for every 30 min)
- Hourly: Every X hours (e.g., 2 for every 2 hours)
- Daily: At specific time (e.g., 03:00 for 3 AM daily)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-07 23:13:27 -05:00
jaredandClaude Sonnet 4.5 4e17fdbf8c Phase 9: Execution Diff View
Added powerful execution comparison and diff view:

- Compare Mode toggle button in executions tab
- Multi-select up to 5 executions for comparison
- Visual selection indicators with checkmarks
- Comparison modal with summary table (status, duration, timestamps)
- Side-by-side output view for all selected executions
- Line-by-line diff analysis for 2-execution comparisons
- Highlights identical vs. different lines
- Shows identical/different line counts
- Color-coded diff (green for exec 1, amber for exec 2)
- Perfect for comparing same command across workers
- Terminal-themed comparison UI

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-07 23:08:55 -05:00
jaredandClaude Sonnet 4.5 5c41afed85 Phase 8: Execution Search & Filtering
Added comprehensive search and filtering for execution history:

- Search bar to filter by command text, execution ID, or workflow name
- Status filter dropdown (All, Running, Completed, Failed, Waiting)
- Real-time client-side filtering as user types
- Filter statistics showing X of Y executions
- Clear Filters button to reset all filters
- Extracts command text from logs for quick command searches
- Maintains all executions in memory for instant filtering
- Terminal-themed filter UI matching existing aesthetic

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-07 23:06:43 -05:00
jaredandClaude Sonnet 4.5 4baecc54d3 Phase 7: Multi-Worker Command Execution
Added ability to execute commands on multiple workers simultaneously:

- Added execution mode selector (Single/Multiple Workers)
- Multi-worker mode with checkbox list for worker selection
- Helper buttons: Select All, Online Only, Clear All
- Sequential execution across selected workers
- Results summary showing success/fail count per worker
- Updated command history to track multi-worker executions
- Terminal beep feedback based on overall success/failure
- Maintained backward compatibility with single worker mode

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-07 23:03:45 -05:00
jaredandClaude Sonnet 4.5 661c83a578 Fix clearCompletedExecutions for new pagination API format
Changes:
- Handle new pagination response format (data.executions vs data)
- Request up to 1000 executions to ensure all are checked
- Track successful deletions count
- Use terminal notification instead of alert
- Better error handling for individual delete failures

Fixes regression from Phase 5 pagination changes.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-07 22:55:13 -05:00
jaredandClaude Sonnet 4.5 c6e3e5704e Phase 6: Terminal aesthetic refinements and notifications
Changes:
- Added blinking terminal cursor animation
- Smooth hover effects for execution/worker/workflow items
- Hover animation: background highlight + border expand + slide
- Loading pulse animation for loading states
- Slide-in animation for log entries
- Terminal beep sound using Web Audio API (different tones for success/error)
- Real-time terminal notifications for command completion
- Toast-style notifications with green glow effects
- Auto-dismiss after 3 seconds with fade-out
- Visual and audio feedback for user actions

Sound features:
- 800Hz tone for success (higher pitch)
- 200Hz tone for errors (lower pitch)
- 440Hz tone for info (standard A note)
- 100ms duration, exponential fade-out
- Graceful fallback if Web Audio API not supported

Notification features:
- Fixed position top-right
- Terminal-themed styling with glow
- Color-coded: green for success, red for errors
- Icons: ✓ success, ✗ error, ℹ info
- Smooth animations (slide-in, fade-out)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-07 22:52:51 -05:00
jaredandClaude Sonnet 4.5 9f972182b2 Phase 5: Auto-cleanup and pagination for executions
Changes:
Server-side:
- Added automatic cleanup of old executions (runs daily)
- Configurable retention period via EXECUTION_RETENTION_DAYS env var (default: 30 days)
- Cleanup runs on server startup and every 24 hours
- Only cleans completed/failed executions, keeps running ones
- Added pagination support to /api/executions endpoint
- Returns total count, limit, offset, and hasMore flag

Client-side:
- Implemented "Load More" button for execution pagination
- Loads 50 executions at a time
- Appends additional executions when "Load More" clicked
- Shows total execution count info
- Backward compatible with old API format

Benefits:
- Automatic database maintenance
- Prevents execution table from growing indefinitely
- Better performance with large execution histories
- User can browse all executions via pagination
- Configurable retention policy per deployment

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-07 22:50:39 -05:00
jaredandClaude Sonnet 4.5 fff50f19da Phase 4: Execution detail enhancements with re-run and download
Changes:
- Added "Re-run Command" button to execution details modal
- Added "Download Logs" button to export execution data as JSON
- Re-run automatically switches to Quick Command tab and pre-fills form
- Download includes all execution metadata and logs
- Buttons only show for applicable execution types
- Terminal-themed button styling

Features:
- Re-run: Quickly repeat a previous command on same worker
- Download: Export execution logs for auditing/debugging
- JSON format includes: execution_id, status, timestamps, logs
- Filename includes execution ID and date for easy organization

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-07 22:49:20 -05:00
jaredandClaude Sonnet 4.5 8152a827e6 Phase 3: Quick command enhancements with templates and history
Changes:
- Added command templates modal with 12 common system commands
- Added command history tracking (stored in localStorage)
- History saves last 50 commands with timestamp and worker name
- Template categories: system info, disk/memory, network, Docker, logs
- Click templates to auto-fill command field
- Click history items to reuse previous commands
- Terminal-themed modals with green/amber styling
- History persists across browser sessions

Templates included:
- System: uname, uptime, CPU info, processes
- Resources: df -h, free -h, memory usage
- Network: ip addr, active connections
- Docker: container list
- Logs: syslog tail, who is logged in, last logins

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-07 22:45:40 -05:00
jaredandClaude Sonnet 4.5 bc3524e163 Phase 2: Enhanced worker status display with metadata
Changes:
- Show worker system metrics in dashboard and worker list
- Display CPU cores, memory usage, load average, uptime
- Added formatBytes() to display memory in human-readable format
- Added formatUptime() to show uptime as days/hours/minutes
- Added getTimeAgo() to show relative last-seen time
- Improved worker list with detailed metadata panel
- Show active tasks vs max concurrent tasks
- Terminal-themed styling for metadata display
- Amber labels for metadata fields

Benefits:
- See worker health at a glance
- Monitor resource usage (CPU, RAM, load)
- Track worker activity (active tasks)
- Better operational visibility

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-07 22:43:13 -05:00
jaredandClaude Sonnet 4.5 f8ec651e73 Phase 1: Improve log display formatting
Changes:
- Added formatLogEntry() function to parse and format log entries
- Replaced raw JSON display with readable formatted logs
- Added specific formatting for command_sent and command_result logs
- Show timestamp, status, duration, stdout/stderr in organized layout
- Color-coded success (green) and failure (red) states
- Added scrollable output sections with max-height
- Syntax highlighting for command code blocks
- Terminal-themed styling with green/amber colors

Benefits:
- Much easier to read execution logs
- Clear visual distinction between sent/result logs
- Professional terminal aesthetic maintained
- Better UX for debugging command execution

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-07 22:41:29 -05:00