Implements Phases 1-8 of the TFTSR implementation plan. Rust backend (Tauri 2.x, src-tauri/): - Multi-provider AI: OpenAI-compatible, Anthropic, Gemini, Mistral, Ollama - PII detection engine: 11 regex patterns with overlap resolution - SQLCipher AES-256 encrypted database with 10 versioned migrations - 28 Tauri IPC commands for triage, analysis, document, and system ops - Ollama: hardware probe, model recommendations, pull/delete with events - RCA and blameless post-mortem Markdown document generators - PDF export via printpdf - Audit log: SHA-256 hash of every external data send - Integration stubs for Confluence, ServiceNow, Azure DevOps (v0.2) Frontend (React 18 + TypeScript + Vite, src/): - 9 pages: full triage workflow NewIssue→LogUpload→Triage→Resolution→RCA→Postmortem→History+Settings - 7 components: ChatWindow, TriageProgress, PiiDiffViewer, DocEditor, HardwareReport, ModelSelector, UI primitives - 3 Zustand stores: session, settings (persisted), history - Type-safe tauriCommands.ts matching Rust backend types exactly - 8 IT domain system prompts (Linux, Windows, Network, K8s, DB, Virt, HW, Obs) DevOps: - .woodpecker/test.yml: rustfmt, clippy, cargo test, tsc, vitest on every push - .woodpecker/release.yml: linux/amd64 + linux/arm64 builds, Gogs release upload Verified: - cargo check: zero errors - tsc --noEmit: zero errors - vitest run: 13/13 unit tests passing Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
222 lines
5.2 KiB
JavaScript
222 lines
5.2 KiB
JavaScript
import { invoke, addPluginListener } from './core.js';
|
|
import { Image } from './image.js';
|
|
|
|
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
// SPDX-License-Identifier: MIT
|
|
/**
|
|
* Bundle type of the current application.
|
|
*/
|
|
var BundleType;
|
|
(function (BundleType) {
|
|
/** Windows NSIS */
|
|
BundleType["Nsis"] = "nsis";
|
|
/** Windows MSI */
|
|
BundleType["Msi"] = "msi";
|
|
/** Linux Debian package */
|
|
BundleType["Deb"] = "deb";
|
|
/** Linux RPM */
|
|
BundleType["Rpm"] = "rpm";
|
|
/** Linux AppImage */
|
|
BundleType["AppImage"] = "appimage";
|
|
/** macOS app bundle */
|
|
BundleType["App"] = "app";
|
|
})(BundleType || (BundleType = {}));
|
|
/**
|
|
* Application metadata and related APIs.
|
|
*
|
|
* @module
|
|
*/
|
|
/**
|
|
* Gets the application version.
|
|
* @example
|
|
* ```typescript
|
|
* import { getVersion } from '@tauri-apps/api/app';
|
|
* const appVersion = await getVersion();
|
|
* ```
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
async function getVersion() {
|
|
return invoke('plugin:app|version');
|
|
}
|
|
/**
|
|
* Gets the application name.
|
|
* @example
|
|
* ```typescript
|
|
* import { getName } from '@tauri-apps/api/app';
|
|
* const appName = await getName();
|
|
* ```
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
async function getName() {
|
|
return invoke('plugin:app|name');
|
|
}
|
|
/**
|
|
* Gets the Tauri framework version used by this application.
|
|
*
|
|
* @example
|
|
* ```typescript
|
|
* import { getTauriVersion } from '@tauri-apps/api/app';
|
|
* const tauriVersion = await getTauriVersion();
|
|
* ```
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
async function getTauriVersion() {
|
|
return invoke('plugin:app|tauri_version');
|
|
}
|
|
/**
|
|
* Gets the application identifier.
|
|
* @example
|
|
* ```typescript
|
|
* import { getIdentifier } from '@tauri-apps/api/app';
|
|
* const identifier = await getIdentifier();
|
|
* ```
|
|
*
|
|
* @returns The application identifier as configured in `tauri.conf.json`.
|
|
*
|
|
* @since 2.4.0
|
|
*/
|
|
async function getIdentifier() {
|
|
return invoke('plugin:app|identifier');
|
|
}
|
|
/**
|
|
* Shows the application on macOS. This function does not automatically
|
|
* focus any specific app window.
|
|
*
|
|
* @example
|
|
* ```typescript
|
|
* import { show } from '@tauri-apps/api/app';
|
|
* await show();
|
|
* ```
|
|
*
|
|
* @since 1.2.0
|
|
*/
|
|
async function show() {
|
|
return invoke('plugin:app|app_show');
|
|
}
|
|
/**
|
|
* Hides the application on macOS.
|
|
*
|
|
* @example
|
|
* ```typescript
|
|
* import { hide } from '@tauri-apps/api/app';
|
|
* await hide();
|
|
* ```
|
|
*
|
|
* @since 1.2.0
|
|
*/
|
|
async function hide() {
|
|
return invoke('plugin:app|app_hide');
|
|
}
|
|
/**
|
|
* Fetches the data store identifiers on macOS and iOS.
|
|
*
|
|
* See https://developer.apple.com/documentation/webkit/wkwebsitedatastore for more information.
|
|
*
|
|
* @example
|
|
* ```typescript
|
|
* import { fetchDataStoreIdentifiers } from '@tauri-apps/api/app';
|
|
* const ids = await fetchDataStoreIdentifiers();
|
|
* ```
|
|
*
|
|
* @since 2.4.0
|
|
*/
|
|
async function fetchDataStoreIdentifiers() {
|
|
return invoke('plugin:app|fetch_data_store_identifiers');
|
|
}
|
|
/**
|
|
* Removes the data store with the given identifier.
|
|
*
|
|
* Note that any webview using this data store should be closed before running this API.
|
|
*
|
|
* See https://developer.apple.com/documentation/webkit/wkwebsitedatastore for more information.
|
|
*
|
|
* @example
|
|
* ```typescript
|
|
* import { fetchDataStoreIdentifiers, removeDataStore } from '@tauri-apps/api/app';
|
|
* for (const id of (await fetchDataStoreIdentifiers())) {
|
|
* await removeDataStore(id);
|
|
* }
|
|
* ```
|
|
*
|
|
* @since 2.4.0
|
|
*/
|
|
async function removeDataStore(uuid) {
|
|
return invoke('plugin:app|remove_data_store', { uuid });
|
|
}
|
|
/**
|
|
* Gets the default window icon.
|
|
*
|
|
* @example
|
|
* ```typescript
|
|
* import { defaultWindowIcon } from '@tauri-apps/api/app';
|
|
* const icon = await defaultWindowIcon();
|
|
* ```
|
|
*
|
|
* @since 2.0.0
|
|
*/
|
|
async function defaultWindowIcon() {
|
|
return invoke('plugin:app|default_window_icon').then((rid) => rid ? new Image(rid) : null);
|
|
}
|
|
/**
|
|
* Sets the application's theme. Pass in `null` or `undefined` to follow
|
|
* the system theme.
|
|
*
|
|
* @example
|
|
* ```typescript
|
|
* import { setTheme } from '@tauri-apps/api/app';
|
|
* await setTheme('dark');
|
|
* ```
|
|
*
|
|
* #### Platform-specific
|
|
*
|
|
* - **iOS / Android:** Unsupported.
|
|
*
|
|
* @since 2.0.0
|
|
*/
|
|
async function setTheme(theme) {
|
|
return invoke('plugin:app|set_app_theme', { theme });
|
|
}
|
|
/**
|
|
* Sets the dock visibility for the application on macOS.
|
|
*
|
|
* @param visible - Whether the dock should be visible or not.
|
|
*
|
|
* @example
|
|
* ```typescript
|
|
* import { setDockVisibility } from '@tauri-apps/api/app';
|
|
* await setDockVisibility(false);
|
|
* ```
|
|
*
|
|
* @since 2.5.0
|
|
*/
|
|
async function setDockVisibility(visible) {
|
|
return invoke('plugin:app|set_dock_visibility', { visible });
|
|
}
|
|
/**
|
|
* Gets the application bundle type.
|
|
*
|
|
* @example
|
|
* ```typescript
|
|
* import { getBundleType } from '@tauri-apps/api/app';
|
|
* const type = await getBundleType();
|
|
* ```
|
|
*
|
|
* @since 2.5.0
|
|
*/
|
|
async function getBundleType() {
|
|
return invoke('plugin:app|bundle_type');
|
|
}
|
|
/**
|
|
* Listens to the backButton event on Android.
|
|
* @param handler
|
|
*/
|
|
async function onBackButtonPress(handler) {
|
|
return addPluginListener('app', 'back-button', handler);
|
|
}
|
|
|
|
export { BundleType, defaultWindowIcon, fetchDataStoreIdentifiers, getBundleType, getIdentifier, getName, getTauriVersion, getVersion, hide, onBackButtonPress, removeDataStore, setDockVisibility, setTheme, show };
|