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>
69 lines
2.6 KiB
TypeScript
69 lines
2.6 KiB
TypeScript
/**
|
|
* Used as an optional.
|
|
* `{ value: S } | { error: E }`.
|
|
*/
|
|
export type SuccessOrFail<S, F> = {
|
|
value: S;
|
|
error?: undefined;
|
|
} | {
|
|
error: F;
|
|
};
|
|
export declare function isSuccess<S, F>(successOrFail: SuccessOrFail<S, F>): successOrFail is {
|
|
value: S;
|
|
};
|
|
export declare function isFail<S, F>(successOrFail: SuccessOrFail<S, F>): successOrFail is {
|
|
error: F;
|
|
};
|
|
/**
|
|
* Used as an optional for results of a Vm call.
|
|
* `{ value: VmHandle } | { error: VmHandle }`.
|
|
*/
|
|
export type VmCallResult<VmHandle> = SuccessOrFail<VmHandle, VmHandle>;
|
|
/**
|
|
* A VmFunctionImplementation takes handles as arguments.
|
|
* It should return a handle, or be void.
|
|
*
|
|
* To indicate an exception, a VMs can throw either a handle (transferred
|
|
* directly) or any other Javascript value (only the poperties `name` and
|
|
* `message` will be transferred). Or, the VmFunctionImplementation may return
|
|
* a VmCallResult's `{ error: handle }` error variant.
|
|
*
|
|
* VmFunctionImplementation should not free its arguments or its return value.
|
|
* It should not retain a reference to its return value or thrown error.
|
|
*/
|
|
export type VmFunctionImplementation<VmHandle> = (this: VmHandle, ...args: VmHandle[]) => VmHandle | VmCallResult<VmHandle> | void;
|
|
/**
|
|
* A minimal interface to a Javascript execution environment.
|
|
*
|
|
* Higher-level tools should build over the LowLevelJavascriptVm interface to
|
|
* share as much as possible between executors.
|
|
*
|
|
* From https://www.figma.com/blog/how-we-built-the-figma-plugin-system/
|
|
*/
|
|
export interface LowLevelJavascriptVm<VmHandle> {
|
|
global: VmHandle;
|
|
undefined: VmHandle;
|
|
typeof(handle: VmHandle): string;
|
|
getNumber(handle: VmHandle): number;
|
|
getString(handle: VmHandle): string;
|
|
newNumber(value: number): VmHandle;
|
|
newString(value: string): VmHandle;
|
|
newObject(prototype?: VmHandle): VmHandle;
|
|
newFunction(name: string, value: VmFunctionImplementation<VmHandle>): VmHandle;
|
|
getProp(handle: VmHandle, key: string | VmHandle): VmHandle;
|
|
setProp(handle: VmHandle, key: string | VmHandle, value: VmHandle): void;
|
|
defineProp(handle: VmHandle, key: string | VmHandle, descriptor: VmPropertyDescriptor<VmHandle>): void;
|
|
callFunction(func: VmHandle, thisVal: VmHandle, ...args: VmHandle[]): VmCallResult<VmHandle>;
|
|
evalCode(code: string, filename?: string): VmCallResult<VmHandle>;
|
|
}
|
|
/**
|
|
* From https://www.figma.com/blog/how-we-built-the-figma-plugin-system/
|
|
*/
|
|
export interface VmPropertyDescriptor<VmHandle> {
|
|
value?: VmHandle;
|
|
configurable?: boolean;
|
|
enumerable?: boolean;
|
|
get?: (this: VmHandle) => VmHandle;
|
|
set?: (this: VmHandle, value: VmHandle) => void;
|
|
}
|