tftsr-devops_investigation/docs/wiki/IPC-Commands.md
Shaun Arman 215c0ae218 feat(ui): fix model dropdown, auth prefill, PII persistence, theme toggle, and Ollama bundle
- AIProviders: hide top model row when custom_rest active (dropdown lower in form handles it);
  clear auth header prefill on format switch; rename User ID / CORE ID → Email Address
- Dashboard + Ollama: add border-border/bg-card classes to Refresh buttons for dark-bg contrast
- Security + settingsStore: wire PII toggle state to persisted Zustand store so pattern
  selections survive app restarts
- App: add Sun/Moon theme toggle button to sidebar footer (always visible when collapsed)
- system.rs: add install_ollama_from_bundle command (copies bundled binary to /usr/local/bin)
- auto-tag.yml: add Download Ollama step to all 4 platform build jobs with SHA256 verification
- tauri.conf.json: add resources/ollama/* to bundle resources
- docs: add install_ollama_from_bundle to IPC-Commands wiki

Security: CI download steps verify SHA256 against Ollama's published sha256sums.txt before bundling.
2026-04-05 19:30:41 -05:00

12 KiB
Raw Blame History

IPC Commands

All backend commands are typed wrappers in src/lib/tauriCommands.ts. The Rust handlers live in src-tauri/src/commands/.


Database Commands

create_issue

createIssueCmd(title: string, description: string, severity: string, category: string)  Issue

Creates a new issue. Generates UUID v7. Returns the created Issue.

get_issue

getIssueCmd(issueId: string)  IssueDetail

Returns a nested IssueDetail — use detail.issue.title, not detail.title.

interface IssueDetail {
    issue: Issue;
    log_files: LogFile[];
    resolution_steps: ResolutionStep[];
    conversations: AiConversation[];
}

list_issues

listIssuesCmd(query: IssueListQuery)  IssueSummary[]

Paginated list. Supports filter by status, severity, category; sort by created_at/updated_at.

update_issue

updateIssueCmd(issueId: string, updates: Partial<IssueUpdate>)  IssueDetail

Partial update. Only provided fields are changed.

delete_issue

deleteIssueCmd(issueId: string)  void

Cascades: deletes log_files, pii_spans, conversations, messages, resolution_steps, documents.

search_issues

searchIssuesCmd(query: string)  IssueSummary[]

Full-text search via FTS5 virtual table on title + description.

add_five_why

addFiveWhyCmd(issueId: string, whyNumber: number, question: string, answer?: string)  FiveWhyEntry

Adds a 5-Whys entry (step 15). whyNumber maps to step_order.

update_five_why

updateFiveWhyCmd(entryId: string, answer: string)  void

Sets or updates the answer for an existing 5-Whys entry.

add_timeline_event

addTimelineEventCmd(issueId: string, eventType: string, description: string)  TimelineEvent

Records a timestamped event in the issue timeline.


Analysis / PII Commands

upload_log_file

uploadLogFileCmd(issueId: string, filePath: string)  LogFile

Reads the file from disk, computes SHA-256, stores metadata in DB. Returns LogFile record.

detect_pii

detectPiiCmd(logFileId: string)  PiiDetectionResult

Runs 13 PII patterns on the file content. Returns non-overlapping PiiSpan[].

interface PiiDetectionResult {
    log_file_id: string;
    spans: PiiSpan[];
    total_found: number;
}

apply_redactions

applyRedactionsCmd(logFileId: string, approvedSpanIds: string[])  RedactedLogFile

Rewrites file content with approved redactions. Records SHA-256 in audit log. Returns redacted content path.


AI Commands

analyze_logs

analyzeLogsCmd(issueId: string, logFileIds: string[], providerConfig: ProviderConfig)  AnalysisResult

Sends selected (redacted) log files to the AI provider with an analysis prompt.

chat_message

chatMessageCmd(issueId: string, message: string, providerConfig: ProviderConfig)  ChatResponse

Sends a message in the ongoing triage conversation. Domain system prompt is injected automatically on first message. AI response is parsed for why-level indicators (15).

list_providers

listProvidersCmd()  ProviderInfo[]

Returns the list of supported providers with their available models and configuration schema.


Document Commands

generate_rca

generateRcaCmd(issueId: string)  Document

Builds an RCA Markdown document from the issue data, 5-Whys answers, and timeline.

generate_postmortem

generatePostmortemCmd(issueId: string)  Document

Builds a blameless post-mortem Markdown document.

update_document

updateDocumentCmd(docId: string, contentMd: string)  Document

Saves edited Markdown content back to the database.

export_document

exportDocumentCmd(docId: string, format: 'md' | 'pdf', outputDir: string)  string

Exports document to file. Returns the absolute path of the written file. PDF generation uses printpdf.


System / Ollama Commands

check_ollama_installed

checkOllamaInstalledCmd()  OllamaStatus

Checks if Ollama is running on the configured URL (default: localhost:11434).

get_ollama_install_guide

getOllamaInstallGuideCmd(platform: string)  InstallGuide

Returns platform-specific install instructions for Ollama.

list_ollama_models

listOllamaModelsCmd()  OllamaModel[]

Lists all locally available Ollama models.

pull_ollama_model

pullOllamaModelCmd(modelName: string)  void

Downloads a model from the Ollama registry. Streams progress.

delete_ollama_model

deleteOllamaModelCmd(modelName: string)  void

Removes a model from local storage.

detect_hardware

detectHardwareCmd()  HardwareInfo

Probes CPU, RAM, GPU. Returns hardware specifications.

recommend_models

recommendModelsCmd()  ModelRecommendation[]

Returns model recommendations based on detected hardware.

interface ModelRecommendation {
    name: string;
    size: string;   // e.g., "2.0 GB" — a String, not a number
    reason: string;
}

get_settings

getSettingsCmd()  AppSettings

Reads app settings from the settings table.

update_settings

updateSettingsCmd(partial: Partial<AppSettings>)  AppSettings

Merges partial settings and persists to DB.

get_audit_log

getAuditLogCmd(filter: AuditLogFilter)  AuditEntry[]

Returns audit log entries. Filter by action, entity_type, date range.

install_ollama_from_bundle

installOllamaFromBundleCmd()  string

Copies the Ollama binary bundled inside the app resources to the system install path:

  • Linux/macOS: /usr/local/bin/ollama (requires write permission — user may need to run app with elevated privileges or sudo)
  • Windows: %LOCALAPPDATA%\Programs\Ollama\ollama.exe

Returns a success message with the install path. Errors if the bundled binary is not present in the app resources (i.e., the app was built without an Ollama bundle step in CI).


Integration Commands

Status: Fully Implemented (v0.2.3+)

All integration commands are production-ready with complete OAuth2/authentication flows.

OAuth2 Commands

initiate_oauth

initiateOauthCmd(service: "confluence" | "servicenow" | "azuredevops")  OAuthInitResponse

Starts OAuth2 PKCE flow. Returns authorization URL and state key. Opens browser window for user authentication.

interface OAuthInitResponse {
    auth_url: string;  // URL to open in browser
    state: string;     // State key for callback verification
}

Flow:

  1. Generates PKCE challenge
  2. Starts local callback server on http://localhost:8765
  3. Opens authorization URL in browser
  4. User authenticates with service
  5. Service redirects to callback server
  6. Callback server triggers handle_oauth_callback

handle_oauth_callback

handleOauthCallbackCmd(service: string, code: string, stateKey: string)  void

Exchanges authorization code for access token. Encrypts token with AES-256-GCM and stores in database.

Confluence Commands

test_confluence_connection

testConfluenceConnectionCmd(baseUrl: string, credentials: Record<string, unknown>)  ConnectionResult

Verifies Confluence connection by calling /rest/api/user/current.

list_confluence_spaces

listConfluenceSpacesCmd(config: ConfluenceConfig)  Space[]

Lists all accessible Confluence spaces.

search_confluence_pages

searchConfluencePagesCmd(config: ConfluenceConfig, query: string, spaceKey?: string)  Page[]

Searches pages using CQL (Confluence Query Language). Optional space filter.

publish_to_confluence

publishToConfluenceCmd(config: ConfluenceConfig, spaceKey: string, title: string, contentHtml: string, parentPageId?: string)  PublishResult

Creates a new page in Confluence. Returns page ID and URL.

update_confluence_page

updateConfluencePageCmd(config: ConfluenceConfig, pageId: string, title: string, contentHtml: string, version: number)  PublishResult

Updates an existing page. Requires current version number.

ServiceNow Commands

test_servicenow_connection

testServiceNowConnectionCmd(instanceUrl: string, credentials: Record<string, unknown>)  ConnectionResult

Verifies ServiceNow connection by querying incident table.

search_servicenow_incidents

searchServiceNowIncidentsCmd(config: ServiceNowConfig, query: string)  Incident[]

Searches incidents by short description. Returns up to 10 results.

create_servicenow_incident

createServiceNowIncidentCmd(config: ServiceNowConfig, shortDesc: string, description: string, urgency: string, impact: string)  TicketResult

Creates a new incident. Returns incident number and URL.

interface TicketResult {
    id: string;           // sys_id (UUID)
    ticket_number: string; // INC0010001
    url: string;          // Direct link to incident
}

get_servicenow_incident

getServiceNowIncidentCmd(config: ServiceNowConfig, incidentId: string)  Incident

Retrieves incident by sys_id or incident number (e.g., INC0010001).

update_servicenow_incident

updateServiceNowIncidentCmd(config: ServiceNowConfig, sysId: string, updates: Record<string, any>)  TicketResult

Updates incident fields. Uses JSON-PATCH format.

Azure DevOps Commands

test_azuredevops_connection

testAzureDevOpsConnectionCmd(orgUrl: string, credentials: Record<string, unknown>)  ConnectionResult

Verifies Azure DevOps connection by querying project info.

search_azuredevops_workitems

searchAzureDevOpsWorkItemsCmd(config: AzureDevOpsConfig, query: string)  WorkItem[]

Searches work items using WIQL (Work Item Query Language).

create_azuredevops_workitem

createAzureDevOpsWorkItemCmd(config: AzureDevOpsConfig, title: string, description: string, workItemType: string, severity: string)  TicketResult

Creates a work item (Bug, Task, User Story). Returns work item ID and URL.

Work Item Types:

  • Bug — Software defect
  • Task — Work assignment
  • User Story — Feature request
  • Issue — Problem or blocker
  • Incident — Production incident

get_azuredevops_workitem

getAzureDevOpsWorkItemCmd(config: AzureDevOpsConfig, workItemId: number)  WorkItem

Retrieves work item by ID.

update_azuredevops_workitem

updateAzureDevOpsWorkItemCmd(config: AzureDevOpsConfig, workItemId: number, updates: Record<string, any>)  TicketResult

Updates work item fields. Uses JSON-PATCH format.


Common Types

ConnectionResult

interface ConnectionResult {
    success: boolean;
    message: string;
}

PublishResult

interface PublishResult {
    id: string;     // Page ID or document ID
    url: string;    // Direct link to published content
}

TicketResult

interface TicketResult {
    id: string;           // sys_id or work item ID
    ticket_number: string; // Human-readable number
    url: string;          // Direct link
}

Authentication Storage

All integration credentials are stored in the credentials table:

CREATE TABLE credentials (
    id TEXT PRIMARY KEY,
    service TEXT NOT NULL CHECK(service IN ('confluence','servicenow','azuredevops')),
    token_hash TEXT NOT NULL,        -- SHA-256 for audit
    encrypted_token TEXT NOT NULL,   -- AES-256-GCM encrypted
    created_at TEXT NOT NULL,
    expires_at TEXT
);

Encryption:

  • Algorithm: AES-256-GCM
  • Key derivation: From TFTSR_DB_KEY environment variable
  • Nonce: Random 96-bit per encryption
  • Format: base64(nonce || ciphertext || tag)

Token retrieval:

// Backend: src-tauri/src/integrations/auth.rs
pub fn decrypt_token(encrypted: &str) -> Result<String, String>