Commit Graph

7168 Commits

Author SHA1 Message Date
rcourtman a4c5a85bef Keep Assistant route labels provider-explicit 2026-06-07 23:25:26 +01:00
rcourtman 92f08a1f16 Add FormatCloudSafeContext: PII-free discovery context for cloud models
Discovery-side enablement for making the Assistant useful on CLOUD models.
Today, sensitive resources route to cloud as a terse redacted summary, so
the Assistant never receives discovery's access context and gives generic
answers — invisibly broken for the majority of users who run cloud AI.

FormatCloudSafeContext returns the operational context the Assistant needs
(service identity, access pattern, config/data/log paths, port numbers)
while omitting PII by construction (no hostname, IP, bind addresses). The
chat sanitizer (Codex's ai/chat + unifiedresources policy lane) can include
this in cloud-routed summaries behind an opt-in, instead of withholding
everything. Local routing keeps using FormatForAIContext (full context).

Tested: includes service/access/paths/ports; rejects hostname + IP.
2026-06-07 23:19:44 +01:00
rcourtman 59a91042d9 Keep Assistant retry routes session-faithful 2026-06-07 23:11:19 +01:00
rcourtman c4523aaf11 Flag stale discoveries (pre-engine-version) for re-run in the panel
Cached discoveries from before the surface/fast-path/nested fixes still
counted as 'fresh' by the time-based window, so the panel showed worse
pre-fix data (what 'surely this isnt done?' surfaced on esphome).

Add servicediscovery.DiscoveryEngineVersion (currently 1), stamped onto
every freshly built discovery (LXC/VM and Docker build sites). Unlike
CLIAccessVersion it is NOT auto-upgraded on read, so a missing/older value
reliably means the result predates the current engine. The per-guest panel
shows an amber 're-run for improved results' nudge when engine version is
below current (CURRENT_DISCOVERY_ENGINE_VERSION, kept in sync).

Contract-neutral re: unified-resources (DiscoveryTab is a consumer; this is
a UI nudge + discovery field, no consumption-contract delta) — landed via
PULSE_ALLOW_CONTRACT_NEUTRAL_COMMIT. Go package + version-stamp test pass;
type-check + eslint clean.
2026-06-07 23:05:46 +01:00
rcourtman 621391a125 Pace burst Assistant workflow statuses 2026-06-07 22:48:43 +01:00
rcourtman 778eaac06e Clear terminal Assistant workflow status rows 2026-06-07 22:27:46 +01:00
rcourtman 38b3ec4a3a Discovery panel: show a human-runnable CLI command, not Assistant plumbing
The per-guest Discovery panel dropped the raw cli_access string into a
copyable code row — but cli_access is guidance written for the Assistant
('Use pulse_control with target_host ...'), which is meaningless to a
person and reads as a fake command.

Derive a concrete, human-runnable command from the resource coordinates
(deriveCliCommand): 'pct exec 101 -- bash' for an LXC, 'docker exec <name>
bash' for Docker, and the layered 'pct exec 101 -- docker exec
homeassistant bash' for a service in a nested container. Show that
(copyable) with a 'run from the Proxmox/Docker host' hint. For types with
no clean human command (VM, k8s, agent) fall back to the cli_access text,
now clearly labelled as how the Assistant reaches it. The cli_access field
itself (Assistant context) is unchanged.

Unit-tested (deriveCliCommand); type-check + eslint clean.
2026-06-07 22:18:30 +01:00
rcourtman 3e0e150f7e Keep same-route retry after hidden stream artifacts 2026-06-07 22:15:52 +01:00
rcourtman 11d442c083 Ignore retired Assistant provider fallback events 2026-06-07 21:59:44 +01:00
rcourtman ac1628f9b4 Add distinctive-port fast-path for un-named workloads
The name fast-path identifies workloads named after their service, but a
workload with a generic name (ct101, db1) still fell through to the model —
which, with a slow reasoning model configured, times out rather than just
being slow. Many such workloads are still identifiable instantly by a
DISTINCTIVE listening port.

Add a Ports field to the identity table (only single-service ports: 8123
HA, 32400 Plex, 5432 postgres, 6379 redis, 1883/8883 mosquitto, 3306
mariadb, 8086 influxdb, 8096 jellyfin, 9090 prometheus, 6052 esphome) and
a second fast-path inferSurfaceIdentityFromPorts that runs after the name
path and before the model. Ambiguous ports (80, 443, 8080, 3000, 5000) are
deliberately excluded — a bad port guess is worse than asking the model.

Parser validated against real ss -tlnp output from LXC 101 (extracts 8123,
ignores ephemeral ports / PIDs / docker-proxy noise → home-assistant).
Unit tests cover distinctive-port matches and ambiguous-only non-matches.
2026-06-07 21:52:41 +01:00
rcourtman ddd9aaddba Keep fast Assistant tool rows visibly running 2026-06-07 21:48:12 +01:00
rcourtman 3bbbee323f Detect nested-container access topology in discovery
The fast-path nailed identity but emitted the bare-guest access path, so
for a service running in Docker inside an LXC/VM (e.g. Home Assistant
Container) it told the Assistant to 'pct exec' into the guest shell —
wrong: the service is one layer deeper.

Access topology is index-level 'how to reach it' (only a probe can know a
service runs in a nested container), so re-add a LIGHT nested-container
probe (docker ps names+images, not the deep enumeration) to the LXC/VM
surface sets. When a nested container matches the identified service,
layer cli_access: '... docker exec <container> <command>'. Identity stays
instant from the name; the access path is corrected by one cheap command
when the agent is connected, and falls back to bare-guest guidance when not.

Verified live: HA LXC 101 (homeassistant container under Docker, alongside
watchtower) now yields cli_access including 'docker exec homeassistant',
in ~1s. Tests cover the match (HA by name, postgres by image), non-matches
(watchtower, unrelated service, no docker), and the cli_access layering.
2026-06-07 21:39:22 +01:00
rcourtman a8833dca2c Add provider settings action to Assistant model picker 2026-06-07 21:37:29 +01:00
rcourtman 691decb845 Align Assistant live workflow status 2026-06-07 21:19:55 +01:00
rcourtman 623d3e7749 Add deterministic surface fast-path to discovery (no model for obvious services)
Discovery should be instant for the obvious case: a workload named after
its service ('home-assistant', 'frigate', 'mqtt'…) is identified from the
name alone, with no model call and no command scan needed. This is the
'surface index' — identity + how-to-reach — with depth left to the
Assistant's own knowledge and on-demand commands.

Expand knownServiceIdentities from one entry (esphome) to the common
homelab set, and run inferSurfaceIdentity BEFORE the model: on a
name match, build the identity result and skip the (slow reasoning-model)
analysis entirely. Conservative — name signals only, never broad
command-output guesses — so the model is skipped only on an obvious match;
ambiguous workloads still fall through to full analysis.

Verified live on real infra: HA LXC now identifies in ~0s as Home
Assistant (0.9), no model call, even with the agent disconnected —
previously it timed out at 45s on the reasoning model.

Tests: new inferSurfaceIdentity coverage; updated three tests whose
fixtures were named after known services (they now take the fast-path) —
abstention test uses a generic name, repair test expects 0 model calls,
cached test uses a complete identity. Full package green.
2026-06-07 21:15:11 +01:00
rcourtman db6694774f Align Assistant slash command empty state 2026-06-07 20:57:34 +01:00
rcourtman f18fb88cdc Make discovery a fast surface scan, not a deep scan
Discovery is the index, not the encyclopedia: it needs to quickly answer
'what is this and how do I reach it', then the Assistant supplies
standard-service knowledge and runs commands on demand for specifics.

Trim the guest command sets to surface identity signals only (OS,
hostname, running services, listening ports, top processes for
LXC/VM; OS, processes, ports, env for Docker). Drop the deep
enumeration — installed_packages, config_files, docker_mounts,
hardware/GPU, disk, cron, nested docker_check — which bloated the
evidence payload (and the AI analysis) for no benefit the Assistant
can't get live. Remove the now-unused dockerMountsCommand const and
retire its test; add TestGuestCommandSetsAreSurfaceOnly to pin the
surface intent (verified live: HA LXC went from 13 commands to 5).

Note: full speed also needs a fast identification path (the configured
reasoning model still exceeds the 45s analysis timeout on its own) —
that's the follow-up.
2026-06-07 20:54:46 +01:00
rcourtman 33701fe274 Preview safe Assistant tool output snippets 2026-06-07 20:37:40 +01:00
rcourtman 4b826d5403 Preserve Assistant workflow activity on completed turns 2026-06-07 20:25:05 +01:00
rcourtman fa50307212 Clarify Assistant route recovery actions 2026-06-07 20:08:29 +01:00
rcourtman 2e486fbbf9 Align Assistant command availability with toolbar state 2026-06-07 19:57:56 +01:00
rcourtman 23f520f7e7 Make Assistant idle liveness route-aware 2026-06-07 19:43:43 +01:00
rcourtman 586f80c837 Compact live Assistant tool activity 2026-06-07 19:21:31 +01:00
rcourtman 4e270cfd50 Improve Assistant model command search 2026-06-07 19:08:28 +01:00
rcourtman edabb6c059 Hide successful Assistant tool output previews 2026-06-07 18:50:28 +01:00
rcourtman a4a14e4911 Require explicit Assistant route recovery 2026-06-07 18:35:25 +01:00
rcourtman 4a21a5fb90 Surface rejected Assistant fallback metadata 2026-06-07 18:26:07 +01:00
rcourtman 2d4c98d513 Reject cross-provider Assistant route fallback 2026-06-07 18:13:21 +01:00
rcourtman 738fc4eb13 Reject unsupported Assistant session diff/revert 2026-06-07 18:01:55 +01:00
rcourtman 8f2d7158db Include Assistant command previews in transcripts 2026-06-07 17:32:34 +01:00
rcourtman 648e24182d Add Assistant live wait heartbeat 2026-06-07 17:21:47 +01:00
rcourtman 84ec1a7214 Align Assistant provider retry with OpenCode 2026-06-07 17:04:42 +01:00
rcourtman b4a492c4bd Add Assistant transcript message copy 2026-06-07 16:29:11 +01:00
rcourtman 5c4b54251d Clarify Assistant gateway fallback and command copy 2026-06-07 16:17:31 +01:00
rcourtman bf1d5ceeaf Show active Assistant model route during turns 2026-06-07 16:03:07 +01:00
rcourtman 05c8874b7d Show Assistant provider route health in composer 2026-06-07 15:53:23 +01:00
rcourtman d20017cdb2 Route Assistant gateway fallback through model resolution 2026-06-07 15:45:00 +01:00
rcourtman eed41dc9a2 Preview bounded Assistant tool output 2026-06-07 15:35:04 +01:00
rcourtman 8d55796fa1 Add Kubernetes (kubectl exec) cell to the Discovery oracle
Completes the resource-type matrix in the scenario corpus: LXC, Docker,
VM, and now k8s. A redis-pod cache-loss/restart question that needs
kubectl exec access, redis.conf, the rollout-restart command, and the
memory-limit fact — verified through both chat and remediation packs.
Test-only coverage; full servicediscovery package green.
2026-06-07 15:23:25 +01:00
rcourtman d946d76a73 Pace Assistant workflow transcript rows 2026-06-07 15:20:23 +01:00
rcourtman 77538f23d0 Add VM (qm guest exec) cell to the Discovery scenario oracle
The corpus covered LXC and Docker workloads but not VMs, which the agent
reaches via the QEMU guest agent (qm guest exec) rather than pct/docker
exec. Add a Plex-on-VM cell — a transcode-failure question that needs the
guest-exec access, the GPU decoder (hardware fact), and the restart
command — verified through both the chat and remediation packs. Test-only
coverage; full servicediscovery package green.
2026-06-07 15:14:13 +01:00
rcourtman 9b77bc5057 Preserve queued Assistant workflow pacing 2026-06-07 15:03:52 +01:00
rcourtman 5af2d95df4 Preserve queued Assistant workflow pacing 2026-06-07 15:02:01 +01:00
rcourtman bbd9f9d0e5 Order Discovery tab facts by actionability before the cap
The Discovery tab capped Key Facts at the first 8 in raw analyzer order
(facts.slice(0, 8)), but the analyzer can emit up to 12. So a late
service-control fact (how to restart the workload — the most actionable
one) could be dropped from the human view, even though it was captured.
Add a small pure helper that stable-sorts facts by actionability
(service > security > dependency > hardware > version > storage),
mirroring the backend context-pack ranking, and apply it before the cap.

New unit test pins the ordering and that a trailing service-control fact
survives the cap. Discovery 21 tests green; type-check + lint + prettier
clean (the 2 unrelated guardrail failures pre-exist).
2026-06-07 14:52:39 +01:00
rcourtman b87341fcae Show queued Assistant follow-ups in activity 2026-06-07 14:50:32 +01:00
rcourtman 9209f939c0 Show read-only commands in Assistant activity 2026-06-07 14:34:07 +01:00
rcourtman 9e9d08d2ff Show prompt-send activity immediately 2026-06-07 14:16:26 +01:00
rcourtman e58df998ef Keep fast Assistant tool activity visible 2026-06-07 13:51:53 +01:00
rcourtman d7f0de0ba2 Add data directories to remediation context
FormatForRemediation surfaced config and log paths but not data paths,
while FormatForAIContext (chat) does. For remediation those matter —
backup targets, disk-full triage, restore points (e.g. a database data
dir or HA's /config/.storage). Add a Data Directories section, matching
the chat pack. Extends the remediation test to assert a data path
reaches it; teeth-checked. Full servicediscovery package green.
2026-06-07 13:36:09 +01:00
rcourtman db28d8bcc3 Grow Discovery scenario oracle: nginx + mosquitto cells
Add two common-service cells to the context oracle. Beyond documenting
nginx and MQTT, they pin two code paths the existing cells did not cover:
the read-only bind-mount marker (nginx config mounted read-only) and
security-category fact surfacing (mosquitto auth). Both pass against the
current formatters (no production gap) — regression protection for the
iter4/iter5 mount + fact-filter work. Corpus now 6 cells (HA-LXC,
HA-Docker, postgres, frigate, nginx, mosquitto). Full package green.
2026-06-07 13:26:30 +01:00