tftsr-devops_investigation/node_modules/basic-ftp/dist/FtpContext.d.ts
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

176 lines
6.2 KiB
TypeScript

import { Socket } from "net";
import { ConnectionOptions as TLSConnectionOptions, TLSSocket } from "tls";
import { StringEncoding } from "./StringEncoding";
interface Task {
/** Handles a response for a task. */
readonly responseHandler: ResponseHandler;
/** Resolves or rejects a task. */
readonly resolver: TaskResolver;
/** Call stack when task was run. */
readonly stack: string;
}
export interface TaskResolver {
resolve(args: any): void;
reject(err: Error): void;
}
export interface FTPResponse {
/** FTP response code */
readonly code: number;
/** Whole response including response code */
readonly message: string;
}
export type ResponseHandler = (response: Error | FTPResponse, task: TaskResolver) => void;
/**
* Describes an FTP server error response including the FTP response code.
*/
export declare class FTPError extends Error {
/** FTP response code */
readonly code: number;
constructor(res: FTPResponse);
}
/**
* FTPContext holds the control and data sockets of an FTP connection and provides a
* simplified way to interact with an FTP server, handle responses, errors and timeouts.
*
* It doesn't implement or use any FTP commands. It's only a foundation to make writing an FTP
* client as easy as possible. You won't usually instantiate this, but use `Client`.
*/
export declare class FTPContext {
readonly timeout: number;
/** Debug-level logging of all socket communication. */
verbose: boolean;
/** IP version to prefer (4: IPv4, 6: IPv6, undefined: automatic). */
ipFamily: number | undefined;
/** Options for TLS connections. */
tlsOptions: TLSConnectionOptions;
/** Current task to be resolved or rejected. */
protected _task: Task | undefined;
/** A multiline response might be received as multiple chunks. */
protected _partialResponse: string;
/** The reason why a context has been closed. */
protected _closingError: NodeJS.ErrnoException | undefined;
/** Encoding supported by Node applied to commands, responses and directory listing data. */
protected _encoding: StringEncoding;
/** FTP control connection */
protected _socket: Socket | TLSSocket;
/** FTP data connection */
protected _dataSocket: Socket | TLSSocket | undefined;
/**
* Instantiate an FTP context.
*
* @param timeout - Timeout in milliseconds to apply to control and data connections. Use 0 for no timeout.
* @param encoding - Encoding to use for control connection. UTF-8 by default. Use "latin1" for older servers.
*/
constructor(timeout?: number, encoding?: StringEncoding);
/**
* Close the context.
*/
close(): void;
/**
* Close the context with an error.
*/
closeWithError(err: Error): void;
/**
* Returns true if this context has been closed or hasn't been connected yet. You can reopen it with `access`.
*/
get closed(): boolean;
/**
* Reset this contex and all of its state.
*/
reset(): void;
/**
* Get the FTP control socket.
*/
get socket(): Socket | TLSSocket;
/**
* Set the socket for the control connection. This will only close the current control socket
* if the new one is not an upgrade to the current one.
*/
set socket(socket: Socket | TLSSocket);
/**
* Get the current FTP data connection if present.
*/
get dataSocket(): Socket | TLSSocket | undefined;
/**
* Set the socket for the data connection. This will automatically close the former data socket.
*/
set dataSocket(socket: Socket | TLSSocket | undefined);
/**
* Get the currently used encoding.
*/
get encoding(): StringEncoding;
/**
* Set the encoding used for the control socket.
*
* See https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings for what encodings
* are supported by Node.
*/
set encoding(encoding: StringEncoding);
/**
* Send an FTP command without waiting for or handling the result.
*/
send(command: string): void;
/**
* Send an FTP command and handle the first response. Use this if you have a simple
* request-response situation.
*/
request(command: string): Promise<FTPResponse>;
/**
* Send an FTP command and handle any response until you resolve/reject. Use this if you expect multiple responses
* to a request. This returns a Promise that will hold whatever the response handler passed on when resolving/rejecting its task.
*/
handle(command: string | undefined, responseHandler: ResponseHandler): Promise<any>;
/**
* Log message if set to be verbose.
*/
log(message: string): void;
/**
* Return true if the control socket is using TLS. This does not mean that a session
* has already been negotiated.
*/
get hasTLS(): boolean;
/**
* Removes reference to current task and handler. This won't resolve or reject the task.
* @protected
*/
protected _stopTrackingTask(): void;
/**
* Handle incoming data on the control socket. The chunk is going to be of type `string`
* because we let `socket` handle encoding with `setEncoding`.
* @protected
*/
protected _onControlSocketData(chunk: string): void;
/**
* Send the current handler a response. This is usually a control socket response
* or a socket event, like an error or timeout.
* @protected
*/
protected _passToHandler(response: Error | FTPResponse): void;
/**
* Setup all error handlers for a socket.
* @protected
*/
protected _setupDefaultErrorHandlers(socket: Socket, identifier: string): void;
/**
* Close the control socket. Sends QUIT, then FIN, and ignores any response or error.
*/
protected _closeControlSocket(): void;
/**
* Close a socket, ignores any error.
* @protected
*/
protected _closeSocket(socket: Socket | undefined): void;
/**
* Remove all default listeners for socket.
* @protected
*/
protected _removeSocketListeners(socket: Socket): void;
/**
* Provide a new socket instance.
*
* Internal use only, replaced for unit tests.
*/
_newSocket(): Socket;
}
export {};