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>
112 lines
4.7 KiB
JavaScript
112 lines
4.7 KiB
JavaScript
"use strict";
|
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
if (ar || !(i in from)) {
|
|
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
ar[i] = from[i];
|
|
}
|
|
}
|
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
};
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.subselects = exports.getNextSiblings = exports.ensureIsTag = exports.PLACEHOLDER_ELEMENT = void 0;
|
|
var boolbase_1 = __importDefault(require("boolbase"));
|
|
var sort_js_1 = require("../sort.js");
|
|
/** Used as a placeholder for :has. Will be replaced with the actual element. */
|
|
exports.PLACEHOLDER_ELEMENT = {};
|
|
function ensureIsTag(next, adapter) {
|
|
if (next === boolbase_1.default.falseFunc)
|
|
return boolbase_1.default.falseFunc;
|
|
return function (elem) { return adapter.isTag(elem) && next(elem); };
|
|
}
|
|
exports.ensureIsTag = ensureIsTag;
|
|
function getNextSiblings(elem, adapter) {
|
|
var siblings = adapter.getSiblings(elem);
|
|
if (siblings.length <= 1)
|
|
return [];
|
|
var elemIndex = siblings.indexOf(elem);
|
|
if (elemIndex < 0 || elemIndex === siblings.length - 1)
|
|
return [];
|
|
return siblings.slice(elemIndex + 1).filter(adapter.isTag);
|
|
}
|
|
exports.getNextSiblings = getNextSiblings;
|
|
function copyOptions(options) {
|
|
// Not copied: context, rootFunc
|
|
return {
|
|
xmlMode: !!options.xmlMode,
|
|
lowerCaseAttributeNames: !!options.lowerCaseAttributeNames,
|
|
lowerCaseTags: !!options.lowerCaseTags,
|
|
quirksMode: !!options.quirksMode,
|
|
cacheResults: !!options.cacheResults,
|
|
pseudos: options.pseudos,
|
|
adapter: options.adapter,
|
|
equals: options.equals,
|
|
};
|
|
}
|
|
var is = function (next, token, options, context, compileToken) {
|
|
var func = compileToken(token, copyOptions(options), context);
|
|
return func === boolbase_1.default.trueFunc
|
|
? next
|
|
: func === boolbase_1.default.falseFunc
|
|
? boolbase_1.default.falseFunc
|
|
: function (elem) { return func(elem) && next(elem); };
|
|
};
|
|
/*
|
|
* :not, :has, :is, :matches and :where have to compile selectors
|
|
* doing this in src/pseudos.ts would lead to circular dependencies,
|
|
* so we add them here
|
|
*/
|
|
exports.subselects = {
|
|
is: is,
|
|
/**
|
|
* `:matches` and `:where` are aliases for `:is`.
|
|
*/
|
|
matches: is,
|
|
where: is,
|
|
not: function (next, token, options, context, compileToken) {
|
|
var func = compileToken(token, copyOptions(options), context);
|
|
return func === boolbase_1.default.falseFunc
|
|
? next
|
|
: func === boolbase_1.default.trueFunc
|
|
? boolbase_1.default.falseFunc
|
|
: function (elem) { return !func(elem) && next(elem); };
|
|
},
|
|
has: function (next, subselect, options, _context, compileToken) {
|
|
var adapter = options.adapter;
|
|
var opts = copyOptions(options);
|
|
opts.relativeSelector = true;
|
|
var context = subselect.some(function (s) { return s.some(sort_js_1.isTraversal); })
|
|
? // Used as a placeholder. Will be replaced with the actual element.
|
|
[exports.PLACEHOLDER_ELEMENT]
|
|
: undefined;
|
|
var compiled = compileToken(subselect, opts, context);
|
|
if (compiled === boolbase_1.default.falseFunc)
|
|
return boolbase_1.default.falseFunc;
|
|
var hasElement = ensureIsTag(compiled, adapter);
|
|
// If `compiled` is `trueFunc`, we can skip this.
|
|
if (context && compiled !== boolbase_1.default.trueFunc) {
|
|
/*
|
|
* `shouldTestNextSiblings` will only be true if the query starts with
|
|
* a traversal (sibling or adjacent). That means we will always have a context.
|
|
*/
|
|
var _a = compiled.shouldTestNextSiblings, shouldTestNextSiblings_1 = _a === void 0 ? false : _a;
|
|
return function (elem) {
|
|
if (!next(elem))
|
|
return false;
|
|
context[0] = elem;
|
|
var childs = adapter.getChildren(elem);
|
|
var nextElements = shouldTestNextSiblings_1
|
|
? __spreadArray(__spreadArray([], childs, true), getNextSiblings(elem, adapter), true) : childs;
|
|
return adapter.existsOne(hasElement, nextElements);
|
|
};
|
|
}
|
|
return function (elem) {
|
|
return next(elem) &&
|
|
adapter.existsOne(hasElement, adapter.getChildren(elem));
|
|
};
|
|
},
|
|
};
|
|
//# sourceMappingURL=subselects.js.map
|