mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-25 09:51:28 +00:00
* feat(terminal): add disconnect/reconnect controls on session status bar Workspace panes could not reach tab-level reconnect. Expose disconnect (without closing the pane) and reconnect beside the host info actions so split sessions stay operable. Closes #2769. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): abort in-flight boot on status-bar disconnect Disconnect keeps the pane mounted, so cancel's unmount cleanup never runs. Flip isBootActiveRef (and isCancelling) so a late startSSH/startMosh attach cannot resurrect the session after the user disconnects mid-connect. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): ignore stale start UI after status-bar disconnect When disconnect aborts an in-flight connect, starter catch paths must not reopen auth or repopulate errors. Gate SSH/telnet/mosh/ET/local/serial failure UI on isTerminalBootActive and harden the boot effect awaits. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): hide disconnect/reconnect on compact popup terminals Owned command popups use compactToolbar with a one-shot startup command. Exposing reconnect there can re-run that command; keep the controls on normal tabs/workspace panes only. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): use boot epoch so reconnect cannot revive aborted starts Disconnect alone flipping isBootActiveRef is not enough: an immediate reconnect re-arms boot, and a late startSSH from the aborted attempt can still attach. Capture a boot epoch per attempt and ignore stale attaches/UI. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): do not let stale attach abort a newer reconnect tryAttach failure for an expired boot epoch must close the orphan session only. Calling abortSessionStartAfterUnmount() would force disconnected on a reconnect that already re-armed boot. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): reject late host-key prompts after disconnect Disconnect can land before pendingHostKeyRequestId is set. Auto-deny onHostKeyVerification when boot is inactive or status is disconnected so approval UI cannot reopen on an aborted pane. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): cancel wake and MFA when status-bar disconnects Invalidate hibernation reconnect-wake tokens on disconnect so a late wake cannot re-arm boot. Reject/cancel keyboard-interactive prompts for disconnected panes and clear any already-queued MFA for that session. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): ignore stale SSH catch UI and password fallback Check boot attempt currency before resetting reconnect UI state on SSH start failure, and before launching key→password fallback after disconnect so a replacement reconnect is not interrupted. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): guard stale SSH progress and host-key prompts Ignore chain-progress callbacks from superseded boot attempts, and thread bootEpoch through SSH host-key verification so a late prompt from an aborted start cannot overwrite a replacement reconnect. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): correlate MFA and jump host-keys with boot epoch Forward bootEpoch through jump-host verification and keyboard-interactive prompts, and reject superseded MFA when the retained tab has already started a replacement reconnect. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): keep replacement SSH session alive across stale starts Skip closeSession for superseded starts while a newer boot still owns the shared sessionId, and avoid clearing MFA wait state before the attempt-freshness guard on SSH success. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): own shared sessionIds by boot epoch Claim SSH/local registry slots with bootEpoch so a stale start cannot overwrite a replacement, and make closeSession no-op when the payload epoch does not match the live session owner. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): claim bootEpoch for all reconnectable backends Pass bootEpoch through Telnet/Mosh/ET/serial starts, claim registry slots the same way as SSH/local, and dispose displaced owners when a newer boot replaces the shared sessionId. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): protect preload listeners and ET artifacts on displace Defer epoch-scoped closeSession listener teardown until main confirms ownership, and remove ET external-auth temp artifacts when a newer boot displaces the previous registry owner. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): clean rejected Mosh starts and keep replacement listeners Kill superseded Mosh/ET PTYs and auth temp files when claimSessionSlot rejects, and never clear shared preload listeners on epoch-scoped closes. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): settle superseded boots and stop displaced log streams Reject Telnet/SSH claim failures through Promise reject/failReuse instead of uncaught EventEmitter/.then throws, and stop a displaced session's log stream so a logging-disabled reconnect cannot append into the old file. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): keep woken runtime when disconnect cancels hibernate wake Disconnect invalidates in-flight hibernated reconnects with keep mode so a successful wake that already cleared hibernatedRef is not disposed into a dead pane that can never reconnect. Unmount still disposes orphan runtimes. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): bind reused SSH shellPid only to the claimed session Late PID discovery after Copy Tab reuse must not write onto a newer bootEpoch that already replaced the shared sessionId registry slot. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): await plugin cancel cleanup and clear boot epochs on teardown Track plugin start/cancel promises so Disconnect→Reconnect waits until the external session finishes unregistering, and stop unmount teardown from republishing boot epochs into the process-wide map. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): cancel SSH passphrase prompts on disconnect Register a pending-boot AbortSignal for SSH starts, abort it (and session- scoped passphrase requests) from closeSession even before a registry slot exists, and filter/drop late passphrase modals by boot epoch / disconnect. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): close owned boot epoch and scope passphrase cancels Capture the pre-bump epoch for disconnect/teardown closeSession so live transports are not skipped by epoch mismatch, cancel only passphrase prompts at or below that epoch, and revalidate boot currency after async passphrase lookups before queuing a modal. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): tag Telnet auto-login and Mosh ready with bootEpoch Emit bootEpoch on telnet auto-login and mosh:ready events so overlapping Disconnect→Reconnect boots ignore cross-delivered callbacks meant for an older shared sessionId. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): update disconnect assertion and cancel pending serial opens Align the disconnect source regression with invalidateBootEpochForClose, and abort in-flight serialPort.open attempts via pending boot AbortSignal so Disconnect→Reconnect cannot leave a stale open racing the replacement. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * fix(terminal): keep flow-pause leases on skipped epoch closes Worker close:await previously cleared pause ownership in finally even when the worker returned skipped for an epoch mismatch, dropping the live replacement's lease. Only clear on non-skipped closes; epoch-scoped fire-and-forget close similarly defers to onSessionClosed. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com>
684 lines
25 KiB
TypeScript
684 lines
25 KiB
TypeScript
/// <reference path="./types/global/netcatty-bridge-session.d.ts" />
|
|
/// <reference path="./types/global/netcatty-bridge-sftp.d.ts" />
|
|
/// <reference path="./types/global/netcatty-bridge-sync.d.ts" />
|
|
/// <reference path="./types/global/netcatty-bridge-files.d.ts" />
|
|
/// <reference path="./types/global/netcatty-bridge-ai.d.ts" />
|
|
/// <reference path="./types/global/netcatty-bridge-app.d.ts" />
|
|
/// <reference path="./types/global/netcatty-bridge-system.d.ts" />
|
|
/// <reference path="./types/global/netcatty-bridge-script.d.ts" />
|
|
declare module "*.cjs" {
|
|
const value: Record<string, unknown>;
|
|
export = value;
|
|
}
|
|
|
|
declare module 'react' {
|
|
interface InputHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
webkitdirectory?: string | boolean;
|
|
}
|
|
}
|
|
|
|
declare global {
|
|
// Proxy configuration for SSH connections
|
|
interface NetcattyProxyConfig {
|
|
type: 'http' | 'socks5' | 'command';
|
|
host: string;
|
|
port: number;
|
|
command?: string;
|
|
username?: string;
|
|
password?: string;
|
|
}
|
|
|
|
// Discovered local shell (e.g. CMD, PowerShell, WSL, Git Bash)
|
|
interface DiscoveredShell {
|
|
id: string;
|
|
name: string;
|
|
command: string;
|
|
args?: string[];
|
|
icon: string;
|
|
isDefault?: boolean;
|
|
}
|
|
|
|
// Jump host configuration for SSH tunneling
|
|
interface NetcattyJumpHost {
|
|
hostname: string;
|
|
hostId?: string;
|
|
port: number;
|
|
username: string;
|
|
authMethod?: import("./domain/models").HostAuthMethod;
|
|
requiresMfa?: boolean;
|
|
password?: string;
|
|
privateKey?: string;
|
|
certificate?: string;
|
|
passphrase?: string;
|
|
publicKey?: string;
|
|
keyId?: string;
|
|
keySource?: 'generated' | 'imported' | 'reference';
|
|
label?: string; // Display label for UI
|
|
proxy?: NetcattyProxyConfig;
|
|
identityFilePaths?: string[];
|
|
useSshAgent?: boolean;
|
|
agentPublicKeys?: string[];
|
|
identityAgent?: string;
|
|
identitiesOnly?: boolean;
|
|
addKeysToAgent?: string;
|
|
useKeychain?: boolean;
|
|
// ET server port on this hop, used only when ET tunnels through it as a
|
|
// jump host (--jport). Defaults to 2022 in the bridge when omitted.
|
|
etPort?: number;
|
|
// Resolved keepalive for THIS hop (caller has already applied host
|
|
// override / global fallback). interval in seconds, 0 = disabled.
|
|
keepaliveInterval?: number;
|
|
keepaliveCountMax?: number;
|
|
// Per-hop SSH connection timeouts, resolved from the saved host.
|
|
sshTcpConnectTimeoutMs?: number;
|
|
sshAuthReadyTimeoutMs?: number;
|
|
verifyHostKeys?: boolean;
|
|
// Per-hop algorithm settings, mirroring the target-host fields. When
|
|
// omitted the bridge falls back to the target host's settings so a
|
|
// single setting on the leaf still covers the chain (matches the
|
|
// pre-existing behavior of `legacyAlgorithms`).
|
|
legacyAlgorithms?: boolean;
|
|
skipEcdsaHostKey?: boolean;
|
|
algorithmOverrides?: import("./domain/models").HostAlgorithmOverrides;
|
|
}
|
|
|
|
// Host key information for verification
|
|
// Reserved for future host key verification UI feature
|
|
interface _NetcattyHostKeyInfo {
|
|
hostname: string;
|
|
port: number;
|
|
keyType: string;
|
|
fingerprint: string;
|
|
publicKey?: string;
|
|
}
|
|
|
|
interface NetcattySSHOptions {
|
|
sessionId?: string;
|
|
hostId?: string;
|
|
hostLabel?: string;
|
|
hostname: string;
|
|
username: string;
|
|
authMethod?: import("./domain/models").HostAuthMethod;
|
|
requiresMfa?: boolean;
|
|
port?: number;
|
|
password?: string;
|
|
privateKey?: string;
|
|
// Optional OpenSSH user certificate
|
|
certificate?: string;
|
|
publicKey?: string; // OpenSSH public key line
|
|
keyId?: string;
|
|
keySource?: 'generated' | 'imported' | 'reference';
|
|
agentForwarding?: boolean;
|
|
x11Forwarding?: boolean;
|
|
x11Display?: string;
|
|
cols?: number;
|
|
rows?: number;
|
|
charset?: string;
|
|
extraArgs?: string[];
|
|
startupCommand?: string;
|
|
passphrase?: string;
|
|
knownHosts?: import("./domain/models").KnownHost[];
|
|
verifyHostKeys?: boolean;
|
|
// Environment variables to set in the remote shell
|
|
env?: Record<string, string>;
|
|
// Proxy configuration
|
|
proxy?: NetcattyProxyConfig;
|
|
// Jump hosts (bastion chain)
|
|
jumpHosts?: NetcattyJumpHost[];
|
|
// SSH-level keepalive interval in seconds (0 = disabled)
|
|
keepaliveInterval?: number;
|
|
// Unanswered keepalives before ssh2 declares the connection dead
|
|
keepaliveCountMax?: number;
|
|
// Maximum time to establish the TCP connection
|
|
sshTcpConnectTimeoutMs?: number;
|
|
// Maximum time for SSH handshake and authentication
|
|
sshAuthReadyTimeoutMs?: number;
|
|
// Enable legacy SSH algorithms for older network equipment
|
|
legacyAlgorithms?: boolean;
|
|
// Drop ecdsa-sha2-* from offered host-key algorithms (#1027)
|
|
skipEcdsaHostKey?: boolean;
|
|
// Per-category algorithm override lists (advanced, see HostAlgorithmOverrides)
|
|
algorithmOverrides?: import("./domain/models").HostAlgorithmOverrides;
|
|
// Use sudo for SFTP server
|
|
sudo?: boolean;
|
|
// Remote file protocol: auto (SFTP then SCP fallback) | sftp | scp
|
|
fileProtocol?: 'auto' | 'sftp' | 'scp';
|
|
// Saved host password used by background system tools when they need sudo.
|
|
sudoAutofillPassword?: string;
|
|
// Session log configuration for real-time streaming
|
|
sessionLog?: { enabled: boolean; directory: string; format: string; timestampsEnabled?: boolean };
|
|
// SSH connection diagnostics. Does not capture terminal output.
|
|
sshDebugLogEnabled?: boolean;
|
|
// Boot generation for correlating host-key prompts with a terminal start.
|
|
bootEpoch?: number;
|
|
// Local SSH key file paths (from SSH config IdentityFile)
|
|
identityFilePaths?: string[];
|
|
useSshAgent?: boolean;
|
|
agentPublicKeys?: string[];
|
|
identityAgent?: string;
|
|
identitiesOnly?: boolean;
|
|
addKeysToAgent?: string;
|
|
useKeychain?: boolean;
|
|
// When set, reuse the already-authenticated SSH connection of this existing
|
|
// session by opening a new shell channel on it, instead of dialing a fresh
|
|
// connection. Lets a duplicated tab skip a second MFA prompt (issue #1204).
|
|
// The bridge falls back to a fresh connection if the source is gone.
|
|
sourceSessionId?: string;
|
|
// Skip POSIX process discovery when copying a network-device session.
|
|
skipShellPidDiscovery?: boolean;
|
|
/**
|
|
* When false, terminal/SFTP opens must dial a fresh SSH connection and
|
|
* must not borrow a live, parked, or in-flight registry transport. Used by
|
|
* connect-time terminal automation and dedicated bulk transfers.
|
|
* Default true (normal terminal, browse, and MFA-skip reuse).
|
|
*/
|
|
reuseTransport?: boolean;
|
|
}
|
|
|
|
interface SftpStatResult {
|
|
name: string;
|
|
type: 'file' | 'directory' | 'symlink';
|
|
size: number;
|
|
lastModified: number; // timestamp
|
|
permissions?: string; // e.g., "rwxr-xr-x"
|
|
owner?: string;
|
|
group?: string;
|
|
}
|
|
|
|
interface SftpTransferProgress {
|
|
transferId: string;
|
|
bytesTransferred: number;
|
|
totalBytes: number;
|
|
speed: number; // bytes per second
|
|
}
|
|
|
|
// Port Forwarding Types
|
|
interface PortForwardOptions {
|
|
ruleId?: string;
|
|
tunnelId: string;
|
|
type: 'local' | 'remote' | 'dynamic';
|
|
localPort: number;
|
|
bindAddress?: string;
|
|
remoteHost?: string;
|
|
remotePort?: number;
|
|
// SSH connection details
|
|
hostname: string;
|
|
hostId?: string;
|
|
port?: number;
|
|
username: string;
|
|
authMethod?: import("./domain/models").HostAuthMethod;
|
|
requiresMfa?: boolean;
|
|
password?: string;
|
|
privateKey?: string;
|
|
certificate?: string;
|
|
keyId?: string;
|
|
passphrase?: string;
|
|
knownHosts?: import("./domain/models").KnownHost[];
|
|
verifyHostKeys?: boolean;
|
|
proxy?: NetcattyProxyConfig;
|
|
jumpHosts?: NetcattyJumpHost[];
|
|
identityFilePaths?: string[];
|
|
useSshAgent?: boolean;
|
|
agentPublicKeys?: string[];
|
|
identityAgent?: string;
|
|
identitiesOnly?: boolean;
|
|
addKeysToAgent?: string;
|
|
useKeychain?: boolean;
|
|
legacyAlgorithms?: boolean;
|
|
skipEcdsaHostKey?: boolean;
|
|
algorithmOverrides?: import("./domain/models").HostAlgorithmOverrides;
|
|
// Resolved keepalive for the target connection (caller has already
|
|
// applied host override / global fallback). interval in seconds.
|
|
keepaliveInterval?: number;
|
|
keepaliveCountMax?: number;
|
|
sshTcpConnectTimeoutMs?: number;
|
|
sshAuthReadyTimeoutMs?: number;
|
|
}
|
|
|
|
interface PortForwardResult {
|
|
tunnelId: string;
|
|
success: boolean;
|
|
cancelled?: boolean;
|
|
blockedByCleanup?: boolean;
|
|
reused?: boolean;
|
|
status?: 'inactive' | 'connecting' | 'active' | 'error';
|
|
error?: string;
|
|
}
|
|
|
|
interface PortForwardStatusResult {
|
|
tunnelId: string;
|
|
status: 'inactive' | 'connecting' | 'active' | 'error';
|
|
type?: 'local' | 'remote' | 'dynamic';
|
|
error?: string;
|
|
}
|
|
|
|
interface NetcattyWindowsPtyInfo {
|
|
backend: 'conpty' | 'winpty';
|
|
buildNumber?: number;
|
|
}
|
|
|
|
type PortForwardStatusCallback = (status: 'inactive' | 'connecting' | 'active' | 'error', error?: string) => void;
|
|
|
|
interface NetcattyPluginRuntimeStatus {
|
|
available: boolean;
|
|
experimental: true;
|
|
}
|
|
|
|
interface NetcattyInstalledPlugin {
|
|
id: string;
|
|
enabled: boolean;
|
|
activeVersion: string | null;
|
|
manifest: unknown;
|
|
runtime: {
|
|
status: string;
|
|
kind: 'browser' | 'utility' | null;
|
|
lastError: string | null;
|
|
quarantinedAt: number | null;
|
|
};
|
|
}
|
|
|
|
interface NetcattyExtensionProviderContribution {
|
|
pluginId: string;
|
|
pluginVersion: string;
|
|
pluginDisplayName?: string;
|
|
provider: import("@netcatty/plugin-contract").ProviderContribution;
|
|
}
|
|
|
|
interface NetcattyExtensionProviderRequest {
|
|
providerId: string;
|
|
kind: 'connection' | 'authentication' | 'importer';
|
|
operation: string;
|
|
requestId?: string;
|
|
payload?: import("@netcatty/plugin-contract").JsonValue;
|
|
deadlineMs?: number;
|
|
}
|
|
|
|
interface NetcattyPluginConnectionStartRequest {
|
|
requestId?: string;
|
|
sessionId: string;
|
|
protocol?: string;
|
|
hostLabel?: string;
|
|
hostname?: string;
|
|
providerId: string;
|
|
configuration: import("@netcatty/plugin-contract").JsonValue;
|
|
columns: number;
|
|
rows: number;
|
|
credential?: import("@netcatty/plugin-contract").CredentialRef | import("@netcatty/plugin-contract").SecretRef;
|
|
authenticationProviderId?: string;
|
|
sessionLog?: { enabled: boolean; directory: string; format: string; timestampsEnabled?: boolean };
|
|
deadlineMs?: number;
|
|
}
|
|
|
|
interface NetcattyPluginImporterPreview {
|
|
providerId: string;
|
|
result: import("@netcatty/plugin-contract").ImporterParseResult;
|
|
records: ReadonlyArray<import("@netcatty/plugin-contract").ImporterRecord>;
|
|
}
|
|
|
|
interface NetcattyPluginImporterProgressEvent {
|
|
requestId: string;
|
|
providerId: string;
|
|
progress: Extract<import("@netcatty/plugin-contract").ImporterRecord, { type: "progress" }>;
|
|
}
|
|
|
|
interface NetcattyPluginAuthenticationChallengeOpenEvent {
|
|
requestId: string;
|
|
challengeRequestId: string;
|
|
challenge: import("@netcatty/plugin-contract").AuthenticationChallenge;
|
|
}
|
|
|
|
interface NetcattyPluginAuthenticationChallengeCancelEvent {
|
|
requestId: string;
|
|
challengeRequestId: string;
|
|
challengeId?: string;
|
|
cancelled: true;
|
|
}
|
|
|
|
type NetcattyPluginAuthenticationChallengeEvent =
|
|
| NetcattyPluginAuthenticationChallengeOpenEvent
|
|
| NetcattyPluginAuthenticationChallengeCancelEvent;
|
|
|
|
interface NetcattyBridge {
|
|
getPluginRuntimeStatus?(): Promise<NetcattyPluginRuntimeStatus>;
|
|
listPlugins?(): Promise<NetcattyInstalledPlugin[]>;
|
|
installPluginPackage?(archivePath: string, options?: { enable?: boolean }): Promise<NetcattyInstalledPlugin>;
|
|
setPluginEnabled?(pluginId: string, enabled: boolean): Promise<NetcattyInstalledPlugin>;
|
|
restartPlugin?(pluginId: string): Promise<NetcattyInstalledPlugin>;
|
|
uninstallPlugin?(pluginId: string): Promise<boolean>;
|
|
getPluginContributions?(options?: NetcattyPluginContributionQuery): Promise<NetcattyPluginContributionSnapshot>;
|
|
getPluginContributionIcon?(pluginId: string, icon: Extract<NetcattyPluginIconReference, { kind: 'package' }>): Promise<{ light: string; dark?: string }>;
|
|
executePluginCommand?(command: string, args?: unknown, context?: Record<string, unknown>): Promise<unknown>;
|
|
updatePluginSetting?(pluginId: string, settingId: string, value: unknown, scopeId?: string): Promise<{ restartRequired: boolean }>;
|
|
resetPluginSetting?(pluginId: string, settingId: string, scopeId?: string): Promise<{ restartRequired: boolean }>;
|
|
setPluginEnvironment?(environment: NetcattyPluginEnvironment): Promise<void>;
|
|
listPluginTerminalProviders?(options: NetcattyTerminalProviderQuery): Promise<ReadonlyArray<NetcattyTerminalProviderContribution>>;
|
|
providePluginTerminal?(request: NetcattyTerminalProviderRequest): Promise<ReadonlyArray<NetcattyTerminalProviderResult>>;
|
|
cancelPluginTerminalRequest?(requestId: string): Promise<boolean>;
|
|
publishPluginTerminalSessionEvent?(event: NetcattyTerminalSessionEvent): Promise<ReadonlyArray<{ pluginId: string; delivered: boolean }>>;
|
|
listPluginExtensionProviders?(options: { kind: 'connection' | 'authentication' | 'importer' | 'sync'; locale?: string }): Promise<ReadonlyArray<NetcattyExtensionProviderContribution>>;
|
|
updatePluginCredentialCatalog?(entries: ReadonlyArray<{ id: string; ciphertext: string }>): Promise<number>;
|
|
invokePluginExtensionProvider?(request: NetcattyExtensionProviderRequest): Promise<import("@netcatty/plugin-contract").JsonValue>;
|
|
cancelPluginExtensionRequest?(requestId: string): Promise<boolean>;
|
|
pluginSyncConnect?(request: {
|
|
requestId?: string;
|
|
providerId: string;
|
|
configuration?: unknown;
|
|
credential?: unknown;
|
|
deadlineMs?: number;
|
|
}): Promise<{ account: { id: string; email?: string; name?: string; avatarUrl?: string } }>;
|
|
pluginSyncDisconnect?(request: { requestId?: string; providerId: string; deadlineMs?: number }): Promise<null>;
|
|
pluginSyncGetAccount?(request: { requestId?: string; providerId: string; deadlineMs?: number }): Promise<{
|
|
account: { id: string; email?: string; name?: string; avatarUrl?: string } | null;
|
|
}>;
|
|
pluginSyncGetCapabilities?(request: { requestId?: string; providerId: string; deadlineMs?: number }): Promise<{
|
|
revisions: boolean;
|
|
conditionalWrites: boolean;
|
|
atomicReplacement: boolean;
|
|
maxObjectBytes?: number;
|
|
maxObjects?: number;
|
|
}>;
|
|
pluginSyncReadObject?(request: {
|
|
requestId?: string;
|
|
providerId: string;
|
|
key: string;
|
|
preferStream?: boolean;
|
|
deadlineMs?: number;
|
|
}): Promise<{
|
|
found: boolean;
|
|
key: string;
|
|
data?: Uint8Array | null;
|
|
streamed?: boolean;
|
|
transferId?: string;
|
|
byteLength?: number;
|
|
revision?: string;
|
|
contentType?: string;
|
|
}>;
|
|
pluginSyncReadChunk?(request: {
|
|
requestId: string;
|
|
transferId: string;
|
|
maxBytes?: number;
|
|
}): Promise<{ chunk: Uint8Array; done: boolean }>;
|
|
pluginSyncWriteObject?(request: {
|
|
requestId?: string;
|
|
providerId: string;
|
|
key: string;
|
|
data: Uint8Array;
|
|
expectedRevision?: string | null;
|
|
preferStream?: boolean;
|
|
deadlineMs?: number;
|
|
}): Promise<{ created: boolean; revision?: string }>;
|
|
pluginSyncWriteBegin?(request: {
|
|
requestId?: string;
|
|
providerId: string;
|
|
key: string;
|
|
byteLength: number;
|
|
expectedRevision?: string | null;
|
|
deadlineMs?: number;
|
|
}): Promise<{ transferId: string; windowBytes: number }>;
|
|
pluginSyncWriteChunk?(request: {
|
|
requestId: string;
|
|
transferId: string;
|
|
sequence: number;
|
|
chunk: Uint8Array;
|
|
}): Promise<{ accepted: number }>;
|
|
pluginSyncWriteCommit?(request: {
|
|
requestId: string;
|
|
transferId: string;
|
|
}): Promise<{ created: boolean; revision?: string }>;
|
|
pluginSyncDeleteObject?(request: {
|
|
requestId?: string;
|
|
providerId: string;
|
|
key: string;
|
|
expectedRevision?: string;
|
|
deadlineMs?: number;
|
|
}): Promise<{ deleted: boolean }>;
|
|
pluginSyncPutSecret?(request: {
|
|
providerId: string;
|
|
key: string;
|
|
value: string;
|
|
}): Promise<{ kind: 'secret'; id: string; key: string; created?: boolean }>;
|
|
pluginSyncDeleteSecrets?(request: {
|
|
providerId: string;
|
|
keys?: string[];
|
|
}): Promise<{ deleted: number }>;
|
|
pluginSyncRestoreSecrets?(request: {
|
|
providerId: string;
|
|
keys: string[];
|
|
discard?: boolean;
|
|
}): Promise<{ restored: number; discarded?: number }>;
|
|
collectPluginSyncSidecars?(): Promise<unknown>;
|
|
applyPluginSyncSidecars?(bundle: unknown): Promise<{ applied: boolean; count?: number; entries?: unknown }>;
|
|
pluginHostReady?(): boolean;
|
|
startPluginConnection?(request: NetcattyPluginConnectionStartRequest): Promise<{ sessionId: string; providerId: string; status: 'connecting' | 'connected'; diagnostics: ReadonlyArray<import("@netcatty/plugin-contract").ProviderValidationIssue> }>;
|
|
writePluginConnection?(sessionId: string, data: Uint8Array): Promise<void>;
|
|
controlPluginConnection?(sessionId: string, operation: 'resize' | 'signal' | 'reconnect' | 'close' | 'getStatus', payload?: Record<string, unknown>): Promise<unknown>;
|
|
detectPluginImporter?(request: { providerId: string; sample: Uint8Array; fileName?: string; mediaType?: string; deadlineMs?: number }): Promise<import("@netcatty/plugin-contract").ImporterDetectResult>;
|
|
selectPluginImporterFile?(): Promise<{ selectionToken: string; fileName: string; sample: Uint8Array } | null>;
|
|
releasePluginImporterFile?(selectionToken: string): Promise<boolean>;
|
|
parsePluginImporterFile?(request: { requestId?: string; providerId: string; selectionToken: string; mediaType?: string; options?: import("@netcatty/plugin-contract").JsonValue; deadlineMs?: number }): Promise<NetcattyPluginImporterPreview>;
|
|
onPluginImporterProgress?(callback: (event: NetcattyPluginImporterProgressEvent) => void): () => void;
|
|
respondPluginAuthenticationChallenge?(response: {
|
|
requestId: string;
|
|
challengeRequestId: string;
|
|
challengeId: string;
|
|
response?: string | boolean | ReadonlyArray<string>;
|
|
cancelled?: boolean;
|
|
}): Promise<void>;
|
|
onPluginAuthenticationChallenge?(callback: (event: NetcattyPluginAuthenticationChallengeEvent) => void): () => void;
|
|
onPluginConnectionData?(callback: (event: { sessionId: string; data: Uint8Array }) => void): () => void;
|
|
onPluginConnectionClosed?(callback: (event: { sessionId: string; reason: string }) => void): () => void;
|
|
openPluginView?(payload: NetcattyPluginViewOpenRequest): Promise<{ instanceId: string }>;
|
|
closePluginView?(instanceId: string): Promise<void>;
|
|
setPluginViewBounds?(instanceId: string, bounds: { x: number; y: number; width: number; height: number }): Promise<void>;
|
|
setPluginViewVisibility?(instanceId: string, visible: boolean): Promise<void>;
|
|
postPluginViewMessage?(instanceId: string, message: unknown): Promise<void>;
|
|
onPluginContributionsChanged?(callback: (event: { reason: string; pluginId: string | null; revision: number }) => void): () => void;
|
|
onPluginViewMessage?(callback: (event: { pluginId: string; viewId: string; message: unknown }) => void): () => void;
|
|
onPluginViewClosed?(callback: (event: NetcattyPluginViewClosedEvent) => void): () => void;
|
|
getPluginScopeCatalog?(): Promise<NetcattyPluginScopeCatalog>;
|
|
setPluginScopeCatalog?(catalog: NetcattyPluginScopeCatalog): Promise<void>;
|
|
onPluginScopeCatalogChanged?(callback: (catalog: NetcattyPluginScopeCatalog) => void): () => void;
|
|
}
|
|
|
|
interface NetcattyPluginContributionQuery {
|
|
locale?: string;
|
|
context?: Record<string, unknown>;
|
|
menuContexts?: Partial<Record<string, Record<string, unknown>>>;
|
|
scopeIds?: Partial<Record<'workspace' | 'host' | 'session' | 'device', string>>;
|
|
}
|
|
|
|
interface NetcattyPluginSettingContribution {
|
|
id: string;
|
|
label: string;
|
|
description?: string;
|
|
placeholder?: string;
|
|
control: string;
|
|
scope: string;
|
|
scopeId: string | null;
|
|
value?: unknown;
|
|
secret?: boolean;
|
|
configured: boolean;
|
|
visible: boolean;
|
|
restartRequired?: boolean;
|
|
required?: boolean;
|
|
options?: ReadonlyArray<{ value: string; label: string; description?: string }>;
|
|
minimum?: number;
|
|
maximum?: number;
|
|
step?: number;
|
|
sortable?: boolean;
|
|
valueSchema?: unknown;
|
|
}
|
|
|
|
type NetcattyPluginIconReference =
|
|
| { kind: 'theme'; name: string }
|
|
| { kind: 'package'; light: string; dark?: string };
|
|
|
|
interface NetcattyPluginContributionSnapshot {
|
|
locale: string;
|
|
plugins: ReadonlyArray<{
|
|
id: string;
|
|
version: string;
|
|
displayName: string;
|
|
description: string;
|
|
commands: ReadonlyArray<{ id: string; title: string; category?: string; description?: string; icon?: NetcattyPluginIconReference; enabled: boolean }>;
|
|
keybindings: ReadonlyArray<{ command: string; key: string; mac?: string; linux?: string; windows?: string; args?: unknown; enabled: boolean }>;
|
|
menus: ReadonlyArray<{
|
|
id: string;
|
|
command: string;
|
|
alt?: string;
|
|
location: string;
|
|
title: string;
|
|
visible: boolean;
|
|
enabled: boolean;
|
|
checked?: boolean;
|
|
order?: number;
|
|
group?: string;
|
|
shortcut?: string;
|
|
showKeybinding?: boolean;
|
|
icon?: NetcattyPluginIconReference;
|
|
}>;
|
|
settings: ReadonlyArray<NetcattyPluginSettingContribution>;
|
|
views: ReadonlyArray<{ id: string; title: string; location: string; entry: string; icon?: NetcattyPluginIconReference; order?: number; visible: boolean; retainContextWhenHidden?: boolean }>;
|
|
}>;
|
|
}
|
|
|
|
interface NetcattyPluginEnvironment {
|
|
locale: string;
|
|
theme: string;
|
|
reducedMotion: boolean;
|
|
highContrast: boolean;
|
|
themeTokens?: Record<string, string>;
|
|
}
|
|
|
|
type NetcattyTerminalProviderKind =
|
|
| 'terminal.completion'
|
|
| 'terminal.decoration'
|
|
| 'terminal.link'
|
|
| 'terminal.hover'
|
|
| 'terminal.matcher'
|
|
| 'terminal.semantic'
|
|
| 'terminal.prompt'
|
|
| 'terminal.background'
|
|
| 'terminal.theme';
|
|
|
|
interface NetcattyTerminalProviderContribution {
|
|
pluginId: string;
|
|
pluginVersion: string;
|
|
runtimeId?: string;
|
|
pluginDisplayName: string;
|
|
provider: {
|
|
id: string;
|
|
label: string;
|
|
description?: string;
|
|
kind: NetcattyTerminalProviderKind;
|
|
capabilities?: ReadonlyArray<string>;
|
|
configurationSchema?: unknown;
|
|
};
|
|
}
|
|
|
|
interface NetcattyTerminalProviderQuery {
|
|
kind: NetcattyTerminalProviderKind;
|
|
locale?: string;
|
|
preferredProviderIds?: ReadonlyArray<string>;
|
|
}
|
|
|
|
interface NetcattyTerminalSessionSnapshot {
|
|
sessionId: string;
|
|
hostId?: string;
|
|
workspaceId?: string;
|
|
protocol: string;
|
|
status: 'connecting' | 'connected' | 'disconnected';
|
|
cwd?: string;
|
|
title?: string;
|
|
shellType?: 'posix' | 'fish' | 'powershell' | 'cmd' | 'unknown';
|
|
cols?: number;
|
|
rows?: number;
|
|
alternateScreen?: boolean;
|
|
}
|
|
|
|
interface NetcattyTerminalSessionEvent {
|
|
type:
|
|
| 'snapshot'
|
|
| 'created'
|
|
| 'connected'
|
|
| 'reconnected'
|
|
| 'cwdChanged'
|
|
| 'titleChanged'
|
|
| 'resized'
|
|
| 'alternateScreenChanged'
|
|
| 'commandSubmitted'
|
|
| 'commandCompleted'
|
|
| 'disconnected'
|
|
| 'disposed';
|
|
session: NetcattyTerminalSessionSnapshot;
|
|
exitCode?: number;
|
|
}
|
|
|
|
interface NetcattyTerminalProviderRequest {
|
|
requestId: string;
|
|
kind: NetcattyTerminalProviderKind;
|
|
operation: string;
|
|
session: NetcattyTerminalSessionSnapshot;
|
|
payload?: unknown;
|
|
locale?: string;
|
|
preferredProviderIds?: ReadonlyArray<string>;
|
|
deadlineMs?: number;
|
|
}
|
|
|
|
type NetcattyTerminalProviderResult = {
|
|
pluginId: string;
|
|
pluginVersion: string;
|
|
runtimeId?: string;
|
|
providerId: string;
|
|
kind: NetcattyTerminalProviderKind;
|
|
requestId: string;
|
|
status: 'ok';
|
|
result: unknown;
|
|
} | {
|
|
pluginId: string;
|
|
pluginVersion: string;
|
|
runtimeId?: string;
|
|
providerId: string;
|
|
kind: NetcattyTerminalProviderKind;
|
|
requestId: string;
|
|
status: 'cancelled';
|
|
} | {
|
|
pluginId: string;
|
|
pluginVersion: string;
|
|
providerId: string;
|
|
kind: NetcattyTerminalProviderKind;
|
|
requestId: string;
|
|
status: 'failed';
|
|
error: { code: number; message: string; data?: unknown };
|
|
};
|
|
|
|
interface NetcattyPluginViewOpenRequest {
|
|
viewId: string;
|
|
instanceId?: string;
|
|
scopeId: string;
|
|
bounds?: { x: number; y: number; width: number; height: number };
|
|
context?: Record<string, unknown>;
|
|
}
|
|
|
|
interface NetcattyPluginViewClosedEvent {
|
|
instanceId: string;
|
|
pluginId: string;
|
|
viewId: string;
|
|
reason: string;
|
|
}
|
|
|
|
type NetcattyPluginSettingScopeKind = 'workspace' | 'host' | 'session' | 'device';
|
|
|
|
type NetcattyPluginScopeCatalog = Record<
|
|
NetcattyPluginSettingScopeKind,
|
|
ReadonlyArray<{ id: string; label: string }>
|
|
>;
|
|
|
|
interface Window {
|
|
netcatty?: NetcattyBridge;
|
|
}
|
|
|
|
}
|
|
|
|
export { };
|