mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-16 20:11:08 +00:00
* feat(plugins): add privileged terminal data pipeline * fix(plugins): harden terminal interceptor lifecycle * fix(plugins): close terminal interceptor lifecycle gaps * fix(plugins): preserve terminal interceptor state transitions * fix(plugin): close terminal pipeline lifecycle gaps * fix(plugin): harden terminal interceptor startup * fix(plugin): isolate terminal output route attempts * fix(plugin): isolate reused terminal sessions * fix(plugin): harden terminal interceptor boundaries * fix(plugin): harden terminal replay metadata * fix(plugin): preserve terminal replay provenance * fix(plugin): close terminal pipeline lifecycle races * fix(plugin): harden terminal route handoff * fix(plugin): contain terminal handoff failures * fix(plugin): route terminal attachment through RPC * fix(plugin): validate terminal attachment RPC * fix(plugin): close unexpected runtime ports * fix(plugin): canonicalize terminal data frames * fix(plugin): close terminal pipeline lifecycle gaps * fix(plugin): close terminal interceptor review gaps * fix(plugin): harden terminal interceptor protocol handling * fix(plugin): preserve terminal flow compatibility * fix(plugin): preserve terminal protocol accounting * fix(plugin): bound terminal interceptor lifecycle * fix(plugin): close terminal interceptor review gaps --------- Co-authored-by: ryan-wong-coder <wangsiyuan19990317@gmail.com>
568 lines
15 KiB
TypeScript
568 lines
15 KiB
TypeScript
// This file is generated from schema/plugin-contract.schema.json.
|
|
// Run `npm run generate:plugin-contract` after changing the contract.
|
|
// Do not edit this file directly.
|
|
|
|
export type ActivationEvent = "onStartupFinished" | `onCommand:${ContributionId}` | `onView:${ContributionId}` | `onProvider:${ContributionId}`;
|
|
|
|
export type BoundedPermissionResource = string;
|
|
|
|
export type CommandContribution = {
|
|
id: ContributionId;
|
|
title: LocalizedText;
|
|
category?: LocalizedText;
|
|
description?: LocalizedText;
|
|
icon?: IconReference;
|
|
enablement?: ContextKeyExpression;
|
|
};
|
|
|
|
export type CompanionExecutable = {
|
|
id: ContributionId;
|
|
variants: Array<CompanionExecutableVariant>;
|
|
permissions?: Array<PluginPermission>;
|
|
};
|
|
|
|
export type CompanionExecutableVariant = {
|
|
path: RelativePackagePath;
|
|
platforms: Array<CompanionPlatform>;
|
|
sha256: string;
|
|
};
|
|
|
|
export type CompanionPlatform = "darwin-arm64" | "darwin-x64" | "linux-arm64" | "linux-x64" | "win32-arm64" | "win32-x64";
|
|
|
|
export type ContextKeyExpression = string;
|
|
|
|
export type ContributionId = string;
|
|
|
|
export type CredentialRef = {
|
|
kind: "credential";
|
|
id: string;
|
|
};
|
|
|
|
export type FeatureId = string;
|
|
|
|
export type IconReference = (ThemeIcon) | (PackageIcon);
|
|
|
|
export type JsonPrimitive = (string) | (number) | (boolean) | (null);
|
|
|
|
export type JsonRpcStandardErrorCode = -32700 | -32600 | -32601 | -32602 | -32603;
|
|
|
|
export type JsonValue = (JsonPrimitive) | (Array<JsonValue>) | ({ [key: string]: JsonValue });
|
|
|
|
export type JsonValueLimits = {"maxDepth":128,"maxNodes":100000};
|
|
|
|
export type KeybindingContribution = {
|
|
command: ContributionId;
|
|
key: string;
|
|
mac?: string;
|
|
linux?: string;
|
|
windows?: string;
|
|
when?: ContextKeyExpression;
|
|
args?: JsonValue;
|
|
};
|
|
|
|
export type LocalizedText = (string) | ({ [key: string]: string });
|
|
|
|
export type MenuContribution = {
|
|
command: ContributionId;
|
|
alt?: ContributionId;
|
|
location: MenuLocation;
|
|
title?: LocalizedText;
|
|
icon?: IconReference;
|
|
group?: string;
|
|
order?: number;
|
|
when?: ContextKeyExpression;
|
|
enablement?: ContextKeyExpression;
|
|
checked?: ContextKeyExpression;
|
|
showKeybinding?: boolean;
|
|
};
|
|
|
|
export type MenuLocation = "commandPalette" | "application" | "host/context" | "terminal/context" | "terminal/toolbar" | "statusBar";
|
|
|
|
export type NonResourceScopedPermission = "storage" | "runtime.advanced" | "settings.read" | "settings.write" | "commands" | "menus" | "views" | "clipboard.read" | "clipboard.write" | "terminal.metadata" | "terminal.output" | "terminal.input" | "terminal.decorate" | "terminal.complete" | "terminal.intercept.input" | "terminal.intercept.output" | "vault.metadata" | "vault.write" | "vault.credentials" | "sftp.read" | "sftp.write" | "secrets" | "provider.terminal" | "provider.connection" | "provider.authentication" | "provider.sync" | "provider.importer";
|
|
|
|
export type NullableRpcId = (RpcId) | (null);
|
|
|
|
export type PackageIcon = {
|
|
kind: "package";
|
|
light: RelativePackagePath;
|
|
dark?: RelativePackagePath;
|
|
};
|
|
|
|
export type PermissionDecision = ({
|
|
requestId: string;
|
|
decision: "allow";
|
|
scope: PermissionGrantScope;
|
|
resources?: Array<PermissionResource>;
|
|
}) | ({
|
|
requestId: string;
|
|
decision: "deny" | "cancel";
|
|
});
|
|
|
|
export type PermissionDeclaration = (PluginPermission) | (PermissionResourceDeclaration);
|
|
|
|
export type PermissionGrantScope = "once" | "session" | "application" | "always";
|
|
|
|
export type PermissionRequest = {
|
|
requestId: string;
|
|
pluginId: PluginId;
|
|
pluginVersion?: SemanticVersion;
|
|
pluginName?: string;
|
|
publisher?: string;
|
|
runtimeId?: string | null;
|
|
runtimeKind?: "browser" | "utility" | null;
|
|
permission: PluginPermission;
|
|
resources?: Array<PermissionResource>;
|
|
resourceKinds?: Array<PermissionResourceKind>;
|
|
reason: string;
|
|
operationId?: string;
|
|
sessionId?: string;
|
|
allowedScopes?: Array<PermissionGrantScope>;
|
|
};
|
|
|
|
export type PermissionResource = string;
|
|
|
|
export type PermissionResourceDeclaration = {
|
|
permission: PluginPermission;
|
|
resources: Array<PermissionResource>;
|
|
reason?: string;
|
|
};
|
|
|
|
export type PermissionResourceKind = "exact" | "directory";
|
|
|
|
export type PermissionSet = {
|
|
required?: Array<RequiredPermissionDeclaration>;
|
|
optional?: Array<PermissionDeclaration>;
|
|
};
|
|
|
|
export type PluginContributions = {
|
|
settings?: Array<SettingContribution>;
|
|
commands?: Array<CommandContribution>;
|
|
keybindings?: Array<KeybindingContribution>;
|
|
menus?: Array<MenuContribution>;
|
|
views?: Array<ViewContribution>;
|
|
providers?: Array<ProviderContribution>;
|
|
};
|
|
|
|
export type PluginEngineHeader = ({
|
|
netcatty: SemverRange;
|
|
api: SemverRange;
|
|
} & Record<string, unknown>);
|
|
|
|
export type PluginEngines = {
|
|
netcatty: SemverRange;
|
|
api: SemverRange;
|
|
};
|
|
|
|
export type PluginEntrypoints = {
|
|
browser?: RelativePackagePath;
|
|
node?: RelativePackagePath;
|
|
};
|
|
|
|
export type PluginErrorData = {
|
|
pluginCode: PluginErrorName;
|
|
details?: JsonValue;
|
|
};
|
|
|
|
export type PluginErrorName = "cancelled" | "unknown" | "deadline_exceeded" | "invalid_argument" | "not_found" | "already_exists" | "permission_denied" | "resource_exhausted" | "failed_precondition" | "aborted" | "out_of_range" | "unavailable" | "unsupported" | "internal" | "data_loss" | "unauthenticated";
|
|
|
|
export type PluginFeatures = {
|
|
required?: Array<FeatureId>;
|
|
optional?: Array<FeatureId>;
|
|
};
|
|
|
|
export type PluginId = string;
|
|
|
|
export type PluginManifest = {
|
|
$schema?: string;
|
|
manifestVersion: 1;
|
|
id: PluginId;
|
|
name: string;
|
|
displayName?: LocalizedText;
|
|
description?: LocalizedText;
|
|
version: SemanticVersion;
|
|
publisher: string;
|
|
license?: string;
|
|
homepage?: string;
|
|
repository?: string;
|
|
engines: PluginEngines;
|
|
features?: PluginFeatures;
|
|
main: PluginEntrypoints;
|
|
activationEvents?: Array<ActivationEvent>;
|
|
permissions?: PermissionSet;
|
|
contributes?: PluginContributions;
|
|
companionExecutables?: Array<CompanionExecutable>;
|
|
};
|
|
|
|
export type PluginManifestHeader = ({
|
|
$schema?: string;
|
|
manifestVersion: number;
|
|
id: PluginId;
|
|
version: SemanticVersion;
|
|
engines: PluginEngineHeader;
|
|
} & Record<string, unknown>);
|
|
|
|
export type PluginPermission = "storage" | "runtime.advanced" | "settings.read" | "settings.write" | "commands" | "menus" | "views" | "clipboard.read" | "clipboard.write" | "terminal.metadata" | "terminal.output" | "terminal.input" | "terminal.decorate" | "terminal.complete" | "terminal.intercept.input" | "terminal.intercept.output" | "vault.metadata" | "vault.write" | "vault.credentials" | "sftp.read" | "sftp.write" | "network" | "filesystem.read" | "filesystem.write" | "secrets" | "companion.execute" | "provider.terminal" | "provider.connection" | "provider.authentication" | "provider.sync" | "provider.importer";
|
|
|
|
export type PluginWireErrorCode = -32001 | -32002 | -32003 | -32004 | -32005 | -32006 | -32007 | -32008 | -32009 | -32010 | -32011 | -32012 | -32013 | -32014 | -32015 | -32016;
|
|
|
|
export type ProgressBegin = {
|
|
kind: "begin";
|
|
title: string;
|
|
message?: string;
|
|
percentage?: number;
|
|
cancellable?: boolean;
|
|
};
|
|
|
|
export type ProgressEnd = {
|
|
kind: "end";
|
|
message?: string;
|
|
};
|
|
|
|
export type ProgressReport = {
|
|
kind: "report";
|
|
message?: string;
|
|
percentage?: number;
|
|
increment?: number;
|
|
};
|
|
|
|
export type ProgressToken = RpcId;
|
|
|
|
export type ProgressValue = (ProgressBegin) | (ProgressReport) | (ProgressEnd);
|
|
|
|
export type ProviderContribution = {
|
|
id: ContributionId;
|
|
label: LocalizedText;
|
|
description?: LocalizedText;
|
|
kind: ProviderKind;
|
|
capabilities?: Array<FeatureId>;
|
|
configurationSchema?: JsonValue;
|
|
};
|
|
|
|
export type ProviderKind = "terminal.completion" | "terminal.decoration" | "terminal.link" | "terminal.hover" | "terminal.matcher" | "terminal.semantic" | "terminal.prompt" | "terminal.background" | "terminal.theme" | "terminal.interceptor.input" | "terminal.interceptor.output" | "connection" | "authentication" | "sync" | "importer";
|
|
|
|
export type ProviderRequest = {
|
|
providerId: ContributionId;
|
|
operation: string;
|
|
requestId: string;
|
|
payload?: JsonValue;
|
|
deadlineMs?: number;
|
|
cancellationId?: string;
|
|
};
|
|
|
|
export type ProviderResult = ({
|
|
requestId: string;
|
|
status: "ok";
|
|
result: JsonValue;
|
|
}) | ({
|
|
requestId: string;
|
|
status: "cancelled";
|
|
}) | ({
|
|
requestId: string;
|
|
status: "failed";
|
|
error: RpcErrorObject;
|
|
});
|
|
|
|
export type RelativePackagePath = string;
|
|
|
|
export type RequiredPermissionDeclaration = (NonResourceScopedPermission) | (RequiredPermissionResourceDeclaration);
|
|
|
|
export type RequiredPermissionResourceDeclaration = {
|
|
permission: ResourceScopedPermission;
|
|
resources: Array<BoundedPermissionResource>;
|
|
reason?: string;
|
|
};
|
|
|
|
export type ResourceScopedPermission = "network" | "filesystem.read" | "filesystem.write" | "companion.execute";
|
|
|
|
export type RpcCancel = {
|
|
jsonrpc: "2.0";
|
|
method: "$/cancelRequest";
|
|
params: {
|
|
cancellationId: string;
|
|
};
|
|
};
|
|
|
|
export type RpcErrorCode = (JsonRpcStandardErrorCode) | (PluginWireErrorCode);
|
|
|
|
export type RpcErrorObject = {
|
|
code: RpcErrorCode;
|
|
message: string;
|
|
data?: JsonValue;
|
|
};
|
|
|
|
export type RpcFailure = {
|
|
jsonrpc: "2.0";
|
|
id: NullableRpcId;
|
|
error: RpcErrorObject;
|
|
};
|
|
|
|
export type RpcId = (string) | (SafeUnsignedInteger);
|
|
|
|
export type RpcLimits = {"maxJsonBytes":1048576};
|
|
|
|
export type RpcMessage = (RpcRequest) | (RpcNotification) | (RpcSuccess) | (RpcFailure) | (RpcCancel) | (RpcProgressNotification) | (RuntimeInitializeRequest) | (TerminalInterceptorAttachmentRequest);
|
|
|
|
export type RpcNotification = {
|
|
jsonrpc: "2.0";
|
|
method: string;
|
|
params?: JsonValue;
|
|
};
|
|
|
|
export type RpcProgressNotification = {
|
|
jsonrpc: "2.0";
|
|
method: "$/progress";
|
|
params: {
|
|
token: ProgressToken;
|
|
value: ProgressValue;
|
|
};
|
|
};
|
|
|
|
export type RpcRequest = {
|
|
jsonrpc: "2.0";
|
|
id: RpcId;
|
|
method: string;
|
|
params?: JsonValue;
|
|
deadlineMs?: number;
|
|
cancellationId?: string;
|
|
};
|
|
|
|
export type RpcSuccess = {
|
|
jsonrpc: "2.0";
|
|
id: RpcId;
|
|
result: JsonValue;
|
|
};
|
|
|
|
export type RuntimeInitializeParams = {
|
|
netcattyVersion: SemanticVersion;
|
|
apiVersion: SemanticVersion;
|
|
supportedFeatures: Array<FeatureId>;
|
|
};
|
|
|
|
export type RuntimeInitializeRequest = {
|
|
jsonrpc: "2.0";
|
|
id: RpcId;
|
|
method: "plugin.initialize";
|
|
params: RuntimeInitializeParams;
|
|
deadlineMs?: number;
|
|
cancellationId?: string;
|
|
};
|
|
|
|
export type RuntimeInitializeResult = {
|
|
pluginId: PluginId;
|
|
pluginVersion: SemanticVersion;
|
|
apiVersion: SemanticVersion;
|
|
enabledFeatures: Array<FeatureId>;
|
|
};
|
|
|
|
export type RuntimeInitializeSuccess = {
|
|
jsonrpc: "2.0";
|
|
id: RpcId;
|
|
result: RuntimeInitializeResult;
|
|
};
|
|
|
|
export type SafePositiveInteger = number;
|
|
|
|
export type SafeUnsignedInteger = number;
|
|
|
|
export type SecretLeaseRef = {
|
|
kind: "secret-lease";
|
|
id: string;
|
|
operationId: string;
|
|
expiresAt: SafePositiveInteger;
|
|
};
|
|
|
|
export type SecretRef = {
|
|
kind: "secret";
|
|
id: string;
|
|
key: string;
|
|
};
|
|
|
|
export type SemanticVersion = string;
|
|
|
|
export type SemverRange = string;
|
|
|
|
export type SettingContribution = {
|
|
id: ContributionId;
|
|
label: LocalizedText;
|
|
description?: LocalizedText;
|
|
control: SettingControl;
|
|
scope: SettingScope;
|
|
default?: JsonValue;
|
|
secret?: boolean;
|
|
required?: boolean;
|
|
options?: Array<SettingOption>;
|
|
minimum?: number;
|
|
maximum?: number;
|
|
step?: number;
|
|
pattern?: string;
|
|
placeholder?: LocalizedText;
|
|
when?: ContextKeyExpression;
|
|
restartRequired?: boolean;
|
|
sync?: boolean;
|
|
sortable?: boolean;
|
|
valueSchema?: JsonValue;
|
|
};
|
|
|
|
export type SettingControl = "switch" | "radio" | "select" | "multiselect" | "text" | "textarea" | "number" | "slider" | "password" | "color" | "font" | "file" | "directory" | "keybinding" | "list" | "table";
|
|
|
|
export type SettingOption = {
|
|
value: string;
|
|
label: LocalizedText;
|
|
description?: LocalizedText;
|
|
};
|
|
|
|
export type SettingScope = "application" | "workspace" | "host" | "session" | "device";
|
|
|
|
export type StreamChunkByteLength = number;
|
|
|
|
export type StreamChunkData = ({
|
|
encoding: "json";
|
|
value: JsonValue;
|
|
byteLength: StreamChunkByteLength;
|
|
}) | ({
|
|
encoding: "base64";
|
|
value: string;
|
|
byteLength: StreamChunkByteLength;
|
|
}) | ({
|
|
encoding: "transfer";
|
|
byteLength: StreamChunkByteLength;
|
|
});
|
|
|
|
export type StreamCreditBytes = number;
|
|
|
|
export type StreamFrame = ({
|
|
streamId: StreamId;
|
|
sequence: 0;
|
|
kind: "open";
|
|
windowBytes: StreamWindowBytes;
|
|
}) | ({
|
|
streamId: StreamId;
|
|
sequence: SafePositiveInteger;
|
|
kind: "chunk";
|
|
data: StreamChunkData;
|
|
}) | ({
|
|
streamId: StreamId;
|
|
sequence: SafePositiveInteger;
|
|
kind: "end" | "cancel";
|
|
}) | ({
|
|
streamId: StreamId;
|
|
sequence: SafePositiveInteger;
|
|
kind: "error";
|
|
error: RpcErrorObject;
|
|
}) | ({
|
|
streamId: StreamId;
|
|
sequence: SafeUnsignedInteger;
|
|
kind: "windowUpdate";
|
|
creditBytes: StreamCreditBytes;
|
|
});
|
|
|
|
export type StreamId = string;
|
|
|
|
export type StreamLimits = {"maxStreamIdLength":128,"maxChunkBytes":16777216,"maxFrameJsonBytes":25165824,"minWindowBytes":1024,"maxWindowBytes":16777216,"maxCreditBytes":16777216};
|
|
|
|
export type StreamWindowBytes = number;
|
|
|
|
export type TerminalInterceptorAttachmentDescriptor = {
|
|
providerId: ContributionId;
|
|
direction: "input" | "output";
|
|
session: TerminalSessionSnapshot;
|
|
};
|
|
|
|
export type TerminalInterceptorAttachmentParams = {
|
|
descriptor: TerminalInterceptorAttachmentDescriptor;
|
|
};
|
|
|
|
export type TerminalInterceptorAttachmentRequest = {
|
|
jsonrpc: "2.0";
|
|
id: RpcId;
|
|
method: "plugin.terminal.interceptor.attach";
|
|
params: TerminalInterceptorAttachmentParams;
|
|
deadlineMs?: number;
|
|
cancellationId?: string;
|
|
};
|
|
|
|
export type TerminalInterceptorAttachmentResult = {
|
|
accepted: true;
|
|
};
|
|
|
|
export type TerminalInterceptorAttachmentSuccess = {
|
|
jsonrpc: "2.0";
|
|
id: RpcId;
|
|
result: TerminalInterceptorAttachmentResult;
|
|
};
|
|
|
|
export type TerminalInterceptorChunkByteLength = number;
|
|
|
|
export type TerminalInterceptorChunkFrame = {
|
|
type: "netcatty:terminal-interceptor:chunk";
|
|
sequence: SafePositiveInteger;
|
|
direction: TerminalInterceptorDirection;
|
|
creditBytes: TerminalInterceptorCreditBytes;
|
|
byteLength: TerminalInterceptorChunkByteLength;
|
|
};
|
|
|
|
export type TerminalInterceptorCreditBytes = number;
|
|
|
|
export type TerminalInterceptorDirection = "input" | "output";
|
|
|
|
export type TerminalInterceptorFailedResultFrame = {
|
|
type: "netcatty:terminal-interceptor:result";
|
|
sequence: SafePositiveInteger;
|
|
status: "failed";
|
|
};
|
|
|
|
export type TerminalInterceptorFrame = (TerminalInterceptorReadyFrame) | (TerminalInterceptorChunkFrame) | (TerminalInterceptorOkResultFrame) | (TerminalInterceptorFailedResultFrame);
|
|
|
|
export type TerminalInterceptorLimits = {"maxChunkBytes":65536,"maxWindowBytes":262144};
|
|
|
|
export type TerminalInterceptorOkResultFrame = {
|
|
type: "netcatty:terminal-interceptor:result";
|
|
sequence: SafePositiveInteger;
|
|
status: "ok";
|
|
creditBytes: TerminalInterceptorChunkByteLength;
|
|
byteLength: TerminalInterceptorChunkByteLength;
|
|
};
|
|
|
|
export type TerminalInterceptorReadyFrame = {
|
|
type: "netcatty:terminal-interceptor:ready";
|
|
sessionId: string;
|
|
direction: TerminalInterceptorDirection;
|
|
windowBytes: TerminalInterceptorWindowBytes;
|
|
};
|
|
|
|
export type TerminalInterceptorWindowBytes = number;
|
|
|
|
export type TerminalSessionSnapshot = {
|
|
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;
|
|
};
|
|
|
|
export type ThemeIcon = {
|
|
kind: "theme";
|
|
name: string;
|
|
};
|
|
|
|
export type ViewContribution = {
|
|
id: ContributionId;
|
|
title: LocalizedText;
|
|
location: ViewLocation;
|
|
entry: RelativePackagePath;
|
|
icon?: IconReference;
|
|
order?: number;
|
|
when?: ContextKeyExpression;
|
|
retainContextWhenHidden?: boolean;
|
|
};
|
|
|
|
export type ViewLocation = "aside" | "panel" | "tab" | "modal" | "settings";
|
|
|
|
export type WireIntegerLimits = {"maxSafeInteger":9007199254740991};
|