feat: release OpsXShell 2.1.0 native Tauri edition
This commit is contained in:
1 parent
e9a0d21758
commit
a3dba0c6ed
311 files changed
+31748
-14897
No files matched your search
@@ -0,0 +1,93 @@
|
||||
export type AiProtocol = 'openai-chat' | 'openai-responses' | 'anthropic'
|
||||
|
||||
export type AiAuthStyle = 'bearer' | 'x-api-key' | 'both' | 'none'
|
||||
|
||||
export type AiBillingMode = 'payg' | 'plan' | 'local'
|
||||
|
||||
export type AiModelCapability = 'chat' | 'reasoning' | 'plan'
|
||||
|
||||
export interface AiModelConfig {
|
||||
/** Stable UI identity. Multiple routes may point at the same upstream model id. */
|
||||
id: string
|
||||
/** Exact model id sent to the provider. */
|
||||
model: string
|
||||
label: string
|
||||
capability: AiModelCapability
|
||||
billing: AiBillingMode
|
||||
/** Optional per-model route overrides for subscription/plan endpoints. */
|
||||
protocol?: AiProtocol
|
||||
baseUrl?: string
|
||||
}
|
||||
|
||||
export interface AiProviderConfig {
|
||||
id: string
|
||||
name: string
|
||||
presetId?: string
|
||||
protocol: AiProtocol
|
||||
authStyle: AiAuthStyle
|
||||
baseUrl: string
|
||||
allowInsecureHttp: boolean
|
||||
models: AiModelConfig[]
|
||||
defaultModelId: string
|
||||
enabled: boolean
|
||||
/** Runtime-only flag. The API key itself never leaves the Rust process after saving. */
|
||||
hasApiKey?: boolean
|
||||
}
|
||||
|
||||
export type AiAssistantAction = 'explain' | 'command' | 'diagnose' | 'execute'
|
||||
|
||||
export interface AiTerminalContext {
|
||||
selection: string
|
||||
viewport: string
|
||||
}
|
||||
|
||||
export interface AiCompleteRequest {
|
||||
provider: AiProviderConfig
|
||||
model: AiModelConfig
|
||||
action: AiAssistantAction
|
||||
prompt: string
|
||||
context: string
|
||||
}
|
||||
|
||||
export interface AiCompleteResponse {
|
||||
success: boolean
|
||||
text?: string
|
||||
model?: string
|
||||
redactedCount?: number
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface AiModelListResponse {
|
||||
success: boolean
|
||||
models?: string[]
|
||||
error?: string
|
||||
}
|
||||
|
||||
/** Connection test credentials are transient and are never persisted by the test command. */
|
||||
export interface AiProviderTestRequest {
|
||||
provider: AiProviderConfig
|
||||
model: AiModelConfig
|
||||
apiKey?: string
|
||||
}
|
||||
|
||||
export interface AiProviderTestResponse {
|
||||
success: boolean
|
||||
status?: number
|
||||
model?: string
|
||||
latencyMs?: number
|
||||
answer?: string
|
||||
error?: string
|
||||
}
|
||||
|
||||
|
||||
export interface AiCatalogDocument {
|
||||
source: string
|
||||
data: unknown
|
||||
}
|
||||
|
||||
export interface AiCatalogFetchResponse {
|
||||
success: boolean
|
||||
documents?: AiCatalogDocument[]
|
||||
errors?: string[]
|
||||
error?: string
|
||||
}
|
||||
@@ -8,3 +8,6 @@ export * from './session.types'
|
||||
export * from './connection.types'
|
||||
export * from './sftp.types'
|
||||
export * from './ipc.types'
|
||||
export * from './known-hosts.types'
|
||||
export * from './serial.types'
|
||||
export * from './ai.types'
|
||||
@@ -3,7 +3,7 @@
|
||||
* 定义所有 IPC 请求/响应的类型
|
||||
*/
|
||||
|
||||
import type { Session, ProxyConfig } from './session.types'
|
||||
import type { Session, ProxyConfig, JumpHostConfig } from './session.types'
|
||||
|
||||
// ============== SSH IPC ==============
|
||||
|
||||
@@ -15,6 +15,10 @@ export interface SSHConnectRequest {
|
||||
privateKey?: string
|
||||
passphrase?: string
|
||||
proxy?: ProxyConfig
|
||||
jumpHost?: JumpHostConfig
|
||||
jumpHosts?: JumpHostConfig[]
|
||||
timeoutSeconds?: number
|
||||
keepAlive?: boolean
|
||||
}
|
||||
|
||||
export interface SSHConnectResponse {
|
||||
@@ -30,7 +34,7 @@ export interface SSHExecRequest {
|
||||
|
||||
export interface SSHExecResponse {
|
||||
success: boolean
|
||||
output?: string
|
||||
result?: string
|
||||
error?: string
|
||||
}
|
||||
|
||||
@@ -80,10 +84,32 @@ export interface SSHForwardDynamicRequest {
|
||||
|
||||
export interface SSHForwardResponse {
|
||||
success: boolean
|
||||
forwardId?: string
|
||||
boundPort?: number
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface SSHForwardStatus {
|
||||
forwardId: string
|
||||
connectionId: string
|
||||
kind: 'local' | 'remote' | 'dynamic'
|
||||
bindHost: string
|
||||
boundPort: number
|
||||
targetHost?: string
|
||||
targetPort?: number
|
||||
startedAt: number
|
||||
running: boolean
|
||||
activeConnections: number
|
||||
bytesUp: number
|
||||
bytesDown: number
|
||||
}
|
||||
|
||||
export interface SSHForwardListResponse {
|
||||
success: boolean
|
||||
tunnels?: SSHForwardStatus[]
|
||||
error?: string
|
||||
}
|
||||
|
||||
// ============== Session IPC ==============
|
||||
|
||||
export interface SessionCreateResponse {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Known Hosts types - host key trust store
|
||||
*/
|
||||
|
||||
export type HostKeyTrustDecision = 'accept-once' | 'accept-always' | 'reject'
|
||||
|
||||
export interface KnownHostEntry {
|
||||
/** host:port */
|
||||
host: string
|
||||
port: number
|
||||
/** e.g. ssh-ed25519, ssh-rsa, ecdsa-sha2-nistp256 */
|
||||
keyType: string
|
||||
/** base64-encoded public key blob (OpenSSH wire format body) */
|
||||
publicKey: string
|
||||
/** SHA256 fingerprint (base64, no prefix) */
|
||||
fingerprint: string
|
||||
firstSeenAt: number
|
||||
lastSeenAt: number
|
||||
}
|
||||
|
||||
export interface HostKeyPromptPayload {
|
||||
requestId: string
|
||||
host: string
|
||||
port: number
|
||||
keyType: string
|
||||
fingerprint: string
|
||||
/** true when stored key differs from presented key */
|
||||
isChanged: boolean
|
||||
previousFingerprint?: string
|
||||
}
|
||||
|
||||
export interface HostKeyPromptResponse {
|
||||
requestId: string
|
||||
decision: HostKeyTrustDecision
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
export type SerialParity = 'none' | 'odd' | 'even'
|
||||
export type SerialFlowControl = 'none' | 'software' | 'hardware'
|
||||
|
||||
export interface SerialConfig {
|
||||
path: string
|
||||
baudRate: number
|
||||
dataBits: 5 | 6 | 7 | 8
|
||||
stopBits: 1 | 2
|
||||
parity: SerialParity
|
||||
flowControl: SerialFlowControl
|
||||
}
|
||||
|
||||
export interface SerialPortSummary {
|
||||
path: string
|
||||
portType: string
|
||||
}
|
||||
|
||||
export interface SerialDataEvent {
|
||||
sessionId: string
|
||||
data: number[]
|
||||
}
|
||||
|
||||
export interface SerialErrorEvent {
|
||||
sessionId: string
|
||||
message: string
|
||||
}
|
||||
@@ -18,6 +18,19 @@ export interface ProxyConfig {
|
||||
password?: string
|
||||
}
|
||||
|
||||
/** Jump host / bastion credentials (ProxyJump-style) */
|
||||
export interface JumpHostConfig {
|
||||
host: string
|
||||
port?: number
|
||||
username: string
|
||||
password?: string
|
||||
privateKey?: string
|
||||
passphrase?: string
|
||||
authType?: AuthType
|
||||
/** Optional proxy used only when reaching the jump host */
|
||||
proxy?: ProxyConfig
|
||||
}
|
||||
|
||||
// 会话配置 (用于快速连接)
|
||||
export interface SSHConnectionConfig {
|
||||
host: string
|
||||
@@ -28,6 +41,20 @@ export interface SSHConnectionConfig {
|
||||
passphrase?: string
|
||||
authType?: AuthType
|
||||
proxy?: ProxyConfig
|
||||
/** 连接成功后自动发送到 shell 的命令(可含片段变量) */
|
||||
startupCommand?: string
|
||||
/** 单跳板(兼容);多跳请用 jumpHosts */
|
||||
jumpHost?: JumpHostConfig
|
||||
/** 有序跳板链:第一跳 → … → 最后一跳 → 目标 */
|
||||
jumpHosts?: JumpHostConfig[]
|
||||
/** TCP connect and SSH handshake timeout in seconds. */
|
||||
timeoutSeconds?: number
|
||||
/** Enable SSH protocol keepalive for this connection. */
|
||||
keepAlive?: boolean
|
||||
/** 单跳板会话 ID(兼容) */
|
||||
jumpSessionId?: string
|
||||
/** 有序跳板会话 ID 链(优先于 jumpSessionId) */
|
||||
jumpSessionIds?: string[]
|
||||
}
|
||||
|
||||
// 持久化会话
|
||||
@@ -42,6 +69,16 @@ export interface Session {
|
||||
privateKey?: string // 私钥路径或内容
|
||||
passphrase?: string // 私钥密码
|
||||
proxy?: ProxyConfig // 代理配置
|
||||
/** 连接成功后自动执行的启动命令 */
|
||||
startupCommand?: string
|
||||
/** 单跳板会话 ID(兼容) */
|
||||
jumpSessionId?: string
|
||||
/** 有序跳板会话 ID 链 JSON 持久化 */
|
||||
jumpSessionIds?: string[]
|
||||
/** 内联单跳板(兼容) */
|
||||
jumpHost?: JumpHostConfig
|
||||
/** 内联多跳板链 */
|
||||
jumpHosts?: JumpHostConfig[]
|
||||
group?: string
|
||||
tags?: string[]
|
||||
createdAt?: number
|
||||
@@ -59,6 +96,11 @@ export interface SessionCreateRequest {
|
||||
privateKey?: string
|
||||
passphrase?: string
|
||||
proxy?: ProxyConfig
|
||||
startupCommand?: string
|
||||
jumpSessionId?: string
|
||||
jumpSessionIds?: string[]
|
||||
jumpHost?: JumpHostConfig
|
||||
jumpHosts?: JumpHostConfig[]
|
||||
group?: string
|
||||
tags?: string[]
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user