tftsr-devops_investigation/node_modules/chardet/lib/encoding/iso2022.js
Shaun Arman 8839075805 feat: initial implementation of TFTSR IT Triage & RCA application
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>
2026-03-14 22:36:25 -05:00

114 lines
3.3 KiB
JavaScript

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ISO_2022_CN = exports.ISO_2022_KR = exports.ISO_2022_JP = void 0;
const match_1 = __importDefault(require("../match"));
class ISO_2022 {
constructor() {
this.escapeSequences = [];
}
name() {
return 'ISO_2022';
}
match(det) {
let i, j;
let escN;
let hits = 0;
let misses = 0;
let shifts = 0;
let confidence;
const text = det.inputBytes;
const textLen = det.inputLen;
scanInput: for (i = 0; i < textLen; i++) {
if (text[i] == 0x1b) {
checkEscapes: for (escN = 0; escN < this.escapeSequences.length; escN++) {
const seq = this.escapeSequences[escN];
if (textLen - i < seq.length)
continue checkEscapes;
for (j = 1; j < seq.length; j++)
if (seq[j] != text[i + j])
continue checkEscapes;
hits++;
i += seq.length - 1;
continue scanInput;
}
misses++;
}
if (text[i] == 0x0e || text[i] == 0x0f)
shifts++;
}
if (hits == 0)
return null;
confidence = (100 * hits - 100 * misses) / (hits + misses);
if (hits + shifts < 5)
confidence -= (5 - (hits + shifts)) * 10;
return confidence <= 0 ? null : (0, match_1.default)(det, this, confidence);
}
}
class ISO_2022_JP extends ISO_2022 {
constructor() {
super(...arguments);
this.escapeSequences = [
[0x1b, 0x24, 0x28, 0x43],
[0x1b, 0x24, 0x28, 0x44],
[0x1b, 0x24, 0x40],
[0x1b, 0x24, 0x41],
[0x1b, 0x24, 0x42],
[0x1b, 0x26, 0x40],
[0x1b, 0x28, 0x42],
[0x1b, 0x28, 0x48],
[0x1b, 0x28, 0x49],
[0x1b, 0x28, 0x4a],
[0x1b, 0x2e, 0x41],
[0x1b, 0x2e, 0x46],
];
}
name() {
return 'ISO-2022-JP';
}
language() {
return 'ja';
}
}
exports.ISO_2022_JP = ISO_2022_JP;
class ISO_2022_KR extends ISO_2022 {
constructor() {
super(...arguments);
this.escapeSequences = [[0x1b, 0x24, 0x29, 0x43]];
}
name() {
return 'ISO-2022-KR';
}
language() {
return 'kr';
}
}
exports.ISO_2022_KR = ISO_2022_KR;
class ISO_2022_CN extends ISO_2022 {
constructor() {
super(...arguments);
this.escapeSequences = [
[0x1b, 0x24, 0x29, 0x41],
[0x1b, 0x24, 0x29, 0x47],
[0x1b, 0x24, 0x2a, 0x48],
[0x1b, 0x24, 0x29, 0x45],
[0x1b, 0x24, 0x2b, 0x49],
[0x1b, 0x24, 0x2b, 0x4a],
[0x1b, 0x24, 0x2b, 0x4b],
[0x1b, 0x24, 0x2b, 0x4c],
[0x1b, 0x24, 0x2b, 0x4d],
[0x1b, 0x4e],
[0x1b, 0x4f],
];
}
name() {
return 'ISO-2022-CN';
}
language() {
return 'zh';
}
}
exports.ISO_2022_CN = ISO_2022_CN;
//# sourceMappingURL=iso2022.js.map