Files
NetMesh/types/global/netcatty-bridge-files.d.ts
zhaolei 3c72efcb7f
Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
[Init] Initial commit - NetMesh terminal manager
2026-09-13 18:24:01 +08:00

153 lines
7.3 KiB
TypeScript

import type { SftpFilenameEncoding } from "../../types";
declare global {
interface NetcattyBridge {
// File opener helpers (for "Open With" feature)
selectApplication?(): Promise<{ path: string; name: string } | null>;
openWithApplication?(filePath: string, appPath: string): Promise<boolean>;
openWithSystemDefault?(filePath: string): Promise<{ success: boolean; error?: string }>;
downloadSftpToTempWithProgress?(
sftpId: string,
remotePath: string,
fileName: string,
encoding: SftpFilenameEncoding | undefined,
transferId: string
): Promise<{ localPath: string; cancelled: boolean }>;
// Save dialog for file downloads
showSaveDialog?(defaultPath: string, filters?: Array<{ name: string; extensions: string[] }>): Promise<string | null>;
selectDirectory?(title?: string, defaultPath?: string): Promise<string | null>;
selectFile?(title?: string, defaultPath?: string, filters?: Array<{ name: string; extensions: string[] }>): Promise<string | null>;
// File watcher for auto-sync feature
startFileWatch?(localPath: string, remotePath: string, sftpId: string, encoding?: SftpFilenameEncoding): Promise<{ watchId: string }>;
stopFileWatch?(watchId: string, cleanupTempFile?: boolean): Promise<{ success: boolean }>;
listFileWatches?(): Promise<Array<{ watchId: string; localPath: string; remotePath: string; sftpId: string }>>;
registerTempFile?(sftpId: string, localPath: string): Promise<{ success: boolean }>;
unregisterTempFile?(sftpId: string, localPath: string): Promise<{ success: boolean; retained?: boolean }>;
onFileWatchSynced?(cb: (payload: { watchId: string; localPath: string; remotePath: string; bytesWritten: number }) => void): () => void;
onFileWatchError?(cb: (payload: { watchId: string; localPath: string; remotePath: string; error: string }) => void): () => void;
onFileWatchStopped?(cb: (payload: { watchId: string; localPath: string; remotePath: string; sftpId: string }) => void): () => void;
// Temp file cleanup
deleteTempFile?(filePath: string): Promise<{ success: boolean }>;
stageUploadFile?(file: File, transferId: string): Promise<string>;
cancelStagedUploadFile?(transferId: string): Promise<{ success: boolean }>;
// Crash Logs
getCrashLogs?(): Promise<Array<{ fileName: string; date: string; size: number; entryCount: number }>>;
readCrashLog?(fileName: string): Promise<Array<{
timestamp: string;
source: string;
message: string;
stack?: string;
errorMeta?: Record<string, unknown>;
extra?: Record<string, unknown>;
pid?: number;
platform?: string;
arch?: string;
version?: string;
electronVersion?: string;
osVersion?: string;
memoryMB?: { rss: number; heapUsed: number; heapTotal: number };
activeSessionCount?: number;
uptimeSeconds?: number;
}>>;
clearCrashLogs?(): Promise<{ deletedCount: number }>;
openCrashLogsDir?(): Promise<{ success: boolean }>;
// Temp directory management
getTempDirInfo?(): Promise<{ path: string; fileCount: number; totalSize: number }>;
clearTempDir?(): Promise<{ deletedCount: number; failedCount: number; error?: string }>;
getTempDirPath?(): Promise<string>;
openTempDir?(): Promise<{ success: boolean }>;
getToolOutputPersistenceStatus?(): Promise<{ durable: boolean; reason?: string }>;
writeToolOutputTemp?(record: import('../../infrastructure/ai/harness/toolOutputStore').PersistedToolOutputRecord, content: string): Promise<{ ok: boolean; path?: string; manifestPath?: string; error?: string }>;
restoreToolOutputTemp?(handleId: string, chatSessionId: string): Promise<{
path: string;
record: import('../../infrastructure/ai/harness/toolOutputStore').PersistedToolOutputRecord;
} | null>;
readToolOutputTemp?(filePath: string, request?: {
mode?: 'head' | 'tail' | 'full' | 'range' | 'search';
maxChars?: number;
offset?: number;
query?: string;
}): Promise<unknown | null>;
deleteToolOutputTemp?(filePath: string): Promise<{ ok: boolean }>;
deleteChatToolOutputsTemp?(chatSessionId: string): Promise<{ deletedCount: number }>;
deleteTerminalToolOutputsTemp?(chatSessionId: string, terminalSessionId: string): Promise<{ deletedCount: number }>;
deleteTerminalToolOutputsEverywhereTemp?(terminalSessionId: string): Promise<{ deletedCount: number }>;
// Session Logs
exportSessionLog?(payload: {
terminalData: string;
hostLabel: string;
hostname: string;
startTime: number;
format: 'txt' | 'raw' | 'html';
}): Promise<{ success: boolean; canceled?: boolean; filePath?: string }>;
selectSessionLogsDir?(): Promise<{ success: boolean; canceled?: boolean; directory?: string }>;
autoSaveSessionLog?(payload: {
terminalData: string;
hostLabel: string;
hostname: string;
hostId: string;
startTime: number;
format: 'txt' | 'raw' | 'html';
directory: string;
}): Promise<{ success: boolean; error?: string; filePath?: string }>;
openSessionLogsDir?(directory: string): Promise<{ success: boolean; error?: string }>;
clearSessionLogsDir?(directory: string): Promise<{ success: boolean; deletedCount: number; failedCount: number; error?: string }>;
chooseManualSessionLogPath?(payload: {
sessionId: string;
sessionName?: string;
preferredDirectory?: string;
format?: 'txt' | 'raw' | 'html';
}): Promise<{
success: boolean;
canceled?: boolean;
error?: string;
selectionToken?: string;
filePath?: string;
format?: 'txt' | 'raw' | 'html';
}>;
startManualSessionLog?(payload: {
sessionId: string;
sessionName?: string;
preferredDirectory?: string;
/** Opaque token from chooseManualSessionLogPath (path is main-process only). */
selectionToken?: string;
format?: 'txt' | 'raw' | 'html';
timestampsEnabled?: boolean;
initialLine?: string;
alternateScreenActive?: boolean;
}): Promise<{ success: boolean; started: boolean; canceled?: boolean; error?: string; filePath?: string }>;
stopManualSessionLog?(payload: {
sessionId: string;
}): Promise<{ success: boolean; stopped: boolean; error?: string; filePath?: string }>;
getManualSessionLogStatus?(payload: {
sessionId: string;
}): Promise<{ success: boolean; isLogging: boolean; error?: string }>;
// Get file path from File object (for drag-and-drop, uses Electron's webUtils)
getPathForFile?(file: File): string | undefined;
showSystemNotification?(payload: {
title: string;
body: string;
sessionId?: string;
}): Promise<{ shown: boolean; reason?: string }>;
readClipboardText?(): Promise<string>;
writeClipboardText?(text: string): Promise<boolean>;
readClipboardFiles?(): Promise<Array<{ path: string; name: string; isDirectory: boolean; size?: number }>>;
readClipboardImage?(): Promise<{ path: string; name: string; mediaType: string; size?: number } | null>;
hasClipboardImage?(): Promise<boolean>;
// Credential encryption (field-level safeStorage for sensitive data at rest)
credentialsAvailable?(): Promise<boolean>;
credentialsEncrypt?(plaintext: string): Promise<string>;
credentialsDecrypt?(value: string): Promise<string>;
}
}
export {};