mirror of
https://github.com/stablyai/orca.git
synced 2026-10-20 00:03:45 +00:00
21 lines
593 B
TypeScript
21 lines
593 B
TypeScript
import { z } from 'zod'
|
|
import { connectRegisteredSshTarget, getRegisteredSshState } from '../../../ipc/ssh'
|
|
import { defineMethod, type RpcMethod } from '../core'
|
|
|
|
const SshTarget = z.object({
|
|
targetId: z.string().min(1)
|
|
})
|
|
|
|
export const SSH_METHODS: RpcMethod[] = [
|
|
defineMethod({
|
|
name: 'ssh.getState',
|
|
params: SshTarget,
|
|
handler: (params) => ({ state: getRegisteredSshState(params.targetId) ?? null })
|
|
}),
|
|
defineMethod({
|
|
name: 'ssh.connect',
|
|
params: SshTarget,
|
|
handler: async (params) => ({ state: await connectRegisteredSshTarget(params.targetId) })
|
|
})
|
|
]
|