Skip to content

Add Pi.dev AI assistant UI: per-device chat + scheduled AI tasks - #56

Open
teknoprep wants to merge 46 commits into
amidaware:masterfrom
teknoprep:feature/pi-ai-assistant
Open

Add Pi.dev AI assistant UI: per-device chat + scheduled AI tasks#56
teknoprep wants to merge 46 commits into
amidaware:masterfrom
teknoprep:feature/pi-ai-assistant

Conversation

@teknoprep

@teknoprep teknoprep commented Jul 7, 2026

Copy link
Copy Markdown

Summary

Frontend for the Pi.dev AI assistant (pairs with the tacticalrmm backend PR of the same name).

📖 Full feature documentation (rendered): https://github.com/teknoprep/tacticalrmm/blob/feature/pi-ai-assistant/PI_AI_ASSISTANT.md
🔗 Backend PR: amidaware/tacticalrmm#2509

What's included

  • Pi.dev agent action opens a per-device chat window (PiChat.vue) with live model switching and streamed tool/command output.
  • AI settings tab in Core Settings: providers, models (auto-listed from configured keys), default model, module toggles.
  • Role permissions: Use AI, auto-approve, allowed-models multiselect.
  • AI History tab: resume past conversations per device.
  • AI Tasks tab: create/schedule tasks, run now, live trace, master-detail run history; company-wide aggregate (with hostname + status roll-up) when a Site or Client is selected.
  • API helpers in api/core.ts and api/agents.js.

Note: branch is based on release 0.101.59; only the assistant changes are included (13 files).

- 'Pi.dev' agent action opens a per-device chat window (PiChat.vue)
- AI settings tab in Core Settings (providers, models, default, toggles)
- Role permissions: Use AI, auto-approve, allowed-models multiselect
- AI History tab: unified log (Chat / Task / Bulk) with a Source column
- AI Tasks tab: run Now (one-shot) or Scheduled (interval/daily/weekly/
  monthly), run now, live trace, master-detail run history; company aggregate
- Tools -> Bulk AI Command: target All/Client/Site/Agents or dynamic Filter
  rules (agent picker shows faded client/site, type to filter); Now or
  Scheduled; target preview lists the matched online devices

Pairs with the backend Pi.dev AI assistant feature.
@teknoprep
teknoprep force-pushed the feature/pi-ai-assistant branch from e1a6556 to e308d8c Compare July 8, 2026 13:05
Multi-machine mode:
- PiChat toolbar gains a Multi-machine button opening a setup dialog:
  one row per machine (filterable agent picker grouped by client/site)
  plus a free-text role prompt describing what each machine is (e.g.
  'primary Proxmox node', 'Proxmox Backup Server'); +/- row controls,
  2-8 machines, duplicate selection rejected
- /pichat/multi route (selection base64-encoded in ?m=) creates the
  session via POST /agents/pi/multisession/; in an existing multi chat
  the button re-opens the dialog to adjust the machine set
- api/agents.js: createPiMultiSession, runPiMultiChat, encode/decode
  helpers

AI History tab:
- double-click a row triggers its default action (Continue for chats,
  View for task/bulk runs)
- summary column ellipsis-capped (420px) with full-text hover tooltip;
  single-line rows + explicit overflow-x so the horizontal scrollbar is
  reliably available in narrow panes; pointer cursor on rows
@teknoprep

Copy link
Copy Markdown
Author

Pushed b5da970, pairing with amidaware/tacticalrmm#2509:

Multi-machine chat UI

  • Multi-machine button in the PiChat toolbar opens a setup dialog: one row per machine — filterable agent picker (grouped by client/site) + a free-text role prompt describing what each machine is (e.g. primary Proxmox node, Proxmox Backup Server); +/− row controls, 2–8 machines, duplicates rejected; the current agent is pre-seeded.
  • Launches /pichat/multi?m=<encoded selection> which creates the session via POST /agents/pi/multisession/. In an existing multi chat the same button re-opens the dialog to adjust the machine set (starts a new chat).

AI History tab UX

  • Double-click a row triggers its default action: Continue (chat) or View (task/bulk run transcript).
  • Summary column ellipsis-capped with full-text hover tooltip; single-line rows + explicit overflow-x so the horizontal scrollbar is reliably reachable in narrow panes.

No email UI needed — users simply ask the assistant to email results and approve the gated action (see the backend PR).

- Approval requests are now queued instead of overwriting a single slot:
  a parallel/multi-machine turn raises several approval_requests; the old
  single-slot UI dropped all but the last, hanging the un-shown tool calls
  forever. Show them one at a time with an (N pending) count and an
  'Approve all' button.
- AI History 'Continue' resumes multi-machine chats with their full
  machine set (via /pichat/multi) instead of falling back to the primary
  machine only; multi chats are badged 'Chat (multi)'.
@teknoprep

Copy link
Copy Markdown
Author

Follow-up 473c50b — two multi-machine fixes:

  1. Approval queue — a parallel/multi-machine turn raises several approval_requests; the old single-slot UI kept only the last and the un-shown tool calls hung forever waiting on approval. Approvals are now queued (shown one at a time with an (N pending) count + Approve all).
  2. Resume — AI History Continue now resumes a multi-machine chat with its full machine set (/pichat/multi) instead of falling back to the primary machine; multi chats badged Chat (multi).

…ety cap

- Roles: 'Allow write (mutating) actions' checkbox (read-only sessions);
  PiChat shows a read-only badge when the session can't mutate
- Bulk AI filter builder: grouped AND/OR sections (per-group + top-level
  ALL/ANY selectors, wider for readability), add/remove group & condition;
  new 'Installed software (name)' filter field
- Safety: preview shows online match count vs the hard cap; when a target
  exceeds the cap the banner turns red and Save/Run are disabled
- Kill switch: per-command Stop button + toolbar Emergency stop
- AI History: double-click row to open, reliable vertical/horizontal scroll,
  fully scrollable run/verdict (alert) viewer
@teknoprep

Copy link
Copy Markdown
Author

Pushed c8c1278 (pairs with amidaware/tacticalrmm#2509): read-only role checkbox + chat badge; bulk filter AND/OR grouped builder (wider selectors) with a new Installed software (name) field; safety cap warning in the target preview that disables Save when a target would exceed the cap; per-command Stop + toolbar Emergency stop; AI History double-click-to-open, reliable scrolling, and a fully-scrollable run/verdict viewer.

- Bulk AI Commands: 'View results' opens a computers-left / results-right
  viewer (last run per computer with client/site + full transcript);
  double-click a row to edit
- Target preview: per-machine exclude checkboxes (untick to exclude even if
  matched); shows 'will run on N (X excluded of Y matched)'
- api/core.ts: fetchBulkAICommandResults
@teknoprep

Copy link
Copy Markdown
Author

Pushed 9cb0f9d (pairs with amidaware/tacticalrmm#2509): bulk View results viewer (computers left / last-run results right, with client/site), double-click to edit, and per-machine exclude checkboxes in the target preview.

- Global Settings 'Pi.dev AI' tab: Helpdesk/Ticketing section below providers &
  models - policy prompt box + helpdesk.js code box, with a 'Use AI to Help
  Create These' assistant dialog that drafts both.
- Bulk AI command: combined end-of-batch report instructions field.
- 'By' (created/edited) column on AI tasks & bulk commands.
- Client/Site 'AI History' review dialog (from the dashboard tree) aggregating
  chats + task/bulk runs across every machine, with a Machine column.
@teknoprep
teknoprep force-pushed the feature/pi-ai-assistant branch from 7b25dd3 to 3770c2a Compare July 12, 2026 20:13
teknoprep added 15 commits July 13, 2026 19:54
…audit filter, manage-all-AI-tasks role toggle, overview delete, scope-aware AI history

- PiChat history now reconstructs the full command window (tool calls + output) when reopening a past session, not just typed text
- AuditManager: 'AI Assistant Session' filter option
- RolesForm: 'Manage/delete all AI tasks & bulk commands (any owner)' permission
- AITasksOverview: delete button (permission-enforced server-side)
- AI History folded into a single scope-aware tab (agent/site/client); retire AIHistoryScope popup
- AISettings: 'only alert when a ticket can't be filed' toggle
- AgentView: make the agent page its own scroll region
- aiPromptAssist() API client (POST /core/ai/prompt-assist/)
- 'Help me write this with AI' assistant dialog in the AI Task Prompt Builder
  (AITasksTab) and the Bulk AI Command Builder (BulkAICommands); the latter also
  drafts the combined-report instruction. Apply-to-prompt / apply-to-report actions.
- getDeviceNotes/saveDeviceNotes API clients (/core/ai/device-note/)
- 'Device Memory (AI notes)' editor in AIHistoryTab (agent scope): view/edit the
  durable notes Pi injects into its context on every run on the device
…ope limiter, triage policy prompt (all editable on the fly, helpdesk-agnostic)
…cket / Running a command / Searching the web...')
…to-action) instead of raw JSON

Domains and client lists are now edited as friendly chip inputs + toggles in Global Settings;
the raw JSON is tucked into an Advanced expansion. Makes the module configurable per-deployment
without hand-editing JSON.
…stomer email); remove dead AIDecision.vue + dead API fns
teknoprep and others added 24 commits July 22, 2026 15:45
… an 'AI Created' section (per device), with cancel
…shed off-screen below the full-height tasks table
… table (AI badge + truncated action + details/cancel dialog); drop the separate table
…t, see what the AI did, open the chat, auto-resolve
…ionable / needs-input / triaged / est. hrs saved) + status filter
…and wraps the subject so the full text shows
…s scroll wedging after changing pages); header/metrics/filter/pagination stay pinned
…Actions.vue (+route); superseded by the Ticket Console + AI Tasks 'AI Created' section
…er + labels/colors for reconciled terminal statuses
…dit every tracked ticket's triage pass + bonus for auto-closed clean alerts) so it no longer decreases as tickets move to terminal states
…ow) reachable from Tools menu and the Ticket Console; Procedures settings section (enable, mining enable, interval, backfill, mining prompt) in AI Settings; core API bindings
…stacked labels above auto-growing multi-line fields, better alignment, readable text, source tickets as chips
…stats + streaming log); edit-dialog prev/next + Accept/Delete for fast review
…er at a time (heartbeat pauses while dialog open), auto-scroll only when already at bottom, reserve the current-company line
…een sort+filter order (via filteredSortedRows) instead of raw fetch order
…wn (headings, bold, lists, code) instead of raw text - shared renderMarkdown util (DOMPurify-sanitized) wired into the Task/Bulk prompt builders and the helpdesk setup assistant
…in template + returned) - ReferenceError blanked the whole AI Tasks tab; add the import
…controls

- "Check capabilities" panel: lists every helpdesk operation with its capability class
  and the PROVENANCE of that class (declared in the integration / guessed from a
  conventional name / unclassified), plus per-surface counts. An operation left
  unclassified is denied once enforcement is on, and that was previously invisible until
  it blocked a working feature.
- api: helpdeskCaps().
- Also carries the model-catalog refresh fix (the run's returned timestamp is now applied,
  so the caption updates immediately), AI runtime update controls, and daily report
  settings.
@CLAassistant

CLAassistant commented Jul 27, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

…oping

Scheduled Reports panel (new AIReportSchedules.vue): add, edit, delete and send-now
any number of reports, each with its own type, cadence (daily / weekdays / weekly /
monthly), data window (24h / 48h / 72h / 7d / 14d / 30d / custom hours), recipients,
options and extra prompt instructions. Replaces the two fixed report blocks, which
are removed.

Chat window:
  * Auto-approve is now a remembered per-user preference and the server reports the
    state in the ready frame, so a refresh or a second window no longer silently
    turns it off while the toggle still reads on
  * labels say what read-only actually scopes: 'Read-only (devices)'. Ticket work -
    replying, noting, closing - is not a device change and is never gated by it

api: report-schedule CRUD + the auto-approve preference.
@teknoprep
teknoprep force-pushed the feature/pi-ai-assistant branch from 96fdcc4 to 8d5fc0b Compare July 27, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants