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>
135 lines
3.4 KiB
JavaScript
135 lines
3.4 KiB
JavaScript
// src/constants.ts
|
|
var DEFAULT_TIMEOUT = 1e4;
|
|
var DEFAULT_MAX_INSTANCES_PER_CAPABILITY = 100;
|
|
var DEFAULT_CONFIGS = () => ({
|
|
specs: [],
|
|
suites: {},
|
|
exclude: [],
|
|
capabilities: [],
|
|
outputDir: void 0,
|
|
logLevel: "info",
|
|
logLevels: {},
|
|
groupLogsByTestSpec: false,
|
|
excludeDriverLogs: [],
|
|
bail: 0,
|
|
waitforInterval: 100,
|
|
waitforTimeout: 5e3,
|
|
framework: "mocha",
|
|
reporters: [],
|
|
services: [],
|
|
maxInstances: 100,
|
|
maxInstancesPerCapability: DEFAULT_MAX_INSTANCES_PER_CAPABILITY,
|
|
injectGlobals: true,
|
|
filesToWatch: [],
|
|
connectionRetryTimeout: 12e4,
|
|
connectionRetryCount: 3,
|
|
execArgv: [],
|
|
runnerEnv: {},
|
|
runner: "local",
|
|
shard: {
|
|
current: 1,
|
|
total: 1
|
|
},
|
|
specFileRetries: 0,
|
|
specFileRetriesDelay: 0,
|
|
specFileRetriesDeferred: false,
|
|
autoAssertOnTestEnd: true,
|
|
reporterSyncInterval: 100,
|
|
reporterSyncTimeout: 5e3,
|
|
cucumberFeaturesWithLineNumbers: [],
|
|
/**
|
|
* framework defaults
|
|
*/
|
|
mochaOpts: {
|
|
timeout: DEFAULT_TIMEOUT
|
|
},
|
|
jasmineOpts: {
|
|
defaultTimeoutInterval: DEFAULT_TIMEOUT
|
|
},
|
|
cucumberOpts: {
|
|
timeout: DEFAULT_TIMEOUT
|
|
},
|
|
/**
|
|
* hooks
|
|
*/
|
|
onPrepare: [],
|
|
onWorkerStart: [],
|
|
onWorkerEnd: [],
|
|
before: [],
|
|
beforeSession: [],
|
|
beforeSuite: [],
|
|
beforeHook: [],
|
|
beforeTest: [],
|
|
beforeCommand: [],
|
|
afterCommand: [],
|
|
afterTest: [],
|
|
afterHook: [],
|
|
afterSuite: [],
|
|
afterSession: [],
|
|
after: [],
|
|
onComplete: [],
|
|
onReload: [],
|
|
beforeAssertion: [],
|
|
afterAssertion: [],
|
|
/**
|
|
* cucumber specific hooks
|
|
*/
|
|
beforeFeature: [],
|
|
beforeScenario: [],
|
|
beforeStep: [],
|
|
afterStep: [],
|
|
afterScenario: [],
|
|
afterFeature: []
|
|
});
|
|
var DEFAULT_MAX_INSTANCES_PER_CAPABILITY_VALUE = DEFAULT_MAX_INSTANCES_PER_CAPABILITY;
|
|
|
|
// src/utils.ts
|
|
function isCloudCapability(caps) {
|
|
return Boolean(caps && (caps["bstack:options"] || caps["sauce:options"] || caps["tb:options"]));
|
|
}
|
|
var defineConfig = (options) => ({
|
|
...DEFAULT_CONFIGS(),
|
|
...options
|
|
});
|
|
function validateConfig(defaults, options, keysToKeep = []) {
|
|
const params = {};
|
|
for (const [name, expectedOption] of Object.entries(defaults)) {
|
|
if (typeof options[name] === "undefined" && !expectedOption.default && expectedOption.required) {
|
|
throw new Error(`Required option "${name.toString()}" is missing`);
|
|
}
|
|
if (typeof options[name] === "undefined" && expectedOption.default) {
|
|
params[name] = expectedOption.default;
|
|
}
|
|
if (typeof options[name] !== "undefined") {
|
|
const optValue = options[name];
|
|
if (typeof optValue !== expectedOption.type) {
|
|
throw new Error(`Expected option "${name.toString()}" to be type of ${expectedOption.type} but was ${typeof options[name]}`);
|
|
}
|
|
if (typeof expectedOption.validate === "function") {
|
|
try {
|
|
expectedOption.validate(optValue);
|
|
} catch (e) {
|
|
throw new Error(`Type check for option "${name.toString()}" failed: ${e.message}`);
|
|
}
|
|
}
|
|
if (typeof optValue === "string" && expectedOption.match && !optValue.match(expectedOption.match)) {
|
|
throw new Error(`Option "${name.toString()}" doesn't match expected values: ${expectedOption.match}`);
|
|
}
|
|
params[name] = options[name];
|
|
}
|
|
}
|
|
for (const [name, option] of Object.entries(options)) {
|
|
if (keysToKeep.includes(name)) {
|
|
params[name] = option;
|
|
}
|
|
}
|
|
return params;
|
|
}
|
|
export {
|
|
DEFAULT_CONFIGS,
|
|
DEFAULT_MAX_INSTANCES_PER_CAPABILITY_VALUE,
|
|
defineConfig,
|
|
isCloudCapability,
|
|
validateConfig
|
|
};
|